From be551c7282fe74aca5a07dc6b2ce49ecbea48c90 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 25 Oct 2007 10:39:23 +0200 Subject: [PATCH] mount: clean up global variables Signed-off-by: Karel Zak --- mount/fstab.c | 4 ---- mount/lomount.c | 5 ----- mount/lomount.h | 1 - mount/mount.c | 11 +++-------- mount/sundries.c | 2 ++ mount/sundries.h | 4 ++-- mount/swapon.c | 5 ++--- mount/umount.c | 5 ----- 8 files changed, 9 insertions(+), 28 deletions(-) diff --git a/mount/fstab.c b/mount/fstab.c index 7baa68ee..cd756098 100644 --- a/mount/fstab.c +++ b/mount/fstab.c @@ -810,11 +810,7 @@ update_mtab (const char *dir, struct my_mntent *instead) { * The test is very simple -- it reads a number from locked file, increments the * number and writes the number back to the file. */ - /* dummy */ -int verbose; -char *progname; - const char *fsprobe_get_label_by_devname(const char *spec) { return NULL; } const char *fsprobe_get_uuid_by_devname(const char *spec) { return NULL; } struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; } diff --git a/mount/lomount.c b/mount/lomount.c index 1373067c..02b337f3 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -25,8 +25,6 @@ #include "sundries.h" #include "xmalloc.h" -extern char *progname; - #define SIZE(a) (sizeof(a)/sizeof(a[0])) #ifdef LOOP_SET_FD @@ -442,9 +440,6 @@ find_unused_loop_device (void) { #include #include -int verbose = 0; -char *progname; - static void usage(void) { fprintf(stderr, _("\nUsage:\n" diff --git a/mount/lomount.h b/mount/lomount.h index 89695cd7..c5c913b5 100644 --- a/mount/lomount.h +++ b/mount/lomount.h @@ -1,4 +1,3 @@ -extern int verbose; extern int set_loop(const char *, const char *, unsigned long long, const char *, int, int *); extern int del_loop(const char *); diff --git a/mount/mount.c b/mount/mount.c index f7ff56e1..8ec3730d 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -62,17 +62,14 @@ static int nomtab = 0; /* True for explicit readonly (-r). */ static int readonly = 0; -/* Nonzero for chatty (-v). */ -int verbose = 0; - /* Nonzero for sloppy (-s). */ -int sloppy = 0; +static int sloppy = 0; /* True for explicit read/write (-w). */ static int readwrite = 0; /* True for all mount (-a). */ -int mount_all = 0; +static int mount_all = 0; /* True for fork() during all mount (-F). */ static int optfork = 0; @@ -81,7 +78,7 @@ static int optfork = 0; static int list_with_volumelabel = 0; /* Nonzero for mount {--bind|--replace|--before|--after|--over|--move| - * make-shared|make-private|make-unbindable|make-slave} + * make-shared|make-private|make-unbindable|make-slave} */ static int mounttype = 0; @@ -1773,8 +1770,6 @@ getfs(const char *spec, const char *uuid, const char *label) return mc; } -char *progname; - int main(int argc, char *argv[]) { int c, result = 0, specseen; diff --git a/mount/sundries.c b/mount/sundries.c index 0c7c6e1e..ba99e353 100644 --- a/mount/sundries.c +++ b/mount/sundries.c @@ -19,6 +19,8 @@ #include "nls.h" int mount_quiet; +int verbose; +char *progname; char * xstrndup (const char *s, int n) { diff --git a/mount/sundries.h b/mount/sundries.h index 010eece4..0853fc2c 100644 --- a/mount/sundries.h +++ b/mount/sundries.h @@ -16,13 +16,13 @@ #include #endif +/* global mount, umount, and losetup variables */ extern int mount_quiet; extern int verbose; -extern int sloppy; +extern char *progname; #define streq(s, t) (strcmp ((s), (t)) == 0) -/* Functions in sundries.c that are used in mount.c and umount.c */ void block_signals (int how); void error (const char *fmt, ...) diff --git a/mount/swapon.c b/mount/swapon.c index 5e8c6eb0..5180fafe 100644 --- a/mount/swapon.c +++ b/mount/swapon.c @@ -34,14 +34,13 @@ #define CANONIC 1 int all = 0; -int verbose = 0; int priority = -1; /* non-prioritized swap by default */ +int verbose; +char *progname; /* If true, don't complain if the device/file doesn't exist */ int ifexists = 0; -char *progname; - static struct option longswaponopts[] = { /* swapon only */ { "priority", required_argument, 0, 'p' }, diff --git a/mount/umount.c b/mount/umount.c index ab179c21..9690f2ac 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -74,9 +74,6 @@ int nomtab = 0; /* Call losetup -d for each unmounted loop device. */ int delloop = 0; -/* Nonzero for chatty (-v). */ -int verbose = 0; - /* True if ruid != euid. */ int suid = 0; @@ -556,8 +553,6 @@ umount_file (char *arg) { return umount_one (arg, arg, arg, arg, NULL); } -char *progname; - int main (int argc, char *argv[]) { int c; -- 2.39.5