aboutsummaryrefslogtreecommitdiffstats
path: root/fs/kernfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/kernfs/inode.c')
-rw-r--r--fs/kernfs/inode.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index 9e74eed63539..f6c0aae3dd5c 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -50,23 +50,23 @@ static struct sysfs_inode_attrs *sysfs_inode_attrs(struct kernfs_node *kn)
50{ 50{
51 struct iattr *iattrs; 51 struct iattr *iattrs;
52 52
53 if (kn->s_iattr) 53 if (kn->iattr)
54 return kn->s_iattr; 54 return kn->iattr;
55 55
56 kn->s_iattr = kzalloc(sizeof(struct sysfs_inode_attrs), GFP_KERNEL); 56 kn->iattr = kzalloc(sizeof(struct sysfs_inode_attrs), GFP_KERNEL);
57 if (!kn->s_iattr) 57 if (!kn->iattr)
58 return NULL; 58 return NULL;
59 iattrs = &kn->s_iattr->ia_iattr; 59 iattrs = &kn->iattr->ia_iattr;
60 60
61 /* assign default attributes */ 61 /* assign default attributes */
62 iattrs->ia_mode = kn->s_mode; 62 iattrs->ia_mode = kn->mode;
63 iattrs->ia_uid = GLOBAL_ROOT_UID; 63 iattrs->ia_uid = GLOBAL_ROOT_UID;
64 iattrs->ia_gid = GLOBAL_ROOT_GID; 64 iattrs->ia_gid = GLOBAL_ROOT_GID;
65 iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME; 65 iattrs->ia_atime = iattrs->ia_mtime = iattrs->ia_ctime = CURRENT_TIME;
66 66
67 simple_xattrs_init(&kn->s_iattr->xattrs); 67 simple_xattrs_init(&kn->iattr->xattrs);
68 68
69 return kn->s_iattr; 69 return kn->iattr;
70} 70}
71 71
72static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr) 72static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
@@ -93,7 +93,7 @@ static int __kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr)
93 iattrs->ia_ctime = iattr->ia_ctime; 93 iattrs->ia_ctime = iattr->ia_ctime;
94 if (ia_valid & ATTR_MODE) { 94 if (ia_valid & ATTR_MODE) {
95 umode_t mode = iattr->ia_mode; 95 umode_t mode = iattr->ia_mode;
96 iattrs->ia_mode = kn->s_mode = mode; 96 iattrs->ia_mode = kn->mode = mode;
97 } 97 }
98 return 0; 98 return 0;
99} 99}
@@ -256,9 +256,9 @@ static inline void set_inode_attr(struct inode *inode, struct iattr *iattr)
256 256
257static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode) 257static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
258{ 258{
259 struct sysfs_inode_attrs *attrs = kn->s_iattr; 259 struct sysfs_inode_attrs *attrs = kn->iattr;
260 260
261 inode->i_mode = kn->s_mode; 261 inode->i_mode = kn->mode;
262 if (attrs) { 262 if (attrs) {
263 /* 263 /*
264 * kernfs_node has non-default attributes get them from 264 * kernfs_node has non-default attributes get them from
@@ -270,7 +270,7 @@ static void sysfs_refresh_inode(struct kernfs_node *kn, struct inode *inode)
270 } 270 }
271 271
272 if (sysfs_type(kn) == SYSFS_DIR) 272 if (sysfs_type(kn) == SYSFS_DIR)
273 set_nlink(inode, kn->s_dir.subdirs + 2); 273 set_nlink(inode, kn->dir.subdirs + 2);
274} 274}
275 275
276int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry, 276int sysfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
@@ -295,7 +295,7 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
295 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; 295 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
296 inode->i_op = &sysfs_inode_operations; 296 inode->i_op = &sysfs_inode_operations;
297 297
298 set_default_inode_attr(inode, kn->s_mode); 298 set_default_inode_attr(inode, kn->mode);
299 sysfs_refresh_inode(kn, inode); 299 sysfs_refresh_inode(kn, inode);
300 300
301 /* initialize inode according to type */ 301 /* initialize inode according to type */
@@ -305,7 +305,7 @@ static void sysfs_init_inode(struct kernfs_node *kn, struct inode *inode)
305 inode->i_fop = &sysfs_dir_operations; 305 inode->i_fop = &sysfs_dir_operations;
306 break; 306 break;
307 case SYSFS_KOBJ_ATTR: 307 case SYSFS_KOBJ_ATTR:
308 inode->i_size = kn->s_attr.size; 308 inode->i_size = kn->attr.size;
309 inode->i_fop = &kernfs_file_operations; 309 inode->i_fop = &kernfs_file_operations;
310 break; 310 break;
311 case SYSFS_KOBJ_LINK: 311 case SYSFS_KOBJ_LINK:
@@ -337,7 +337,7 @@ struct inode *sysfs_get_inode(struct super_block *sb, struct kernfs_node *kn)
337{ 337{
338 struct inode *inode; 338 struct inode *inode;
339 339
340 inode = iget_locked(sb, kn->s_ino); 340 inode = iget_locked(sb, kn->ino);
341 if (inode && (inode->i_state & I_NEW)) 341 if (inode && (inode->i_state & I_NEW))
342 sysfs_init_inode(kn, inode); 342 sysfs_init_inode(kn, inode);
343 343