]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfsmount.c
mount.nfs: Change *flags to flags
[nfs-utils.git] / utils / mount / nfsmount.c
index 9c08ff5837b22d4b18115e25a3e948ccade47edb..89fd4a32f05144530cee2146fef6c649fa3265fd 100644 (file)
@@ -89,6 +89,7 @@ typedef union {
 } mntres_t;
 
 extern int nfs_mount_data_version;
+extern char *progname;
 extern int verbose;
 extern int sloppy;
 
@@ -485,9 +486,8 @@ out_bad:
 }
 
 int
-nfsmount(const char *spec, const char *node, int *flags,
-        char **extra_opts, char **mount_opts,
-        int running_bg, int *need_statd)
+nfsmount(const char *spec, const char *node, int flags,
+        char **extra_opts, int running_bg, int fake)
 {
        static char *prev_bg_host;
        char hostdir[1024];
@@ -617,9 +617,8 @@ nfsmount(const char *spec, const char *node, int *flags,
 #endif
 
        data.version = nfs_mount_data_version;
-       *mount_opts = (char *) &data;
 
-       if (*flags & MS_REMOUNT)
+       if (flags & MS_REMOUNT)
                goto out_ok;
 
        /*
@@ -849,7 +848,26 @@ noauth_flavors:
        strcat(new_opts, cbuf);
 
        *extra_opts = xstrdup(new_opts);
-       *need_statd = ! (data.flags & NFS_MOUNT_NONLM);
+
+       if (!fake && !(data.flags & NFS_MOUNT_NONLM)) {
+               if (!start_statd()) {
+                       nfs_error(_("%s: rpc.statd is not running but is "
+                               "required for remote locking.\n"
+                               "   Either use '-o nolocks' to keep "
+                               "locks local, or start statd."),
+                                       progname);
+                       goto fail;
+               }
+       }
+
+       if (!fake) {
+               if (mount(spec, node, "nfs",
+                               flags & ~(MS_USER|MS_USERS), &data)) {
+                       mount_error(spec, node, errno);
+                       goto fail;
+               }
+       }
+
        return 0;
 
        /* abort */