]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Many files:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 11 Jan 2001 04:54:39 +0000 (04:54 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Jan 2001 04:54:39 +0000 (04:54 +0000)
  alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, bmove.c,
   brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, dir_iterate.c,
   expanddir.c, ext2fs.h, ext2fsP.h, fileio.c, finddev.c, get_pathname.c,
   icount.c, inode.c, irel.h, irel_ma.c, ismounted.c, link.c, lookup.c,
   mkdir.c, mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
   tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to ext2_ino_t,
   to protect applications that attempt to compile
   -D_FILE_OFFSET_BITS=64, since this inexplicably changes ino_t(!?).  So
   we use ext2_ino_t to avoid an unexpected ABI change.

35 files changed:
lib/ext2fs/ChangeLog
lib/ext2fs/alloc.c
lib/ext2fs/bb_inode.c
lib/ext2fs/bitmaps.c
lib/ext2fs/bitops.h
lib/ext2fs/block.c
lib/ext2fs/bmap.c
lib/ext2fs/bmove.c
lib/ext2fs/brel.h
lib/ext2fs/cmp_bitmaps.c
lib/ext2fs/dblist.c
lib/ext2fs/dblist_dir.c
lib/ext2fs/dir_iterate.c
lib/ext2fs/expanddir.c
lib/ext2fs/ext2fs.h
lib/ext2fs/ext2fsP.h
lib/ext2fs/fileio.c
lib/ext2fs/finddev.c
lib/ext2fs/get_pathname.c
lib/ext2fs/icount.c
lib/ext2fs/inode.c
lib/ext2fs/irel.h
lib/ext2fs/irel_ma.c
lib/ext2fs/ismounted.c
lib/ext2fs/link.c
lib/ext2fs/lookup.c
lib/ext2fs/mkdir.c
lib/ext2fs/mkjournal.c
lib/ext2fs/namei.c
lib/ext2fs/newdir.c
lib/ext2fs/read_bb_file.c
lib/ext2fs/test_io.c
lib/ext2fs/tst_iscan.c
lib/ext2fs/unix_io.c
lib/ext2fs/unlink.c

index ad380268654a2becd3cf69e81fe65676067c0d28..0cb488ea9ae4c59c496a0c73e87c6ed67d5f962f 100644 (file)
@@ -1,3 +1,17 @@
+2001-01-10    <tytso@snap.thunk.org>
+
+       * alloc.c, bb_inode.c, bitmaps.c, bitops.h, block.c, bmap.c, 
+               bmove.c, brel.h, cmp_bitmaps.c, dblist.c, dblist_dir.c, 
+               dir_iterate.c, expanddir.c, ext2fs.h, ext2fsP.h, fileio.c,
+               finddev.c, get_pathname.c, icount.c, inode.c, irel.h, 
+               irel_ma.c, ismounted.c, link.c, lookup.c, mkdir.c, 
+               mkjournal.c, namei.c, newdir.c, read_bb_file.c, test_io.c,
+               tst_iscan.c, unix_io.c, unlink.c: Change use of ino_t to
+               ext2_ino_t, to protect applications that attempt to
+               compile -D_FILE_OFFSET_BITS=64, since this inexplicably
+               changes ino_t(!?).  So we use ext2_ino_t  to avoid an
+               unexpected ABI change.
+
 2001-01-05    <tytso@snap.thunk.org>
 
        * dirblock.c (ext2fs_read_dir_block): Fix a potential case where
index fa71406c94c549077e91687726e0df3c77798767..e89c55f439ae458e9ee0d90ccbf20fdde0b2aa6b 100644 (file)
  *
  * Should have a special policy for directories.
  */
-errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode,
-                          ext2fs_inode_bitmap map, ino_t *ret)
+errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
+                          ext2fs_inode_bitmap map, ext2_ino_t *ret)
 {
-       ino_t   dir_group = 0;
-       ino_t   i;
-       ino_t   start_inode;
+       ext2_ino_t      dir_group = 0;
+       ext2_ino_t      i;
+       ext2_ino_t      start_inode;
 
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
        
index e6ce7766a0324fb50e8ada1300f1301e0ddd6182..a9e32b3df52960f50433f9f4225cfc33c2e1e985 100644 (file)
@@ -163,7 +163,7 @@ cleanup:
  * indirect blocks.
  */
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
                                e2_blkcnt_t blockcnt,
@@ -225,7 +225,7 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
  * Set the block list in the bad block inode, using the supplied bitmap.
  */
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
                              e2_blkcnt_t blockcnt, blk_t ref_block, 
index cbfd43d58cef9ee05dcb58dc9c22e773d628e81b..d215f30847e709c344429ca71cf3eea49447455a 100644 (file)
@@ -174,7 +174,7 @@ errcode_t ext2fs_allocate_block_bitmap(ext2_filsys fs,
 }
 
 errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
-                                       ino_t end, ino_t *oend)
+                                       ext2_ino_t end, ext2_ino_t *oend)
 {
        EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP);
        
index 7e049d1e89862e7ab6534b3301bcb65af1b38ee8..6ab778198278b85d25260746b2d9f28ec1805562 100644 (file)
@@ -40,10 +40,10 @@ extern int ext2fs_unmark_block_bitmap(ext2fs_block_bitmap bitmap,
                                       blk_t block);
 extern int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap, blk_t block);
 
-extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
+extern int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
 extern int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                      ino_t inode);
-extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ino_t inode);
+                                      ext2_ino_t inode);
+extern int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap, ext2_ino_t inode);
 
 extern void ext2fs_fast_mark_block_bitmap(ext2fs_block_bitmap bitmap,
                                          blk_t block);
@@ -53,15 +53,15 @@ extern int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
                                         blk_t block);
 
 extern void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                         ino_t inode);
+                                         ext2_ino_t inode);
 extern void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                           ino_t inode);
+                                           ext2_ino_t inode);
 extern int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                        ino_t inode);
+                                        ext2_ino_t inode);
 extern blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap);
-extern ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
+extern ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap);
 extern blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap);
-extern ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
+extern ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap);
 
 extern void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
                                           blk_t block, int num);
@@ -389,21 +389,21 @@ _INLINE_ int ext2fs_test_block_bitmap(ext2fs_block_bitmap bitmap,
 }
 
 _INLINE_ int ext2fs_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                      ino_t inode)
+                                      ext2_ino_t inode)
 {
        return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
                                          inode);
 }
 
 _INLINE_ int ext2fs_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                        ino_t inode)
+                                        ext2_ino_t inode)
 {
        return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
                                     inode);
 }
 
 _INLINE_ int ext2fs_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                      ino_t inode)
+                                      ext2_ino_t inode)
 {
        return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) bitmap, 
                                          inode);
@@ -449,7 +449,7 @@ _INLINE_ int ext2fs_fast_test_block_bitmap(ext2fs_block_bitmap bitmap,
 }
 
 _INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                           ino_t inode)
+                                           ext2_ino_t inode)
 {
 #ifdef EXT2FS_DEBUG_FAST_OPS
        if ((inode < bitmap->start) || (inode > bitmap->end)) {
@@ -462,7 +462,7 @@ _INLINE_ void ext2fs_fast_mark_inode_bitmap(ext2fs_inode_bitmap bitmap,
 }
 
 _INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                             ino_t inode)
+                                             ext2_ino_t inode)
 {
 #ifdef EXT2FS_DEBUG_FAST_OPS
        if ((inode < bitmap->start) || (inode > bitmap->end)) {
@@ -475,7 +475,7 @@ _INLINE_ void ext2fs_fast_unmark_inode_bitmap(ext2fs_inode_bitmap bitmap,
 }
 
 _INLINE_ int ext2fs_fast_test_inode_bitmap(ext2fs_inode_bitmap bitmap,
-                                          ino_t inode)
+                                          ext2_ino_t inode)
 {
 #ifdef EXT2FS_DEBUG_FAST_OPS
        if ((inode < bitmap->start) || (inode > bitmap->end)) {
@@ -492,7 +492,7 @@ _INLINE_ blk_t ext2fs_get_block_bitmap_start(ext2fs_block_bitmap bitmap)
        return bitmap->start;
 }
 
-_INLINE_ ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
+_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_start(ext2fs_inode_bitmap bitmap)
 {
        return bitmap->start;
 }
@@ -502,7 +502,7 @@ _INLINE_ blk_t ext2fs_get_block_bitmap_end(ext2fs_block_bitmap bitmap)
        return bitmap->end;
 }
 
-_INLINE_ ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
+_INLINE_ ext2_ino_t ext2fs_get_inode_bitmap_end(ext2fs_inode_bitmap bitmap)
 {
        return bitmap->end;
 }
index 03357b10e64203ea5f2f4007e1ba5f235a12f1be..621e85070d0d8998919f28c1daa63061515528ca 100644 (file)
@@ -302,7 +302,7 @@ static int block_iterate_tind(blk_t *tind_block, blk_t ref_block,
 }
        
 errcode_t ext2fs_block_iterate2(ext2_filsys fs,
-                               ino_t   ino,
+                               ext2_ino_t ino,
                                int     flags,
                                char *block_buf,
                                int (*func)(ext2_filsys fs,
@@ -366,7 +366,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
            !(flags & BLOCK_FLAG_DATA_ONLY)) {
                ctx.errcode = ext2fs_read_inode(fs, ino, &inode);
                if (ctx.errcode)
-                       goto abort;
+                       goto abort_exit;
                got_inode = 1;
                if (inode.osd1.hurd1.h_i_translator) {
                        ret |= (*ctx.func)(fs,
@@ -374,7 +374,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
                                           BLOCK_COUNT_TRANSLATOR,
                                           0, 0, priv_data);
                        if (ret & BLOCK_ABORT)
-                               goto abort;
+                               goto abort_exit;
                }
        }
        
@@ -386,31 +386,31 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
                        ret |= (*ctx.func)(fs, &blocks[i],
                                            ctx.bcount, 0, i, priv_data);
                        if (ret & BLOCK_ABORT)
-                               goto abort;
+                               goto abort_exit;
                }
        }
        if (*(blocks + EXT2_IND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
                ret |= block_iterate_ind(blocks + EXT2_IND_BLOCK,
                                         0, EXT2_IND_BLOCK, &ctx);
                if (ret & BLOCK_ABORT)
-                       goto abort;
+                       goto abort_exit;
        } else
                ctx.bcount += limit;
        if (*(blocks + EXT2_DIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
                ret |= block_iterate_dind(blocks + EXT2_DIND_BLOCK,
                                          0, EXT2_DIND_BLOCK, &ctx);
                if (ret & BLOCK_ABORT)
-                       goto abort;
+                       goto abort_exit;
        } else
                ctx.bcount += limit * limit;
        if (*(blocks + EXT2_TIND_BLOCK) || (flags & BLOCK_FLAG_APPEND)) {
                ret |= block_iterate_tind(blocks + EXT2_TIND_BLOCK,
                                          0, EXT2_TIND_BLOCK, &ctx);
                if (ret & BLOCK_ABORT)
-                       goto abort;
+                       goto abort_exit;
        }
 
-abort:
+abort_exit:
        if (ret & BLOCK_CHANGED) {
                if (!got_inode) {
                        retval = ext2fs_read_inode(fs, ino, &inode);
@@ -443,7 +443,7 @@ struct xlate {
 };
 
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
                      blk_t ref_block, int ref_offset, void *priv_data)
@@ -454,7 +454,7 @@ static int xlate_func(ext2_filsys fs, blk_t *blocknr, e2_blkcnt_t blockcnt,
 }
 
 errcode_t ext2fs_block_iterate(ext2_filsys fs,
-                              ino_t    ino,
+                              ext2_ino_t ino,
                               int      flags,
                               char *block_buf,
                               int (*func)(ext2_filsys fs,
index 9d7ebfed472385bb728363cf2a40f2f8ed25a4a1..7677499a0db046ecf832ceea72c54ea560a657b6 100644 (file)
@@ -29,7 +29,7 @@
 #define _BMAP_INLINE_
 #endif
 
-extern errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino,
+extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
                             struct ext2_inode *inode, 
                             char *block_buf, int bmap_flags,
                             blk_t block, blk_t *phys_blk);
@@ -124,7 +124,7 @@ static errcode_t _BMAP_INLINE_ block_tind_bmap(ext2_filsys fs, int flags,
        return retval;
 }
 
-errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino, struct ext2_inode *inode,
+errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode,
                      char *block_buf, int bmap_flags, blk_t block,
                      blk_t *phys_blk)
 {
index fbb5f9b6322c60d4215d170963636ba0f40c7abf..e3cac4dc3aaddebe9fc0d6abc7eabaf0f8b43989 100644 (file)
@@ -27,7 +27,7 @@
 #include "ext2fsP.h"
 
 struct process_block_struct {
-       ino_t                   ino;
+       ext2_ino_t              ino;
        struct ext2_inode *     inode;
        ext2fs_block_bitmap     reserve;
        ext2fs_block_bitmap     alloc_map;
@@ -97,7 +97,7 @@ errcode_t ext2fs_move_blocks(ext2_filsys fs,
                             ext2fs_block_bitmap alloc_map,
                             int flags)
 {
-       ino_t   ino;
+       ext2_ino_t      ino;
        struct ext2_inode inode;
        errcode_t       retval;
        struct process_block_struct pb;
index a8d83b7bf6eac97acb580911c1471f466df0446e..be97243caa4b06bb2c655dcdb73cfa59d20a8198 100644 (file)
@@ -14,8 +14,8 @@ struct ext2_block_relocate_entry {
        __s16   offset;
        __u16   flags;
        union {
-               blk_t   block_ref;
-               ino_t   inode_ref;
+               blk_t           block_ref;
+               ext2_ino_t      inode_ref;
        } owner;
 };
 
index 5086d125ae4190f7b634474db114b1d1b96f8f74..1f27421e3861de78977353dc05eca16606e9f852 100644 (file)
@@ -56,7 +56,7 @@ errcode_t ext2fs_compare_block_bitmap(ext2fs_block_bitmap bm1,
 errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
                                      ext2fs_inode_bitmap bm2)
 {
-       ino_t   i;
+       ext2_ino_t      i;
        
        EXT2_CHECK_MAGIC(bm1, EXT2_ET_MAGIC_INODE_BITMAP);
        EXT2_CHECK_MAGIC(bm2, EXT2_ET_MAGIC_INODE_BITMAP);
index 5a2a964113e896756aed06c842c633ccd995a335..4688aa711a70c319eec0c0a214e2755198b69c15 100644 (file)
@@ -32,10 +32,10 @@ static EXT2_QSORT_TYPE dir_block_cmp(const void *a, const void *b);
  * the group descriptors.  Of course, the group descriptors could be
  * wrong!
  */
-errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs)
+errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs)
 {
        dgrp_t  i;
-       ino_t   num_dirs, max_dirs;
+       ext2_ino_t      num_dirs, max_dirs;
 
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
        
@@ -59,7 +59,7 @@ errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs)
  * helper function for making a new directory block list (for
  * initialize and copy).
  */
-static errcode_t make_dblist(ext2_filsys fs, ino_t size, ino_t count,
+static errcode_t make_dblist(ext2_filsys fs, ext2_ino_t size, ext2_ino_t count,
                             struct ext2_db_entry *list,
                             ext2_dblist *ret_dblist)
 {
@@ -158,7 +158,7 @@ errcode_t ext2fs_copy_dblist(ext2_dblist src, ext2_dblist *dest)
 /*
  * Add a directory block to the directory block list
  */
-errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
+errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
                               int blockcnt)
 {
        struct ext2_db_entry    *new_entry;
@@ -191,7 +191,7 @@ errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
 /*
  * Change the directory block to the directory block list
  */
-errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino, blk_t blk,
+errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino, blk_t blk,
                               int blockcnt)
 {
        dgrp_t                  i;
@@ -218,8 +218,8 @@ errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
                                            void        *priv_data),
                                void *priv_data)
 {
-       ino_t   i;
-       int     ret;
+       ext2_ino_t      i;
+       int             ret;
        
        EXT2_CHECK_MAGIC(dblist, EXT2_ET_MAGIC_DBLIST);
 
index d97ca95de337a3cd3625c76cfcd6b53ea1786f15..f4c3f6245f071588d52097e1f3ebecfd119a35c3 100644 (file)
@@ -31,7 +31,7 @@ static int db_dir_proc(ext2_filsys fs, struct ext2_db_entry *db_info,
 errcode_t ext2fs_dblist_dir_iterate(ext2_dblist dblist,
                                    int flags,
                                    char        *block_buf,
-                                   int (*func)(ino_t   dir,
+                                   int (*func)(ext2_ino_t dir,
                                                int     entry,
                                                struct ext2_dir_entry *dirent,
                                                int     offset,
index 3fecf23facaa690434f267a584697a65da33961f..2f07345f7ef0bd7430b3c17fddefba97e88eef53 100644 (file)
@@ -27,7 +27,7 @@
 #include "ext2fsP.h"
 
 errcode_t ext2fs_dir_iterate(ext2_filsys fs,
-                            ino_t dir,
+                            ext2_ino_t dir,
                             int flags,
                             char *block_buf,
                             int (*func)(struct ext2_dir_entry *dirent,
index eb1308438ecb851e68de4425ee9d4c1e9ecefa35..0e6adebb4f409a6ceb209246862458ac3bf681f7 100644 (file)
@@ -89,7 +89,7 @@ static int expand_dir_proc(ext2_filsys                fs,
                return BLOCK_CHANGED;
 }
 
-errcode_t ext2fs_expand_dir(ext2_filsys fs, ino_t dir)
+errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir)
 {
        errcode_t       retval;
        struct expand_dir_struct es;
index 1f3e61494e3ef113a12dfa9d7d62732ee91113de..1112702230f6078436b1ff82882387dbe3d15bdd 100644 (file)
@@ -61,6 +61,7 @@ typedef unsigned long long __u64;
 #endif
 #endif /* EXT2_FLAT_INCLUDES */
 
+typedef __u32          ext2_ino_t;
 typedef __u32          blk_t;
 typedef __u32          dgrp_t;
 typedef __u32          ext2_off_t;
@@ -130,7 +131,7 @@ typedef struct ext2_struct_badblocks_iterate *badblocks_iterate;
  * ext2_dblist structure and abstractions (see dblist.c)
  */
 struct ext2_db_entry {
-       ino_t   ino;
+       ext2_ino_t      ino;
        blk_t   blk;
        int     blockcnt;
 };
@@ -200,12 +201,12 @@ struct struct_ext2_filsys {
        int                             inode_blocks_per_group;
        ext2fs_inode_bitmap             inode_map;
        ext2fs_block_bitmap             block_map;
-       errcode_t (*get_blocks)(ext2_filsys fs, ino_t ino, blk_t *blocks);
-       errcode_t (*check_directory)(ext2_filsys fs, ino_t ino);
+       errcode_t (*get_blocks)(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
+       errcode_t (*check_directory)(ext2_filsys fs, ext2_ino_t ino);
        errcode_t (*write_bitmaps)(ext2_filsys fs);
-       errcode_t (*read_inode)(ext2_filsys fs, ino_t ino,
+       errcode_t (*read_inode)(ext2_filsys fs, ext2_ino_t ino,
                                struct ext2_inode *inode);
-       errcode_t (*write_inode)(ext2_filsys fs, ino_t ino,
+       errcode_t (*write_inode)(ext2_filsys fs, ext2_ino_t ino,
                                struct ext2_inode *inode);
        badblocks_list                  badblocks;
        ext2_dblist                     dblist;
@@ -423,8 +424,8 @@ typedef struct ext2_icount *ext2_icount_t;
  */
 
 /* alloc.c */
-extern errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode,
-                                 ext2fs_inode_bitmap map, ino_t *ret);
+extern errcode_t ext2fs_new_inode(ext2_filsys fs, ext2_ino_t dir, int mode,
+                                 ext2fs_inode_bitmap map, ext2_ino_t *ret);
 extern errcode_t ext2fs_new_block(ext2_filsys fs, blk_t goal,
                                  ext2fs_block_bitmap map, blk_t *ret);
 extern errcode_t ext2fs_get_free_blocks(ext2_filsys fs, blk_t start,
@@ -488,7 +489,7 @@ extern errcode_t ext2fs_allocate_inode_bitmap(ext2_filsys fs,
                                              const char *descr,
                                              ext2fs_inode_bitmap *ret);
 extern errcode_t ext2fs_fudge_inode_bitmap_end(ext2fs_inode_bitmap bitmap,
-                                              ino_t end, ino_t *oend);
+                                              ext2_ino_t end, ext2_ino_t *oend);
 extern errcode_t ext2fs_fudge_block_bitmap_end(ext2fs_block_bitmap bitmap,
                                               blk_t end, blk_t *oend);
 extern void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap);
@@ -498,7 +499,7 @@ extern errcode_t ext2fs_write_bitmaps(ext2_filsys fs);
 
 /* block.c */
 extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
-                                     ino_t     ino,
+                                     ext2_ino_t        ino,
                                      int       flags,
                                      char *block_buf,
                                      int (*func)(ext2_filsys fs,
@@ -507,7 +508,7 @@ extern errcode_t ext2fs_block_iterate(ext2_filsys fs,
                                                  void  *priv_data),
                                      void *priv_data);
 errcode_t ext2fs_block_iterate2(ext2_filsys fs,
-                               ino_t   ino,
+                               ext2_ino_t      ino,
                                int     flags,
                                char *block_buf,
                                int (*func)(ext2_filsys fs,
@@ -519,7 +520,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
                                void *priv_data);
 
 /* bmap.c */
-extern errcode_t ext2fs_bmap(ext2_filsys fs, ino_t ino,
+extern errcode_t ext2fs_bmap(ext2_filsys fs, ext2_ino_t ino,
                             struct ext2_inode *inode, 
                             char *block_buf, int bmap_flags,
                             blk_t block, blk_t *phys_blk);
@@ -550,15 +551,15 @@ extern errcode_t ext2fs_compare_inode_bitmap(ext2fs_inode_bitmap bm1,
 
 /* dblist.c */
 
-extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs);
+extern errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ext2_ino_t *ret_num_dirs);
 extern errcode_t ext2fs_init_dblist(ext2_filsys fs, ext2_dblist *ret_dblist);
-extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ino_t ino,
+extern errcode_t ext2fs_add_dir_block(ext2_dblist dblist, ext2_ino_t ino,
                                      blk_t blk, int blockcnt);
 extern errcode_t ext2fs_dblist_iterate(ext2_dblist dblist,
        int (*func)(ext2_filsys fs, struct ext2_db_entry *db_info,
                    void        *priv_data),
        void *priv_data);
-extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ino_t ino,
+extern errcode_t ext2fs_set_dir_block(ext2_dblist dblist, ext2_ino_t ino,
                                      blk_t blk, int blockcnt);
 extern errcode_t ext2fs_copy_dblist(ext2_dblist src,
                                    ext2_dblist *dest);
@@ -569,7 +570,7 @@ extern errcode_t
        ext2fs_dblist_dir_iterate(ext2_dblist dblist,
                                  int   flags,
                                  char  *block_buf,
-                                 int (*func)(ino_t     dir,
+                                 int (*func)(ext2_ino_t        dir,
                                              int               entry,
                                              struct ext2_dir_entry *dirent,
                                              int       offset,
@@ -586,7 +587,7 @@ extern errcode_t ext2fs_write_dir_block(ext2_filsys fs, blk_t block,
 
 /* dir_iterate.c */
 extern errcode_t ext2fs_dir_iterate(ext2_filsys fs, 
-                             ino_t dir,
+                             ext2_ino_t dir,
                              int flags,
                              char *block_buf,
                              int (*func)(struct ext2_dir_entry *dirent,
@@ -600,10 +601,10 @@ extern errcode_t ext2fs_dir_iterate(ext2_filsys fs,
 extern errcode_t ext2fs_dup_handle(ext2_filsys src, ext2_filsys *dest);
 
 /* expanddir.c */
-extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ino_t dir);
+extern errcode_t ext2fs_expand_dir(ext2_filsys fs, ext2_ino_t dir);
 
 /* fileio.c */
-extern errcode_t ext2fs_file_open(ext2_filsys fs, ino_t ino,
+extern errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
                                  int flags, ext2_file_t *ret);
 extern ext2_filsys ext2fs_file_get_fs(ext2_file_t file);
 extern errcode_t ext2fs_file_close(ext2_file_t file);
@@ -649,7 +650,7 @@ extern errcode_t ext2fs_flush_icache(ext2_filsys fs);
 extern errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
                                  ext2_inode_scan *ret_scan);
 extern void ext2fs_close_inode_scan(ext2_inode_scan scan);
-extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
+extern errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
                               struct ext2_inode *inode);
 extern errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
                                                   int  group);
@@ -662,12 +663,12 @@ extern void ext2fs_set_inode_callback
         void *done_group_data);
 extern int ext2fs_inode_scan_flags(ext2_inode_scan scan, int set_flags,
                                   int clear_flags);
-extern errcode_t ext2fs_read_inode (ext2_filsys fs, ino_t ino,
+extern errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
                            struct ext2_inode * inode);
-extern errcode_t ext2fs_write_inode(ext2_filsys fs, ino_t ino,
+extern errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
                            struct ext2_inode * inode);
-extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks);
-extern errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino);
+extern errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks);
+extern errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino);
 
 /* icount.c */
 extern void ext2fs_free_icount(ext2_icount_t icount);
@@ -675,15 +676,15 @@ extern errcode_t ext2fs_create_icount2(ext2_filsys fs, int flags, int size,
                                       ext2_icount_t hint, ext2_icount_t *ret);
 extern errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size,
                                      ext2_icount_t *ret);
-extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino,
+extern errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino,
                                     __u16 *ret);
-extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino,
+extern errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
                                         __u16 *ret);
-extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino,
+extern errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
                                         __u16 *ret);
-extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino,
+extern errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
                                     __u16 count);
-extern ino_t ext2fs_get_icount_size(ext2_icount_t icount);
+extern ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount);
 errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *);
 
 /* ismounted.c */
@@ -692,24 +693,24 @@ extern errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
                                          char *mtpt, int mtlen);
 
 /* namei.c */
-extern errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name,
-                        int namelen, char *buf, ino_t *inode);
-extern errcode_t ext2fs_namei(ext2_filsys fs, ino_t root, ino_t cwd,
-                       const char *name, ino_t *inode);
-errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd,
-                             const char *name, ino_t *inode);
-extern errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd,
-                       ino_t inode, ino_t *res_inode);
+extern errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
+                        int namelen, char *buf, ext2_ino_t *inode);
+extern errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                       const char *name, ext2_ino_t *inode);
+errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                             const char *name, ext2_ino_t *inode);
+extern errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                       ext2_ino_t inode, ext2_ino_t *res_inode);
 
 /* native.c */
 int ext2fs_native_flag(void);
 
 /* newdir.c */
-extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ino_t dir_ino,
-                               ino_t parent_ino, char **block);
+extern errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
+                               ext2_ino_t parent_ino, char **block);
 
 /* mkdir.c */
-extern errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
+extern errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
                              const char *name);
 
 /* mkjournal.c */
@@ -724,14 +725,14 @@ extern errcode_t ext2fs_open(const char *name, int flags, int superblock,
                             ext2_filsys *ret_fs);
 
 /* get_pathname.c */
-extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ino_t dir, ino_t ino,
+extern errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
                               char **name);
 
 /* link.c */
-errcode_t ext2fs_link(ext2_filsys fs, ino_t dir, const char *name,
-                     ino_t ino, int flags);
-errcode_t ext2fs_unlink(ext2_filsys fs, ino_t dir, const char *name,
-                       ino_t ino, int flags);
+errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
+                     ext2_ino_t ino, int flags);
+errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir, const char *name,
+                       ext2_ino_t ino, int flags);
 
 /* read_bb.c */
 extern errcode_t ext2fs_read_bb_inode(ext2_filsys fs,
@@ -775,6 +776,12 @@ extern int ext2fs_parse_version_string(const char *ver_string);
 extern int ext2fs_get_library_version(const char **ver_string,
                                      const char **date_string);
 
+/* write_bb_file.c */
+extern errcode_t ext2fs_write_bb_FILE(ext2_badblocks_list bb_list,
+                                     unsigned int flags,
+                                     FILE *f);
+
+
 /* inline functions */
 extern errcode_t ext2fs_get_mem(unsigned long size, void **ptr);
 extern errcode_t ext2fs_free_mem(void **ptr);
@@ -791,7 +798,7 @@ extern void ext2fs_mark_bb_dirty(ext2_filsys fs);
 extern int ext2fs_test_ib_dirty(ext2_filsys fs);
 extern int ext2fs_test_bb_dirty(ext2_filsys fs);
 extern int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk);
-extern int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino);
+extern int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino);
 
 /*
  * The actual inlined functions definitions themselves...
@@ -940,7 +947,7 @@ _INLINE_ int ext2fs_group_of_blk(ext2_filsys fs, blk_t blk)
 /*
  * Return the group # of an inode number
  */
-_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ino_t ino)
+_INLINE_ int ext2fs_group_of_ino(ext2_filsys fs, ext2_ino_t ino)
 {
        return (ino - 1) / fs->super->s_inodes_per_group;
 }
index b2b593db42a838dfb8c7333930ad1798620098db..aedee1535b48daabd0eb37a5cc3c38e6ce63e6b4 100644 (file)
@@ -35,8 +35,8 @@ struct ext2_struct_badblocks_iterate {
 struct ext2_struct_dblist {
        int                     magic;
        ext2_filsys             fs;
-       ino_t                   size;
-       ino_t                   count;
+       ext2_ino_t              size;
+       ext2_ino_t              count;
        int                     sorted;
        struct ext2_db_entry *  list;
 };
@@ -45,7 +45,7 @@ struct ext2_struct_dblist {
  * For directory iterators
  */
 struct dir_context {
-       ino_t           dir;
+       ext2_ino_t              dir;
        int             flags;
        char            *buf;
        int (*func)(struct ext2_dir_entry *dirent,
@@ -53,7 +53,7 @@ struct dir_context {
                    int blocksize,
                    char        *buf,
                    void        *priv_data);
-       int (*func2)(ino_t      dir,
+       int (*func2)(ext2_ino_t dir,
                     int        entry,
                     struct ext2_dir_entry *dirent,
                     int        offset,
@@ -77,8 +77,8 @@ struct ext2_inode_cache {
 };
 
 struct ext2_inode_cache_ent {
-       ino_t   ino;
-       struct ext2_inode inode;
+       ext2_ino_t              ino;
+       struct ext2_inode       inode;
 };
 
 /* Function prototypes */
index 5e41034156599b7a03a586d8d54931ea5374ee5c..d876cd19ccf3598a39304cbf3e60e057ac2f048a 100644 (file)
@@ -26,7 +26,7 @@
 struct ext2_file {
        errcode_t               magic;
        ext2_filsys             fs;
-       ino_t                   ino;
+       ext2_ino_t              ino;
        struct ext2_inode       inode;
        int                     flags;
        ext2_off_t              pos;
@@ -35,7 +35,7 @@ struct ext2_file {
        char                    *buf;
 };
 
-errcode_t ext2fs_file_open(ext2_filsys fs, ino_t ino,
+errcode_t ext2fs_file_open(ext2_filsys fs, ext2_ino_t ino,
                           int flags, ext2_file_t *ret)
 {
        ext2_file_t     file;
index 7609f0ca850e96b666061b542876e48b366a54ef..69b5d4b9eb1dc05261c496241095b04b8dac8d9b 100644 (file)
 #include <sys/mkdev.h>
 #endif
 
+#if EXT2_FLAT_INCLUDES
+#include "ext2_fs.h"
+#else
+#include <linux/ext2_fs.h>
+#endif
+
+#include "ext2fs.h"
+
 struct dir_list {
        char    *name;
        struct dir_list *next;
@@ -39,7 +47,7 @@ struct dir_list {
 /*
  * This function adds an entry to the directory list
  */
-static void add_to_dirlist(char *name, struct dir_list **list)
+static void add_to_dirlist(const char *name, struct dir_list **list)
 {
        struct dir_list *dp;
 
@@ -89,7 +97,7 @@ static int scan_dir(char *dirname, dev_t device, struct dir_list **list,
                        goto skip_to_next;
                if (dp->d_name[0] == '.' &&
                    ((dp->d_name[1] == 0) ||
-                    (dp->d_name[1] == '.') && (dp->d_name[2] == 0)))
+                    ((dp->d_name[1] == '.') && (dp->d_name[2] == 0))))
                        goto skip_to_next;
                sprintf(path, "%s/%s", dirname, dp->d_name);
                if (stat(path, &st) < 0)
@@ -149,7 +157,6 @@ char *ext2fs_find_block_device(dev_t device)
                        new_list = 0;
                }
        }
-found_it:
        free_dirlist(&list);
        free_dirlist(&new_list);
        return ret_path;
index 9a793a4c763a20cfb3c7bb3bf76a149fb331c1a3..3e37fe834952ad4d564de253412ecf5d5dac1990 100644 (file)
 #include "ext2fs.h"
 
 struct get_pathname_struct {
-       ino_t           search_ino;
-       ino_t           parent;
+       ext2_ino_t      search_ino;
+       ext2_ino_t      parent;
        char            *name;
        errcode_t       errcode;
 };
 
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 static int get_pathname_proc(struct ext2_dir_entry *dirent,
                             int        offset,
@@ -70,8 +70,9 @@ static int get_pathname_proc(struct ext2_dir_entry *dirent,
        return 0;
 }
 
-static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ino_t dir, ino_t ino,
-                                        int maxdepth, char *buf, char **name)
+static errcode_t ext2fs_get_pathname_int(ext2_filsys fs, ext2_ino_t dir, 
+                                        ext2_ino_t ino, int maxdepth, 
+                                        char *buf, char **name)
 {
        struct get_pathname_struct gp;
        char    *parent_name, *ret;
@@ -142,7 +143,7 @@ cleanup:
        return retval;
 }
 
-errcode_t ext2fs_get_pathname(ext2_filsys fs, ino_t dir, ino_t ino,
+errcode_t ext2fs_get_pathname(ext2_filsys fs, ext2_ino_t dir, ext2_ino_t ino,
                              char **name)
 {
        char    *buf;
index 543187cd53740fdfb39a7fe5ba6111f5120355b5..98a9f7284a06a74afbc018caa55a03c238619192 100644 (file)
@@ -43,7 +43,7 @@
  */
 
 struct ext2_icount_el {
-       ino_t   ino;
+       ext2_ino_t      ino;
        __u16   count;
 };
 
@@ -51,9 +51,9 @@ struct ext2_icount {
        errcode_t               magic;
        ext2fs_inode_bitmap     single;
        ext2fs_inode_bitmap     multiple;
-       ino_t                   count;
-       ino_t                   size;
-       ino_t                   num_inodes;
+       ext2_ino_t              count;
+       ext2_ino_t              size;
+       ext2_ino_t              num_inodes;
        int                     cursor;
        struct ext2_icount_el   *list;
 };
@@ -164,17 +164,17 @@ errcode_t ext2fs_create_icount(ext2_filsys fs, int flags, int size,
  *     specified position.
  */
 static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
-                                           ino_t ino, int pos)
+                                           ext2_ino_t ino, int pos)
 {
        struct ext2_icount_el   *el;
        errcode_t               retval;
-       ino_t                   new_size = 0;
+       ext2_ino_t                      new_size = 0;
        int                     num;
 
        if (icount->count >= icount->size) {
                if (icount->count) {
                        new_size = icount->list[(unsigned)icount->count-1].ino;
-                       new_size = (ino_t) (icount->count * 
+                       new_size = (ext2_ino_t) (icount->count * 
                                ((float) new_size / icount->num_inodes));
                }
                if (new_size < (icount->size + 100))
@@ -211,11 +211,11 @@ static struct ext2_icount_el *insert_icount_el(ext2_icount_t icount,
  *     and we can't find an entry, create one in the sorted list.
  */
 static struct ext2_icount_el *get_icount_el(ext2_icount_t icount,
-                                           ino_t ino, int create)
+                                           ext2_ino_t ino, int create)
 {
        float   range;
        int     low, high, mid;
-       ino_t   lowval, highval;
+       ext2_ino_t      lowval, highval;
 
        if (!icount || !icount->list)
                return 0;
@@ -289,7 +289,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
        }
        for (i=1; i < icount->count; i++) {
                if (icount->list[i-1].ino >= icount->list[i].ino) {
-                       fprintf(out, "%s: list[%d].ino=%ld, list[%d].ino=%ld\n",
+                       fprintf(out, "%s: list[%d].ino=%u, list[%d].ino=%u\n",
                                bad, i-1, icount->list[i-1].ino,
                                i, icount->list[i].ino);
                        ret = EXT2_ET_INVALID_ARGUMENT;
@@ -298,7 +298,7 @@ errcode_t ext2fs_icount_validate(ext2_icount_t icount, FILE *out)
        return ret;
 }
 
-errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino, __u16 *ret)
+errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ext2_ino_t ino, __u16 *ret)
 {
        struct ext2_icount_el   *el;
        
@@ -325,7 +325,7 @@ errcode_t ext2fs_icount_fetch(ext2_icount_t icount, ino_t ino, __u16 *ret)
        return 0;
 }
 
-errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino,
+errcode_t ext2fs_icount_increment(ext2_icount_t icount, ext2_ino_t ino,
                                  __u16 *ret)
 {
        struct ext2_icount_el   *el;
@@ -390,7 +390,7 @@ errcode_t ext2fs_icount_increment(ext2_icount_t icount, ino_t ino,
        return 0;
 }
 
-errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino,
+errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ext2_ino_t ino,
                                  __u16 *ret)
 {
        struct ext2_icount_el   *el;
@@ -433,7 +433,7 @@ errcode_t ext2fs_icount_decrement(ext2_icount_t icount, ino_t ino,
        return 0;
 }
 
-errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino,
+errcode_t ext2fs_icount_store(ext2_icount_t icount, ext2_ino_t ino,
                              __u16 count)
 {
        struct ext2_icount_el   *el;
@@ -478,7 +478,7 @@ errcode_t ext2fs_icount_store(ext2_icount_t icount, ino_t ino,
        return 0;
 }
 
-ino_t ext2fs_get_icount_size(ext2_icount_t icount)
+ext2_ino_t ext2fs_get_icount_size(ext2_icount_t icount)
 {
        if (!icount || icount->magic != EXT2_ET_MAGIC_ICOUNT)
                return 0;
index 590def434e256620f66d9f9ebf8ea2bf19493ac9..b09331c86982278ba5870e2e9d3b3efb4c8b27c2 100644 (file)
 struct ext2_struct_inode_scan {
        errcode_t               magic;
        ext2_filsys             fs;
-       ino_t                   current_inode;
+       ext2_ino_t              current_inode;
        blk_t                   current_block;
        dgrp_t                  current_group;
-       ino_t                   inodes_left;
+       ext2_ino_t              inodes_left;
        blk_t                   blocks_left;
        dgrp_t                  groups_left;
        blk_t                   inode_buffer_blocks;
@@ -108,7 +108,7 @@ errcode_t ext2fs_open_inode_scan(ext2_filsys fs, int buffer_blocks,
 {
        ext2_inode_scan scan;
        errcode_t       retval;
-       errcode_t (*save_get_blocks)(ext2_filsys f, ino_t ino, blk_t *blocks);
+       errcode_t (*save_get_blocks)(ext2_filsys f, ext2_ino_t ino, blk_t *blocks);
 
        EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
 
@@ -381,7 +381,7 @@ static inline int is_empty_scan(ext2_inode_scan scan)
 }
 #endif
 
-errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
+errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ext2_ino_t *ino,
                                struct ext2_inode *inode)
 {
        errcode_t       retval;
@@ -480,7 +480,7 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
 /*
  * Functions to read and write a single inode.
  */
-errcode_t ext2fs_read_inode (ext2_filsys fs, ino_t ino,
+errcode_t ext2fs_read_inode (ext2_filsys fs, ext2_ino_t ino,
                             struct ext2_inode * inode)
 {
        unsigned long   group, block, block_nr, offset;
@@ -564,7 +564,7 @@ errcode_t ext2fs_read_inode (ext2_filsys fs, ino_t ino,
        return 0;
 }
 
-errcode_t ext2fs_write_inode(ext2_filsys fs, ino_t ino,
+errcode_t ext2fs_write_inode(ext2_filsys fs, ext2_ino_t ino,
                             struct ext2_inode * inode)
 {
        unsigned long group, block, block_nr, offset;
@@ -663,7 +663,7 @@ errcode_t ext2fs_write_inode(ext2_filsys fs, ino_t ino,
        return 0;
 }
 
-errcode_t ext2fs_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
+errcode_t ext2fs_get_blocks(ext2_filsys fs, ext2_ino_t ino, blk_t *blocks)
 {
        struct ext2_inode       inode;
        int                     i;
@@ -686,7 +686,7 @@ errcode_t ext2fs_get_blocks(ext2_filsys fs, ino_t ino, blk_t *blocks)
        return 0;
 }
 
-errcode_t ext2fs_check_directory(ext2_filsys fs, ino_t ino)
+errcode_t ext2fs_check_directory(ext2_filsys fs, ext2_ino_t ino)
 {
        struct  ext2_inode      inode;
        errcode_t               retval;
index 6c76ed5f4f255add67cc10b6e4f3c025d339e5b8..9b943ced132b337b0401cb058fae58097f0d020a 100644 (file)
@@ -15,10 +15,10 @@ struct ext2_inode_reference {
 };
 
 struct ext2_inode_relocate_entry {
-       ino_t   new;
-       ino_t   orig;
-       __u16   flags;
-       __u16   max_refs;
+       ext2_ino_t      new;
+       ext2_ino_t      orig;
+       __u16           flags;
+       __u16           max_refs;
 };
 
 typedef struct ext2_inode_relocation_table *ext2_irel;
@@ -26,24 +26,24 @@ typedef struct ext2_inode_relocation_table *ext2_irel;
 struct ext2_inode_relocation_table {
        __u32   magic;
        char    *name;
-       ino_t   current;
+       ext2_ino_t      current;
        void    *priv_data;
 
        /*
         * Add an inode relocation entry.
         */
-       errcode_t (*put)(ext2_irel irel, ino_t old,
+       errcode_t (*put)(ext2_irel irel, ext2_ino_t old,
                              struct ext2_inode_relocate_entry *ent);
        /*
         * Get an inode relocation entry.
         */
-       errcode_t (*get)(ext2_irel irel, ino_t old,
+       errcode_t (*get)(ext2_irel irel, ext2_ino_t old,
                              struct ext2_inode_relocate_entry *ent);
 
        /*
         * Get an inode relocation entry by its original inode number
         */
-       errcode_t (*get_by_orig)(ext2_irel irel, ino_t orig, ino_t *old,
+       errcode_t (*get_by_orig)(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
                                 struct ext2_inode_relocate_entry *ent);
 
        /*
@@ -55,21 +55,21 @@ struct ext2_inode_relocation_table {
         * The iterator function for the inode relocation entries.
         * Returns an inode number of 0 when out of entries.
         */
-       errcode_t (*next)(ext2_irel irel, ino_t *old,
+       errcode_t (*next)(ext2_irel irel, ext2_ino_t *old,
                          struct ext2_inode_relocate_entry *ent);
 
        /*
         * Add an inode reference (i.e., note the fact that a
         * particular block/offset contains a reference to an inode)
         */
-       errcode_t (*add_ref)(ext2_irel irel, ino_t ino,
+       errcode_t (*add_ref)(ext2_irel irel, ext2_ino_t ino,
                             struct ext2_inode_reference *ref);
 
        /*
         * Initialize for iterating over the inode references for a
         * particular inode.
         */
-       errcode_t (*start_iter_ref)(ext2_irel irel, ino_t ino);
+       errcode_t (*start_iter_ref)(ext2_irel irel, ext2_ino_t ino);
 
        /*
         * The iterator function for the inode references for an
@@ -83,13 +83,13 @@ struct ext2_inode_relocation_table {
         * Move the inode relocation table from one inode number to
         * another.  Note that the inode references also must move.
         */
-       errcode_t (*move)(ext2_irel irel, ino_t old, ino_t new);
+       errcode_t (*move)(ext2_irel irel, ext2_ino_t old, ext2_ino_t new);
 
        /*
         * Remove an inode relocation entry, along with all of the
         * inode references.
         */
-       errcode_t (*delete)(ext2_irel irel, ino_t old);
+       errcode_t (*delete)(ext2_irel irel, ext2_ino_t old);
 
        /*
         * Free the inode relocation table.
@@ -97,7 +97,7 @@ struct ext2_inode_relocation_table {
        errcode_t (*free)(ext2_irel irel);
 };
 
-errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode,
+errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode,
                                    ext2_irel *irel);
 
 #define ext2fs_irel_put(irel, old, ent) ((irel)->put((irel), old, ent))
index ee5caf1178c03fbec2b494fe75284e0ed4c3c71e..07ab9ddd0f0b7404c68f6d95205028a9ab6bdf55 100644 (file)
 #include "ext2fs.h"
 #include "irel.h"
 
-static errcode_t ima_put(ext2_irel irel, ino_t old,
+static errcode_t ima_put(ext2_irel irel, ext2_ino_t old,
                         struct ext2_inode_relocate_entry *ent);
-static errcode_t ima_get(ext2_irel irel, ino_t old,
+static errcode_t ima_get(ext2_irel irel, ext2_ino_t old,
                         struct ext2_inode_relocate_entry *ent);
-static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old,
+static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
                                 struct ext2_inode_relocate_entry *ent);
 static errcode_t ima_start_iter(ext2_irel irel);
-static errcode_t ima_next(ext2_irel irel, ino_t *old,
+static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old,
                          struct ext2_inode_relocate_entry *ent);
-static errcode_t ima_add_ref(ext2_irel irel, ino_t ino,
+static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino,
                             struct ext2_inode_reference *ref);
-static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino);
+static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino);
 static errcode_t ima_next_ref(ext2_irel irel, struct ext2_inode_reference *ref);
-static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new);
-static errcode_t ima_delete(ext2_irel irel, ino_t old);
+static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new);
+static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old);
 static errcode_t ima_free(ext2_irel irel);
 
 /*
@@ -56,15 +56,15 @@ struct inode_reference_entry {
 
 struct irel_ma {
        __u32 magic;
-       ino_t max_inode;
-       ino_t ref_current;
+       ext2_ino_t max_inode;
+       ext2_ino_t ref_current;
        int   ref_iter;
-       ino_t   *orig_map;
+       ext2_ino_t      *orig_map;
        struct ext2_inode_relocate_entry *entries;
        struct inode_reference_entry *ref_entries;
 };
 
-errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode,
+errcode_t ext2fs_irel_memarray_create(char *name, ext2_ino_t max_inode,
                                      ext2_irel *new_irel)
 {
        ext2_irel               irel = 0;
@@ -94,7 +94,7 @@ errcode_t ext2fs_irel_memarray_create(char *name, ino_t max_inode,
        memset(ma, 0, sizeof(struct irel_ma));
        irel->priv_data = ma;
        
-       size = (size_t) (sizeof(ino_t) * (max_inode+1));
+       size = (size_t) (sizeof(ext2_ino_t) * (max_inode+1));
        retval = ext2fs_get_mem(size, (void **) &ma->orig_map);
        if (retval)
                goto errout;
@@ -138,7 +138,7 @@ errout:
        return retval;
 }
 
-static errcode_t ima_put(ext2_irel irel, ino_t old,
+static errcode_t ima_put(ext2_irel irel, ext2_ino_t old,
                        struct ext2_inode_relocate_entry *ent)
 {
        struct inode_reference_entry    *ref_ent;
@@ -179,7 +179,7 @@ static errcode_t ima_put(ext2_irel irel, ino_t old,
        return 0;
 }
 
-static errcode_t ima_get(ext2_irel irel, ino_t old,
+static errcode_t ima_get(ext2_irel irel, ext2_ino_t old,
                        struct ext2_inode_relocate_entry *ent)
 {
        struct irel_ma  *ma;
@@ -193,11 +193,11 @@ static errcode_t ima_get(ext2_irel irel, ino_t old,
        return 0;
 }
 
-static errcode_t ima_get_by_orig(ext2_irel irel, ino_t orig, ino_t *old,
+static errcode_t ima_get_by_orig(ext2_irel irel, ext2_ino_t orig, ext2_ino_t *old,
                        struct ext2_inode_relocate_entry *ent)
 {
        struct irel_ma  *ma;
-       ino_t   ino;
+       ext2_ino_t      ino;
 
        ma = irel->priv_data;
        if (orig > ma->max_inode)
@@ -216,7 +216,7 @@ static errcode_t ima_start_iter(ext2_irel irel)
        return 0;
 }
 
-static errcode_t ima_next(ext2_irel irel, ino_t *old,
+static errcode_t ima_next(ext2_irel irel, ext2_ino_t *old,
                         struct ext2_inode_relocate_entry *ent)
 {
        struct irel_ma  *ma;
@@ -233,7 +233,7 @@ static errcode_t ima_next(ext2_irel irel, ino_t *old,
        return 0;
 }
 
-static errcode_t ima_add_ref(ext2_irel irel, ino_t ino,
+static errcode_t ima_add_ref(ext2_irel irel, ext2_ino_t ino,
                             struct ext2_inode_reference *ref)
 {
        struct irel_ma  *ma;
@@ -269,7 +269,7 @@ static errcode_t ima_add_ref(ext2_irel irel, ino_t ino,
        return 0;
 }
 
-static errcode_t ima_start_iter_ref(ext2_irel irel, ino_t ino)
+static errcode_t ima_start_iter_ref(ext2_irel irel, ext2_ino_t ino)
 {
        struct irel_ma  *ma;
 
@@ -304,7 +304,7 @@ static errcode_t ima_next_ref(ext2_irel irel,
 }
 
 
-static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new)
+static errcode_t ima_move(ext2_irel irel, ext2_ino_t old, ext2_ino_t new)
 {
        struct irel_ma  *ma;
 
@@ -327,7 +327,7 @@ static errcode_t ima_move(ext2_irel irel, ino_t old, ino_t new)
        return 0;
 }
 
-static errcode_t ima_delete(ext2_irel irel, ino_t old)
+static errcode_t ima_delete(ext2_irel irel, ext2_ino_t old)
 {
        struct irel_ma  *ma;
 
@@ -350,7 +350,7 @@ static errcode_t ima_delete(ext2_irel irel, ino_t old)
 static errcode_t ima_free(ext2_irel irel)
 {
        struct irel_ma  *ma;
-       ino_t   ino;
+       ext2_ino_t      ino;
 
        if (!irel)
                return 0;
index 95bf953ee01cd5c641a4c69763b8ad5e9470553f..c3b1070dc5029efdfe5fda749caa445c0a0b526c 100644 (file)
@@ -28,6 +28,7 @@
 #include <sys/param.h>
 #include <sys/mount.h>
 #endif /* HAVE_GETMNTINFO */
+#include <string.h>
 
 #if EXT2_FLAT_INCLUDES
 #include "ext2_fs.h"
@@ -120,7 +121,7 @@ static errcode_t check_getmntinfo(const char *file, int *mount_flags,
  * characters.
  */
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
                                  char *mtpt, int mtlen)
@@ -143,7 +144,7 @@ errcode_t ext2fs_check_mount_point(const char *device, int *mount_flags,
  * 
  */
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 errcode_t ext2fs_check_if_mounted(const char *file, int *mount_flags)
 {
index f8d760d21b1f08877394ceadcc38cf229f595d38..e6802592e895d2f7715f29df9cbc0de4ab194721 100644 (file)
@@ -26,7 +26,7 @@
 struct link_struct  {
        const char      *name;
        int             namelen;
-       ino_t           inode;
+       ext2_ino_t      inode;
        int             flags;
        int             done;
        struct ext2_super_block *sb;
@@ -97,10 +97,10 @@ static int link_proc(struct ext2_dir_entry *dirent,
  * entry filetype.
  */
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
-errcode_t ext2fs_link(ext2_filsys fs, ino_t dir, const char *name, ino_t ino,
-                     int flags)
+errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name, 
+                     ext2_ino_t ino, int flags)
 {
        errcode_t       retval;
        struct link_struct ls;
index 282180c68f4f14af94489352d671934dc07e7af1..6b44bc0e845de891afb4c6ce4e587655a73a8d9d 100644 (file)
@@ -26,7 +26,7 @@
 struct lookup_struct  {
        const char      *name;
        int             len;
-       ino_t           *inode;
+       ext2_ino_t      *inode;
        int             found;
 };     
 
@@ -51,8 +51,8 @@ static int lookup_proc(struct ext2_dir_entry *dirent,
 }
 
 
-errcode_t ext2fs_lookup(ext2_filsys fs, ino_t dir, const char *name,
-                       int namelen, char *buf, ino_t *inode)
+errcode_t ext2fs_lookup(ext2_filsys fs, ext2_ino_t dir, const char *name,
+                       int namelen, char *buf, ext2_ino_t *inode)
 {
        errcode_t       retval;
        struct lookup_struct ls;
index 98c5ccf2cb40a74b03643dfa8f112e2f55d5f061..e037dadbe6dfe1c8c80ae082befef59dc2e8eb85 100644 (file)
 #define EXT2_FT_DIR            2
 #endif
 
-errcode_t ext2fs_mkdir(ext2_filsys fs, ino_t parent, ino_t inum,
+errcode_t ext2fs_mkdir(ext2_filsys fs, ext2_ino_t parent, ext2_ino_t inum,
                       const char *name)
 {
        errcode_t               retval;
        struct ext2_inode       parent_inode, inode;
-       ino_t                   ino = inum;
-       ino_t                   scratch_ino;
+       ext2_ino_t              ino = inum;
+       ext2_ino_t              scratch_ino;
        blk_t                   blk;
        char                    *block = 0;
        int                     group;
index 9bb0f66cbc4c93ddedd56a1e2cafd35798a877e7..e8ab6836fe495c3ea5ec6f343ffdf5a463395e68 100644 (file)
@@ -174,7 +174,7 @@ static int mkjournal_proc(ext2_filsys               fs,
 /*
  * This function creates a journal using direct I/O routines.
  */
-static errcode_t write_journal_inode(ext2_filsys fs, ino_t journal_ino,
+static errcode_t write_journal_inode(ext2_filsys fs, ext2_ino_t journal_ino,
                                     blk_t size, int flags)
 {
        journal_superblock_t    jsb;
@@ -275,7 +275,7 @@ errcode_t ext2fs_add_journal_device(ext2_filsys fs, char *device,
 errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
 {
        errcode_t               retval;
-       ino_t                   journal_ino;
+       ext2_ino_t              journal_ino;
        struct stat             st;
        char                    jfile[1024];
        int                     fd, mount_flags;
index ae19387a0d85a68f930503ab6a79a1a262cdfd70..71d314da5af760c796d438f45b4e489d1e7ba563 100644 (file)
 
 #include "ext2fs.h"
 
-static errcode_t open_namei(ext2_filsys fs, ino_t root, ino_t base,
+static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
                            const char *pathname, size_t pathlen, int follow,
-                           int link_count, char *buf, ino_t *res_inode);
+                           int link_count, char *buf, ext2_ino_t *res_inode);
 
-static errcode_t follow_link(ext2_filsys fs, ino_t root, ino_t dir,
-                            ino_t inode, int link_count,
-                            char *buf, ino_t *res_inode)
+static errcode_t follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
+                            ext2_ino_t inode, int link_count,
+                            char *buf, ext2_ino_t *res_inode)
 {
        char *pathname;
        char *buffer = 0;
@@ -77,15 +77,16 @@ static errcode_t follow_link(ext2_filsys fs, ino_t root, ino_t dir,
  * containing directory, and a pointer to the filename of the file
  * (pointing into the pathname) and the length of the filename.
  */
-static errcode_t dir_namei(ext2_filsys fs, ino_t root, ino_t dir,
+static errcode_t dir_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t dir,
                           const char *pathname, int pathlen,
                           int link_count, char *buf,
-                          const char **name, int *namelen, ino_t *res_inode)
+                          const char **name, int *namelen,
+                          ext2_ino_t *res_inode)
 {
        char c;
        const char *thisname;
        int len;
-       ino_t inode;
+       ext2_ino_t inode;
        errcode_t retval;
 
        if ((c = *pathname) == '/') {
@@ -114,13 +115,13 @@ static errcode_t dir_namei(ext2_filsys fs, ino_t root, ino_t dir,
        return 0;
 }
 
-static errcode_t open_namei(ext2_filsys fs, ino_t root, ino_t base,
+static errcode_t open_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t base,
                            const char *pathname, size_t pathlen, int follow,
-                           int link_count, char *buf, ino_t *res_inode)
+                           int link_count, char *buf, ext2_ino_t *res_inode)
 {
        const char *basename;
        int namelen;
-       ino_t dir, inode;
+       ext2_ino_t dir, inode;
        errcode_t retval;
 
 #ifdef NAMEI_DEBUG
@@ -151,8 +152,8 @@ static errcode_t open_namei(ext2_filsys fs, ino_t root, ino_t base,
        return 0;
 }
 
-errcode_t ext2fs_namei(ext2_filsys fs, ino_t root, ino_t cwd,
-                      const char *name, ino_t *inode)
+errcode_t ext2fs_namei(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                      const char *name, ext2_ino_t *inode)
 {
        char *buf;
        errcode_t retval;
@@ -170,8 +171,8 @@ errcode_t ext2fs_namei(ext2_filsys fs, ino_t root, ino_t cwd,
        return retval;
 }
 
-errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd,
-                             const char *name, ino_t *inode)
+errcode_t ext2fs_namei_follow(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                             const char *name, ext2_ino_t *inode)
 {
        char *buf;
        errcode_t retval;
@@ -189,8 +190,8 @@ errcode_t ext2fs_namei_follow(ext2_filsys fs, ino_t root, ino_t cwd,
        return retval;
 }
 
-errcode_t ext2fs_follow_link(ext2_filsys fs, ino_t root, ino_t cwd,
-                       ino_t inode, ino_t *res_inode)
+errcode_t ext2fs_follow_link(ext2_filsys fs, ext2_ino_t root, ext2_ino_t cwd,
+                       ext2_ino_t inode, ext2_ino_t *res_inode)
 {
        char *buf;
        errcode_t retval;
index ec7b52d6886f074a673a5e58bb2a307adb0c790c..940256bcaee60a9718ab1aaf6c5a940096dc3c6a 100644 (file)
@@ -30,8 +30,8 @@
 /*
  * Create new directory block
  */
-errcode_t ext2fs_new_dir_block(ext2_filsys fs, ino_t dir_ino, ino_t parent_ino,
-                              char **block)
+errcode_t ext2fs_new_dir_block(ext2_filsys fs, ext2_ino_t dir_ino,
+                              ext2_ino_t parent_ino, char **block)
 {
        struct ext2_dir_entry   *dir = NULL;
        errcode_t               retval;
index 20696a88f9799e1db641a0a085991ba134c3a9ac..2aa2e578b2feb4d2acf353338ce86570ef52bf20 100644 (file)
@@ -79,7 +79,7 @@ errcode_t ext2fs_read_bb_FILE2(ext2_filsys fs, FILE *f,
 static void call_compat_invalid(ext2_filsys fs, blk_t blk,
                                char *badstr, void *private)
 {
-       void (*invalid)(ext2_filsys fs, blk_t blk);
+       void (*invalid)(ext2_filsys, blk_t);
 
        invalid = (void (*)(ext2_filsys, blk_t)) private;
        if (invalid)
@@ -94,7 +94,7 @@ errcode_t ext2fs_read_bb_FILE(ext2_filsys fs, FILE *f,
                              ext2_badblocks_list *bb_list,
                              void (*invalid)(ext2_filsys fs, blk_t blk))
 {
-       return ext2fs_read_bb_FILE2(fs, f, bb_list, invalid,
+       return ext2fs_read_bb_FILE2(fs, f, bb_list, (void *) invalid,
                                    call_compat_invalid);
 }
 
index 7c77624e905504cc0d7d31552bd1100cfed00339..faa447e88d766eff611ceec9ca3552d51a056d1e 100644 (file)
@@ -55,6 +55,8 @@ static errcode_t test_read_blk(io_channel channel, unsigned long block,
 static errcode_t test_write_blk(io_channel channel, unsigned long block,
                                int count, const void *data);
 static errcode_t test_flush(io_channel channel);
+static errcode_t test_write_byte(io_channel channel, unsigned long offset,
+                                int count, const void *buf);
 
 static struct struct_io_manager struct_test_manager = {
        EXT2_ET_MAGIC_IO_MANAGER,
@@ -64,7 +66,9 @@ static struct struct_io_manager struct_test_manager = {
        test_set_blksize,
        test_read_blk,
        test_write_blk,
-       test_flush
+       test_flush,
+       test_write_byte
+       
 };
 
 io_manager test_io_manager = &struct_test_manager;
index ed9fe3659f4dee9c8ea8709107b12277358d0cf1..fc0053b8ef8c116e3b2fbd2483c630db50613584 100644 (file)
@@ -141,7 +141,7 @@ static void iterate(void)
        struct ext2_inode inode;
        ext2_inode_scan scan;
        errcode_t       retval;
-       ino_t           ino;
+       ext2_ino_t      ino;
 
        retval = ext2fs_open_inode_scan(test_fs, 8, &scan);
        if (retval) {
index 142d149f09de7b40788773fe0ce4662994517fef..6028b271f1202bc8fd9e8a4ce0190eb160466101 100644 (file)
@@ -215,18 +215,18 @@ static void free_cache(io_channel channel,
  * if the block isn't in the cache, evict the oldest block in the
  * cache and create a new cache entry for the requested block.
  */
-struct unix_cache *find_cached_block(io_channel channel,
-                                    struct unix_private_data *data,
-                                    unsigned long block,
-                                    int get_cache)
+static struct unix_cache *find_cached_block(io_channel channel,
+                                           struct unix_private_data *data,
+                                           unsigned long block,
+                                           int get_cache)
 {
-       struct unix_cache       *cache, *free_cache, *oldest_cache;
+       struct unix_cache       *cache, *unused_cache, *oldest_cache;
        int                     i;
        
-       free_cache = oldest_cache = 0;
+       unused_cache = oldest_cache = 0;
        for (i=0, cache = data->cache; i < CACHE_SIZE; i++, cache++) {
                if (!cache->in_use) {
-                       free_cache = cache;
+                       unused_cache = cache;
                        continue;
                }
                if (cache->block == block) {
@@ -243,8 +243,8 @@ struct unix_cache *find_cached_block(io_channel channel,
        /*
         * Try to allocate cache slot.
         */
-       if (free_cache)
-               cache = free_cache;
+       if (unused_cache)
+               cache = unused_cache;
        else {
                cache = oldest_cache;
                if (cache->dirty)
@@ -406,6 +406,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block,
        struct unix_private_data *data;
        struct unix_cache *cache;
        errcode_t       retval;
+       char            *cp;
        int             i, j;
 
        EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
@@ -422,16 +423,17 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block,
                return raw_read_blk(channel, data, block, count, buf);
        }
 
+       cp = buf;
        while (count > 0) {
                /* If it's in the cache, use it! */
                if ((cache = find_cached_block(channel, data, block, 0))) {
 #ifdef DEBUG
                        printf("Using cached block %d\n", block);
 #endif
-                       memcpy(buf, cache->buf, channel->block_size);
+                       memcpy(cp, cache->buf, channel->block_size);
                        count--;
                        block++;
-                       buf += channel->block_size;
+                       cp += channel->block_size;
                        continue;
                }
                /*
@@ -444,7 +446,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block,
 #ifdef DEBUG
                printf("Reading %d blocks starting at %d\n", i, block);
 #endif
-               if ((retval = raw_read_blk(channel, data, block, i, buf)))
+               if ((retval = raw_read_blk(channel, data, block, i, cp)))
                        return retval;
                
                /* Save the results in the cache */
@@ -452,8 +454,8 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block,
                        count--;
                        cache = find_cached_block(channel, data, block++, 1);
                        if (cache)
-                               memcpy(cache->buf, buf, channel->block_size);
-                       buf += channel->block_size;
+                               memcpy(cache->buf, cp, channel->block_size);
+                       cp += channel->block_size;
                }
        }
        return 0;
@@ -465,8 +467,8 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block,
        struct unix_private_data *data;
        struct unix_cache *cache;
        errcode_t       retval = 0, retval2;
-       char            *cp;
-       int             i, writethrough;
+       const char      *cp;
+       int             writethrough;
 
        EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
        data = (struct unix_private_data *) channel->private_data;
@@ -491,6 +493,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block,
        if (writethrough)
                retval = raw_write_blk(channel, data, block, count, buf);
        
+       cp = buf;
        while (count > 0) {
                cache = find_cached_block(channel, data, block, 1);
                if (!cache) {
@@ -499,15 +502,15 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block,
                         * Force the write directly.
                         */
                        if ((retval2 = raw_write_blk(channel, data, block,
-                                               1, buf)))
+                                               1, cp)))
                                retval = retval2;
                } else {
-                       memcpy(cache->buf, buf, channel->block_size);
+                       memcpy(cache->buf, cp, channel->block_size);
                        cache->dirty = !writethrough;
                }
                count--;
                block++;
-               buf += channel->block_size;
+               cp += channel->block_size;
        }
        return retval;
 }
@@ -516,10 +519,7 @@ static errcode_t unix_write_byte(io_channel channel, unsigned long offset,
                                 int size, const void *buf)
 {
        struct unix_private_data *data;
-       struct unix_cache *cache;
-       errcode_t       retval = 0, retval2;
-       char            *cp;
-       int             i, writethrough;
+       errcode_t       retval = 0;
        size_t          actual;
 
        EXT2_CHECK_MAGIC(channel, EXT2_ET_MAGIC_IO_CHANNEL);
index ead5ec35009fb9a01a3b2239b6fe9d8b45fec62e..59b251f43d5de1b31537f05d827e4105f25910a5 100644 (file)
 struct link_struct  {
        const char      *name;
        int             namelen;
-       ino_t           inode;
+       ext2_ino_t      inode;
        int             flags;
        int             done;
 };     
 
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
 static int unlink_proc(struct ext2_dir_entry *dirent,
                     int        offset,
@@ -56,9 +56,10 @@ static int unlink_proc(struct ext2_dir_entry *dirent,
 }
 
 #ifdef __TURBOC__
-#pragma argsused
+ #pragma argsused
 #endif
-errcode_t ext2fs_unlink(ext2_filsys fs, ino_t dir, const char *name, ino_t ino,
+errcode_t ext2fs_unlink(ext2_filsys fs, ext2_ino_t dir,
+                       const char *name, ext2_ino_t ino,
                        int flags)
 {
        errcode_t       retval;