Whamcloud - gitweb
ChangeLog, e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c, uuidgen.c:
authorTheodore Ts'o <tytso@mit.edu>
Thu, 11 Jan 2001 16:08:23 +0000 (16:08 +0000)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 11 Jan 2001 16:08:23 +0000 (16:08 +0000)
  e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c, uuidgen.c: Fix
   gcc -Wall complaints, including one bug in tune2fs caused by a block
   automatic shadowing version of the variable we really wanted to use,
   which broke the logic testing to see if the filesystem was mounted.
ChangeLog, MCONFIG.in:
  (gcc-wall-new): Added new target which forgoes the make clean so we
   only check the newly modified .c files.

ChangeLog
MCONFIG.in
misc/ChangeLog
misc/e2image.c
misc/mke2fs.c
misc/mklost+found.c
misc/tune2fs.c
misc/util.c
misc/uuidgen.c

index 00a5059..81051f9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
        * MCONFIG.in: Change --enable-gcc-wall handling so that it's no
                longer a configure option, but something which is done
                when the developer uses the command "make gcc-wall".
+               (gcc-wall-new): Added new target which forgoes the make
+               clean so we only check the newly modified .c files.
 
        * configure.in: Remove test for ino_t, since we don't use it any
                more (we always use our own ext2_ino_t).  Remove
index 0e3d494..e4ad578 100644 (file)
@@ -115,9 +115,12 @@ WFLAGS=            -ansi -D_POSIX_SOURCE -pedantic \
                        -Wstrict-prototypes -Wmissing-prototypes \
                        -Wnested-externs -Winline -DNO_INLINE_FUNCS -Wshadow 
 
+gcc-wall-new:
+       (make USE_WFLAGS="$(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup 
+
 gcc-wall:
        make clean > /dev/null
-       (make USE_WFLAGS="$(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup 
+       make gcc-wall-new
 
 #
 # Installation user and groups
index e993326..8047211 100644 (file)
@@ -1,5 +1,11 @@
 2001-01-11    <tytso@snap.thunk.org>
 
+       * e2image.c, mke2fs.c, mklost+found.c, tune2fs.c, util.c,
+               uuidgen.c: Fix gcc -Wall complaints, including one bug in
+               tune2fs caused by a block automatic shadowing version of
+               the variable we really wanted to use, which broke the
+               logic testing to see if the filesystem was mounted.
+
        * badblocks.c (flush_bufs): Use ext2fs_sync_device() to sync and
                flush the device.
 
index 24dcdd7..f7c42d0 100644 (file)
@@ -49,8 +49,6 @@ static void usage(void)
        exit (1);
 }
 
-static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n");
-
 static void write_header(int fd, struct ext2_image_hdr *hdr)
 {
        char header_buf[4096];
@@ -81,13 +79,11 @@ static void write_header(int fd, struct ext2_image_hdr *hdr)
 int main (int argc, char ** argv)
 {
        int c;
-       char * tmp;
        errcode_t retval;
        ext2_filsys fs;
        int open_flag = 0;
        int raw_flag = 0;
        int fd = 0;
-       char *features_cmd = 0;
        struct ext2_image_hdr hdr;
 
 #ifdef ENABLE_NLS
index 1ba3aaf..b611065 100644 (file)
@@ -513,9 +513,9 @@ static void show_stats(ext2_filsys fs)
               100.0 * s->s_r_blocks_count / s->s_blocks_count);
        printf(_("First data block=%u\n"), s->s_first_data_block);
        if (fs->group_desc_count > 1)
-               printf(_("%lu block groups\n"), fs->group_desc_count);
+               printf(_("%u block groups\n"), fs->group_desc_count);
        else
-               printf(_("%lu block group\n"), fs->group_desc_count);
+               printf(_("%u block group\n"), fs->group_desc_count);
        printf(_("%u blocks per group, %u fragments per group\n"),
               s->s_blocks_per_group, s->s_frags_per_group);
        printf(_("%u inodes per group\n"), s->s_inodes_per_group);
index a4d0f7d..37b7a7b 100644 (file)
@@ -18,6 +18,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <sys/param.h>
 #include <sys/stat.h>
 
index cf2163a..a28b3e4 100644 (file)
@@ -55,7 +55,8 @@ extern int optind;
 
 const char * program_name = "tune2fs";
 char * device_name;
-char * new_label, *new_last_mounted, *new_UUID, *journal_opts;
+char * new_label, *new_last_mounted, *new_UUID;
+const char *journal_opts;
 static int c_flag, C_flag, e_flag, g_flag, i_flag, l_flag, L_flag;
 static int m_flag, M_flag, r_flag, s_flag = -1, u_flag, U_flag;
 static int print_label;
@@ -93,7 +94,7 @@ static __u32 ok_features[3] = {
 /*
  * Update the feature set as provided by the user.
  */
-static void update_feature_set(ext2_filsys fs, char *features_cmd)
+static void update_feature_set(ext2_filsys fs, char *features)
 {
        int sparse, old_sparse, filetype, old_filetype;
        int journal, old_journal;
@@ -107,10 +108,10 @@ static void update_feature_set(ext2_filsys fs, char *features_cmd)
                EXT2_FEATURE_INCOMPAT_FILETYPE;
        old_journal = sb->s_feature_compat &
                EXT3_FEATURE_COMPAT_HAS_JOURNAL;
-       if (e2p_edit_feature(features_cmd, &sb->s_feature_compat,
+       if (e2p_edit_feature(features, &sb->s_feature_compat,
                             ok_features)) {
                fprintf(stderr, _("Invalid filesystem option set: %s\n"),
-                       features_cmd);
+                       features);
                exit(1);
        }
        sparse = sb->s_feature_ro_compat &
@@ -215,9 +216,6 @@ static void add_journal(ext2_filsys fs)
                }
                printf(_("done\n"));
        } else if (journal_size) {
-               errcode_t       retval;
-               int             mount_flags;
-
                printf(_("Creating journal inode: "));
                fflush(stdout);
                retval = ext2fs_add_journal_inode(fs, journal_blocks,
@@ -241,7 +239,7 @@ static void add_journal(ext2_filsys fs)
 /*
  * Given argv[0], return the program name.
  */
-char *get_progname(char *argv_zero)
+static char *get_progname(char *argv_zero)
 {
        char    *cp;
 
@@ -253,7 +251,7 @@ char *get_progname(char *argv_zero)
 }
 
 
-void parse_e2label_options(int argc, char ** argv)
+static void parse_e2label_options(int argc, char ** argv)
 {
        if ((argc < 2) || (argc > 3)) {
                fprintf(stderr, _("Usage: e2label device [newlabel]\n"));
@@ -269,7 +267,7 @@ void parse_e2label_options(int argc, char ** argv)
 }
 
 
-void parse_tune2fs_options(int argc, char **argv)
+static void parse_tune2fs_options(int argc, char **argv)
 {
        int c;
        char * tmp;
@@ -487,7 +485,8 @@ int main (int argc, char ** argv)
        sb = fs->super;
        if (print_label) {
                /* For e2label emulation */
-               printf("%.*s\n", sizeof(sb->s_volume_name), sb->s_volume_name);
+               printf("%.*s\n", (int) sizeof(sb->s_volume_name),
+                      sb->s_volume_name);
                exit(0);
        }
        retval = ext2fs_check_if_mounted(device_name, &mount_flags);
@@ -495,7 +494,7 @@ int main (int argc, char ** argv)
                com_err("ext2fs_check_if_mount", retval,
                        _("while determining whether %s is mounted."),
                        device_name);
-               return;
+               exit(0);
        }
        /* Normally we only need to write out the superblock */
        fs->flags |= EXT2_FLAG_SUPER_ONLY;
index e4e147e..bf3aabd 100644 (file)
@@ -45,7 +45,7 @@ int strcasecmp (char *s1, char *s2)
 void proceed_question(void)
 {
        char buf[256];
-       char *short_yes = _("yY");
+       const char *short_yes = _("yY");
 
        fflush(stdout);
        fflush(stderr);
index b6f3837..6e3fb31 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #ifdef HAVE_GETOPT_H
 #include <getopt.h>
 #else
@@ -22,7 +23,7 @@ extern int optind;
 #define DO_TYPE_TIME   1
 #define DO_TYPE_RANDOM 2
 
-void usage(const char *progname)
+static void usage(const char *progname)
 {
        fprintf(stderr, _("Usage: %s [-r] [-t]\n"), progname);
        exit(1);