diff options
author | Theodore Ts'o <tytso@mit.edu> | 1998-06-27 05:11:14 +0000 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 1998-06-27 05:11:14 +0000 |
commit | 818180cdfcff84b9048ecdc5dc86323f0fefba24 (patch) | |
tree | d8405d0cb0f74ce8f23baa4cb5f278d09dbb3961 /misc | |
parent | 4faba5b2aebb89619f5798274394670cce96370c (diff) | |
download | e2fsprogs-818180cdfcff84b9048ecdc5dc86323f0fefba24.tar.gz |
ChangeLog, debugfs.8.in, debugfs.c:
Add a -V option which displays the current version.
ChangeLog, unix.c:
unix.c (e2fsck_update_progress): Remove unused variables.
ChangeLog, inode.c:
inode.c (get_next_blockgroup): Fix bug where if get_next_blockgroup()
is called early because of a missing inode table in a block group, the
current_inode counter wasn't incremented correctly.
ChangeLog, tst_uuid.c:
tst_uuid.c (main): Fixed bogus declaration of the main's argv parameter.
ChangeLog, test_icount.c:
test_icount.c (main): Fix main() declaration so that it returns int,
not void.
Many files:
fsck.c (ignore): Remove unused variable cp.
chattr.c (fatal_error):
tune2fs.c (usage):
lsattr.c (usage):
dumpe2fs.c (usage):
badblocks.c (usage): Remove volatile from declaration.
fsck.c: Change use of strdup to be string_copy, since we don't trust
what glibc is doing with strdup. (Whatever it is, it isn't pretty.)
Diffstat (limited to 'misc')
-rw-r--r-- | misc/ChangeLog | 19 | ||||
-rw-r--r-- | misc/badblocks.c | 8 | ||||
-rw-r--r-- | misc/chattr.c | 4 | ||||
-rw-r--r-- | misc/dumpe2fs.c | 6 | ||||
-rw-r--r-- | misc/fsck.c | 41 | ||||
-rw-r--r-- | misc/lsattr.c | 8 | ||||
-rw-r--r-- | misc/mke2fs.8.in | 8 | ||||
-rw-r--r-- | misc/mke2fs.c | 9 | ||||
-rw-r--r-- | misc/tune2fs.c | 69 |
9 files changed, 91 insertions, 81 deletions
diff --git a/misc/ChangeLog b/misc/ChangeLog index 9500526b..5868c97c 100644 --- a/misc/ChangeLog +++ b/misc/ChangeLog @@ -1,3 +1,22 @@ +1998-06-25 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * fsck.c (ignore): Remove unused variable cp. + + * chattr.c (fatal_error): + * tune2fs.c (usage): + * lsattr.c (usage): + * dumpe2fs.c (usage): + * badblocks.c (usage): Remove volatile from declaration. + + * fsck.c: Change use of strdup to be string_copy, since we don't + trust what glibc is doing with strdup. (Whatever it is, + it isn't pretty.) + +1998-06-19 Theodore Ts'o <tytso@rsts-11.mit.edu> + + * mke2fs.c (PRS): Add a -V option which prints the version number + and exit. + 1998-05-14 Theodore Ts'o <tytso@rsts-11.mit.edu> * fsck.c (ignore): Remove check for filesystems with the noauto diff --git a/misc/badblocks.c b/misc/badblocks.c index 81dc891e..f9551938 100644 --- a/misc/badblocks.c +++ b/misc/badblocks.c @@ -50,7 +50,7 @@ int v_flag = 0; /* verbose */ int w_flag = 0; /* do r/w test */ int s_flag = 0; /* show progress of test */ -static volatile void usage (void) +static void usage(void) { fprintf (stderr, "Usage: %s [-b block_size] [-o output_file] [-svw] device blocks_count\n [start_count]\n", program_name); @@ -298,14 +298,14 @@ int main (int argc, char ** argv) w_flag = 1; break; default: - usage (); + usage(); } } if (optind > argc - 1) - usage (); + usage(); device_name = argv[optind++]; if (optind > argc - 1) - usage (); + usage(); blocks_count = strtoul (argv[optind], &tmp, 0); if (*tmp) { diff --git a/misc/chattr.c b/misc/chattr.c index 7f40f885..c8c92453 100644 --- a/misc/chattr.c +++ b/misc/chattr.c @@ -51,13 +51,13 @@ unsigned long af; unsigned long rf; unsigned long sf; -static void volatile fatal_error (const char * fmt_string, int errcode) +static void fatal_error(const char * fmt_string, int errcode) { fprintf (stderr, fmt_string, program_name); exit (errcode); } -#define usage() fatal_error ("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \ +#define usage() fatal_error("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \ 1) static int decode_arg (int * i, int argc, char ** argv) diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c index e8c6b8de..a0908478 100644 --- a/misc/dumpe2fs.c +++ b/misc/dumpe2fs.c @@ -41,7 +41,7 @@ const char * program_name = "dumpe2fs"; char * device_name = NULL; -static volatile void usage (void) +static void usage(void) { fprintf (stderr, "usage: %s [-bV] device\n", program_name); exit (1); @@ -198,11 +198,11 @@ int main (int argc, char ** argv) error_message(EXT2_ET_BASE)); exit(0); default: - usage (); + usage(); } } if (optind > argc - 1) - usage (); + usage(); device_name = argv[optind++]; retval = ext2fs_open (device_name, 0, 0, 0, unix_io_manager, &fs); if (retval) { diff --git a/misc/fsck.c b/misc/fsck.c index 29c87413..c30997e1 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -133,12 +133,7 @@ const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc"; char *fsck_path = 0; static int ignore(struct fs_info *); -#ifdef HAVE_STRDUP -#ifdef _POSIX_SOURCE -extern char *strdup(const char *s); -#endif -#else -static char *strdup(const char *s) +static char *string_copy(const char *s) { char *ret; @@ -147,7 +142,6 @@ static char *strdup(const char *s) strcpy(ret, s); return ret; } -#endif static void free_instance(struct fsck_instance *i) { @@ -182,10 +176,10 @@ static void load_fs_info(NOARGS) while ((mp = getmntent(mntfile)) != NULL) { fs = malloc(sizeof(struct fs_info)); memset(fs, 0, sizeof(struct fs_info)); - fs->device = strdup(mp->mnt_fsname); - fs->mountpt = strdup(mp->mnt_dir); - fs->type = strdup(mp->mnt_type); - fs->opts = strdup(mp->mnt_opts); + fs->device = string_copy(mp->mnt_fsname); + fs->mountpt = string_copy(mp->mnt_dir); + fs->type = string_copy(mp->mnt_type); + fs->opts = string_copy(mp->mnt_opts); fs->freq = mp->mnt_freq; fs->passno = mp->mnt_passno; fs->next = NULL; @@ -241,7 +235,7 @@ static char *find_fsck(char *type) char *s; const char *tpl; static char prog[256]; - char *p = strdup(fsck_path); + char *p = string_copy(fsck_path); struct stat st; /* Are we looking for a program or just a type? */ @@ -266,13 +260,13 @@ static int execute(char *prog, char *device) struct fsck_instance *inst; pid_t pid; - argv[0] = strdup(prog); + argv[0] = string_copy(prog); argc = 1; for (i=0; i <num_args; i++) - argv[argc++] = strdup(args[i]); + argv[argc++] = string_copy(args[i]); - argv[argc++] = strdup(device); + argv[argc++] = string_copy(device); argv[argc] = 0; s = find_fsck(prog); @@ -304,8 +298,8 @@ static int execute(char *prog, char *device) return ENOMEM; memset(inst, 0, sizeof(struct fsck_instance)); inst->pid = pid; - inst->prog = strdup(prog); - inst->device = strdup(device); + inst->prog = string_copy(prog); + inst->device = string_copy(device); inst->next = instance_list; instance_list = inst; @@ -460,7 +454,6 @@ static int fs_match(char *type, char *fs_type) /* Check if we should ignore this filesystem. */ static int ignore(struct fs_info *fs) { - const char *cp; const char **ip; int wanted = 0; @@ -661,7 +654,7 @@ static void PRS(int argc, char *argv[]) progname); exit(1); } - devices[num_devices++] = strdup(arg); + devices[num_devices++] = string_copy(arg); continue; } if (arg[0] != '-') { @@ -670,7 +663,7 @@ static void PRS(int argc, char *argv[]) progname); exit(1); } - args[num_args++] = strdup(arg); + args[num_args++] = string_copy(arg); continue; } for (j=1; arg[j]; j++) { @@ -705,12 +698,12 @@ static void PRS(int argc, char *argv[]) break; case 't': if (arg[j+1]) { - fstype = strdup(arg+j+1); + fstype = string_copy(arg+j+1); goto next_arg; } if ((i+1) < argc) { i++; - fstype = strdup(argv[i]); + fstype = string_copy(argv[i]); goto next_arg; } usage(); @@ -733,7 +726,7 @@ static void PRS(int argc, char *argv[]) progname); exit(1); } - args[num_args++] = strdup(options); + args[num_args++] = string_copy(options); opt = 0; } } @@ -759,7 +752,7 @@ int main(int argc, char *argv[]) strcat (fsck_path, ":"); strcat (fsck_path, oldpath); } else { - fsck_path = strdup(fsck_prefix_path); + fsck_path = string_copy(fsck_prefix_path); } /* If -A was specified ("check all"), do that! */ diff --git a/misc/lsattr.c b/misc/lsattr.c index 839df0fd..73823cce 100644 --- a/misc/lsattr.c +++ b/misc/lsattr.c @@ -49,10 +49,10 @@ int l_opt = 0; int recursive = 0; int v_opt = 0; -static void volatile usage (void) +static void usage(void) { - fprintf (stderr, "Usage: %s [-Radlv] [files...]\n", program_name); - exit (1); + fprintf(stderr, "Usage: %s [-Radlv] [files...]\n", program_name); + exit(1); } static void list_attributes (const char * name) @@ -148,7 +148,7 @@ int main (int argc, char ** argv) v_opt = 1; break; default: - usage (); + usage(); } if (optind > argc - 1) diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in index 6bb5877e..7b109373 100644 --- a/misc/mke2fs.8.in +++ b/misc/mke2fs.8.in @@ -65,6 +65,9 @@ mke2fs \- create a Linux second extended file system [ .B \-S ] +[ +.B \-V +] .I device [ .I blocks-count @@ -175,6 +178,11 @@ and the block and inode bitmaps. The .B e2fsck program should be run immediately after this option is used, and there is no guarantee that any data will be salvageable. +.TP +.I -V +print the version number of +.B mke2fs +and exit. .SH AUTHOR This version of .B mke2fs diff --git a/misc/mke2fs.c b/misc/mke2fs.c index 0ec17ba1..5eacdad7 100644 --- a/misc/mke2fs.c +++ b/misc/mke2fs.c @@ -88,7 +88,7 @@ static void usage(NOARGS) { fprintf(stderr, "Usage: %s [-c|-t|-l filename] [-b block-size] " "[-f fragment-size]\n\t[-i bytes-per-inode] " - "[-m reserved-blocks-percentage] [-qvS]\n\t" + "[-m reserved-blocks-percentage] [-qvSV]\n\t" "[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t" "[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t" "device [blocks-count]\n", @@ -636,7 +636,7 @@ static void PRS(int argc, char *argv[]) if (argc && *argv) program_name = *argv; while ((c = getopt (argc, argv, - "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:")) != EOF) + "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:V")) != EOF) switch (c) { case 'b': size = strtoul(optarg, &tmp, 0); @@ -740,6 +740,11 @@ static void PRS(int argc, char *argv[]) case 'S': super_only = 1; break; + case 'V': + /* Print version number and exit */ + fprintf(stderr, "\tUsing %s\n", + error_message(EXT2_ET_BASE)); + exit(0); default: usage(); } diff --git a/misc/tune2fs.c b/misc/tune2fs.c index a82ed5ca..b5582a5c 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -90,9 +90,9 @@ static int strcasecmp (char *s1, char *s2) } #endif -static volatile void usage (void) +static void usage(void) { - fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] " + fprintf(stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] " "[-g group]\n" "\t[-i interval[d|m|w]] [-l] [-s] [-m reserved-blocks-percent]\n" "\t[-r reserved-blocks-count] [-u user] [-C mount-count]\n" @@ -123,24 +123,22 @@ int main (int argc, char ** argv) { case 'c': max_mount_count = strtoul (optarg, &tmp, 0); - if (*tmp || max_mount_count > 16000) - { + if (*tmp || max_mount_count > 16000) { com_err (program_name, 0, "bad mounts count - %s", optarg); - usage (); + usage(); } c_flag = 1; open_flag = EXT2_FLAG_RW; break; case 'C': mount_count = strtoul (optarg, &tmp, 0); - if (*tmp || mount_count > 16000) - { + if (*tmp || mount_count > 16000) { com_err (program_name, 0, "bad mounts count - %s", optarg); - usage (); + usage(); } C_flag = 1; open_flag = EXT2_FLAG_RW; @@ -152,20 +150,18 @@ int main (int argc, char ** argv) errors = EXT2_ERRORS_RO; else if (strcmp (optarg, "panic") == 0) errors = EXT2_ERRORS_PANIC; - else - { + else { com_err (program_name, 0, "bad error behavior - %s", optarg); - usage (); + usage(); } e_flag = 1; open_flag = EXT2_FLAG_RW; break; case 'g': resgid = strtoul (optarg, &tmp, 0); - if (*tmp) - { + if (*tmp) { gr = getgrnam (optarg); if (gr == NULL) tmp = optarg; @@ -174,12 +170,11 @@ int main (int argc, char ** argv) *tmp =0; } } - if (*tmp) - { + if (*tmp) { com_err (program_name, 0, "bad gid/group name - %s", optarg); - usage (); + usage(); } g_flag = 1; open_flag = EXT2_FLAG_RW; @@ -208,11 +203,10 @@ int main (int argc, char ** argv) tmp++; break; } - if (*tmp || interval > (365 * 86400)) - { + if (*tmp || interval > (365 * 86400)) { com_err (program_name, 0, "bad interval - %s", optarg); - usage (); + usage(); } i_flag = 1; open_flag = EXT2_FLAG_RW; @@ -227,12 +221,11 @@ int main (int argc, char ** argv) break; case 'm': reserved_ratio = strtoul (optarg, &tmp, 0); - if (*tmp || reserved_ratio > 50) - { + if (*tmp || reserved_ratio > 50) { com_err (program_name, 0, "bad reserved block ratio - %s", optarg); - usage (); + usage(); } m_flag = 1; open_flag = EXT2_FLAG_RW; @@ -244,12 +237,11 @@ int main (int argc, char ** argv) break; case 'r': reserved_blocks = strtoul (optarg, &tmp, 0); - if (*tmp) - { + if (*tmp) { com_err (program_name, 0, "bad reserved blocks count - %s", optarg); - usage (); + usage(); } r_flag = 1; open_flag = EXT2_FLAG_RW; @@ -260,8 +252,7 @@ int main (int argc, char ** argv) break; case 'u': resuid = strtoul (optarg, &tmp, 0); - if (*tmp) - { + if (*tmp) { pw = getpwnam (optarg); if (pw == NULL) tmp = optarg; @@ -270,12 +261,11 @@ int main (int argc, char ** argv) *tmp = 0; } } - if (*tmp) - { + if (*tmp) { com_err (program_name, 0, "bad uid/user name - %s", optarg); - usage (); + usage(); } u_flag = 1; open_flag = EXT2_FLAG_RW; @@ -286,17 +276,16 @@ int main (int argc, char ** argv) open_flag = EXT2_FLAG_RW; break; default: - usage (); + usage(); } if (optind < argc - 1 || optind == argc) - usage (); + usage(); if (!open_flag && !l_flag) usage(); device_name = argv[optind]; retval = ext2fs_open (device_name, open_flag, 0, 0, unix_io_manager, &fs); - if (retval) - { + if (retval) { com_err (program_name, retval, "while trying to open %s", device_name); printf("Couldn't find valid filesystem superblock.\n"); @@ -332,24 +321,20 @@ int main (int argc, char ** argv) "The -g option is not supported by this version -- " "Recompile with a newer kernel"); #endif - if (i_flag) - { + if (i_flag) { fs->super->s_checkinterval = interval; ext2fs_mark_super_dirty(fs); printf ("Setting interval between check %lu seconds\n", interval); } - if (m_flag) - { + if (m_flag) { fs->super->s_r_blocks_count = (fs->super->s_blocks_count / 100) * reserved_ratio; ext2fs_mark_super_dirty(fs); printf ("Setting reserved blocks percentage to %lu (%u blocks)\n", reserved_ratio, fs->super->s_r_blocks_count); } - if (r_flag) - { - if (reserved_blocks >= fs->super->s_blocks_count) - { + if (r_flag) { + if (reserved_blocks >= fs->super->s_blocks_count) { com_err (program_name, 0, "reserved blocks count is too big (%ul)", reserved_blocks); |