Whamcloud - gitweb
ChangeLog, debugfs.c, debugfs.h, logdump.c:
authorTheodore Ts'o <tytso@mit.edu>
Fri, 1 Jun 2001 15:36:05 +0000 (15:36 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 1 Jun 2001 15:36:05 +0000 (15:36 +0000)
  debugfs.c, debugfs.h, logdump.c: Fix various gcc -Wall nitpicks.

debugfs/ChangeLog
debugfs/debugfs.c
debugfs/debugfs.h
debugfs/logdump.c

index 9964624..a8d0c8f 100644 (file)
@@ -1,5 +1,7 @@
 2001-06-01  Theodore Tso  <tytso@valinux.com>
 
+       * debugfs.c, debugfs.h, logdump.c: Fix various gcc -Wall nitpicks.
+
        * logdump.c (read_journal_block): Replace pread with lseek/read
                combination.
 
index 7ec6849..d37599e 100644 (file)
@@ -388,7 +388,7 @@ static int list_blocks_proc(ext2_filsys fs, blk_t *blocknr, int blockcnt,
 }
 
 
-static void dump_blocks(FILE *f, char *prefix, ext2_ino_t inode)
+static void dump_blocks(FILE *f, const char *prefix, ext2_ino_t inode)
 {
        struct list_blocks_struct lb;
 
@@ -406,7 +406,7 @@ static void dump_blocks(FILE *f, char *prefix, ext2_ino_t inode)
 }
 
 
-void internal_dump_inode(FILE *out, char *prefix,
+void internal_dump_inode(FILE *out, const char *prefix,
                         ext2_ino_t inode_num, struct ext2_inode *inode,
                         int do_dump_blocks)
 {
index ed56a29..1cc308a 100644 (file)
@@ -31,6 +31,9 @@ extern void do_dump(int argc, char **argv);
 extern void do_cat(int argc, char **argv);
 extern void do_rdump(int argc, char **argv);
 
+/* logdump.c */
+extern void do_logdump(int argc, char **argv);
+
 /* lsdel.c */
 extern void do_lsdel(int argc, char **argv);
 
@@ -44,7 +47,7 @@ extern void do_ncheck(int argc, char **argv);
 extern void do_set_super(int argc, char **);
 
 /* debugfs.c */
-extern void internal_dump_inode(FILE *, char *, ext2_ino_t, 
+extern void internal_dump_inode(FILE *, const char *, ext2_ino_t, 
                                struct ext2_inode *, int);
 
 extern void do_dirty_filesys(int argc, char **argv);
index 5bcd7ca..c6f6fd6 100644 (file)
@@ -72,9 +72,7 @@ static void do_hexdump (FILE *, char *, int);
 
 void do_logdump(int argc, char **argv)
 {
-       ext2_ino_t      inode;
        int             c;
-       int             fd;
        int             retval;
        char            *out_fn;
        FILE            *out_file;
@@ -92,12 +90,15 @@ void do_logdump(int argc, char **argv)
                                          "[-ac] [-b<block>] [-i<inode>] "
                                          "[-f<journal_file>] [output_file]");
        
-       struct journal_source journal_source = {};
+       struct journal_source journal_source;
 
        optind = 0;
 #ifdef HAVE_OPTRESET
        optreset = 1;           /* Makes BSD getopt happy */
 #endif
+       journal_source.where = 0;
+       journal_source.fd = 0;
+       journal_source.file = 0;
        dump_all = 0;
        dump_contents = 0;
        dump_descriptors = 1;
@@ -243,8 +244,9 @@ void do_logdump(int argc, char **argv)
 }
 
 
-int read_journal_block(char *cmd, struct journal_source *source, off_t offset,
-                      char *buf, int size, int *got)
+static int read_journal_block(const char *cmd, struct journal_source *source, 
+                             off_t offset, char *buf, int size,
+                             unsigned int *got)
 {
        int retval;
        
@@ -281,7 +283,7 @@ int read_journal_block(char *cmd, struct journal_source *source, off_t offset,
        return retval;
 }
 
-static char *type_to_name(int btype)
+static const char *type_to_name(int btype)
 {
        switch (btype) {
        case JFS_DESCRIPTOR_BLOCK:
@@ -294,7 +296,6 @@ static char *type_to_name(int btype)
                return "V2 superblock";
        case JFS_REVOKE_BLOCK:
                return "revoke table";
-       default:
        }
        return "unrecognised type";
 }
@@ -307,7 +308,7 @@ static void dump_journal(char *cmdname, FILE *out_file,
        char                    buf[8192];
        journal_superblock_t    *jsb;
        int                     blocksize;
-       int                     got;
+       unsigned int            got;
        int                     retval;
        __u32                   magic, sequence, blocktype;
        journal_header_t        *header;
@@ -494,7 +495,7 @@ static void show_extent(FILE *out_file, int start_extent, int end_extent,
                        start_extent, end_extent-start_extent, first_block);
 }
 
-static void show_indirect(FILE *out_file, char *name, __u32 where)
+static void show_indirect(FILE *out_file, const char *name, __u32 where)
 {
        if (where)
                fprintf(out_file, "(%s): %u ", name, where);
@@ -508,8 +509,9 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
                                int blocksize,
                                tid_t transaction)
 {
-       int got, retval;
-       char buf[8192];
+       unsigned int    got;
+       int             retval;
+       char            buf[8192];
        
        if (!(dump_all
              || (fs_blocknr == block_to_dump)
@@ -576,7 +578,7 @@ static void dump_metadata_block(FILE *out_file, struct journal_source *source,
                 * inode. */
                
                fprintf (out_file, "    Blocks:  ");
-               start_extent = -1;
+               first = prev = start_extent = -1;
 
                for (i=0; i<EXT2_NDIR_BLOCKS; i++) {
                        this = inode->i_block[i];