26 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28 #include <linux/module.h>
29 #include <linux/errno.h>
31 #include <linux/sched.h>
34 #include <linux/slab.h>
84 static int get_cache_mode(
char *
s)
91 }
else if (!
strcmp(s,
"fscache")) {
94 }
else if (!
strcmp(s,
"none")) {
98 pr_info(
"Unknown Cache mode %s\n", s);
122 #ifdef CONFIG_9P_FSCACHE
123 v9ses->cachetag =
NULL;
132 goto fail_option_alloc;
134 options = tmp_options;
146 "integer field, but no integer?\n");
151 #ifdef CONFIG_NET_9P_DEBUG
160 "integer field, but no integer?\n");
170 "integer field, but no integer?\n");
180 "integer field, but no integer?\n");
191 goto free_and_return;
199 goto free_and_return;
212 #ifdef CONFIG_9P_FSCACHE
221 "problem allocating copy of cache arg\n");
222 goto free_and_return;
224 ret = get_cache_mode(s);
227 goto free_and_return;
239 "problem allocating copy of access arg\n");
240 goto free_and_return;
244 if (
strcmp(s,
"user") == 0)
246 else if (
strcmp(s,
"any") == 0)
248 else if (
strcmp(s,
"client") == 0) {
255 pr_info(
"Unknown access argument %s\n",
258 goto free_and_return;
266 #ifdef CONFIG_9P_FS_POSIX_ACL
270 "Not defined CONFIG_9P_FS_POSIX_ACL. Ignoring posixacl option\n");
294 const char *dev_name,
char *
data)
318 spin_lock(&v9fs_sessionlist_lock);
319 list_add(&v9ses->
slist, &v9fs_sessionlist);
320 spin_unlock(&v9fs_sessionlist_lock);
327 if (IS_ERR(v9ses->
clnt)) {
328 retval = PTR_ERR(v9ses->
clnt);
343 rc = v9fs_parse_options(v9ses, data);
351 if (!v9fs_proto_dotl(v9ses) &&
362 if (!(v9fs_proto_dotu(v9ses) || v9fs_proto_dotl(v9ses)) &&
369 if (!v9fs_proto_dotl(v9ses) ||
381 retval = PTR_ERR(fid);
392 #ifdef CONFIG_9P_FSCACHE
401 return ERR_PTR(retval);
417 #ifdef CONFIG_9P_FSCACHE
418 if (v9ses->fscache) {
420 kfree(v9ses->cachetag);
428 spin_lock(&v9fs_sessionlist_lock);
430 spin_unlock(&v9fs_sessionlist_lock);
460 static struct kobject *v9fs_kobj;
462 #ifdef CONFIG_9P_FSCACHE
476 spin_lock(&v9fs_sessionlist_lock);
478 if (v9ses->cachetag) {
490 spin_unlock(&v9fs_sessionlist_lock);
497 static struct attribute *v9fs_attrs[] = {
498 #ifdef CONFIG_9P_FSCACHE
499 &v9fs_attr_cache.
attr,
513 static int v9fs_sysfs_init(
void)
532 static void v9fs_sysfs_cleanup(
void)
538 static void v9fs_inode_init_once(
void *
foo)
541 #ifdef CONFIG_9P_FSCACHE
542 v9inode->fscache =
NULL;
552 static int v9fs_init_inode_cache(
void)
558 v9fs_inode_init_once);
559 if (!v9fs_inode_cache)
569 static void v9fs_destroy_inode_cache(
void)
579 static int v9fs_cache_register(
void)
582 ret = v9fs_init_inode_cache();
585 #ifdef CONFIG_9P_FSCACHE
592 static void v9fs_cache_unregister(
void)
594 v9fs_destroy_inode_cache();
595 #ifdef CONFIG_9P_FSCACHE
605 static int __init init_v9fs(
void)
608 pr_info(
"Installing v9fs 9p2000 file system support\n");
611 err = v9fs_cache_register();
613 pr_err(
"Failed to register v9fs for caching\n");
617 err = v9fs_sysfs_init();
619 pr_err(
"Failed to register with sysfs\n");
624 pr_err(
"Failed to register filesystem\n");
625 goto out_sysfs_cleanup;
631 v9fs_sysfs_cleanup();
634 v9fs_cache_unregister();
644 static void __exit exit_v9fs(
void)
646 v9fs_sysfs_cleanup();
647 v9fs_cache_unregister();