1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /* FS-Cache statistics viewing interface
4 * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
8 #define FSCACHE_DEBUG_LEVEL OPERATION
9 #include <linux/module.h>
10 #include <linux/proc_fs.h>
11 #include <linux/seq_file.h>
15 * initialise the /proc/fs/fscache/ directory
17 int __init fscache_proc_init(void)
21 if (!proc_mkdir("fs/fscache", NULL))
24 if (!proc_create_seq("fs/fscache/cookies", S_IFREG | 0444, NULL,
25 &fscache_cookies_seq_ops))
28 #ifdef CONFIG_FSCACHE_STATS
29 if (!proc_create_single("fs/fscache/stats", S_IFREG | 0444, NULL,
34 #ifdef CONFIG_FSCACHE_OBJECT_LIST
35 if (!proc_create("fs/fscache/objects", S_IFREG | 0444, NULL,
36 &fscache_objlist_proc_ops))
43 #ifdef CONFIG_FSCACHE_OBJECT_LIST
46 #ifdef CONFIG_FSCACHE_STATS
47 remove_proc_entry("fs/fscache/stats", NULL);
50 remove_proc_entry("fs/fscache/cookies", NULL);
52 remove_proc_entry("fs/fscache", NULL);
59 * clean up the /proc/fs/fscache/ directory
61 void fscache_proc_cleanup(void)
63 #ifdef CONFIG_FSCACHE_OBJECT_LIST
64 remove_proc_entry("fs/fscache/objects", NULL);
66 #ifdef CONFIG_FSCACHE_STATS
67 remove_proc_entry("fs/fscache/stats", NULL);
69 remove_proc_entry("fs/fscache/cookies", NULL);
70 remove_proc_entry("fs/fscache", NULL);