rw_bitmaps.c: Fixed signed/unsigned warnings.
fileio.c (ext2fs_file_set_size): Remove unneeded extern from the
function declaration.
dblist.c (make_dblist): Add safety check in case the dblist pointer
passed in is null (in which case, assign it to fs->dblist). Fixed
some signed/unsigned warnings.
bmap.c: Make addr_per_block be of type blk_t to avoid signed/unsigned
warnings.
namei.c (ext2fs_follow_link): Remove uneeded extern from the function
declaration.
get_pathname.c (get_pathname_proc): Use return value from
ext2fs_get_mem, instead of checking if &gp->name is NULL.
dir_iterate.c (ext2fs_process_dir_block):
dblist_dir.c (ext2fs_dblist_dir_iterate): Remove uneeded extern from
the function declaration.
block.c (ext2fs_block_iterate2): If the read_inode call fails, return
the error directly instead of jumping to the cleanup routine, since we
don't need to do any cleanup.
alloc_table.c (ext2fs_allocate_group_table): Make this function take a
dgrp_t for its group argument.
ext2fs.h: Make dgrp_t an __u32 type, and make fs->desc_group_count be
of type dgrp_t.
+1998-09-02 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * rw_bitmaps.c: Fixed signed/unsigned warnings.
+
+ * fileio.c (ext2fs_file_set_size): Remove unneeded extern from the
+ function declaration.
+
+ * dblist.c (make_dblist): Add safety check in case the dblist
+ pointer passed in is null (in which case, assign it to
+ fs->dblist). Fixed some signed/unsigned warnings.
+
+ * bmap.c: Make addr_per_block be of type blk_t to avoid
+ signed/unsigned warnings.
+
+ * namei.c (ext2fs_follow_link): Remove uneeded extern from the
+ function declaration.
+
+ * get_pathname.c (get_pathname_proc): Use return value from
+ ext2fs_get_mem, instead of checking if &gp->name is
+ NULL.
+
+ * dir_iterate.c (ext2fs_process_dir_block):
+ * dblist_dir.c (ext2fs_dblist_dir_iterate): Remove uneeded extern
+ from the function declaration.
+
+ * block.c (ext2fs_block_iterate2): If the read_inode call fails,
+ return the error directly instead of jumping to the
+ cleanup routine, since we don't need to do any cleanup.
+
+ * alloc_table.c (ext2fs_allocate_group_table): Make this
+ function take a dgrp_t for its group argument.
+
+ * ext2fs.h: Make dgrp_t an __u32 type, and make
+ fs->desc_group_count be of type dgrp_t.
+
1998-07-27 Theodore Ts'o <tytso@rsts-11.mit.edu>
* badblocks.c (ext2fs_badblocks_list_add): Use a bigger increment
#include "ext2fs.h"
-errcode_t ext2fs_allocate_group_table(ext2_filsys fs, int group,
+errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
ext2fs_block_bitmap bmap)
{
errcode_t retval;
errcode_t ext2fs_allocate_tables(ext2_filsys fs)
{
errcode_t retval;
- int i;
+ dgrp_t i;
for (i = 0; i < fs->group_desc_count; i++) {
retval = ext2fs_allocate_group_table(fs, i, fs->block_map);
if (flags & BLOCK_FLAG_NO_LARGE) {
ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
if (ctx.errcode)
- goto abort;
+ return ctx.errcode;
got_inode = 1;
if (!LINUX_S_ISDIR(inode.i_mode) &&
(inode.i_size_high != 0))
{
blk_t b;
errcode_t retval;
- int addr_per_block;
+ blk_t addr_per_block;
- addr_per_block = fs->blocksize >> 2;
+ addr_per_block = (blk_t) fs->blocksize >> 2;
retval = block_ind_bmap(fs, flags, dind, block_buf, blocks_alloc,
nr / addr_per_block, &b);
{
blk_t b;
errcode_t retval;
- int addr_per_block;
+ blk_t addr_per_block;
- addr_per_block = fs->blocksize >> 2;
+ addr_per_block = (blk_t) fs->blocksize >> 2;
retval = block_dind_bmap(fs, flags, tind, block_buf, blocks_alloc,
nr / addr_per_block, &b);
blk_t *phys_blk)
{
struct ext2_inode inode_buf;
- int addr_per_block;
+ blk_t addr_per_block;
blk_t b;
char *buf = 0;
errcode_t retval = 0;
return retval;
inode = &inode_buf;
}
- addr_per_block = fs->blocksize >> 2;
+ addr_per_block = (blk_t) fs->blocksize >> 2;
if (!block_buf) {
retval = ext2fs_get_mem(fs->blocksize * 2, (void **) &buf);
*/
errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs)
{
- int i;
+ dgrp_t i;
ino_t num_dirs, max_dirs;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
memcpy(dblist->list, list, len);
else
memset(dblist->list, 0, len);
- *ret_dblist = dblist;
+ if (ret_dblist)
+ *ret_dblist = dblist;
+ else
+ fs->dblist = dblist;
return 0;
cleanup:
if (dblist)
errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
int blockcnt)
{
- int i;
+ dgrp_t i;
EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
void *priv_data);
-extern errcode_t
- ext2fs_dblist_dir_iterate(ext2_dblist dblist,
- int flags,
- char *block_buf,
- int (*func)(ino_t dir,
- int entry,
- struct ext2_dir_entry *dirent,
- int offset,
- int blocksize,
- char *buf,
- void *priv_data),
- void *priv_data)
+errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
+ int flags,
+ char *block_buf,
+ int (*func)(ino_t dir,
+ int entry,
+ struct ext2_dir_entry *dirent,
+ int offset,
+ int blocksize,
+ char *buf,
+ void *priv_data),
+ void *priv_data)
{
errcode_t retval;
struct dir_context ctx;
* Helper function which is private to this module. Used by
* ext2fs_dir_iterate() and ext2fs_dblist_dir_iterate()
*/
-extern int ext2fs_process_dir_block(ext2_filsys fs,
- blk_t *blocknr,
- e2_blkcnt_t blockcnt,
- blk_t ref_block,
- int ref_offset,
- void *priv_data)
+int ext2fs_process_dir_block(ext2_filsys fs,
+ blk_t *blocknr,
+ e2_blkcnt_t blockcnt,
+ blk_t ref_block,
+ int ref_offset,
+ void *priv_data)
{
struct dir_context *ctx = (struct dir_context *) priv_data;
int offset = 0;
#endif
typedef __u32 blk_t;
-typedef unsigned int dgrp_t;
+typedef __u32 dgrp_t;
typedef __u32 ext2_off_t;
typedef __s64 e2_blkcnt_t;
struct ext2_super_block * super;
int blocksize;
int fragsize;
- unsigned long group_desc_count;
+ dgrp_t group_desc_count;
unsigned long desc_blocks;
struct ext2_group_desc * group_desc;
int inode_blocks_per_group;
/* alloc_tables.c */
extern errcode_t ext2fs_allocate_tables(ext2_filsys fs);
-extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, int group,
+extern errcode_t ext2fs_allocate_group_table(ext2_filsys fs, dgrp_t group,
ext2fs_block_bitmap bmap);
/* badblocks.c */
*
* XXX still need to call truncate
*/
-extern errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size)
+errcode_t ext2fs_file_set_size(ext2_file_t file, ext2_off_t size)
{
errcode_t retval;
EXT2_CHECK_MAGIC(file, EXT2_ET_MAGIC_EXT2_FILE);
if (dirent->inode == gp->search_ino) {
retval = ext2fs_get_mem((dirent->name_len & 0xFF) + 1,
(void **) &gp->name);
- if (!gp->name) {
- gp->errcode = EXT2_ET_NO_MEMORY;
+ if (retval) {
+ gp->errcode = retval;
return DIRENT_ABORT;
}
strncpy(gp->name, dirent->name, (dirent->name_len & 0xFF));
return retval;
}
-extern errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd,
+errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd,
ino_t inode, ino_t *res_inode)
{
char *buf;
errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs)
{
- int i;
+ dgrp_t i;
size_t nbytes;
errcode_t retval;
char * inode_bitmap = fs->inode_map->bitmap;
errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
{
- int i;
+ dgrp_t i;
int j;
int nbytes;
int nbits;
static errcode_t read_bitmaps(ext2_filsys fs, int do_inode, int do_block)
{
- int i;
+ dgrp_t i;
char *block_bitmap = 0, *inode_bitmap = 0;
char *buf;
errcode_t retval;