diff options
| author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-17 16:13:25 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:46 -0400 |
| commit | 81d44ed159e3e81f7e62cee2d0fe68aae0c95e78 (patch) | |
| tree | 4d6d02a6d57d547e53ffa0cfb6c54acc3e4c630f /fs/configfs | |
| parent | 8fc3dc5a3a17aa2b353886422bd89420619af211 (diff) | |
configfs: don't bother with checks for mkdir/rmdir/unlink/symlink in root
just give root directory separate inode_operations without all those
methods...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/configfs')
| -rw-r--r-- | fs/configfs/configfs_internal.h | 1 | ||||
| -rw-r--r-- | fs/configfs/dir.c | 13 | ||||
| -rw-r--r-- | fs/configfs/mount.c | 2 | ||||
| -rw-r--r-- | fs/configfs/symlink.c | 6 |
4 files changed, 7 insertions, 15 deletions
diff --git a/fs/configfs/configfs_internal.h b/fs/configfs/configfs_internal.h index ede857d20a04..1b7fdc0a6a09 100644 --- a/fs/configfs/configfs_internal.h +++ b/fs/configfs/configfs_internal.h | |||
| @@ -89,6 +89,7 @@ extern const struct file_operations configfs_dir_operations; | |||
| 89 | extern const struct file_operations configfs_file_operations; | 89 | extern const struct file_operations configfs_file_operations; |
| 90 | extern const struct file_operations bin_fops; | 90 | extern const struct file_operations bin_fops; |
| 91 | extern const struct inode_operations configfs_dir_inode_operations; | 91 | extern const struct inode_operations configfs_dir_inode_operations; |
| 92 | extern const struct inode_operations configfs_root_inode_operations; | ||
| 92 | extern const struct inode_operations configfs_symlink_inode_operations; | 93 | extern const struct inode_operations configfs_symlink_inode_operations; |
| 93 | extern const struct dentry_operations configfs_dentry_ops; | 94 | extern const struct dentry_operations configfs_dentry_ops; |
| 94 | 95 | ||
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 5ddd7ebd9dcd..b0fbcbeb03ee 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
| @@ -1183,11 +1183,6 @@ static int configfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
| 1183 | struct module *subsys_owner = NULL, *new_item_owner = NULL; | 1183 | struct module *subsys_owner = NULL, *new_item_owner = NULL; |
| 1184 | char *name; | 1184 | char *name; |
| 1185 | 1185 | ||
| 1186 | if (dentry->d_parent == configfs_sb->s_root) { | ||
| 1187 | ret = -EPERM; | ||
| 1188 | goto out; | ||
| 1189 | } | ||
| 1190 | |||
| 1191 | sd = dentry->d_parent->d_fsdata; | 1186 | sd = dentry->d_parent->d_fsdata; |
| 1192 | 1187 | ||
| 1193 | /* | 1188 | /* |
| @@ -1359,9 +1354,6 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
| 1359 | struct module *subsys_owner = NULL, *dead_item_owner = NULL; | 1354 | struct module *subsys_owner = NULL, *dead_item_owner = NULL; |
| 1360 | int ret; | 1355 | int ret; |
| 1361 | 1356 | ||
| 1362 | if (dentry->d_parent == configfs_sb->s_root) | ||
| 1363 | return -EPERM; | ||
| 1364 | |||
| 1365 | sd = dentry->d_fsdata; | 1357 | sd = dentry->d_fsdata; |
| 1366 | if (sd->s_type & CONFIGFS_USET_DEFAULT) | 1358 | if (sd->s_type & CONFIGFS_USET_DEFAULT) |
| 1367 | return -EPERM; | 1359 | return -EPERM; |
| @@ -1459,6 +1451,11 @@ const struct inode_operations configfs_dir_inode_operations = { | |||
| 1459 | .setattr = configfs_setattr, | 1451 | .setattr = configfs_setattr, |
| 1460 | }; | 1452 | }; |
| 1461 | 1453 | ||
| 1454 | const struct inode_operations configfs_root_inode_operations = { | ||
| 1455 | .lookup = configfs_lookup, | ||
| 1456 | .setattr = configfs_setattr, | ||
| 1457 | }; | ||
| 1458 | |||
| 1462 | #if 0 | 1459 | #if 0 |
| 1463 | int configfs_rename_dir(struct config_item * item, const char *new_name) | 1460 | int configfs_rename_dir(struct config_item * item, const char *new_name) |
| 1464 | { | 1461 | { |
diff --git a/fs/configfs/mount.c b/fs/configfs/mount.c index 07f60455f1c1..eb41adc28cfe 100644 --- a/fs/configfs/mount.c +++ b/fs/configfs/mount.c | |||
| @@ -82,7 +82,7 @@ static int configfs_fill_super(struct super_block *sb, void *data, int silent) | |||
| 82 | inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, | 82 | inode = configfs_new_inode(S_IFDIR | S_IRWXU | S_IRUGO | S_IXUGO, |
| 83 | &configfs_root); | 83 | &configfs_root); |
| 84 | if (inode) { | 84 | if (inode) { |
| 85 | inode->i_op = &configfs_dir_inode_operations; | 85 | inode->i_op = &configfs_root_inode_operations; |
| 86 | inode->i_fop = &configfs_dir_operations; | 86 | inode->i_fop = &configfs_dir_operations; |
| 87 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ | 87 | /* directory inodes start off with i_nlink == 2 (for "." entry) */ |
| 88 | inc_nlink(inode); | 88 | inc_nlink(inode); |
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c index 0f3eb41d9201..2817153d33c2 100644 --- a/fs/configfs/symlink.c +++ b/fs/configfs/symlink.c | |||
| @@ -141,10 +141,6 @@ int configfs_symlink(struct inode *dir, struct dentry *dentry, const char *symna | |||
| 141 | struct config_item *target_item = NULL; | 141 | struct config_item *target_item = NULL; |
| 142 | struct config_item_type *type; | 142 | struct config_item_type *type; |
| 143 | 143 | ||
| 144 | ret = -EPERM; /* What lack-of-symlink returns */ | ||
| 145 | if (dentry->d_parent == configfs_sb->s_root) | ||
| 146 | goto out; | ||
| 147 | |||
| 148 | sd = dentry->d_parent->d_fsdata; | 144 | sd = dentry->d_parent->d_fsdata; |
| 149 | /* | 145 | /* |
| 150 | * Fake invisibility if dir belongs to a group/default groups hierarchy | 146 | * Fake invisibility if dir belongs to a group/default groups hierarchy |
| @@ -198,8 +194,6 @@ int configfs_unlink(struct inode *dir, struct dentry *dentry) | |||
| 198 | if (!(sd->s_type & CONFIGFS_ITEM_LINK)) | 194 | if (!(sd->s_type & CONFIGFS_ITEM_LINK)) |
| 199 | goto out; | 195 | goto out; |
| 200 | 196 | ||
| 201 | BUG_ON(dentry->d_parent == configfs_sb->s_root); | ||
| 202 | |||
| 203 | sl = sd->s_element; | 197 | sl = sd->s_element; |
| 204 | 198 | ||
| 205 | parent_item = configfs_get_config_item(dentry->d_parent); | 199 | parent_item = configfs_get_config_item(dentry->d_parent); |
