OSDN Git Service

Many files:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 3 Sep 1998 01:22:57 +0000 (01:22 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 3 Sep 1998 01:22:57 +0000 (01:22 +0000)
  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.

12 files changed:
lib/ext2fs/ChangeLog
lib/ext2fs/alloc_tables.c
lib/ext2fs/block.c
lib/ext2fs/bmap.c
lib/ext2fs/dblist.c
lib/ext2fs/dblist_dir.c
lib/ext2fs/dir_iterate.c
lib/ext2fs/ext2fs.h
lib/ext2fs/fileio.c
lib/ext2fs/get_pathname.c
lib/ext2fs/namei.c
lib/ext2fs/rw_bitmaps.c

index ddce36d..2684d86 100644 (file)
@@ -1,3 +1,38 @@
+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
index 3660c5e..8113854 100644 (file)
@@ -32,7 +32,7 @@
 
 #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;
@@ -113,7 +113,7 @@ errcode_t ext2fs_allocate_group_table(ext2_filsys fs, int group,
 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);
index 72cbb4a..91b5c4c 100644 (file)
@@ -330,7 +330,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
        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))
index e4cf92a..ba3a114 100644 (file)
@@ -91,9 +91,9 @@ static errcode_t _BMAP_INLINE_ block_dind_bmap(ext2_filsys fs, int flags,
 {
        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);
@@ -111,9 +111,9 @@ static errcode_t _BMAP_INLINE_ block_tind_bmap(ext2_filsys fs, int flags,
 {
        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);
@@ -129,7 +129,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
                      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;
@@ -144,7 +144,7 @@ errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
                        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);
index b636584..5a2a964 100644 (file)
@@ -34,7 +34,7 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b);
  */
 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);
@@ -99,7 +99,10 @@ static errcode_t make_dblist(ext2_filsys fs, ino_t size, ino_t count,
                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)
@@ -191,7 +194,7 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
 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);
 
index 7fd14e0..d97ca95 100644 (file)
 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;
index 9aff315..10a136a 100644 (file)
@@ -72,12 +72,12 @@ errcode_t ext2fs_dir_iterate(ext2_filsys fs,
  * 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;
index 29c439a..dc27029 100644 (file)
@@ -52,7 +52,7 @@ typedef unsigned long long __u64;
 #endif
 
 typedef __u32          blk_t;
-typedef unsigned int   dgrp_t;
+typedef __u32          dgrp_t;
 typedef __u32          ext2_off_t;
 typedef __s64          e2_blkcnt_t;
 
@@ -177,7 +177,7 @@ struct struct_ext2_filsys {
        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;
@@ -480,7 +480,7 @@ extern errcode_t ext2fs_alloc_block(ext2_filsys fs, blk_t goal,
 
 /* 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 */
index 51375b7..98191f8 100644 (file)
@@ -310,7 +310,7 @@ ext2_off_t ext2fs_file_get_size(ext2_file_t file)
  * 
  * 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);
index ddbc58a..9a793a4 100644 (file)
@@ -59,8 +59,8 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent,
        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));
index c9bf6ce..ae19387 100644 (file)
@@ -189,7 +189,7 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd,
        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;
index 8ad93de..73979fd 100644 (file)
@@ -57,7 +57,7 @@ void ext2fs_swap_bitmap(ext2_filsys fs, char *bitmap, int nbytes)
 
 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;
@@ -100,7 +100,7 @@ errcode_t ext2fs_write_inode_bitmap(ext2_filsys fs)
 
 errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
 {
-       int             i;
+       dgrp_t          i;
        int             j;
        int             nbytes;
        int             nbits;
@@ -153,7 +153,7 @@ errcode_t ext2fs_write_block_bitmap (ext2_filsys fs)
 
 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;