Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308796
b: refs/heads/master
c: 15b6a47
h: refs/heads/master
v: v3
  • Loading branch information
Jeff Layton authored and Steve French committed May 17, 2012
1 parent ec46442 commit 608d6ba
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d61cd6ec764368689fab3bd19e78d76c1e6b176
refs/heads/master: 15b6a47322940beb74a83ffc1632c1ee1d00f35b
57 changes: 54 additions & 3 deletions trunk/fs/cifs/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ enum {
Opt_srcaddr, Opt_prefixpath,
Opt_iocharset, Opt_sockopt,
Opt_netbiosname, Opt_servern,
Opt_ver, Opt_sec,
Opt_ver, Opt_sec, Opt_cache,

/* Mount options to be ignored */
Opt_ignore,
Expand Down Expand Up @@ -213,6 +213,7 @@ static const match_table_t cifs_mount_option_tokens = {
{ Opt_ver, "vers=%s" },
{ Opt_ver, "version=%s" },
{ Opt_sec, "sec=%s" },
{ Opt_cache, "cache=%s" },

{ Opt_ignore, "cred" },
{ Opt_ignore, "credentials" },
Expand Down Expand Up @@ -261,6 +262,21 @@ static const match_table_t cifs_secflavor_tokens = {
{ Opt_sec_err, NULL }
};

/* cache flavors */
enum {
Opt_cache_loose,
Opt_cache_strict,
Opt_cache_none,
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_err, NULL }
};

static int ip_connect(struct TCP_Server_Info *server);
static int generic_ip_connect(struct TCP_Server_Info *server);
static void tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink);
Expand Down Expand Up @@ -1185,6 +1201,31 @@ static int cifs_parse_security_flavors(char *value,
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;
break;
case Opt_cache_strict:
vol->direct_io = false;
vol->strict_io = true;
break;
case Opt_cache_none:
vol->direct_io = true;
vol->strict_io = false;
break;
default:
cERROR(1, "bad cache= option: %s", value);
return 1;
}
return 0;
}

static int
cifs_parse_mount_options(const char *mountdata, const char *devname,
struct smb_vol *vol)
Expand Down Expand Up @@ -1414,10 +1455,12 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
vol->seal = 1;
break;
case Opt_direct:
vol->direct_io = 1;
vol->direct_io = true;
vol->strict_io = false;
break;
case Opt_strictcache:
vol->strict_io = 1;
vol->direct_io = false;
vol->strict_io = true;
break;
case Opt_noac:
printk(KERN_WARNING "CIFS: Mount option noac not "
Expand Down Expand Up @@ -1838,6 +1881,14 @@ cifs_parse_mount_options(const char *mountdata, const char *devname,
if (cifs_parse_security_flavors(string, vol) != 0)
goto cifs_parse_mount_err;
break;
case Opt_cache:
string = match_strdup(args);
if (string == NULL)
goto out_nomem;

if (cifs_parse_cache_flavor(string, vol) != 0)
goto cifs_parse_mount_err;
break;
default:
/*
* An option we don't recognize. Save it off for later
Expand Down

0 comments on commit 608d6ba

Please sign in to comment.