diff options
author | Joel Becker <joel.becker@oracle.com> | 2006-01-25 16:31:07 -0500 |
---|---|---|
committer | Mark Fasheh <mark.fasheh@oracle.com> | 2006-02-03 17:01:05 -0500 |
commit | 3d0f89bb169482d26d5aa4e82e763077e7e9bc4d (patch) | |
tree | 2d2317ce1417202322e3f715534fab80394bd5d2 /fs/configfs/mount.c | |
parent | 62ca3d2603571dc2b1b4c1368e19d44b599062e2 (diff) |
configfs: Add permission and ownership to configfs objects.
configfs always made item and attribute ownership root.root and
permissions based on a umask of 022. Add ->setattr() to allow
chown(2)/chmod(2), and persist the changes for the lifetime of the
items and attributes.
Signed-off-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/configfs/mount.c')
-rw-r--r-- | fs/configfs/mount.c | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 1a2f6f6a4d91..f920d30478e5 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
@@ -38,6 +38,7 @@ | |||
38 | 38 | ||
39 | struct vfsmount * configfs_mount = NULL; | 39 | struct vfsmount * configfs_mount = NULL; |
40 | struct super_block * configfs_sb = NULL; | 40 | struct super_block * configfs_sb = NULL; |
41 | kmem_cache_t *configfs_dir_cachep; | ||
41 | static int configfs_mnt_count = 0; | 42 | static int configfs_mnt_count = 0; |
42 | 43 | ||
43 | static struct super_operations configfs_ops = { | 44 | static struct super_operations configfs_ops = { |
@@ -62,6 +63,7 @@ static struct configfs_dirent configfs_root = { | |||
62 | .s_children = LIST_HEAD_INIT(configfs_root.s_children), | 63 | .s_children = LIST_HEAD_INIT(configfs_root.s_children), |
63 | .s_element = &configfs_root_group.cg_item, | 64 | .s_element = &configfs_root_group.cg_item, |
64 | .s_type = CONFIGFS_ROOT, | 65 | .s_type = CONFIGFS_ROOT, |
66 | .s_iattr = NULL, | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | static int configfs_fill_super(struct super_block *sb, void *data, int silent) | 69 | static int configfs_fill_super(struct super_block *sb, void *data, int silent) |
@@ -73,9 +75,11 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) | |||
73 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; | 75 | sb->s_blocksize_bits = PAGE_CACHE_SHIFT; |
74 | sb->s_magic = CONFIGFS_MAGIC; | 76 | sb->s_magic = CONFIGFS_MAGIC; |
75 | sb->s_op = &configfs_ops; | 77 | sb->s_op = &configfs_ops; |
78 | sb->s_time_gran = 1; | ||
76 | configfs_sb = sb; | 79 | configfs_sb = sb; |
77 | 80 | ||
78 | inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO); | 81 | inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, |
82 | &configfs_root); | ||
79 | if (inode) { | 83 | if (inode) { |
80 | inode->i_op = &configfs_dir_inode_operations; | 84 | inode->i_op = &configfs_dir_inode_operations; |
81 | inode->i_fop = &configfs_dir_operations; | 85 | inode->i_fop = &configfs_dir_operations; |
@@ -128,19 +132,31 @@ static decl_subsys(config, NULL, NULL); | |||
128 | 132 | ||
129 | static int __init configfs_init(void) | 133 | static int __init configfs_init(void) |
130 | { | 134 | { |
131 | int err; | 135 | int err = -ENOMEM; |
136 | |||
137 | configfs_dir_cachep = kmem_cache_create("configfs_dir_cache", | ||
138 | sizeof(struct configfs_dirent), | ||
139 | 0, 0, NULL, NULL); | ||
140 | if (!configfs_dir_cachep) | ||
141 | goto out; | ||
132 | 142 | ||
133 | kset_set_kset_s(&config_subsys, kernel_subsys); | 143 | kset_set_kset_s(&config_subsys, kernel_subsys); |
134 | err = subsystem_register(&config_subsys); | 144 | err = subsystem_register(&config_subsys); |
135 | if (err) | 145 | if (err) { |
136 | return err; | 146 | kmem_cache_destroy(configfs_dir_cachep); |
147 | configfs_dir_cachep = NULL; | ||
148 | goto out; | ||
149 | } | ||
137 | 150 | ||
138 | err = register_filesystem(&configfs_fs_type); | 151 | err = register_filesystem(&configfs_fs_type); |
139 | if (err) { | 152 | if (err) { |
140 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); | 153 | printk(KERN_ERR "configfs: Unable to register filesystem!\n"); |
141 | subsystem_unregister(&config_subsys); | 154 | subsystem_unregister(&config_subsys); |
155 | kmem_cache_destroy(configfs_dir_cachep); | ||
156 | configfs_dir_cachep = NULL; | ||
142 | } | 157 | } |
143 | 158 | ||
159 | out: | ||
144 | return err; | 160 | return err; |
145 | } | 161 | } |
146 | 162 | ||
@@ -148,11 +164,13 @@ static void __exit configfs_exit(void) | |||
148 | { | 164 | { |
149 | unregister_filesystem(&configfs_fs_type); | 165 | unregister_filesystem(&configfs_fs_type); |
150 | subsystem_unregister(&config_subsys); | 166 | subsystem_unregister(&config_subsys); |
167 | kmem_cache_destroy(configfs_dir_cachep); | ||
168 | configfs_dir_cachep = NULL; | ||
151 | } | 169 | } |
152 | 170 | ||
153 | MODULE_AUTHOR("Oracle"); | 171 | MODULE_AUTHOR("Oracle"); |
154 | MODULE_LICENSE("GPL"); | 172 | MODULE_LICENSE("GPL"); |
155 | MODULE_VERSION("0.0.1"); | 173 | MODULE_VERSION("0.0.2"); |
156 | MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration."); | 174 | MODULE_DESCRIPTION("Simple RAM filesystem for user driven kernel subsystem configuration."); |
157 | 175 | ||
158 | module_init(configfs_init); | 176 | module_init(configfs_init); |