From 8ce2449daf5d846a50ecc9342f929998524baa86 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 2 Apr 2008 13:46:26 +0200 Subject: [PATCH] mount: remove built-in support for background mounts EX_BG is archaism from old integrated NFS code. The built-in NFS code has been removed in the previous version and all "bg" stuff is handled by /sbin/mount.nfs. It seems we can remove all "bg" stuff from mount(8). Signed-off-by: Karel Zak --- mount/mount.c | 40 +++++----------------------------------- mount/sundries.h | 2 -- 2 files changed, 5 insertions(+), 37 deletions(-) diff --git a/mount/mount.c b/mount/mount.c index 5f66cb26..c4d21ca8 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -1051,16 +1051,14 @@ cdrom_setspeed(const char *spec) { /* * try_mount_one() - * Try to mount one file system. When "bg" is 1, this is a retry - * in the background. One additional exit code EX_BG is used here. - * It is used to instruct the caller to retry the mount in the - * background. + * Try to mount one file system. + * * returns: 0: OK, EX_SYSERR, EX_FAIL, return code from nfsmount, * return status from wait */ static int try_mount_one (const char *spec0, const char *node0, const char *types0, - const char *opts0, int freq, int pass, int bg, int ro) { + const char *opts0, int freq, int pass, int ro) { int res = 0, status = 0, special = 0; int mnt5_res = 0; /* only for gcc */ int mnt_err; @@ -1358,7 +1356,7 @@ try_mount_one (const char *spec0, const char *node0, const char *types0, types = 0; error (_("mount: %s%s is write-protected, mounting read-only"), bd, spec0); - res = try_mount_one (spec0, node0, types, opts, freq, pass, bg, 1); + res = try_mount_one (spec0, node0, types, opts, freq, pass, 1); goto out; } break; @@ -1437,7 +1435,6 @@ is_existing_file (const char *s) { static int mount_one (const char *spec, const char *node, const char *types, const char *fstabopts, char *cmdlineopts, int freq, int pass) { - int status, status2; const char *nspec; char *opts; @@ -1472,34 +1469,7 @@ mount_one (const char *spec, const char *node, const char *types, spec = nspec; } - /* - * Try to mount the file system. When the exit status is EX_BG, - * we will retry in the background. Otherwise, we're done. - */ - status = try_mount_one (spec, node, types, opts, freq, pass, 0, 0); - if (status != EX_BG) - return status; - - /* - * Retry in the background. - */ - printf (_("mount: backgrounding \"%s\"\n"), spec); - fflush( stdout ); /* prevent duplicate output */ - if (fork() > 0) - return 0; /* parent returns "success" */ - spec = xstrdup(spec); /* arguments will be destroyed */ - node = xstrdup(node); /* by set_proc_name() */ - types = xstrdup(types); - set_proc_name (spec); /* make a nice "ps" listing */ - status2 = try_mount_one (spec, node, types, opts, freq, pass, 1, 0); - if (verbose && status2) - printf (_("mount: giving up \"%s\"\n"), spec); - - free(opts); - - my_free(node); - my_free(types); - exit (0); /* child stops here */ + return try_mount_one (spec, node, types, opts, freq, pass, 0); } /* Check if an fsname/dir pair was already in the old mtab. */ diff --git a/mount/sundries.h b/mount/sundries.h index 0853fc2c..a62e25c4 100644 --- a/mount/sundries.h +++ b/mount/sundries.h @@ -49,7 +49,5 @@ int parse_spec(const char *spec, char **name, char **value); #define EX_FAIL 32 /* mount failure */ #define EX_SOMEOK 64 /* some mount succeeded */ -#define EX_BG 256 /* retry in background (internal only) */ - #endif /* SUNDRIES_H */ -- 2.39.5