summaryrefslogtreecommitdiffstats
path: root/include/linux/kernfs.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-11-23 17:21:52 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-11-27 16:57:57 -0500
commit5d60418e54751c856f5aecc308620fde9572e481 (patch)
tree364f8e338ee33fbd0186c53ed962438255746854 /include/linux/kernfs.h
parent890ece160c6465b49c42975d529c3481d89da8f5 (diff)
sysfs, kernfs: introduce kernfs_setattr()
Introduce kernfs setattr interface - kernfs_setattr(). sysfs_sd_setattr() is renamed to __kernfs_setattr() and kernfs_setattr() is a simple wrapper around it with sysfs_mutex locking. sysfs_chmod_file() is updated to get an explicit ref on kobj->sd and then invoke kernfs_setattr() so that it doesn't have to use internal interface. This patch doesn't introduce any behavior differences. v2: Dummy implementation for !CONFIG_SYSFS updated to return -ENOSYS. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/kernfs.h')
-rw-r--r--include/linux/kernfs.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
index 803d9600cf72..8cb673875715 100644
--- a/include/linux/kernfs.h
+++ b/include/linux/kernfs.h
@@ -10,6 +10,9 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/err.h> 11#include <linux/err.h>
12 12
13struct file;
14struct iattr;
15
13struct sysfs_dirent; 16struct sysfs_dirent;
14 17
15#ifdef CONFIG_SYSFS 18#ifdef CONFIG_SYSFS
@@ -22,6 +25,7 @@ int kernfs_remove_by_name_ns(struct sysfs_dirent *parent, const char *name,
22 const void *ns); 25 const void *ns);
23int kernfs_rename_ns(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent, 26int kernfs_rename_ns(struct sysfs_dirent *sd, struct sysfs_dirent *new_parent,
24 const char *new_name, const void *new_ns); 27 const char *new_name, const void *new_ns);
28int kernfs_setattr(struct sysfs_dirent *sd, const struct iattr *iattr);
25 29
26#else /* CONFIG_SYSFS */ 30#else /* CONFIG_SYSFS */
27 31
@@ -41,6 +45,10 @@ static inline int kernfs_rename_ns(struct sysfs_dirent *sd,
41 const char *new_name, const void *new_ns) 45 const char *new_name, const void *new_ns)
42{ return -ENOSYS; } 46{ return -ENOSYS; }
43 47
48static inline int kernfs_setattr(struct sysfs_dirent *sd,
49 const struct iattr *iattr)
50{ return -ENOSYS; }
51
44#endif /* CONFIG_SYSFS */ 52#endif /* CONFIG_SYSFS */
45 53
46static inline int kernfs_remove_by_name(struct sysfs_dirent *parent, 54static inline int kernfs_remove_by_name(struct sysfs_dirent *parent,