diff options
author | David Howells <dhowells@redhat.com> | 2023-11-21 15:43:52 +0000 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2023-12-24 15:08:48 +0000 |
commit | 7eb5b3e3a0a55f2d166ca949ef47ca6e0c704aab (patch) | |
tree | 30357b01626c21f2c231823d099c69e84eceb943 /fs/netfs/main.c | |
parent | 4498a8eccc97de3d65f876b6fdeddb439ef73abc (diff) | |
download | linux-7eb5b3e3a0a55f2d166ca949ef47ca6e0c704aab.tar.gz linux-7eb5b3e3a0a55f2d166ca949ef47ca6e0c704aab.tar.bz2 linux-7eb5b3e3a0a55f2d166ca949ef47ca6e0c704aab.zip |
netfs, fscache: Move /proc/fs/fscache to /proc/fs/netfs and put in a symlink
Rename /proc/fs/fscache to "netfs" and make a symlink from fscache to that.
Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
cc: Christian Brauner <christian@brauner.io>
cc: linux-fsdevel@vger.kernel.org
cc: linux-cachefs@redhat.com
Diffstat (limited to 'fs/netfs/main.c')
-rw-r--r-- | fs/netfs/main.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/fs/netfs/main.c b/fs/netfs/main.c index 1ba8091fcf3e..c9af6e0896d3 100644 --- a/fs/netfs/main.c +++ b/fs/netfs/main.c @@ -7,6 +7,8 @@ #include <linux/module.h> #include <linux/export.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> #include "internal.h" #define CREATE_TRACE_POINTS #include <trace/events/netfs.h> @@ -19,3 +21,34 @@ unsigned netfs_debug; module_param_named(debug, netfs_debug, uint, S_IWUSR | S_IRUGO); MODULE_PARM_DESC(netfs_debug, "Netfs support debugging mask"); +static int __init netfs_init(void) +{ + int ret = -ENOMEM; + + if (!proc_mkdir("fs/netfs", NULL)) + goto error; + +#ifdef CONFIG_FSCACHE_STATS + if (!proc_create_single("fs/netfs/stats", S_IFREG | 0444, NULL, + netfs_stats_show)) + goto error_proc; +#endif + + ret = fscache_init(); + if (ret < 0) + goto error_proc; + return 0; + +error_proc: + remove_proc_entry("fs/netfs", NULL); +error: + return ret; +} +fs_initcall(netfs_init); + +static void __exit netfs_exit(void) +{ + fscache_exit(); + remove_proc_entry("fs/netfs", NULL); +} +module_exit(netfs_exit); |