diff options
author | Theodore Ts'o <tytso@mit.edu> | 2008-03-30 14:03:51 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-03-30 14:03:51 -0400 |
commit | a70f10dbc493c4eae488cadd8512e873220037d9 (patch) | |
tree | d645cc6d93b8882a4915802c783437c50af63577 | |
parent | d89ad0aefd5a38b401d945998a5b65de75d828f6 (diff) | |
parent | e28a1bca9edbbd6c9880d16ea7b9199d0b6cb976 (diff) | |
download | e2fsprogs-a70f10dbc493c4eae488cadd8512e873220037d9.tar.gz |
Merge branch 'maint'
-rw-r--r-- | debian/libuuid1.postinst | 16 | ||||
-rw-r--r-- | debugfs/util.c | 1 | ||||
-rw-r--r-- | e2fsck/e2fsck.8.in | 10 | ||||
-rw-r--r-- | e2fsck/e2fsck.c | 6 | ||||
-rw-r--r-- | e2fsck/unix.c | 19 | ||||
-rw-r--r-- | misc/fsck.c | 25 | ||||
-rw-r--r-- | misc/logsave.c | 25 | ||||
-rw-r--r-- | misc/mke2fs.8.in | 2 | ||||
-rw-r--r-- | misc/tune2fs.8.in | 1 | ||||
-rw-r--r-- | misc/tune2fs.c | 1 |
10 files changed, 90 insertions, 16 deletions
diff --git a/debian/libuuid1.postinst b/debian/libuuid1.postinst index cd5b093c..ccbd8810 100644 --- a/debian/libuuid1.postinst +++ b/debian/libuuid1.postinst @@ -1,10 +1,22 @@ #!/bin/sh set -e -groupadd -f -K GID_MIN=100 -K GID_MAX=999 libuuid + +FIRST_SYSTEM_UID=100 +LAST_SYSTEM_UID=999 +FIRST_SYSTEM_GID=100 +LAST_SYSTEM_GID=999 + +if test -f /etc/adduser.conf; then + . /etc/adduser.conf +fi + +groupadd -f -K GID_MIN=$FIRST_SYSTEM_GID -K GID_MAX=$LAST_SYSTEM_GID libuuid + if ! grep -q libuuid /etc/passwd; then - useradd -d /var/lib/libuuid -K UID_MIN=100 -K UID_MAX=999 -g libuuid libuuid + useradd -d /var/lib/libuuid -K UID_MIN=$FIRST_SYSTEM_UID -K UID_MAX=$LAST_SYSTEM_UID -g libuuid libuuid fi + mkdir -p /var/lib/libuuid chown libuuid:libuuid /var/lib/libuuid chmod 2775 /var/lib/libuuid diff --git a/debugfs/util.c b/debugfs/util.c index 7ff347bc..28abe526 100644 --- a/debugfs/util.c +++ b/debugfs/util.c @@ -231,6 +231,7 @@ extern time_t string_to_time(const char *arg) ts.tm_min > 59 || ts.tm_sec > 61) ts.tm_mday = 0; #endif + ts.tm_isdst = -1; ret = mktime(&ts); if (ts.tm_mday == 0 || ret == ((time_t) -1)) { /* Try it as an integer... */ diff --git a/e2fsck/e2fsck.8.in b/e2fsck/e2fsck.8.in index cd110b3b..53c473eb 100644 --- a/e2fsck/e2fsck.8.in +++ b/e2fsck/e2fsck.8.in @@ -139,6 +139,11 @@ so that the progress of the filesystem check can be monitored. This option is typically used by programs which are running .BR e2fsck . +If the file descriptor number is negative, then absolute value of +the file descriptor will be used, and the progress information will be +suppressed initially. It can later be enabled by sending the +.B e2fsck +process a SIGUSR1 signal. If the file descriptor specified is 0, .B e2fsck will print a completion bar as it goes about its business. This requires @@ -326,14 +331,15 @@ The following signals have the following effect when sent to .B SIGUSR1 This signal causes .B e2fsck -to start displaying a completion bar. (See discussion of the +to start displaying a completion bar or emitting progress information. +(See discussion of the .B \-C option.) .TP .B SIGUSR2 This signal causes .B e2fsck -to stop displaying a completion bar. +to stop displaying a completion bar or emitting progress information. .SH REPORTING BUGS Almost any piece of software will have bugs. If you manage to find a filesystem which causes diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c index e2434da8..9afd906e 100644 --- a/e2fsck/e2fsck.c +++ b/e2fsck/e2fsck.c @@ -169,6 +169,12 @@ void e2fsck_free_context(e2fsck_t ctx) if (ctx->profile) profile_release(ctx->profile); + + if (ctx->filesystem_name) + ext2fs_free_mem(&ctx->filesystem_name); + + if (ctx->device_name) + ext2fs_free_mem(&ctx->device_name); ext2fs_free_mem(&ctx); } diff --git a/e2fsck/unix.c b/e2fsck/unix.c index 7b662e49..deec4425 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -441,14 +441,15 @@ int e2fsck_simple_progress(e2fsck_t ctx, const char *label, float percent, static int e2fsck_update_progress(e2fsck_t ctx, int pass, unsigned long cur, unsigned long max) { - char buf[80]; + char buf[1024]; float percent; if (pass == 0) return 0; if (ctx->progress_fd) { - sprintf(buf, "%d %lu %lu\n", pass, cur, max); + snprintf(buf, sizeof(buf), "%d %lu %lu %s\n", + pass, cur, max, ctx->device_name); write(ctx->progress_fd, buf, strlen(buf)); } else { percent = calc_percent(&e2fsck_tbl, pass, cur, max); @@ -487,7 +488,6 @@ static void signal_progress_on(int sig EXT2FS_ATTR((unused))) return; ctx->progress = e2fsck_update_progress; - ctx->progress_fd = 0; } static void signal_progress_off(int sig EXT2FS_ATTR((unused))) @@ -626,6 +626,10 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) if (res != 1) goto sscanf_err; + if (ctx->progress_fd < 0) { + ctx->progress = 0; + ctx->progress_fd = ctx->progress_fd * -1; + } if (!ctx->progress_fd) break; /* Validate the file descriptor to avoid disasters */ @@ -732,7 +736,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) break; #endif case 'N': - ctx->device_name = optarg; + ctx->device_name = string_copy(ctx, optarg, 0); break; case 'k': keep_bad_blocks++; @@ -757,6 +761,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) argv[optind]); fatal_error(ctx, 0); } + ctx->filesystem_name = string_copy(ctx, ctx->filesystem_name, 0); if (extended_opts) parse_extended_opts(ctx, extended_opts); @@ -862,6 +867,7 @@ int main (int argc, char *argv[]) int journal_size; int sysval, sys_page_size = 4096; __u32 features[3]; + char *cp; clear_problem_context(&pctx); #ifdef MTRACE @@ -1083,7 +1089,10 @@ restart: sizeof(sb->s_volume_name)); } if (ctx->device_name == 0) - ctx->device_name = ctx->filesystem_name; + ctx->device_name = string_copy(ctx, ctx->filesystem_name, 0); + for (cp = ctx->device_name; *cp; cp++) + if (isspace(*cp) || *cp == ':') + *cp = '_'; /* * Make sure the ext3 superblock fields are consistent. diff --git a/misc/fsck.c b/misc/fsck.c index baddba2d..95102610 100644 --- a/misc/fsck.c +++ b/misc/fsck.c @@ -81,6 +81,8 @@ static const char *really_wanted[] = { "minix", "ext2", "ext3", + "ext4", + "ext4dev", "jfs", "reiserfs", "xiafs", @@ -451,13 +453,21 @@ static int execute(const char *type, const char *device, const char *mntpt, for (i=0; i <num_args; i++) argv[argc++] = string_copy(args[i]); - if (progress && !progress_active()) { + if (progress) { if ((strcmp(type, "ext2") == 0) || - (strcmp(type, "ext3") == 0)) { + (strcmp(type, "ext3") == 0) || + (strcmp(type, "ext4") == 0) || + (strcmp(type, "ext4dev") == 0)) { char tmp[80]; - snprintf(tmp, 80, "-C%d", progress_fd); - argv[argc++] = string_copy(tmp); - inst->flags |= FLAG_PROGRESS; + + tmp[0] = 0; + if (!progress_active()) { + snprintf(tmp, 80, "-C%d", progress_fd); + inst->flags |= FLAG_PROGRESS; + } else if (progress_fd) + snprintf(tmp, 80, "-C%d", progress_fd * -1); + if (tmp[0]) + argv[argc++] = string_copy(tmp); } } @@ -615,13 +625,16 @@ static struct fsck_instance *wait_one(int flags) status = EXIT_ERROR; } inst->exit_status = status; + inst->flags |= FLAG_DONE; if (progress && (inst->flags & FLAG_PROGRESS) && !progress_active()) { for (inst2 = instance_list; inst2; inst2 = inst2->next) { if (inst2->flags & FLAG_DONE) continue; if (strcmp(inst2->type, "ext2") && - strcmp(inst2->type, "ext3")) + strcmp(inst2->type, "ext3") && + strcmp(inst2->type, "ext4") && + strcmp(inst2->type, "ext4dev")) continue; /* * If we've just started the fsck, wait a tiny diff --git a/misc/logsave.c b/misc/logsave.c index f256c20e..c6fd3f8c 100644 --- a/misc/logsave.c +++ b/misc/logsave.c @@ -19,6 +19,9 @@ #include <fcntl.h> #include <time.h> #include <errno.h> +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif #ifdef HAVE_GETOPT_H #include <getopt.h> #else @@ -32,6 +35,7 @@ void *outbuf = 0; int verbose = 0; int do_skip = 0; int skip_mode = 0; +pid_t child_pid = -1; static void usage(char *progname) { @@ -102,17 +106,36 @@ static int do_read(int fd) return c; } +static void signal_term(int sig) +{ + if (child_pid > 0) + kill(child_pid, sig); +} + static int run_program(char **argv) { int fds[2]; int status, rc, pid; char buffer[80]; +#ifdef HAVE_SIGNAL_H + struct sigaction sa; +#endif if (pipe(fds) < 0) { perror("pipe"); exit(1); } +#ifdef HAVE_SIGNAL_H + memset(&sa, 0, sizeof(struct sigaction)); + sa.sa_handler = signal_term; + sigaction(SIGINT, &sa, 0); + sigaction(SIGTERM, &sa, 0); +#ifdef SA_RESTART + sa.sa_flags = SA_RESTART; +#endif +#endif + pid = fork(); if (pid < 0) { perror("vfork"); @@ -127,11 +150,13 @@ static int run_program(char **argv) perror(argv[0]); exit(1); } + child_pid = pid; close(fds[1]); while (!(waitpid(pid, &status, WNOHANG ))) { do_read(fds[0]); } + child_pid = -1; do_read(fds[0]); close(fds[0]); diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in index a32c34a6..390874c1 100644 --- a/misc/mke2fs.8.in +++ b/misc/mke2fs.8.in @@ -227,7 +227,7 @@ for the filesystem. (For administrators who are creating filesystems on RAID arrays, it is preferable to use the .I stride RAID parameter as part of the -.B \-R +.B \-E option rather than manipulating the number of blocks per group.) This option is generally used by developers who are developing test cases. diff --git a/misc/tune2fs.8.in b/misc/tune2fs.8.in index b5af4d03..69da5de5 100644 --- a/misc/tune2fs.8.in +++ b/misc/tune2fs.8.in @@ -471,6 +471,7 @@ Set the number of reserved filesystem blocks. .BI \-T " time-last-checked" Set the time the filesystem was last checked using .BR e2fsck . +The time is interpreted using the current (local) timezone. This can be useful in scripts which use a Logical Volume Manager to make a consistent snapshot of a filesystem, and then check the filesystem during off hours to make sure it hasn't been corrupted due to diff --git a/misc/tune2fs.c b/misc/tune2fs.c index 8f5d564a..85046e25 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -557,6 +557,7 @@ static time_t parse_time(char *str) str); usage(); } + ts.tm_isdst = -1; return (mktime(&ts)); } |