diff options
author | Christian Brauner <christian.brauner@ubuntu.com> | 2020-02-27 06:37:11 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-02-27 07:07:25 +0300 |
commit | f70ce185687bbe4e2d7ff126a8c890631f5fc2af (patch) | |
tree | fa62764ac154c9e86c2fa446aa534eebefeedb32 /include/linux/sysfs.h | |
parent | d1c73cbdf9d3f6181a50398568372ef41b1f485c (diff) | |
download | linux-f70ce185687bbe4e2d7ff126a8c890631f5fc2af.tar.xz |
sysfs: add sysfs_file_change_owner()
Add helpers to change the owner of a sysfs files.
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.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index fa7ee503fb76..a7884024a911 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -310,6 +310,9 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) return kernfs_enable_ns(kn); } +int sysfs_file_change_owner(struct kobject *kobj, const char *name, kuid_t kuid, + kgid_t kgid); + #else /* CONFIG_SYSFS */ static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns) @@ -522,6 +525,13 @@ static inline void sysfs_enable_ns(struct kernfs_node *kn) { } +static inline int sysfs_file_change_owner(struct kobject *kobj, + const char *name, kuid_t kuid, + kgid_t kgid) +{ + return 0; +} + #endif /* CONFIG_SYSFS */ static inline int __must_check sysfs_create_file(struct kobject *kobj, |