1
2
3
4
5
6
7
8#define FSCACHE_DEBUG_LEVEL OPERATION
9#include <linux/module.h>
10#include <linux/proc_fs.h>
11#include <linux/seq_file.h>
12#include "internal.h"
13
14
15
16
17int __init fscache_proc_init(void)
18{
19 _enter("");
20
21 if (!proc_mkdir("fs/fscache", NULL))
22 goto error_dir;
23
24 if (!proc_create_seq("fs/fscache/cookies", S_IFREG | 0444, NULL,
25 &fscache_cookies_seq_ops))
26 goto error_cookies;
27
28#ifdef CONFIG_FSCACHE_STATS
29 if (!proc_create_single("fs/fscache/stats", S_IFREG | 0444, NULL,
30 fscache_stats_show))
31 goto error_stats;
32#endif
33
34#ifdef CONFIG_FSCACHE_OBJECT_LIST
35 if (!proc_create("fs/fscache/objects", S_IFREG | 0444, NULL,
36 &fscache_objlist_proc_ops))
37 goto error_objects;
38#endif
39
40 _leave(" = 0");
41 return 0;
42
43#ifdef CONFIG_FSCACHE_OBJECT_LIST
44error_objects:
45#endif
46#ifdef CONFIG_FSCACHE_STATS
47 remove_proc_entry("fs/fscache/stats", NULL);
48error_stats:
49#endif
50 remove_proc_entry("fs/fscache/cookies", NULL);
51error_cookies:
52 remove_proc_entry("fs/fscache", NULL);
53error_dir:
54 _leave(" = -ENOMEM");
55 return -ENOMEM;
56}
57
58
59
60
61void fscache_proc_cleanup(void)
62{
63#ifdef CONFIG_FSCACHE_OBJECT_LIST
64 remove_proc_entry("fs/fscache/objects", NULL);
65#endif
66#ifdef CONFIG_FSCACHE_STATS
67 remove_proc_entry("fs/fscache/stats", NULL);
68#endif
69 remove_proc_entry("fs/fscache/cookies", NULL);
70 remove_proc_entry("fs/fscache", NULL);
71}
72