.. | .. |
---|
8 | 8 | |
---|
9 | 9 | #include <uapi/linux/incrementalfs.h> |
---|
10 | 10 | |
---|
| 11 | +#include "sysfs.h" |
---|
11 | 12 | #include "vfs.h" |
---|
12 | | - |
---|
13 | | -#define INCFS_NODE_FEATURES "features" |
---|
14 | 13 | |
---|
15 | 14 | static struct file_system_type incfs_fs_type = { |
---|
16 | 15 | .owner = THIS_MODULE, |
---|
.. | .. |
---|
20 | 19 | .fs_flags = 0 |
---|
21 | 20 | }; |
---|
22 | 21 | |
---|
23 | | -static struct kobject *sysfs_root, *featurefs_root; |
---|
24 | | - |
---|
25 | | -static ssize_t corefs_show(struct kobject *kobj, |
---|
26 | | - struct kobj_attribute *attr, char *buff) |
---|
27 | | -{ |
---|
28 | | - return snprintf(buff, PAGE_SIZE, "supported\n"); |
---|
29 | | -} |
---|
30 | | - |
---|
31 | | -static struct kobj_attribute corefs_attr = __ATTR_RO(corefs); |
---|
32 | | - |
---|
33 | | -static ssize_t mounter_context_for_backing_rw_show(struct kobject *kobj, |
---|
34 | | - struct kobj_attribute *attr, char *buff) |
---|
35 | | -{ |
---|
36 | | - return snprintf(buff, PAGE_SIZE, "supported\n"); |
---|
37 | | -} |
---|
38 | | - |
---|
39 | | -static struct kobj_attribute mounter_context_for_backing_rw_attr = |
---|
40 | | - __ATTR_RO(mounter_context_for_backing_rw); |
---|
41 | | - |
---|
42 | | -static struct attribute *attributes[] = { |
---|
43 | | - &corefs_attr.attr, |
---|
44 | | - &mounter_context_for_backing_rw_attr.attr, |
---|
45 | | - NULL, |
---|
46 | | -}; |
---|
47 | | - |
---|
48 | | -static const struct attribute_group attr_group = { |
---|
49 | | - .attrs = attributes, |
---|
50 | | -}; |
---|
51 | | - |
---|
52 | | -static int __init init_sysfs(void) |
---|
53 | | -{ |
---|
54 | | - int res = 0; |
---|
55 | | - |
---|
56 | | - sysfs_root = kobject_create_and_add(INCFS_NAME, fs_kobj); |
---|
57 | | - if (!sysfs_root) |
---|
58 | | - return -ENOMEM; |
---|
59 | | - |
---|
60 | | - featurefs_root = kobject_create_and_add(INCFS_NODE_FEATURES, |
---|
61 | | - sysfs_root); |
---|
62 | | - if (!featurefs_root) |
---|
63 | | - return -ENOMEM; |
---|
64 | | - |
---|
65 | | - res = sysfs_create_group(featurefs_root, &attr_group); |
---|
66 | | - if (res) { |
---|
67 | | - kobject_put(sysfs_root); |
---|
68 | | - sysfs_root = NULL; |
---|
69 | | - } |
---|
70 | | - return res; |
---|
71 | | -} |
---|
72 | | - |
---|
73 | | -static void cleanup_sysfs(void) |
---|
74 | | -{ |
---|
75 | | - if (featurefs_root) { |
---|
76 | | - sysfs_remove_group(featurefs_root, &attr_group); |
---|
77 | | - kobject_put(featurefs_root); |
---|
78 | | - featurefs_root = NULL; |
---|
79 | | - } |
---|
80 | | - |
---|
81 | | - if (sysfs_root) { |
---|
82 | | - kobject_put(sysfs_root); |
---|
83 | | - sysfs_root = NULL; |
---|
84 | | - } |
---|
85 | | -} |
---|
86 | | - |
---|
87 | 22 | static int __init init_incfs_module(void) |
---|
88 | 23 | { |
---|
89 | 24 | int err = 0; |
---|
90 | 25 | |
---|
91 | | - err = init_sysfs(); |
---|
| 26 | + err = incfs_init_sysfs(); |
---|
92 | 27 | if (err) |
---|
93 | 28 | return err; |
---|
94 | 29 | |
---|
95 | 30 | err = register_filesystem(&incfs_fs_type); |
---|
96 | 31 | if (err) |
---|
97 | | - cleanup_sysfs(); |
---|
| 32 | + incfs_cleanup_sysfs(); |
---|
98 | 33 | |
---|
99 | 34 | return err; |
---|
100 | 35 | } |
---|
101 | 36 | |
---|
102 | 37 | static void __exit cleanup_incfs_module(void) |
---|
103 | 38 | { |
---|
104 | | - cleanup_sysfs(); |
---|
| 39 | + incfs_cleanup_sysfs(); |
---|
105 | 40 | unregister_filesystem(&incfs_fs_type); |
---|
106 | 41 | } |
---|
107 | 42 | |
---|
.. | .. |
---|
109 | 44 | module_exit(cleanup_incfs_module); |
---|
110 | 45 | |
---|
111 | 46 | MODULE_LICENSE("GPL v2"); |
---|
| 47 | +MODULE_IMPORT_NS(ANDROID_GKI_VFS_EXPORT_ONLY); |
---|
112 | 48 | MODULE_AUTHOR("Eugene Zemtsov <ezemtsov@google.com>"); |
---|
113 | 49 | MODULE_DESCRIPTION("Incremental File System"); |
---|