aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/inode.c')
-rw-r--r--fs/sysfs/inode.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index 9889e54e1f13..e79e38d52c00 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -12,6 +12,7 @@
12#include <linux/namei.h> 12#include <linux/namei.h>
13#include <linux/backing-dev.h> 13#include <linux/backing-dev.h>
14#include <linux/capability.h> 14#include <linux/capability.h>
15#include <linux/errno.h>
15#include "sysfs.h" 16#include "sysfs.h"
16 17
17extern struct super_block * sysfs_sb; 18extern struct super_block * sysfs_sb;
@@ -124,7 +125,6 @@ struct inode * sysfs_new_inode(mode_t mode, struct sysfs_dirent * sd)
124{ 125{
125 struct inode * inode = new_inode(sysfs_sb); 126 struct inode * inode = new_inode(sysfs_sb);
126 if (inode) { 127 if (inode) {
127 inode->i_blksize = PAGE_CACHE_SIZE;
128 inode->i_blocks = 0; 128 inode->i_blocks = 0;
129 inode->i_mapping->a_ops = &sysfs_aops; 129 inode->i_mapping->a_ops = &sysfs_aops;
130 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; 130 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
@@ -234,17 +234,18 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent)
234 } 234 }
235} 235}
236 236
237void sysfs_hash_and_remove(struct dentry * dir, const char * name) 237int sysfs_hash_and_remove(struct dentry * dir, const char * name)
238{ 238{
239 struct sysfs_dirent * sd; 239 struct sysfs_dirent * sd;
240 struct sysfs_dirent * parent_sd; 240 struct sysfs_dirent * parent_sd;
241 int found = 0;
241 242
242 if (!dir) 243 if (!dir)
243 return; 244 return -ENOENT;
244 245
245 if (dir->d_inode == NULL) 246 if (dir->d_inode == NULL)
246 /* no inode means this hasn't been made visible yet */ 247 /* no inode means this hasn't been made visible yet */
247 return; 248 return -ENOENT;
248 249
249 parent_sd = dir->d_fsdata; 250 parent_sd = dir->d_fsdata;
250 mutex_lock(&dir->d_inode->i_mutex); 251 mutex_lock(&dir->d_inode->i_mutex);
@@ -255,8 +256,11 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name)
255 list_del_init(&sd->s_sibling); 256 list_del_init(&sd->s_sibling);
256 sysfs_drop_dentry(sd, dir); 257 sysfs_drop_dentry(sd, dir);
257 sysfs_put(sd); 258 sysfs_put(sd);
259 found = 1;
258 break; 260 break;
259 } 261 }
260 } 262 }
261 mutex_unlock(&dir->d_inode->i_mutex); 263 mutex_unlock(&dir->d_inode->i_mutex);
264
265 return found ? 0 : -ENOENT;
262} 266}