]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfs4mount.c
mount.nfs: Add the mount option "nosharecache"
[nfs-utils.git] / utils / mount / nfs4mount.c
index 717ad56756cad43f8445b73d4064ad65d2929afb..0376f32da6df684a1a3ef64fb8fa26dcbcba4f44 100644 (file)
@@ -50,6 +50,7 @@
 #endif
 
 extern int verbose;
+extern int sloppy;
 
 char *IDMAPLCK = DEFAULT_DIR "/rpcidmapd";
 #define idmapd_check() do { \
@@ -200,7 +201,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
        char *s;
        int val;
        int bg, soft, intr;
-       int nocto, noac;
+       int nocto, noac, unshared;
        int retry;
        int retval;
        time_t timeout, t;
@@ -251,6 +252,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
        intr = NFS4_MOUNT_INTR;
        nocto = 0;
        noac = 0;
+       unshared = 0;
        retry = 10000;          /* 10000 minutes ~ 1 week */
 
        /*
@@ -308,7 +310,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                                num_flavour = parse_sec(opteq+1, pseudoflavour);
                                if (!num_flavour)
                                        goto fail;
-                       } else if (!strcmp(opt, "addr")) {
+                       } else if (!strcmp(opt, "addr") || sloppy) {
                                /* ignore */;
                        } else {
                                printf(_("unknown nfs mount parameter: "
@@ -335,7 +337,9 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                                nocto = !val;
                        else if (!strcmp(opt, "ac"))
                                noac = !val;
-                       else {
+                       else if (!strcmp(opt, "sharecache"))
+                               unshared = !val;
+                       else if (!sloppy) {
                                printf(_("unknown nfs mount option: "
                                         "%s%s\n"), val ? "" : "no", opt);
                                goto fail;
@@ -346,11 +350,16 @@ int nfs4mount(const char *spec, const char *node, int *flags,
        data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
                | (intr ? NFS4_MOUNT_INTR : 0)
                | (nocto ? NFS4_MOUNT_NOCTO : 0)
-               | (noac ? NFS4_MOUNT_NOAC : 0);
+               | (noac ? NFS4_MOUNT_NOAC : 0)
+               | (unshared ? NFS4_MOUNT_UNSHARED : 0);
 
        /*
         * Give a warning if the rpc.idmapd daemon is not running
         */
+#if 0
+       /* We shouldn't have these checks as nothing in this package
+        * creates the files that are checked
+        */
        idmapd_check();
 
        if (num_flavour == 0)
@@ -361,6 +370,7 @@ int nfs4mount(const char *spec, const char *node, int *flags,
                 */
                gssd_check();
        }
+#endif
        data.auth_flavourlen = num_flavour;
        data.auth_flavours = pseudoflavour;
 
@@ -382,11 +392,13 @@ int nfs4mount(const char *spec, const char *node, int *flags,
               data.acregmin, data.acregmax, data.acdirmin, data.acdirmax);
        printf("port = %d, bg = %d, retry = %d, flags = %.8x\n",
               ntohs(server_addr.sin_port), bg, retry, data.flags);
-       printf("soft = %d, intr = %d, nocto = %d, noac = %d\n",
+       printf("soft = %d, intr = %d, nocto = %d, noac = %d, "
+              "nosharecache = %d\n",
               (data.flags & NFS4_MOUNT_SOFT) != 0,
               (data.flags & NFS4_MOUNT_INTR) != 0,
               (data.flags & NFS4_MOUNT_NOCTO) != 0,
-              (data.flags & NFS4_MOUNT_NOAC) != 0);
+              (data.flags & NFS4_MOUNT_NOAC) != 0,
+              (data.flags & NFS4_MOUNT_UNSHARED) != 0);
 
        if (num_flavour > 0) {
                int pf_cnt, i;