diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2024-01-25 14:00:54 -0800 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2024-01-25 14:20:08 -0800 |
| commit | 06f609b3119876b42f19fdb690b10896d3c648e6 (patch) | |
| tree | 2f42b892152af80d299133ef6c902261a1fd0b98 /fs/netfs/fscache_proc.c | |
| parent | 91374ba537bd60caa9ae052c9f1c0fe055b39149 (diff) | |
| parent | ecb1b8288dc7ccbdcb3b9df005fa1c0e0c0388a7 (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR.
No conflicts or adjacent changes.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'fs/netfs/fscache_proc.c')
| -rw-r--r-- | fs/netfs/fscache_proc.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/netfs/fscache_proc.c b/fs/netfs/fscache_proc.c new file mode 100644 index 000000000000..874d951bc390 --- /dev/null +++ b/fs/netfs/fscache_proc.c @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* FS-Cache statistics viewing interface + * + * Copyright (C) 2021 Red Hat, Inc. All Rights Reserved. + * Written by David Howells (dhowells@redhat.com) + */ + +#define FSCACHE_DEBUG_LEVEL CACHE +#include <linux/module.h> +#include <linux/proc_fs.h> +#include <linux/seq_file.h> +#include "internal.h" + +/* + * Add files to /proc/fs/netfs/. + */ +int __init fscache_proc_init(void) +{ + if (!proc_symlink("fs/fscache", NULL, "netfs")) + goto error_sym; + + if (!proc_create_seq("fs/netfs/caches", S_IFREG | 0444, NULL, + &fscache_caches_seq_ops)) + goto error; + + if (!proc_create_seq("fs/netfs/volumes", S_IFREG | 0444, NULL, + &fscache_volumes_seq_ops)) + goto error; + + if (!proc_create_seq("fs/netfs/cookies", S_IFREG | 0444, NULL, + &fscache_cookies_seq_ops)) + goto error; + return 0; + +error: + remove_proc_entry("fs/fscache", NULL); +error_sym: + return -ENOMEM; +} + +/* + * Clean up the /proc/fs/fscache symlink. + */ +void fscache_proc_cleanup(void) +{ + remove_proc_subtree("fs/fscache", NULL); +} |
