From: Theodore Ts'o Date: Mon, 14 Oct 2002 03:56:28 +0000 (-0400) Subject: Fix gcc -Wall nits. X-Git-Tag: E2FSPROGS-1_30~27 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=3e69906495d5898849a6154b0311b5d4a84a27ae;p=tools%2Fe2fsprogs.git Fix gcc -Wall nits. Fix format bug if NLS is in use. Add extra so that the info directory looks OK on OpenWall. --- diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog index a038554..2de14f5 100644 --- a/debugfs/ChangeLog +++ b/debugfs/ChangeLog @@ -1,3 +1,7 @@ +2002-10-13 Theodore Ts'o + + * debugfs.h, htree.c, setsuper.c: Fix gcc -Wall nits. + 2002-10-02 Theodore Y. Ts'o * htree.c (htree_dump_leaf_node): Use ext2fs_read_dir_block2 so diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h index 6c81b09..d8a5b8f 100644 --- a/debugfs/debugfs.h +++ b/debugfs/debugfs.h @@ -52,6 +52,11 @@ extern void do_dump(int argc, char **argv); extern void do_cat(int argc, char **argv); extern void do_rdump(int argc, char **argv); +/* htree.c */ +extern void do_htree_dump(int argc, char **argv); +extern void do_dx_hash(int argc, char **argv); +extern void do_dirsearch(int argc, char **argv); + /* logdump.c */ extern void do_logdump(int argc, char **argv); @@ -104,5 +109,6 @@ extern void do_mkdir(int argc, char **argv); extern void do_rmdir(int argc, char **argv); extern void do_show_debugfs_params(int argc, char **argv); extern void do_expand_dir(int argc, char **argv); -extern void do_features(int argc, char *argv[]); +extern void do_features(int argc, char **argv); +extern void do_bmap(int argc, char **argv); diff --git a/debugfs/htree.c b/debugfs/htree.c index 9ae2f11..13c0916 100644 --- a/debugfs/htree.c +++ b/debugfs/htree.c @@ -31,7 +31,7 @@ static FILE *pager; static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, - struct ext2_dx_root_info * root, + struct ext2_dx_root_info * rootnode, blk_t blk, char *buf) { errcode_t errcode; @@ -69,8 +69,8 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, (dirent->name_len & 0xFF) : EXT2_NAME_LEN; strncpy(name, dirent->name, thislen); name[thislen] = '\0'; - errcode = ext2fs_dirhash(root->hash_version, name, thislen, - fs->super->s_hash_seed, + errcode = ext2fs_dirhash(rootnode->hash_version, name, + thislen, fs->super->s_hash_seed, &hash, 0); if (errcode) com_err("htree_dump_leaf_node", errcode, @@ -92,13 +92,13 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino, static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, - struct ext2_dx_root_info * root, + struct ext2_dx_root_info * rootnode, blk_t blk, char *buf, int level); static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, - struct ext2_dx_root_info * root, + struct ext2_dx_root_info * rootnode, struct ext2_dx_entry *ent, char *buf, int level) { @@ -129,10 +129,10 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, fprintf(pager, "Entry #%d: Hash 0x%08x, block %d\n", i, i ? e.hash : 0, e.block); if (level) - htree_dump_int_block(fs, ino, inode, root, + htree_dump_int_block(fs, ino, inode, rootnode, e.block, buf, level-1); else - htree_dump_leaf_node(fs, ino, inode, root, + htree_dump_leaf_node(fs, ino, inode, rootnode, e.block, buf); } @@ -141,7 +141,7 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino, static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, struct ext2_inode *inode, - struct ext2_dx_root_info * root, + struct ext2_dx_root_info * rootnode, blk_t blk, char *buf, int level) { char *cbuf; @@ -168,7 +168,7 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino, return; } - htree_dump_int_node(fs, ino, inode, root, + htree_dump_int_node(fs, ino, inode, rootnode, (struct ext2_dx_entry *) (buf+8), cbuf, level); free(cbuf); @@ -180,12 +180,10 @@ void do_htree_dump(int argc, char *argv[]) { ext2_ino_t ino; struct ext2_inode inode; - int retval; - int i, c; - int flags; + int c; int long_opt; - void *buf = NULL; - struct ext2_dx_root_info *root; + char *buf = NULL; + struct ext2_dx_root_info *rootnode; struct ext2_dx_entry *ent; struct ext2_dx_countlimit *limit; errcode_t errcode; @@ -245,21 +243,21 @@ void do_htree_dump(int argc, char *argv[]) goto errout; } - root = (struct ext2_dx_root_info *) (buf + 24); + rootnode = (struct ext2_dx_root_info *) (buf + 24); fprintf(pager, "Root node dump:\n"); - fprintf(pager, "\t Reserved zero: %d\n", root->reserved_zero); - fprintf(pager, "\t Hash Version: %d\n", root->hash_version); - fprintf(pager, "\t Info length: %d\n", root->info_length); - fprintf(pager, "\t Indirect levels: %d\n", root->indirect_levels); - fprintf(pager, "\t Flags: %d\n", root->unused_flags); + fprintf(pager, "\t Reserved zero: %d\n", rootnode->reserved_zero); + fprintf(pager, "\t Hash Version: %d\n", rootnode->hash_version); + fprintf(pager, "\t Info length: %d\n", rootnode->info_length); + fprintf(pager, "\t Indirect levels: %d\n", rootnode->indirect_levels); + fprintf(pager, "\t Flags: %d\n", rootnode->unused_flags); - ent = (struct ext2_dx_entry *) (buf + 24 + root->info_length); + ent = (struct ext2_dx_entry *) (buf + 24 + rootnode->info_length); limit = (struct ext2_dx_countlimit *) ent; - htree_dump_int_node(current_fs, ino, &inode, root, ent, + htree_dump_int_node(current_fs, ino, &inode, rootnode, ent, buf + current_fs->blocksize, - root->indirect_levels); + rootnode->indirect_levels); errout: if (buf) @@ -322,9 +320,6 @@ static int search_dir_block(ext2_filsys fs, blk_t *blocknr, void do_dirsearch(int argc, char *argv[]) { ext2_ino_t inode; - int retval; - int c; - int flags; struct process_block_struct pb; if (check_fs_open(argv[0])) diff --git a/debugfs/setsuper.c b/debugfs/setsuper.c index 5870770..b1061b2 100644 --- a/debugfs/setsuper.c +++ b/debugfs/setsuper.c @@ -17,6 +17,8 @@ #include #include "debugfs.h" +#include "uuid/uuid.h" +#include "e2p/e2p.h" static struct ext2_super_block set_sb; @@ -174,7 +176,7 @@ static errcode_t parse_string(struct super_set_info *info, char *arg) static errcode_t parse_uuid(struct super_set_info *info, char *arg) { - char * p = (char *) info->ptr; + unsigned char * p = (unsigned char *) info->ptr; if ((strcasecmp(arg, "null") == 0) || (strcasecmp(arg, "clear") == 0)) { diff --git a/doc/ChangeLog b/doc/ChangeLog index a2bb16e..0455a32 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +2002-10-13 Theodore Ts'o + + * libext2fs.texinfo: Add extra spaceing so that the info directory + looks OK on Openwall. + 2001-09-24 Theodore Tso * Release of E2fsprogs 1.29 diff --git a/doc/libext2fs.texinfo b/doc/libext2fs.texinfo index 0816861..afa2d9e 100644 --- a/doc/libext2fs.texinfo +++ b/doc/libext2fs.texinfo @@ -9,7 +9,7 @@ @dircategory Development @format START-INFO-DIR-ENTRY -* libext2fs: (libext2fs.info). The EXT2FS library. +* libext2fs: (libext2fs.info). The EXT2FS library. END-INFO-DIR-ENTRY @end format @end ifinfo diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog index 4a5a903..c3abc75 100644 --- a/e2fsck/ChangeLog +++ b/e2fsck/ChangeLog @@ -1,3 +1,12 @@ +2002-10-13 Theodore Ts'o + + * pass3.c (e2fsck_get_lost_and_found): Pass in mode 700 to + ext2fs_new_inode(). + + * unix.c (show_stats): Fix format bug if NLS is in use. + + * journal.c, pass1.c, revoke.c, util.c: Fix gcc -Wall nits. + 2002-10-08 Theodore Ts'o * pass3.c (e2fsck_get_lost_and_found): Create the lost+found diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 246af2b..a6a8426 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -184,10 +184,10 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal) struct buffer_head *bh; struct inode *j_inode = NULL; struct kdev_s *dev_fs = NULL, *dev_journal; - char *journal_name = 0; + const char *journal_name = 0; journal_t *journal = NULL; - errcode_t retval; - io_manager io_ptr; + errcode_t retval = 0; + io_manager io_ptr = 0; unsigned long start = 0; int free_journal_name = 0; int ext_journal = 0; diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 1322eb9..9849645 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -37,6 +37,7 @@ * found. */ +#include #include #ifdef HAVE_ERRNO_H #include diff --git a/e2fsck/revoke.c b/e2fsck/revoke.c index fd2b73e..bb4888d 100644 --- a/e2fsck/revoke.c +++ b/e2fsck/revoke.c @@ -117,7 +117,8 @@ static inline int hash(journal_t *journal, unsigned long block) (block << (hash_shift - 12))) & (table->hash_size - 1); } -int insert_revoke_hash(journal_t *journal, unsigned long blocknr, tid_t seq) +static int insert_revoke_hash(journal_t *journal, unsigned long blocknr, + tid_t seq) { struct list_head *hash_list; struct jbd_revoke_record_s *record; diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 4de0637..a086793 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -121,7 +121,7 @@ static void show_stats(e2fsck_t ctx) */ #ifdef ENABLE_NLS printf (_("\n%8d inodes used (%d%%)\n"), inodes_used, - (inodes_used != 1), 100 * inodes_used / inodes); + 100 * inodes_used / inodes); printf (_("%8d non-contiguous inodes (%0d.%d%%)\n"), ctx->fs_fragmented, frag_percent / 10, frag_percent % 10); printf (_(" # of inodes with ind/dind/tind blocks: %d/%d/%d\n"), diff --git a/e2fsck/util.c b/e2fsck/util.c index ec60de0..842379a 100644 --- a/e2fsck/util.c +++ b/e2fsck/util.c @@ -71,7 +71,7 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size, } #ifndef HAVE_CONIO_H -int read_a_char(void) +static int read_a_char(void) { char c; int r; diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog index 320643f..3aea116 100644 --- a/lib/ext2fs/ChangeLog +++ b/lib/ext2fs/ChangeLog @@ -1,3 +1,8 @@ +2002-10-13 Theodore Ts'o + + * ext2fs.h: Add #include of header files necessary for ext2fs.h to + compile cleanly. + 2002-10-02 Theodore Y. Ts'o * rw_bitmaps.c (ext2fs_write_block_bitmap, diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h index fa3eb63..6f5bc47 100644 --- a/lib/ext2fs/ext2fs.h +++ b/lib/ext2fs/ext2fs.h @@ -52,12 +52,15 @@ extern "C" { #include #endif +#include #include #if EXT2_FLAT_INCLUDES #include "e2_types.h" +#include "ext2_fs.h" #else #include +#include #endif /* EXT2_FLAT_INCLUDES */ typedef __u32 ext2_ino_t; diff --git a/misc/ChangeLog b/misc/ChangeLog index d940c51..63351a1 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,11 @@ +2002-10-13 Theodore Ts'o + + * get_device_by_label.c (read_partitions): Use a 16k buffer to + read in /proc/partitions in one go. + + * badblocks.c, fsck.c, fstype.c, get_device_by_label.c, + tune2fs.c: Fix gcc -Wall nits. + 2002-10-11 Theodore Ts'o * mklost+found.c (main): Make sure the lost+found directory is diff --git a/misc/badblocks.c b/misc/badblocks.c index 8840d9b..c6e308e 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -785,7 +785,7 @@ int main (int argc, char ** argv) } } else host_dev = dev; - if (input_file) + if (input_file) { if (strcmp (input_file, "-") == 0) in = stdin; else { @@ -798,6 +798,7 @@ int main (int argc, char ** argv) exit (1); } } + } if (output_file && strcmp (output_file, "-") != 0) { out = fopen (output_file, "w"); diff --git a/misc/fsck.c b/misc/fsck.c index e4c19a3..7393927 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -472,7 +472,7 @@ static int execute(const char *type, char *device, char *mntpt, /* * Send a signal to all outstanding fsck child processes */ -static int kill_all(int signal) +static int kill_all(int signum) { struct fsck_instance *inst; int n = 0; @@ -480,7 +480,7 @@ static int kill_all(int signal) for (inst = instance_list; inst; inst = inst->next) { if (inst->flags & FLAG_DONE) continue; - kill(inst->pid, signal); + kill(inst->pid, signum); n++; } return n; @@ -886,7 +886,6 @@ static int device_already_active(char *device) static int check_all(NOARGS) { struct fs_info *fs = NULL; - struct fsck_instance *inst; int status = EXIT_OK; int not_done_yet = 1; int passno = 1; diff --git a/misc/fstype.c b/misc/fstype.c index 783ef65..8b5f9aa 100644 --- a/misc/fstype.c +++ b/misc/fstype.c @@ -10,6 +10,7 @@ */ #include +#include #include #if HAVE_UNISTD_H #include diff --git a/misc/get_device_by_label.c b/misc/get_device_by_label.c index 95cd28c..a80bfbc 100644 --- a/misc/get_device_by_label.c +++ b/misc/get_device_by_label.c @@ -166,6 +166,8 @@ get_label_uuid(const char *device, char **label, char *uuid) { return 0; } +#define CBBUF (16 * 1024) + static void uuidcache_addentry(char *device, char *label, char *uuid) { struct uuidCache_s *last; @@ -257,11 +259,16 @@ read_partitions(void) struct stat statbuf; int firstPass; int handleOnFirst; + char *iobuf; procpt = fopen(PROC_PARTITIONS, "r"); if (!procpt) return; + iobuf = (char *)malloc(CBBUF); + if (iobuf) + setvbuf(procpt, iobuf, _IOFBF, CBBUF); + for (firstPass = 1; firstPass >= 0; firstPass--) { fseek(procpt, 0, SEEK_SET); @@ -313,13 +320,14 @@ read_partitions(void) } fclose(procpt); + if (iobuf) + free(iobuf); } static void read_evms(void) { char line[100]; - char *s; int ma, mi, sz; FILE *procpt; char uuid[16], *label, *devname; diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 9a8801b..2ea7abb 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -72,6 +72,8 @@ char *journal_device; static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n"); +void do_findfs(int argc, char **argv); + static void usage(void) { fprintf(stderr, @@ -640,7 +642,7 @@ static void parse_tune2fs_options(int argc, char **argv) device_name = argv[optind]; } -do_findfs(int argc, char **argv) +void do_findfs(int argc, char **argv) { char *dev;