|
@@ -78,6 +78,25 @@ static const match_table_t tokens = {
|
|
{Opt_err, NULL}
|
|
{Opt_err, NULL}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/* Interpret mount options for cache mode */
|
|
|
|
+static int get_cache_mode(char *s)
|
|
|
|
+{
|
|
|
|
+ int version = -EINVAL;
|
|
|
|
+
|
|
|
|
+ if (!strcmp(s, "loose")) {
|
|
|
|
+ version = CACHE_LOOSE;
|
|
|
|
+ P9_DPRINTK(P9_DEBUG_9P, "Cache mode: loose\n");
|
|
|
|
+ } else if (!strcmp(s, "fscache")) {
|
|
|
|
+ version = CACHE_FSCACHE;
|
|
|
|
+ P9_DPRINTK(P9_DEBUG_9P, "Cache mode: fscache\n");
|
|
|
|
+ } else if (!strcmp(s, "none")) {
|
|
|
|
+ version = CACHE_NONE;
|
|
|
|
+ P9_DPRINTK(P9_DEBUG_9P, "Cache mode: none\n");
|
|
|
|
+ } else
|
|
|
|
+ printk(KERN_INFO "9p: Unknown Cache mode %s.\n", s);
|
|
|
|
+ return version;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* v9fs_parse_options - parse mount options into session structure
|
|
* v9fs_parse_options - parse mount options into session structure
|
|
* @v9ses: existing v9fs session information
|
|
* @v9ses: existing v9fs session information
|
|
@@ -97,7 +116,7 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
|
/* setup defaults */
|
|
/* setup defaults */
|
|
v9ses->afid = ~0;
|
|
v9ses->afid = ~0;
|
|
v9ses->debug = 0;
|
|
v9ses->debug = 0;
|
|
- v9ses->cache = 0;
|
|
|
|
|
|
+ v9ses->cache = CACHE_NONE;
|
|
#ifdef CONFIG_9P_FSCACHE
|
|
#ifdef CONFIG_9P_FSCACHE
|
|
v9ses->cachetag = NULL;
|
|
v9ses->cachetag = NULL;
|
|
#endif
|
|
#endif
|
|
@@ -171,13 +190,13 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
|
"problem allocating copy of cache arg\n");
|
|
"problem allocating copy of cache arg\n");
|
|
goto free_and_return;
|
|
goto free_and_return;
|
|
}
|
|
}
|
|
|
|
+ ret = get_cache_mode(s);
|
|
|
|
+ if (ret == -EINVAL) {
|
|
|
|
+ kfree(s);
|
|
|
|
+ goto free_and_return;
|
|
|
|
+ }
|
|
|
|
|
|
- if (strcmp(s, "loose") == 0)
|
|
|
|
- v9ses->cache = CACHE_LOOSE;
|
|
|
|
- else if (strcmp(s, "fscache") == 0)
|
|
|
|
- v9ses->cache = CACHE_FSCACHE;
|
|
|
|
- else
|
|
|
|
- v9ses->cache = CACHE_NONE;
|
|
|
|
|
|
+ v9ses->cache = ret;
|
|
kfree(s);
|
|
kfree(s);
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -200,9 +219,15 @@ static int v9fs_parse_options(struct v9fs_session_info *v9ses, char *opts)
|
|
} else {
|
|
} else {
|
|
v9ses->flags |= V9FS_ACCESS_SINGLE;
|
|
v9ses->flags |= V9FS_ACCESS_SINGLE;
|
|
v9ses->uid = simple_strtoul(s, &e, 10);
|
|
v9ses->uid = simple_strtoul(s, &e, 10);
|
|
- if (*e != '\0')
|
|
|
|
- v9ses->uid = ~0;
|
|
|
|
|
|
+ if (*e != '\0') {
|
|
|
|
+ ret = -EINVAL;
|
|
|
|
+ printk(KERN_INFO "9p: Unknown access "
|
|
|
|
+ "argument %s.\n", s);
|
|
|
|
+ kfree(s);
|
|
|
|
+ goto free_and_return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
kfree(s);
|
|
kfree(s);
|
|
break;
|
|
break;
|
|
|
|
|