mount.cifs: handle the "mand" and "nomand" mount options (try #2)
authorJeff Layton <jlayton@samba.org>
Tue, 27 Jul 2010 11:37:05 +0000 (07:37 -0400)
committerJeff Layton <jlayton@samba.org>
Tue, 27 Jul 2010 11:37:05 +0000 (07:37 -0400)
These are filesystem-independent mount options that get passed to
mount.cifs too. Handle them appropriately by enabling and disabling
MS_MANDLOCK and not handing them off to the kernel.

Also, don't set MS_MANDLOCK by default. There's no reason to ask the
kernel to enforce mandatory locking by default. This also matches
up better with the way that "mand" is set in the mtab.

Signed-off-by: Jeff Layton <jlayton@samba.org>
mount.cifs.c

index 27d267cc9034d7e696fc81aee88ffbdffff5b4b4..5a05caa3b37842a745e417e5ca6bd24d783a2450 100644 (file)
 #define OPT_RO         24
 #define OPT_RW         25
 #define OPT_REMOUNT    26
+#define OPT_MAND       27
+#define OPT_NOMAND     28
 
 
 /* struct for holding parsed mount info for use by privleged process */
@@ -823,6 +825,10 @@ static int parse_opt_token(const char *token)
                return OPT_NO_DEV;
        if (strncmp(token, "nobrl", 5) == 0 || strncmp(token, "nolock", 6) == 0)
                return OPT_NO_LOCK;
+       if (strncmp(token, "mand", 4) == 0)
+               return OPT_MAND;
+       if (strncmp(token, "nomand", 6) == 0)
+               return OPT_NOMAND;
        if (strncmp(token, "dev", 3) == 0)
                return OPT_DEV;
        if (strncmp(token, "noexec", 6) == 0)
@@ -1109,6 +1115,12 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
                case OPT_NO_LOCK:
                        *filesys_flags &= ~MS_MANDLOCK;
                        break;
+               case OPT_MAND:
+                       *filesys_flags |= MS_MANDLOCK;
+                       goto nocopy;
+               case OPT_NOMAND:
+                       *filesys_flags &= ~MS_MANDLOCK;
+                       goto nocopy;
                case OPT_DEV:
                        *filesys_flags &= ~MS_NODEV;
                        break;
@@ -1735,8 +1747,6 @@ int main(int argc, char **argv)
                return EX_SYSERR;
        }
 
-       parsed_info->flags = MS_MANDLOCK;
-
        /* add sharename in opts string as unc= parm */
        while ((c = getopt_long(argc, argv, "?fhno:rvVw",
                                longopts, NULL)) != -1) {