]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
cifs: move cache mount options to fs_context.ch
authorRonnie Sahlberg <lsahlber@redhat.com>
Wed, 21 Oct 2020 01:30:35 +0000 (11:30 +1000)
committerSteve French <stfrench@microsoft.com>
Thu, 22 Oct 2020 17:17:05 +0000 (12:17 -0500)
Helps to shrink connect.c and make it more readable
by moving mount related code to fs_context.c and
fs_context.h

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reviewed-by: Aurelien Aptel <aaptel@suse.com>
fs/cifs/connect.c
fs/cifs/fs_context.c
fs/cifs/fs_context.h

index c2a92e26fef44243ce1aadda8ee45ba432681f5d..f7ef38a9daface50c63bb03dd5035dd2b154bdff 100644 (file)
@@ -280,25 +280,6 @@ static const match_table_t cifs_mount_option_tokens = {
        { Opt_err, NULL }
 };
 
-/* cache flavors */
-enum {
-       Opt_cache_loose,
-       Opt_cache_strict,
-       Opt_cache_none,
-       Opt_cache_ro,
-       Opt_cache_rw,
-       Opt_cache_err
-};
-
-static const match_table_t cifs_cacheflavor_tokens = {
-       { Opt_cache_loose, "loose" },
-       { Opt_cache_strict, "strict" },
-       { Opt_cache_none, "none" },
-       { Opt_cache_ro, "ro" },
-       { Opt_cache_rw, "singleclient" },
-       { Opt_cache_err, NULL }
-};
-
 static const match_table_t cifs_smb_version_tokens = {
        { Smb_1, SMB1_VERSION_STRING },
        { Smb_20, SMB20_VERSION_STRING},
@@ -1346,49 +1327,6 @@ static int get_option_gid(substring_t args[], kgid_t *result)
        return 0;
 }
 
-static int
-cifs_parse_cache_flavor(char *value, struct smb_vol *vol)
-{
-       substring_t args[MAX_OPT_ARGS];
-
-       switch (match_token(value, cifs_cacheflavor_tokens, args)) {
-       case Opt_cache_loose:
-               vol->direct_io = false;
-               vol->strict_io = false;
-               vol->cache_ro = false;
-               vol->cache_rw = false;
-               break;
-       case Opt_cache_strict:
-               vol->direct_io = false;
-               vol->strict_io = true;
-               vol->cache_ro = false;
-               vol->cache_rw = false;
-               break;
-       case Opt_cache_none:
-               vol->direct_io = true;
-               vol->strict_io = false;
-               vol->cache_ro = false;
-               vol->cache_rw = false;
-               break;
-       case Opt_cache_ro:
-               vol->direct_io = false;
-               vol->strict_io = false;
-               vol->cache_ro = true;
-               vol->cache_rw = false;
-               break;
-       case Opt_cache_rw:
-               vol->direct_io = false;
-               vol->strict_io = false;
-               vol->cache_ro = false;
-               vol->cache_rw = true;
-               break;
-       default:
-               cifs_dbg(VFS, "bad cache= option: %s\n", value);
-               return 1;
-       }
-       return 0;
-}
-
 static int
 cifs_parse_smb_version(char *value, struct smb_vol *vol, bool is_smb3)
 {
index dd9da734e34647a642145acc9d2e9e50822d93fb..deb1168ed8af703c7f3aeb9e0f073c2bac746011 100644 (file)
@@ -82,3 +82,55 @@ int cifs_parse_security_flavors(char *value, struct smb_vol *vol)
 
        return 0;
 }
+
+static const match_table_t cifs_cacheflavor_tokens = {
+       { Opt_cache_loose, "loose" },
+       { Opt_cache_strict, "strict" },
+       { Opt_cache_none, "none" },
+       { Opt_cache_ro, "ro" },
+       { Opt_cache_rw, "singleclient" },
+       { Opt_cache_err, NULL }
+};
+
+int
+cifs_parse_cache_flavor(char *value, struct smb_vol *vol)
+{
+       substring_t args[MAX_OPT_ARGS];
+
+       switch (match_token(value, cifs_cacheflavor_tokens, args)) {
+       case Opt_cache_loose:
+               vol->direct_io = false;
+               vol->strict_io = false;
+               vol->cache_ro = false;
+               vol->cache_rw = false;
+               break;
+       case Opt_cache_strict:
+               vol->direct_io = false;
+               vol->strict_io = true;
+               vol->cache_ro = false;
+               vol->cache_rw = false;
+               break;
+       case Opt_cache_none:
+               vol->direct_io = true;
+               vol->strict_io = false;
+               vol->cache_ro = false;
+               vol->cache_rw = false;
+               break;
+       case Opt_cache_ro:
+               vol->direct_io = false;
+               vol->strict_io = false;
+               vol->cache_ro = true;
+               vol->cache_rw = false;
+               break;
+       case Opt_cache_rw:
+               vol->direct_io = false;
+               vol->strict_io = false;
+               vol->cache_ro = false;
+               vol->cache_rw = true;
+               break;
+       default:
+               cifs_dbg(VFS, "bad cache= option: %s\n", value);
+               return 1;
+       }
+       return 0;
+}
index 87747ef7a2d34076cd2981ca3cd5cc8cef5fe2c3..3e3f6e29e787855136ee7156e8b618390dcefc32 100644 (file)
 #include <linux/parser.h>
 #include "cifsglob.h"
 
+enum {
+       Opt_cache_loose,
+       Opt_cache_strict,
+       Opt_cache_none,
+       Opt_cache_ro,
+       Opt_cache_rw,
+       Opt_cache_err
+};
+
+int cifs_parse_cache_flavor(char *value, struct smb_vol *vol);
+
 enum cifs_sec_param {
        Opt_sec_krb5,
        Opt_sec_krb5i,