summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ext2fs/ChangeLog14
-rw-r--r--lib/ext2fs/alloc.c10
-rw-r--r--lib/ext2fs/bb_inode.c4
-rw-r--r--lib/ext2fs/bitmaps.c2
-rw-r--r--lib/ext2fs/bitops.h32
-rw-r--r--lib/ext2fs/block.c20
-rw-r--r--lib/ext2fs/bmap.c4
-rw-r--r--lib/ext2fs/bmove.c4
-rw-r--r--lib/ext2fs/brel.h4
-rw-r--r--lib/ext2fs/cmp_bitmaps.c2
-rw-r--r--lib/ext2fs/dblist.c14
-rw-r--r--lib/ext2fs/dblist_dir.c2
-rw-r--r--lib/ext2fs/dir_iterate.c2
-rw-r--r--lib/ext2fs/expanddir.c2
-rw-r--r--lib/ext2fs/ext2fs.h99
-rw-r--r--lib/ext2fs/ext2fsP.h12
-rw-r--r--lib/ext2fs/fileio.c4
-rw-r--r--lib/ext2fs/finddev.c13
-rw-r--r--lib/ext2fs/get_pathname.c13
-rw-r--r--lib/ext2fs/icount.c30
-rw-r--r--lib/ext2fs/inode.c16
-rw-r--r--lib/ext2fs/irel.h28
-rw-r--r--lib/ext2fs/irel_ma.c46
-rw-r--r--lib/ext2fs/ismounted.c5
-rw-r--r--lib/ext2fs/link.c8
-rw-r--r--lib/ext2fs/lookup.c6
-rw-r--r--lib/ext2fs/mkdir.c6
-rw-r--r--lib/ext2fs/mkjournal.c4
-rw-r--r--lib/ext2fs/namei.c35
-rw-r--r--lib/ext2fs/newdir.c4
-rw-r--r--lib/ext2fs/read_bb_file.c4
-rw-r--r--lib/ext2fs/test_io.c6
-rw-r--r--lib/ext2fs/tst_iscan.c2
-rw-r--r--lib/ext2fs/unix_io.c46
-rw-r--r--lib/ext2fs/unlink.c9
35 files changed, 274 insertions, 238 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index ad380268..0cb488ea 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -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
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index fa71406c..e89c55f4 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -37,12 +37,12 @@
*
* 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);
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index e6ce7766..a9e32b3d 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -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,
diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
index cbfd43d5..d215f308 100644
--- a/lib/ext2fs/bitmaps.c
+++ b/lib/ext2fs/bitmaps.c
@@ -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);
diff --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h
index 7e049d1e..6ab77819 100644
--- a/lib/ext2fs/bitops.h
+++ b/lib/ext2fs/bitops.h
@@ -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;
}
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 03357b10..621e8507 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -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,
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index 9d7ebfed..7677499a 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -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)
{
diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c
index fbb5f9b6..e3cac4dc 100644
--- a/lib/ext2fs/bmove.c
+++ b/lib/ext2fs/bmove.c
@@ -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;
diff --git a/lib/ext2fs/brel.h b/lib/ext2fs/brel.h
index a8d83b7b..be97243c 100644
--- a/lib/ext2fs/brel.h
+++ b/lib/ext2fs/brel.h
@@ -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;
};
diff --git a/lib/ext2fs/cmp_bitmaps.c b/lib/ext2fs/cmp_bitmaps.c
index 5086d125..1f27421e 100644
--- a/lib/ext2fs/cmp_bitmaps.c
+++ b/lib/ext2fs/cmp_bitmaps.c
@@ -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);
diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c
index 5a2a9641..4688aa71 100644
--- a/lib/ext2fs/dblist.c
+++ b/lib/ext2fs/dblist.c
@@ -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);
diff --git a/lib/ext2fs/dblist_dir.c b/lib/ext2fs/dblist_dir.c
index d97ca95d..f4c3f624 100644
--- a/lib/ext2fs/dblist_dir.c
+++ b/lib/ext2fs/dblist_dir.c
@@ -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,
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 3fecf23f..2f07345f 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -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,
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index eb130843..0e6adebb 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -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;
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 1f3e6149..11127022 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -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;
}
diff --git a/lib/ext2fs/ext2fsP.h b/lib/ext2fs/ext2fsP.h
index b2b593db..aedee153 100644
--- a/lib/ext2fs/ext2fsP.h
+++ b/lib/ext2fs/ext2fsP.h
@@ -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 */
diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index 5e410341..d876cd19 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -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;
diff --git a/lib/ext2fs/finddev.c b/lib/ext2fs/finddev.c
index 7609f0ca..69b5d4b9 100644
--- a/lib/ext2fs/finddev.c
+++ b/lib/ext2fs/finddev.c
@@ -31,6 +31,14 @@
#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;
diff --git a/lib/ext2fs/get_pathname.c b/lib/ext2fs/get_pathname.c
index 9a793a4c..3e37fe83 100644
--- a/lib/ext2fs/get_pathname.c
+++ b/lib/ext2fs/get_pathname.c
@@ -33,14 +33,14 @@
#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;
diff --git a/lib/ext2fs/icount.c b/lib/ext2fs/icount.c
index 543187cd..98a9f728 100644
--- a/lib/ext2fs/icount.c
+++ b/lib/ext2fs/icount.c
@@ -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;
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 590def43..b09331c8 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -32,10 +32,10 @@
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;
diff --git a/lib/ext2fs/irel.h b/lib/ext2fs/irel.h
index 6c76ed5f..9b943ced 100644
--- a/lib/ext2fs/irel.h
+++ b/lib/ext2fs/irel.h
@@ -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))
diff --git a/lib/ext2fs/irel_ma.c b/lib/ext2fs/irel_ma.c
index ee5caf11..07ab9ddd 100644
--- a/lib/ext2fs/irel_ma.c
+++ b/lib/ext2fs/irel_ma.c
@@ -28,21 +28,21 @@
#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;
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
index 95bf953e..c3b1070d 100644
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -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)
{
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c
index f8d760d2..e6802592 100644
--- a/lib/ext2fs/link.c
+++ b/lib/ext2fs/link.c
@@ -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;
diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c
index 282180c6..6b44bc0e 100644
--- a/lib/ext2fs/lookup.c
+++ b/lib/ext2fs/lookup.c
@@ -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;
diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c
index 98c5ccf2..e037dadb 100644
--- a/lib/ext2fs/mkdir.c
+++ b/lib/ext2fs/mkdir.c
@@ -35,13 +35,13 @@
#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;
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index 9bb0f66c..e8ab6836 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -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;
diff --git a/lib/ext2fs/namei.c b/lib/ext2fs/namei.c
index ae19387a..71d314da 100644
--- a/lib/ext2fs/namei.c
+++ b/lib/ext2fs/namei.c
@@ -25,13 +25,13 @@
#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;
diff --git a/lib/ext2fs/newdir.c b/lib/ext2fs/newdir.c
index ec7b52d6..940256bc 100644
--- a/lib/ext2fs/newdir.c
+++ b/lib/ext2fs/newdir.c
@@ -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;
diff --git a/lib/ext2fs/read_bb_file.c b/lib/ext2fs/read_bb_file.c
index 20696a88..2aa2e578 100644
--- a/lib/ext2fs/read_bb_file.c
+++ b/lib/ext2fs/read_bb_file.c
@@ -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);
}
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index 7c77624e..faa447e8 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -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;
diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c
index ed9fe365..fc0053b8 100644
--- a/lib/ext2fs/tst_iscan.c
+++ b/lib/ext2fs/tst_iscan.c
@@ -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) {
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 142d149f..6028b271 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -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);
diff --git a/lib/ext2fs/unlink.c b/lib/ext2fs/unlink.c
index ead5ec35..59b251f4 100644
--- a/lib/ext2fs/unlink.c
+++ b/lib/ext2fs/unlink.c
@@ -26,13 +26,13 @@
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;