diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2010-12-21 13:29:29 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-01-12 20:02:47 -0500 |
commit | 0df6a63f8735a7c8a877878bc215d4312e41ef81 (patch) | |
tree | 93eb15c4408d86e16a6a96409670d16cf223e106 /kernel/cgroup.c | |
parent | af53d29ac13a97304d44343dc3b26154ca595268 (diff) |
switch cgroup
switching it to s_d_op allows to kill the cgroup_lookup() kludge.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel/cgroup.c')
-rw-r--r-- | kernel/cgroup.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 51cddc11cd85..5c5f4cc2e99a 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c | |||
@@ -763,8 +763,6 @@ EXPORT_SYMBOL_GPL(cgroup_unlock); | |||
763 | * -> cgroup_mkdir. | 763 | * -> cgroup_mkdir. |
764 | */ | 764 | */ |
765 | 765 | ||
766 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
767 | struct dentry *dentry, struct nameidata *nd); | ||
768 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); | 766 | static int cgroup_mkdir(struct inode *dir, struct dentry *dentry, int mode); |
769 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); | 767 | static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry); |
770 | static int cgroup_populate_dir(struct cgroup *cgrp); | 768 | static int cgroup_populate_dir(struct cgroup *cgrp); |
@@ -1451,6 +1449,10 @@ static int cgroup_set_super(struct super_block *sb, void *data) | |||
1451 | 1449 | ||
1452 | static int cgroup_get_rootdir(struct super_block *sb) | 1450 | static int cgroup_get_rootdir(struct super_block *sb) |
1453 | { | 1451 | { |
1452 | static const struct dentry_operations cgroup_dops = { | ||
1453 | .d_iput = cgroup_diput, | ||
1454 | }; | ||
1455 | |||
1454 | struct inode *inode = | 1456 | struct inode *inode = |
1455 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); | 1457 | cgroup_new_inode(S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR, sb); |
1456 | struct dentry *dentry; | 1458 | struct dentry *dentry; |
@@ -1468,6 +1470,8 @@ static int cgroup_get_rootdir(struct super_block *sb) | |||
1468 | return -ENOMEM; | 1470 | return -ENOMEM; |
1469 | } | 1471 | } |
1470 | sb->s_root = dentry; | 1472 | sb->s_root = dentry; |
1473 | /* for everything else we want ->d_op set */ | ||
1474 | sb->s_d_op = &cgroup_dops; | ||
1471 | return 0; | 1475 | return 0; |
1472 | } | 1476 | } |
1473 | 1477 | ||
@@ -2191,7 +2195,7 @@ static const struct file_operations cgroup_file_operations = { | |||
2191 | }; | 2195 | }; |
2192 | 2196 | ||
2193 | static const struct inode_operations cgroup_dir_inode_operations = { | 2197 | static const struct inode_operations cgroup_dir_inode_operations = { |
2194 | .lookup = cgroup_lookup, | 2198 | .lookup = simple_lookup, |
2195 | .mkdir = cgroup_mkdir, | 2199 | .mkdir = cgroup_mkdir, |
2196 | .rmdir = cgroup_rmdir, | 2200 | .rmdir = cgroup_rmdir, |
2197 | .rename = cgroup_rename, | 2201 | .rename = cgroup_rename, |
@@ -2207,26 +2211,6 @@ static inline struct cftype *__file_cft(struct file *file) | |||
2207 | return __d_cft(file->f_dentry); | 2211 | return __d_cft(file->f_dentry); |
2208 | } | 2212 | } |
2209 | 2213 | ||
2210 | static int cgroup_delete_dentry(const struct dentry *dentry) | ||
2211 | { | ||
2212 | return 1; | ||
2213 | } | ||
2214 | |||
2215 | static struct dentry *cgroup_lookup(struct inode *dir, | ||
2216 | struct dentry *dentry, struct nameidata *nd) | ||
2217 | { | ||
2218 | static const struct dentry_operations cgroup_dentry_operations = { | ||
2219 | .d_delete = cgroup_delete_dentry, | ||
2220 | .d_iput = cgroup_diput, | ||
2221 | }; | ||
2222 | |||
2223 | if (dentry->d_name.len > NAME_MAX) | ||
2224 | return ERR_PTR(-ENAMETOOLONG); | ||
2225 | d_set_d_op(dentry, &cgroup_dentry_operations); | ||
2226 | d_add(dentry, NULL); | ||
2227 | return NULL; | ||
2228 | } | ||
2229 | |||
2230 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, | 2214 | static int cgroup_create_file(struct dentry *dentry, mode_t mode, |
2231 | struct super_block *sb) | 2215 | struct super_block *sb) |
2232 | { | 2216 | { |