#include <unistd.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "xcommon.h"
#include "nls.h"
#include "mount_constants.h"
+#include "mount_config.h"
#include "nfs_paths.h"
#include "nfs_mntent.h"
*/
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))
return result;
}
-void mount_usage(void)
+static void mount_usage(void)
{
printf(_("usage: %s remotetarget dir [-rvVwfnsih] [-o nfsoptions]\n"),
progname);
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;
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);
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;
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) {
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);
}
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);
/*
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);