diff options
Diffstat (limited to 'fs/configfs')
-rw-r--r-- | fs/configfs/dir.c | 44 | ||||
-rw-r--r-- | fs/configfs/inode.c | 8 | ||||
-rw-r--r-- | fs/configfs/item.c | 1 |
3 files changed, 26 insertions, 27 deletions
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 214ec14149d9..ea59c891fc53 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c @@ -696,23 +696,29 @@ static int populate_groups(struct config_group *group) { struct config_group *new_group; int ret = 0; - int i; - - if (group->default_groups) { - for (i = 0; group->default_groups[i]; i++) { - new_group = group->default_groups[i]; - ret = create_default_group(group, new_group); - if (ret) { - detach_groups(group); - break; - } + list_for_each_entry(new_group, &group->default_groups, group_entry) { + ret = create_default_group(group, new_group); + if (ret) { + detach_groups(group); + break; } } return ret; } +void configfs_remove_default_groups(struct config_group *group) +{ + struct config_group *g, *n; + + list_for_each_entry_safe(g, n, &group->default_groups, group_entry) { + list_del(&g->group_entry); + config_item_put(&g->cg_item); + } +} +EXPORT_SYMBOL(configfs_remove_default_groups); + /* * All of link_obj/unlink_obj/link_group/unlink_group require that * subsys->su_mutex is held. @@ -761,15 +767,10 @@ static void link_obj(struct config_item *parent_item, struct config_item *item) static void unlink_group(struct config_group *group) { - int i; struct config_group *new_group; - if (group->default_groups) { - for (i = 0; group->default_groups[i]; i++) { - new_group = group->default_groups[i]; - unlink_group(new_group); - } - } + list_for_each_entry(new_group, &group->default_groups, group_entry) + unlink_group(new_group); group->cg_subsys = NULL; unlink_obj(&group->cg_item); @@ -777,7 +778,6 @@ static void unlink_group(struct config_group *group) static void link_group(struct config_group *parent_group, struct config_group *group) { - int i; struct config_group *new_group; struct configfs_subsystem *subsys = NULL; /* gcc is a turd */ @@ -791,12 +791,8 @@ static void link_group(struct config_group *parent_group, struct config_group *g BUG(); group->cg_subsys = subsys; - if (group->default_groups) { - for (i = 0; group->default_groups[i]; i++) { - new_group = group->default_groups[i]; - link_group(group, new_group); - } - } + list_for_each_entry(new_group, &group->default_groups, group_entry) + link_group(group, new_group); } /* diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c index 45811ea3fd87..03d124ae27d7 100644 --- a/fs/configfs/inode.c +++ b/fs/configfs/inode.c @@ -75,7 +75,8 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) sd_iattr->ia_mode = sd->s_mode; sd_iattr->ia_uid = GLOBAL_ROOT_UID; sd_iattr->ia_gid = GLOBAL_ROOT_GID; - sd_iattr->ia_atime = sd_iattr->ia_mtime = sd_iattr->ia_ctime = CURRENT_TIME; + sd_iattr->ia_atime = sd_iattr->ia_mtime = + sd_iattr->ia_ctime = current_fs_time(inode->i_sb); sd->s_iattr = sd_iattr; } /* attributes were changed atleast once in past */ @@ -111,7 +112,8 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr) static inline void set_default_inode_attr(struct inode * inode, umode_t mode) { inode->i_mode = mode; - inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; + inode->i_atime = inode->i_mtime = + inode->i_ctime = current_fs_time(inode->i_sb); } static inline void set_inode_attr(struct inode * inode, struct iattr * iattr) @@ -195,7 +197,7 @@ int configfs_create(struct dentry * dentry, umode_t mode, void (*init)(struct in return -ENOMEM; p_inode = d_inode(dentry->d_parent); - p_inode->i_mtime = p_inode->i_ctime = CURRENT_TIME; + p_inode->i_mtime = p_inode->i_ctime = current_fs_time(p_inode->i_sb); configfs_set_inode_lock_class(sd, inode); init(inode); diff --git a/fs/configfs/item.c b/fs/configfs/item.c index b863a09cd2f1..8b2a994042dd 100644 --- a/fs/configfs/item.c +++ b/fs/configfs/item.c @@ -182,6 +182,7 @@ void config_group_init(struct config_group *group) { config_item_init(&group->cg_item); INIT_LIST_HEAD(&group->cg_children); + INIT_LIST_HEAD(&group->default_groups); } EXPORT_SYMBOL(config_group_init); |