diff options
author | Luis R. Rodriguez <mcgrof@do-not-panic.com> | 2013-05-16 01:23:29 -0700 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-17 14:05:47 +0200 |
commit | 260f9bf9933bf35d09b40f22993364af33fe01ca (patch) | |
tree | 7c559e714543d3c5780dda72527cc295f365bf8d | |
parent | 6fd4f5d11cd40d44e0f45f762ba1bcaaab36e9e9 (diff) |
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 <dhowells@redhat.com>
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 <dhowells@redhat.com>
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
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 <viro@zeniv.linux.org.uk>
Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | backport/backport-include/linux/proc_fs.h | 9 | ||||
-rw-r--r-- | 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 22a7b548..05851d2c 100644 --- a/backport/backport-include/linux/proc_fs.h +++ b/backport/backport-include/linux/proc_fs.h @@ -4,6 +4,7 @@ #include <linux/version.h> #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 69c3788c..980ed59d 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 <linux/kernel.h> +#include <linux/module.h> +#include <linux/err.h> +#include <linux/proc_fs.h> + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0)) #include <linux/init.h> #include <linux/debugfs.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/async.h> -#include <linux/err.h> #include <linux/mutex.h> #include <linux/suspend.h> #include <linux/delay.h> @@ -26,8 +29,9 @@ #include <linux/regulator/consumer.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> -#include <linux/module.h> +#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); |