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.
5 * Written by David Howells (dhowells@redhat.com)
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 #ifdef CONFIG_FSCACHE_STATS
25 if (!proc_create_single("fs/fscache/stats", S_IFREG
| 0444, NULL
,
30 #ifdef CONFIG_FSCACHE_HISTOGRAM
31 if (!proc_create_seq("fs/fscache/histogram", S_IFREG
| 0444, NULL
,
32 &fscache_histogram_ops
))
36 #ifdef CONFIG_FSCACHE_OBJECT_LIST
37 if (!proc_create("fs/fscache/objects", S_IFREG
| 0444, NULL
,
38 &fscache_objlist_proc_ops
))
45 #ifdef CONFIG_FSCACHE_OBJECT_LIST
48 #ifdef CONFIG_FSCACHE_HISTOGRAM
49 remove_proc_entry("fs/fscache/histogram", NULL
);
52 #ifdef CONFIG_FSCACHE_STATS
53 remove_proc_entry("fs/fscache/stats", NULL
);
56 remove_proc_entry("fs/fscache", NULL
);
63 * clean up the /proc/fs/fscache/ directory
65 void fscache_proc_cleanup(void)
67 #ifdef CONFIG_FSCACHE_OBJECT_LIST
68 remove_proc_entry("fs/fscache/objects", NULL
);
70 #ifdef CONFIG_FSCACHE_HISTOGRAM
71 remove_proc_entry("fs/fscache/histogram", NULL
);
73 #ifdef CONFIG_FSCACHE_STATS
74 remove_proc_entry("fs/fscache/stats", NULL
);
76 remove_proc_entry("fs/fscache", NULL
);