aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/sysfs.h
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2020-02-27 04:37:13 +0100
committerDavid S. Miller <davem@davemloft.net>2020-02-26 20:07:25 -0800
commit303a42769c4c4d8e5e3ad928df87eb36f8c1fa60 (patch)
treecfe2a546d0f14cffd03044ac8e7756e8646e46a5 /include/linux/sysfs.h
parentsysfs: add sysfs_link_change_owner() (diff)
downloadwireguard-linux-303a42769c4c4d8e5e3ad928df87eb36f8c1fa60.tar.xz
wireguard-linux-303a42769c4c4d8e5e3ad928df87eb36f8c1fa60.zip
sysfs: add sysfs_group{s}_change_owner()
Add helpers to change the owner of sysfs groups. This function will be used to correctly account for kobject ownership changes, e.g. when moving network devices between network namespaces. Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/sysfs.h')
-rw-r--r--include/linux/sysfs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 7e15ebfd750e..3fcaabdb05ef 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -314,6 +314,12 @@ int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid,
kgid_t kgid);
int sysfs_link_change_owner(struct kobject *kobj, struct kobject *targ,
const char *name, kuid_t kuid, kgid_t kgid);
+int sysfs_groups_change_owner(struct kobject *kobj,
+ const struct attribute_group **groups,
+ kuid_t kuid, kgid_t kgid);
+int sysfs_group_change_owner(struct kobject *kobj,
+ const struct attribute_group *groups, kuid_t kuid,
+ kgid_t kgid);
#else /* CONFIG_SYSFS */
@@ -542,6 +548,20 @@ static inline int sysfs_link_change_owner(struct kobject *kobj,
return 0;
}
+static inline int sysfs_groups_change_owner(struct kobject *kobj,
+ const struct attribute_group **groups,
+ kuid_t kuid, kgid_t kgid)
+{
+ return 0;
+}
+
+static inline int sysfs_group_change_owner(struct kobject *kobj,
+ const struct attribute_group **groups,
+ kuid_t kuid, kgid_t kgid)
+{
+ return 0;
+}
+
#endif /* CONFIG_SYSFS */
static inline int __must_check sysfs_create_file(struct kobject *kobj,