X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fmount.c;h=2909595b5926d63501c5dbf970e7372d19ace231;hp=d0eb1a04cd65d752df79c82eb2c32298837db56c;hb=e2b6d9cbaf20df26dd371a715fce3ae158f37126;hpb=d5a09b59916d4ef24b15e34eac394149cb7a641a diff --git a/utils/mount/mount.c b/utils/mount/mount.c index d0eb1a0..2909595 100644 --- a/utils/mount/mount.c +++ b/utils/mount/mount.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include "xcommon.h" #include "nls.h" #include "mount_constants.h" +#include "mount_config.h" #include "nfs_paths.h" #include "nfs_mntent.h" @@ -44,7 +46,6 @@ #include "nfs4_mount.h" #include "mount.h" #include "error.h" -#include "network.h" #include "stropts.h" #include "version.h" @@ -157,7 +158,7 @@ static void parse_opts(const char *options, int *flags, char **extra_opts); */ static void discover_nfs_mount_data_version(void) { - int kernel_version = linux_version_code(); + unsigned int kernel_version = linux_version_code(); if (kernel_version) { if (kernel_version < MAKE_VERSION(2, 1, 32)) @@ -320,7 +321,7 @@ static int add_mtab(char *spec, char *mount_point, char *fstype, return result; } -void mount_usage(void) +static void mount_usage(void) { printf(_("usage: %s remotetarget dir [-rvVwfnsih] [-o nfsoptions]\n"), progname); @@ -336,7 +337,7 @@ void mount_usage(void) printf(_("\tnfsoptions\tRefer to mount.nfs(8) or nfs(5)\n\n")); } -static void parse_opt(const char *opt, int *mask, char *extra_opts, int len) +static void parse_opt(const char *opt, int *mask, char *extra_opts, size_t len) { const struct opt_map *om; @@ -370,7 +371,7 @@ static void parse_opts(const char *options, int *flags, char **extra_opts) if (options != NULL) { char *opts = xstrdup(options); char *opt, *p; - int len = strlen(opts) + 1; /* include room for a null */ + size_t len = strlen(opts) + 1; /* include room for a null */ int open_quote = 0; *extra_opts = xmalloc(len); @@ -418,7 +419,7 @@ static int chk_mountpoint(char *mount_point) static int try_mount(char *spec, char *mount_point, int flags, char *fs_type, char **extra_opts, char *mount_opts, - int fake, int nomtab, int bg) + int fake, int bg) { int ret; @@ -475,6 +476,8 @@ int main(int argc, char *argv[]) spec = argv[1]; mount_point = argv[2]; + mount_config_init(progname); + argv[2] = argv[0]; /* so that getopt error messages are correct */ while ((c = getopt_long(argc - 2, argv + 2, "rvVwfno:hs", longopts, NULL)) != -1) { @@ -560,6 +563,10 @@ int main(int argc, char *argv[]) mnt_err = EX_USAGE; goto out; } + /* + * Concatenate mount options from the configuration file + */ + mount_opts = mount_config_opts(spec, mount_point, mount_opts); parse_opts(mount_opts, &flags, &extra_opts); @@ -583,10 +590,13 @@ int main(int argc, char *argv[]) } mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts, - mount_opts, fake, nomtab, FOREGROUND); + mount_opts, fake, FOREGROUND); if (mnt_err == EX_BG) { printf(_("%s: backgrounding \"%s\"\n"), progname, spec); + printf(_("%s: mount options: \"%s\"\n"), + progname, extra_opts); + fflush(stdout); /* @@ -601,7 +611,7 @@ int main(int argc, char *argv[]) mnt_err = try_mount(spec, mount_point, flags, fs_type, &extra_opts, mount_opts, fake, - nomtab, BACKGROUND); + BACKGROUND); if (verbose && mnt_err) printf(_("%s: giving up \"%s\"\n"), progname, spec);