Whamcloud - gitweb
Fix gcc -Wall nits.
authorTheodore Ts'o <tytso@mit.edu>
Mon, 14 Oct 2002 03:56:28 +0000 (23:56 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 14 Oct 2002 03:56:28 +0000 (23:56 -0400)
Fix format bug if NLS is in use.

Add extra so that the info directory looks OK on OpenWall.

20 files changed:
debugfs/ChangeLog
debugfs/debugfs.h
debugfs/htree.c
debugfs/setsuper.c
doc/ChangeLog
doc/libext2fs.texinfo
e2fsck/ChangeLog
e2fsck/journal.c
e2fsck/pass1.c
e2fsck/revoke.c
e2fsck/unix.c
e2fsck/util.c
lib/ext2fs/ChangeLog
lib/ext2fs/ext2fs.h
misc/ChangeLog
misc/badblocks.c
misc/fsck.c
misc/fstype.c
misc/get_device_by_label.c
misc/tune2fs.c

index a038554..2de14f5 100644 (file)
@@ -1,3 +1,7 @@
+2002-10-13  Theodore Ts'o  <tytso@mit.edu>
+
+       * debugfs.h, htree.c, setsuper.c: Fix gcc -Wall nits.
+
 2002-10-02  Theodore Y. Ts'o  <tytso@mit.edu>
 
        * htree.c (htree_dump_leaf_node): Use ext2fs_read_dir_block2 so
index 6c81b09..d8a5b8f 100644 (file)
@@ -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);
 
index 9ae2f11..13c0916 100644 (file)
@@ -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]))
index 5870770..b1061b2 100644 (file)
@@ -17,6 +17,8 @@
 #include <utime.h>
 
 #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)) {
index a2bb16e..0455a32 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-13  Theodore Ts'o  <tytso@mit.edu>
+
+       * libext2fs.texinfo: Add extra spaceing so that the info directory
+               looks OK on Openwall. 
+
 2001-09-24  Theodore Tso  <tytso@mit.edu>
 
        * Release of E2fsprogs 1.29
index 0816861..afa2d9e 100644 (file)
@@ -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
index 4a5a903..c3abc75 100644 (file)
@@ -1,3 +1,12 @@
+2002-10-13  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * pass3.c (e2fsck_get_lost_and_found): Create the lost+found
index 246af2b..a6a8426 100644 (file)
@@ -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;
index 1322eb9..9849645 100644 (file)
@@ -37,6 +37,7 @@
  * found.
  */
 
+#include <string.h>
 #include <time.h>
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
index fd2b73e..bb4888d 100644 (file)
@@ -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;
index 4de0637..a086793 100644 (file)
@@ -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"),
index ec60de0..842379a 100644 (file)
@@ -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;
index 320643f..3aea116 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-13  Theodore Ts'o  <tytso@mit.edu>
+
+       * ext2fs.h: Add #include of header files necessary for ext2fs.h to
+               compile cleanly.
+
 2002-10-02  Theodore Y. Ts'o  <tytso@mit.edu>
 
        * rw_bitmaps.c (ext2fs_write_block_bitmap,
index fa3eb63..6f5bc47 100644 (file)
@@ -52,12 +52,15 @@ extern "C" {
 #include <sys/types.h>
 #endif
 
+#include <stdio.h>
 #include <stdlib.h>
 
 #if EXT2_FLAT_INCLUDES
 #include "e2_types.h"
+#include "ext2_fs.h"
 #else
 #include <ext2fs/ext2_types.h>
+#include <ext2fs/ext2_fs.h>
 #endif /* EXT2_FLAT_INCLUDES */
 
 typedef __u32          ext2_ino_t;
index d940c51..63351a1 100644 (file)
@@ -1,3 +1,11 @@
+2002-10-13  Theodore Ts'o  <tytso@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * mklost+found.c (main): Make sure the lost+found directory is
index 8840d9b..c6e308e 100644 (file)
@@ -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");
index e4c19a3..7393927 100644 (file)
@@ -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;
index 783ef65..8b5f9aa 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #if HAVE_UNISTD_H
 #include <unistd.h>
index 95cd28c..a80bfbc 100644 (file)
@@ -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;
index 9a8801b..2ea7abb 100644 (file)
@@ -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;