From 31e5abe9a6dab1ed3a5c30352bdb001353146318 Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Mon, 18 Apr 2005 21:57:32 -0700 Subject: [PATCH] sysfs: add sysfs_chmod_file() sysfs: allow changing the permissions for already created attributes Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- include/linux/sysfs.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 6f502ff..38b58b3 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -99,6 +99,9 @@ sysfs_create_file(struct kobject *, const struct attribute *); extern int sysfs_update_file(struct kobject *, const struct attribute *); +extern int +sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); + extern void sysfs_remove_file(struct kobject *, const struct attribute *); @@ -140,6 +143,10 @@ static inline int sysfs_update_file(struct kobject * k, const struct attribute * { return 0; } +static inline int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode) +{ + return 0; +} static inline void sysfs_remove_file(struct kobject * k, const struct attribute * a) { -- cgit v1.1 From a7a76cefc4b12bb6508afa4c77f11c2752cc365d Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Mon, 18 Apr 2005 21:57:33 -0700 Subject: [PATCH] debugfs: Reduce dependencies The current include file is a little fragile in that it is not self-contained and hence may cause compile warnings or errors depending on the files included before it, the kernel config and the architecture. This patch makes things a little more robust by: - including to get definitions of u32, mode_t, and so on. - forward declaring struct file_operations. - including when CONFIG_DEBUG_FS is not set The last change is particularly useful, as a kernel developer is likely to build with debugfs always enabled and never see the build breakage cased if debugfs is disabled. Signed-off-by: Roland Dreier Signed-off-by: Greg Kroah-Hartman --- include/linux/debugfs.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index f7a7b86..dcf847c 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -17,6 +17,10 @@ #include +#include + +struct file_operations; + #if defined(CONFIG_DEBUG_FS) struct dentry *debugfs_create_file(const char *name, mode_t mode, struct dentry *parent, void *data, @@ -36,6 +40,9 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode, struct dentry *parent, u32 *value); #else + +#include + /* * We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled * so users have a chance to detect if there was a real error or not. We don't -- cgit v1.1 From 7b558637b0efc6ab3f3ca08f0b9cc0191665e9db Mon Sep 17 00:00:00 2001 From: Michal Ostrowski Date: Mon, 18 Apr 2005 21:57:34 -0700 Subject: [PATCH] debugfs: fix !debugfs prototypes - Fix prototypes for debugfs functions (in configurations where debugfs is disabled). Signed-off-by: Michal Ostrowski Signed-off-by: Greg Kroah-Hartman --- include/linux/debugfs.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h index dcf847c..a5fa6a6 100644 --- a/include/linux/debugfs.h +++ b/include/linux/debugfs.h @@ -75,21 +75,21 @@ static inline struct dentry *debugfs_create_u8(const char *name, mode_t mode, static inline struct dentry *debugfs_create_u16(const char *name, mode_t mode, struct dentry *parent, - u8 *value) + u16 *value) { return ERR_PTR(-ENODEV); } static inline struct dentry *debugfs_create_u32(const char *name, mode_t mode, struct dentry *parent, - u8 *value) + u32 *value) { return ERR_PTR(-ENODEV); } static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode, struct dentry *parent, - u8 *value) + u32 *value) { return ERR_PTR(-ENODEV); } -- cgit v1.1