From 260f9bf9933bf35d09b40f22993364af33fe01ca Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Thu, 16 May 2013 01:23:29 -0700 Subject: [PATCH] backports: add proc_set_size() and proc_set_user() mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 271a15ea v3.10-rc1~129^2~24 commit 271a15eabe094538d958dc68ccfc9c36b699247a Author: David Howells Date: Fri Apr 12 00:38:51 2013 +0100 proc: Supply PDE attribute setting accessor functions Supply accessor functions to set attributes in proc_dir_entry structs. The following are supplied: proc_set_size() and proc_set_user(). Signed-off-by: David Howells Acked-by: Mauro Carvalho Chehab cc: linuxppc-dev@lists.ozlabs.org cc: linux-media@vger.kernel.org cc: netdev@vger.kernel.org cc: linux-wireless@vger.kernel.org cc: linux-pci@vger.kernel.org cc: netfilter-devel@vger.kernel.org cc: alsa-devel@alsa-project.org Signed-off-by: Al Viro Signed-off-by: Luis R. Rodriguez Signed-off-by: Johannes Berg --- backport/backport-include/linux/proc_fs.h | 9 ++++++++- backport/compat/backport-3.10.c | 23 ++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/backport/backport-include/linux/proc_fs.h b/backport/backport-include/linux/proc_fs.h index 22a7b5481762..05851d2cfb0e 100644 --- a/backport/backport-include/linux/proc_fs.h +++ b/backport/backport-include/linux/proc_fs.h @@ -4,6 +4,7 @@ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) + #ifdef CONFIG_PROC_FS /* * backport of: @@ -13,8 +14,14 @@ static inline void *PDE_DATA(const struct inode *inode) { return PROC_I(inode)->pde->data; } +extern void proc_set_size(struct proc_dir_entry *, loff_t); +extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t); #else static inline void *PDE_DATA(const struct inode *inode) {BUG(); return NULL;} -#endif +static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} +static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} +#endif /* CONFIG_PROC_FS */ + +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0) */ #endif /* __BACKPORT_PROC_FS_H */ diff --git a/backport/compat/backport-3.10.c b/backport/compat/backport-3.10.c index 69c3788c0521..980ed59d8e4e 100644 --- a/backport/compat/backport-3.10.c +++ b/backport/compat/backport-3.10.c @@ -8,14 +8,17 @@ * published by the Free Software Foundation. */ -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) #include +#include +#include +#include + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) #include #include #include #include #include -#include #include #include #include @@ -26,8 +29,9 @@ #include #include #include -#include +#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) /** * regulator_map_voltage_ascend - map_voltage() for ascendant voltage list * @@ -60,3 +64,16 @@ int regulator_map_voltage_ascend(struct regulator_dev *rdev, EXPORT_SYMBOL_GPL(regulator_map_voltage_ascend); #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) */ + +void proc_set_size(struct proc_dir_entry *de, loff_t size) +{ + de->size = size; +} +EXPORT_SYMBOL_GPL(proc_set_size); + +void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) +{ + de->uid = uid; + de->gid = gid; +} +EXPORT_SYMBOL_GPL(proc_set_user); -- 2.30.2