From: Cody P Schafer <[email protected]> bin_attributes created/updated in create_files() (such as those listed via (struct device).attribute_groups) were not placed under the specified group, and instead appeared in the base kobj directory.
Fix this by making bin_attributes use creating code similar to normal attributes. A quick grep shows that no one is using bin_attrs in a named attribute group yet, so we can do this without breaking anything in usespace. Note that I do not add is_visible() support to bin_attributes, though that could be done as well. Signed-off-by: Cody P Schafer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit aabaf4c2050d21d39fe11eec889c508e84d6a328) Signed-off-by: Vladimir Davydov <[email protected]> Conflicts: fs/sysfs/cgroup.c --- fs/sysfs/group.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/sysfs/group.c b/fs/sysfs/group.c index 5f92cd2f61c1..c2f76a5e2f61 100644 --- a/fs/sysfs/group.c +++ b/fs/sysfs/group.c @@ -29,7 +29,8 @@ static void remove_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); if (grp->bin_attrs) for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) - sysfs_remove_bin_file(kobj, *bin_attr); + sysfs_hash_and_remove(dir_sd, NULL, + (*bin_attr)->attr.name); } static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, @@ -71,8 +72,10 @@ static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, if (grp->bin_attrs) { for (bin_attr = grp->bin_attrs; *bin_attr; bin_attr++) { if (update) - sysfs_remove_bin_file(kobj, *bin_attr); - error = sysfs_create_bin_file(kobj, *bin_attr); + sysfs_hash_and_remove(dir_sd, NULL, + (*bin_attr)->attr.name); + error = sysfs_add_file(dir_sd, &(*bin_attr)->attr, + SYSFS_KOBJ_BIN_ATTR); if (error) break; } -- 2.1.4 _______________________________________________ Devel mailing list [email protected] https://lists.openvz.org/mailman/listinfo/devel
