* [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
@ 2013-04-16 18:26 ` David Howells
2013-04-16 21:37 ` Mauro Carvalho Chehab
` (2 more replies)
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
` (5 subsequent siblings)
6 siblings, 3 replies; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel
Cc: alsa-devel, netdev, linux-wireless, netfilter-devel, viro,
linux-pci, linux-fsdevel, linuxppc-dev, linux-media
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>
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
---
arch/powerpc/kernel/proc_powerpc.c | 2 +-
arch/powerpc/platforms/pseries/reconfig.c | 2 +-
drivers/media/pci/ttpci/av7110_ir.c | 2 +-
drivers/net/irda/vlsi_ir.c | 2 +-
drivers/net/wireless/airo.c | 34 +++++++++--------------------
drivers/pci/proc.c | 2 +-
fs/proc/generic.c | 13 +++++++++++
include/linux/proc_fs.h | 5 ++++
kernel/configs.c | 2 +-
kernel/profile.c | 2 +-
net/netfilter/xt_recent.c | 3 +--
sound/core/info.c | 2 +-
12 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
index 41d8ee9..feb8580 100644
--- a/arch/powerpc/kernel/proc_powerpc.c
+++ b/arch/powerpc/kernel/proc_powerpc.c
@@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void)
&page_map_fops, vdso_data);
if (!pde)
return 1;
- pde->size = PAGE_SIZE;
+ proc_set_size(pde, PAGE_SIZE);
return 0;
}
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index d6491bd..f93cdf5 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
if (ent)
- ent->size = 0;
+ proc_set_size(ent, 0);
return 0;
}
diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c
index eb82286..0e763a7 100644
--- a/drivers/media/pci/ttpci/av7110_ir.c
+++ b/drivers/media/pci/ttpci/av7110_ir.c
@@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
if (av_cnt == 1) {
e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
if (e)
- e->size = 4 + 256 * sizeof(u16);
+ proc_set_size(e, 4 + 256 * sizeof(u16));
}
tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
index e22cd4e..5f47584 100644
--- a/drivers/net/irda/vlsi_ir.c
+++ b/drivers/net/irda/vlsi_ir.c
@@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
IRDA_WARNING("%s: failed to create proc entry\n",
__func__);
} else {
- ent->size = 0;
+ proc_set_size(ent, 0);
}
idev->proc_entry = ent;
}
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 66e398d..21d0233 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev,
airo_entry);
if (!apriv->proc_entry)
goto fail;
- apriv->proc_entry->uid = proc_kuid;
- apriv->proc_entry->gid = proc_kgid;
+ proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
/* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry)
goto fail_stats_delta;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev);
if (!entry)
goto fail_stats;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev);
if (!entry)
goto fail_status;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Config */
entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev);
if (!entry)
goto fail_config;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the SSID */
entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry)
goto fail_ssid;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the APList */
entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev);
if (!entry)
goto fail_aplist;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry)
goto fail_bsslist;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
+ proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry)
goto fail_wepkey;
- entry->uid = proc_kuid;
- entry->gid = proc_kgid;
-
+ proc_set_user(entry, proc_kuid, proc_kgid);
return 0;
fail_wepkey:
@@ -5695,10 +5685,8 @@ static int __init airo_init_module( void )
airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
- if (airo_entry) {
- airo_entry->uid = proc_kuid;
- airo_entry->gid = proc_kgid;
- }
+ if (airo_entry)
+ proc_set_user(airo_entry, proc_kuid, proc_kgid);
for (i = 0; i < 4 && io[i] && irq[i]; i++) {
airo_print_info("", "Trying to configure ISA adapter at irq=%d "
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 12e4fb5..7cde7c1 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -419,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev)
&proc_bus_pci_operations, dev);
if (!e)
return -ENOMEM;
- e->size = dev->cfg_size;
+ proc_set_size(e, dev->cfg_size);
dev->procent = e;
return 0;
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 1c07cad..5f6f6c3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -498,6 +498,19 @@ out:
return NULL;
}
EXPORT_SYMBOL(proc_create_data);
+
+void proc_set_size(struct proc_dir_entry *de, loff_t size)
+{
+ de->size = size;
+}
+EXPORT_SYMBOL(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(proc_set_user);
static void free_proc_entry(struct proc_dir_entry *de)
{
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 805edac..28a4d7e 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -130,6 +130,9 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
struct proc_dir_entry *parent);
+extern void proc_set_size(struct proc_dir_entry *, loff_t);
+extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
+
extern struct file *proc_ns_fget(int fd);
extern bool proc_ns_inode(struct inode *inode);
@@ -158,6 +161,8 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
struct proc_dir_entry *parent) {return NULL;}
static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
umode_t mode, struct proc_dir_entry *parent) { return NULL; }
+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) {}
struct tty_driver;
static inline void proc_tty_register_driver(struct tty_driver *driver) {};
diff --git a/kernel/configs.c b/kernel/configs.c
index 42e8fa0..c18b1f1 100644
--- a/kernel/configs.c
+++ b/kernel/configs.c
@@ -79,7 +79,7 @@ static int __init ikconfig_init(void)
if (!entry)
return -ENOMEM;
- entry->size = kernel_config_data_size;
+ proc_set_size(entry, kernel_config_data_size);
return 0;
}
diff --git a/kernel/profile.c b/kernel/profile.c
index 524ce5e..0bf4007 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -600,7 +600,7 @@ int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */
NULL, &proc_profile_operations);
if (!entry)
return 0;
- entry->size = (1+prof_len) * sizeof(atomic_t);
+ proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
hotcpu_notifier(profile_cpu_callback, 0);
return 0;
}
diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
index 3db2d38..1e657cf 100644
--- a/net/netfilter/xt_recent.c
+++ b/net/netfilter/xt_recent.c
@@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
ret = -ENOMEM;
goto out;
}
- pde->uid = uid;
- pde->gid = gid;
+ proc_set_user(pde, uid, gid);
#endif
spin_lock_bh(&recent_lock);
list_add_tail(&t->list, &recent_net->tables);
diff --git a/sound/core/info.c b/sound/core/info.c
index 3aa8864..c7f41c3 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -970,7 +970,7 @@ int snd_info_register(struct snd_info_entry * entry)
mutex_unlock(&info_mutex);
return -ENOMEM;
}
- p->size = entry->size;
+ proc_set_size(p, entry->size);
}
entry->p = p;
if (entry->parent)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
@ 2013-04-16 18:26 ` David Howells
2013-04-16 21:39 ` Mauro Carvalho Chehab
2013-04-17 0:58 ` Greg KH
2013-04-16 18:26 ` [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC] David Howells
` (4 subsequent siblings)
6 siblings, 2 replies; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel
Cc: Neela Syam Kolli, devel, Mauro Carvalho Chehab, linux-scsi,
Jerry Chuang, linux-wireless, viro, linux-fsdevel
Add proc_mkdir_data() to allow procfs directories to be created that are
annotated at the time of creation with private data rather than doing this
post-creation. This means no access is then required to the proc_dir_entry
struct to set this.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Neela Syam Kolli <megaraidlinux@lsi.com>
cc: Jerry Chuang <jerry-chuang@realtek.com>
cc: Mauro Carvalho Chehab <mchehab@redhat.com>
cc: linux-scsi@vger.kernel.org
cc: devel@driverdev.osuosl.org
cc: linux-wireless@vger.kernel.org
---
drivers/message/i2o/i2o_proc.c | 8 ++------
drivers/scsi/megaraid.c | 4 ++--
drivers/staging/rtl8192u/r8192U_core.c | 3 +--
fs/proc/generic.c | 30 ++++++++++++------------------
include/linux/proc_fs.h | 11 ++++++++---
5 files changed, 25 insertions(+), 31 deletions(-)
diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
index 70a840f..b7d87cd 100644
--- a/drivers/message/i2o/i2o_proc.c
+++ b/drivers/message/i2o/i2o_proc.c
@@ -1913,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
- devdir = proc_mkdir(buff, dir);
+ devdir = proc_mkdir_data(buff, 0, dir, dev);
if (!devdir) {
osm_warn("Could not allocate procdir!\n");
return;
}
- devdir->data = dev;
-
i2o_proc_create_entries(devdir, generic_dev_entries, dev);
/* Inform core that we want updates about this device's status */
@@ -1954,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
osm_debug("adding IOP /proc/i2o/%s\n", c->name);
- iopdir = proc_mkdir(c->name, dir);
+ iopdir = proc_mkdir_data(c->name, 0, dir, c);
if (!iopdir)
return -1;
- iopdir->data = c;
-
i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
list_for_each_entry(dev, &c->devices, list)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index a1c90bd..ef3384d 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2818,12 +2818,12 @@ mega_create_proc_entry(int index, struct proc_dir_entry *parent)
sprintf(string, "hba%d", adapter->host->host_no);
- dir = adapter->controller_proc_dir_entry = proc_mkdir(string, parent);
+ dir = adapter->controller_proc_dir_entry =
+ proc_mkdir_data(string, 0, parent, adapter);
if(!dir) {
printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
return;
}
- dir->data = adapter;
for (f = mega_proc_files; f->name; f++) {
de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops,
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 433c3df..d81d7d5 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -672,13 +672,12 @@ void rtl8192_proc_init_one(struct net_device *dev)
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
if (rtl8192_proc) {
- priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
+ priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev);
if (!priv->dir_dev) {
RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
dev->name);
return;
}
- priv->dir_dev->data = dev;
for (f = rtl8192_proc_files; f->name[0]; f++) {
if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 5f6f6c3..4074da5 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -428,13 +428,17 @@ struct proc_dir_entry *proc_symlink(const char *name,
}
EXPORT_SYMBOL(proc_symlink);
-struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
- struct proc_dir_entry *parent)
+struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode,
+ struct proc_dir_entry *parent, void *data)
{
struct proc_dir_entry *ent;
+ if (mode == 0)
+ mode = S_IRUGO | S_IXUGO;
+
ent = __proc_create(&parent, name, S_IFDIR | mode, 2);
if (ent) {
+ ent->data = data;
if (proc_register(parent, ent) < 0) {
kfree(ent);
ent = NULL;
@@ -442,29 +446,19 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
}
return ent;
}
-EXPORT_SYMBOL(proc_mkdir_mode);
+EXPORT_SYMBOL_GPL(proc_mkdir_data);
-struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
- struct proc_dir_entry *parent)
+struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
+ struct proc_dir_entry *parent)
{
- struct proc_dir_entry *ent;
-
- ent = __proc_create(&parent, name, S_IFDIR | S_IRUGO | S_IXUGO, 2);
- if (ent) {
- ent->data = net;
- if (proc_register(parent, ent) < 0) {
- kfree(ent);
- ent = NULL;
- }
- }
- return ent;
+ return proc_mkdir_data(name, mode, parent, NULL);
}
-EXPORT_SYMBOL_GPL(proc_net_mkdir);
+EXPORT_SYMBOL(proc_mkdir_mode);
struct proc_dir_entry *proc_mkdir(const char *name,
struct proc_dir_entry *parent)
{
- return proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent);
+ return proc_mkdir_data(name, 0, parent, NULL);
}
EXPORT_SYMBOL(proc_mkdir);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 80d9e24..e5d8f69 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -73,6 +73,8 @@ extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
extern struct proc_dir_entry *proc_symlink(const char *,
struct proc_dir_entry *, const char *);
extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
+extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
+ struct proc_dir_entry *, void *);
extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
struct proc_dir_entry *parent);
@@ -82,9 +84,6 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
return proc_create_data(name, mode, parent, proc_fops, NULL);
}
-extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
- struct proc_dir_entry *parent);
-
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
@@ -153,4 +152,10 @@ static inline void *PDE_DATA(const struct inode *inode)
return PROC_I(inode)->pde->data;
}
+static inline struct proc_dir_entry *proc_net_mkdir(
+ struct net *net, const char *name, struct proc_dir_entry *parent)
+{
+ return proc_mkdir_data(name, 0, parent, net);
+}
+
#endif /* _LINUX_PROC_FS_H */
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
@ 2013-04-16 18:26 ` David Howells
2013-04-17 0:59 ` Greg KH
2013-04-16 18:26 ` [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC] David Howells
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel
Cc: devel, linux-wireless, YAMANE Toshiaki, Maxim Mikityanskiy, viro,
linux-fsdevel
Create a dir under /proc/net/r8180/ named for the device and create that
device's files under there. This means that there won't be a problem for
multiple devices in the system (if such is possible) and it means we don't
need to save the 'device directory' PDE any more as we can just do a proc
subtree removal.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Maxim Mikityanskiy <maxtram95@gmail.com>
cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
cc: linux-wireless@vger.kernel.org
cc: devel@driverdev.osuosl.org
---
drivers/staging/rtl8187se/r8180.h | 1 -
drivers/staging/rtl8187se/r8180_core.c | 26 ++++++++------------------
2 files changed, 8 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h
index 70ea414..edacc80 100644
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -372,7 +372,6 @@ typedef struct r8180_priv
struct Stats stats;
struct _link_detect_t link_detect; //YJ,add,080828
struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
/*RX stuff*/
u32 *rxring;
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 448da77..ab469ce 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -288,14 +288,7 @@ void rtl8180_proc_module_remove(void)
void rtl8180_proc_remove_one(struct net_device *dev)
{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
- if (priv->dir_dev) {
- remove_proc_entry("stats-hw", priv->dir_dev);
- remove_proc_entry("stats-tx", priv->dir_dev);
- remove_proc_entry("stats-rx", priv->dir_dev);
- remove_proc_entry("registers", priv->dir_dev);
- priv->dir_dev = NULL;
- }
+ remove_proc_subtree(dev->name, rtl8180_proc);
}
/*
@@ -335,22 +328,19 @@ static const struct rtl8180_proc_file rtl8180_proc_files[] = {
void rtl8180_proc_init_one(struct net_device *dev)
{
const struct rtl8180_proc_file *f;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
+ struct proc_dir_entry *dir;
- priv->dir_dev = rtl8180_proc;
- if (!priv->dir_dev) {
- DMESGE("Unable to initialize /proc/net/r8180/%s\n",
- dev->name);
+ dir = proc_mkdir_data(dev->name, 0, rtl8180_proc, dev);
+ if (!dir) {
+ DMESGE("Unable to initialize /proc/net/r8180/%s\n", dev->name);
return;
}
- priv->dir_dev->data = dev;
for (f = rtl8180_proc_files; f->name[0]; f++) {
- if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
- priv->dir_dev,
+ if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
&rtl8180_proc_fops, f->show)) {
- DMESGE("Unable to initialize /proc/net/r8180/%s\n",
- f->name);
+ DMESGE("Unable to initialize /proc/net/r8180/%s/%s\n",
+ dev->name, f->name);
return;
}
}
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
` (2 preceding siblings ...)
2013-04-16 18:26 ` [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC] David Howells
@ 2013-04-16 18:26 ` David Howells
2013-04-17 1:00 ` Greg KH
2013-04-16 18:26 ` [PATCH 13/28] airo: Use remove_proc_subtree() [RFC] David Howells
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel
Cc: devel, Mauro Carvalho Chehab, Jerry Chuang, linux-wireless, viro,
linux-fsdevel
Don't need to save the PDE of a directory created under /proc/net/rtl8192/ as
we can use proc subtree deletion to get rid of it and all its children.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jerry Chuang <jerry-chuang@realtek.com>
cc: Mauro Carvalho Chehab <mchehab@redhat.com>
cc: linux-wireless@vger.kernel.org
cc: devel@driverdev.osuosl.org
---
drivers/staging/rtl8192u/r8192U.h | 1 -
drivers/staging/rtl8192u/r8192U_core.c | 18 ++++++------------
2 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r8192U.h
index e538e02..bedeb33 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -946,7 +946,6 @@ typedef struct r8192_priv {
/*stats*/
struct Stats stats;
struct iw_statistics wstats;
- struct proc_dir_entry *dir_dev;
/*RX stuff*/
// u32 *rxring;
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index d81d7d5..27ba2a3 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -669,20 +669,19 @@ static const struct rtl8192_proc_file rtl8192_proc_files[] = {
void rtl8192_proc_init_one(struct net_device *dev)
{
const struct rtl8192_proc_file *f;
- struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
+ struct proc_dir_entry *dir;
if (rtl8192_proc) {
- priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev);
- if (!priv->dir_dev) {
+ dir = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev);
+ if (!dir) {
RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
dev->name);
return;
}
for (f = rtl8192_proc_files; f->name[0]; f++) {
- if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
- priv->dir_dev,
- rtl8192_proc_fops, f->show)) {
+ if (!proc_create_data(f->name, S_IFREG | S_IRUGO, dir,
+ &rtl8192_proc_fops, f->show)) {
RT_TRACE(COMP_ERR, "Unable to initialize "
"/proc/net/rtl8192/%s/%s\n",
dev->name, f->name);
@@ -694,12 +693,7 @@ void rtl8192_proc_init_one(struct net_device *dev)
void rtl8192_proc_remove_one(struct net_device *dev)
{
- struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
-
- if (priv->dir_dev) {
- remove_proc_subtree(dev->name, rtl8192_proc);
- priv->dir_dev = NULL;
- }
+ remove_proc_subtree(dev->name, rtl8192_proc);
}
/****************************************************************************
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 13/28] airo: Use remove_proc_subtree() [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
` (3 preceding siblings ...)
2013-04-16 18:26 ` [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC] David Howells
@ 2013-04-16 18:26 ` David Howells
2013-04-16 18:26 ` [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC] David Howells
2013-04-16 18:27 ` [PATCH 20/28] hostap: proc: Use remove_proc_subtree() [RFC] David Howells
6 siblings, 0 replies; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fsdevel, linux-wireless, viro
Use remove_proc_subtree() to remove the airo device subdir and all its
children instead of doing it manually.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: linux-wireless@vger.kernel.org
---
drivers/net/wireless/airo.c | 49 +++++++++++--------------------------------
1 file changed, 13 insertions(+), 36 deletions(-)
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 21d0233..6125adb 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -4506,98 +4506,75 @@ static int setup_proc_entry( struct net_device *dev,
apriv->proc_entry = proc_mkdir_mode(apriv->proc_name, airo_perm,
airo_entry);
if (!apriv->proc_entry)
- goto fail;
+ return -ENOMEM;
proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
/* Setup the StatsDelta */
entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_statsdelta_ops, dev);
if (!entry)
- goto fail_stats_delta;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Stats */
entry = proc_create_data("Stats", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_stats_ops, dev);
if (!entry)
- goto fail_stats;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Status */
entry = proc_create_data("Status", S_IRUGO & proc_perm,
apriv->proc_entry, &proc_status_ops, dev);
if (!entry)
- goto fail_status;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the Config */
entry = proc_create_data("Config", proc_perm,
apriv->proc_entry, &proc_config_ops, dev);
if (!entry)
- goto fail_config;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the SSID */
entry = proc_create_data("SSID", proc_perm,
apriv->proc_entry, &proc_SSID_ops, dev);
if (!entry)
- goto fail_ssid;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the APList */
entry = proc_create_data("APList", proc_perm,
apriv->proc_entry, &proc_APList_ops, dev);
if (!entry)
- goto fail_aplist;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the BSSList */
entry = proc_create_data("BSSList", proc_perm,
apriv->proc_entry, &proc_BSSList_ops, dev);
if (!entry)
- goto fail_bsslist;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
/* Setup the WepKey */
entry = proc_create_data("WepKey", proc_perm,
apriv->proc_entry, &proc_wepkey_ops, dev);
if (!entry)
- goto fail_wepkey;
+ goto fail;
proc_set_user(entry, proc_kuid, proc_kgid);
return 0;
-fail_wepkey:
- remove_proc_entry("BSSList", apriv->proc_entry);
-fail_bsslist:
- remove_proc_entry("APList", apriv->proc_entry);
-fail_aplist:
- remove_proc_entry("SSID", apriv->proc_entry);
-fail_ssid:
- remove_proc_entry("Config", apriv->proc_entry);
-fail_config:
- remove_proc_entry("Status", apriv->proc_entry);
-fail_status:
- remove_proc_entry("Stats", apriv->proc_entry);
-fail_stats:
- remove_proc_entry("StatsDelta", apriv->proc_entry);
-fail_stats_delta:
- remove_proc_entry(apriv->proc_name, airo_entry);
fail:
+ remove_proc_subtree(apriv->proc_name, airo_entry);
return -ENOMEM;
}
static int takedown_proc_entry( struct net_device *dev,
- struct airo_info *apriv ) {
- if ( !apriv->proc_entry->namelen ) return 0;
- remove_proc_entry("Stats",apriv->proc_entry);
- remove_proc_entry("StatsDelta",apriv->proc_entry);
- remove_proc_entry("Status",apriv->proc_entry);
- remove_proc_entry("Config",apriv->proc_entry);
- remove_proc_entry("SSID",apriv->proc_entry);
- remove_proc_entry("APList",apriv->proc_entry);
- remove_proc_entry("BSSList",apriv->proc_entry);
- remove_proc_entry("WepKey",apriv->proc_entry);
- remove_proc_entry(apriv->proc_name,airo_entry);
+ struct airo_info *apriv )
+{
+ remove_proc_subtree(apriv->proc_name, airo_entry);
return 0;
}
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
` (4 preceding siblings ...)
2013-04-16 18:26 ` [PATCH 13/28] airo: Use remove_proc_subtree() [RFC] David Howells
@ 2013-04-16 18:26 ` David Howells
2013-04-17 1:01 ` Greg KH
2013-04-16 18:27 ` [PATCH 20/28] hostap: proc: Use remove_proc_subtree() [RFC] David Howells
6 siblings, 1 reply; 15+ messages in thread
From: David Howells @ 2013-04-16 18:26 UTC (permalink / raw)
To: linux-kernel
Cc: devel, Mauro Carvalho Chehab, linux-scsi, Jerry Chuang,
linux-wireless, YAMANE Toshiaki, Maxim Mikityanskiy, viro,
linux-fsdevel
Supply an accessor function for getting the private data from the parent
proc_dir_entry struct of the proc_dir_entry struct associated with an inode.
ReiserFS, for instance, stores the super_block pointer in the proc directory
it makes for that super_block, and a pointer to the respective seq_file show
function in each of the proc files in that directory.
This allows a reduction in the number of file_operations structs, open
functions and seq_operations structs required. The problem otherwise is that
each show function requires two pieces of data but only has storage for one
per PDE (and this has no release function).
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jerry Chuang <jerry-chuang@realtek.com>
cc: Mauro Carvalho Chehab <mchehab@redhat.com>
cc: Maxim Mikityanskiy <maxtram95@gmail.com>
cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
cc: linux-wireless@vger.kernel.org
cc: linux-scsi@vger.kernel.org
cc: devel@driverdev.osuosl.org
---
drivers/scsi/megaraid.c | 2 +-
drivers/staging/rtl8187se/r8180_core.c | 2 +-
drivers/staging/rtl8192u/r8192U_core.c | 2 +-
fs/proc/generic.c | 7 +++++++
include/linux/proc_fs.h | 1 +
5 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index ef3384d..7373255 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -2760,7 +2760,7 @@ proc_show_rdrv_40(struct seq_file *m, void *v)
*/
static int mega_proc_open(struct inode *inode, struct file *file)
{
- adapter_t *adapter = PDE(inode)->parent->data;
+ adapter_t *adapter = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
return single_open(file, show, adapter);
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index ab469ce..f7c1d99 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -296,7 +296,7 @@ void rtl8180_proc_remove_one(struct net_device *dev)
*/
static int rtl8180_proc_open(struct inode *inode, struct file *file)
{
- struct net_device *dev = PDE(inode)->parent->data;
+ struct net_device *dev = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
return single_open(file, show, dev);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
index 27ba2a3..1459233 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -637,7 +637,7 @@ void rtl8192_proc_module_remove(void)
*/
static int rtl8192_proc_open(struct inode *inode, struct file *file)
{
- struct net_device *dev = PDE(inode)->parent->data;
+ struct net_device *dev = proc_get_parent_data(inode);
int (*show)(struct seq_file *, void *) = PDE_DATA(inode);
return single_open(file, show, dev);
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 4074da5..75e08d3 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -617,3 +617,10 @@ int remove_proc_subtree(const char *name, struct proc_dir_entry *parent)
return 0;
}
EXPORT_SYMBOL(remove_proc_subtree);
+
+void *proc_get_parent_data(const struct inode *inode)
+{
+ struct proc_dir_entry *de = PDE(inode);
+ return de->parent->data;
+}
+EXPORT_SYMBOL_GPL(proc_get_parent_data);
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index e5d8f69..12694ef 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -86,6 +86,7 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
extern void proc_set_size(struct proc_dir_entry *, loff_t);
extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
+extern void *proc_get_parent_data(const struct inode *);
#else
static inline void proc_flush_task(struct task_struct *task)
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 20/28] hostap: proc: Use remove_proc_subtree() [RFC]
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
` (5 preceding siblings ...)
2013-04-16 18:26 ` [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC] David Howells
@ 2013-04-16 18:27 ` David Howells
6 siblings, 0 replies; 15+ messages in thread
From: David Howells @ 2013-04-16 18:27 UTC (permalink / raw)
To: linux-kernel
Cc: devel, Jouni Malinen, linux-wireless, viro, linux-fsdevel,
Johannes Berg
Use remove_proc_subtree() rather than remove_proc_entry() to remove a
device-specific proc directory and all its children.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Jouni Malinen <j@w1.fi>
cc: Johannes Berg <johannes@sipsolutions.net>
cc: linux-wireless@vger.kernel.org
cc: devel@driverdev.osuosl.org
---
drivers/net/wireless/hostap/hostap_proc.c | 20 +-------------------
1 file changed, 1 insertion(+), 19 deletions(-)
diff --git a/drivers/net/wireless/hostap/hostap_proc.c b/drivers/net/wireless/hostap/hostap_proc.c
index 89292cf..7491dab 100644
--- a/drivers/net/wireless/hostap/hostap_proc.c
+++ b/drivers/net/wireless/hostap/hostap_proc.c
@@ -496,25 +496,7 @@ void hostap_init_proc(local_info_t *local)
void hostap_remove_proc(local_info_t *local)
{
- if (local->proc != NULL) {
-#ifndef PRISM2_NO_STATION_MODES
- remove_proc_entry("scan_results", local->proc);
-#endif /* PRISM2_NO_STATION_MODES */
-#ifdef PRISM2_IO_DEBUG
- remove_proc_entry("io_debug", local->proc);
-#endif /* PRISM2_IO_DEBUG */
- remove_proc_entry("pda", local->proc);
- remove_proc_entry("aux_dump", local->proc);
- remove_proc_entry("wds", local->proc);
- remove_proc_entry("stats", local->proc);
- remove_proc_entry("bss_list", local->proc);
- remove_proc_entry("crypt", local->proc);
-#ifndef PRISM2_NO_PROCFS_DEBUG
- remove_proc_entry("debug", local->proc);
-#endif /* PRISM2_NO_PROCFS_DEBUG */
- if (hostap_proc != NULL)
- remove_proc_entry(local->proc->name, hostap_proc);
- }
+ remove_proc_subtree(local->ddev->name, hostap_proc);
}
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC]
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
@ 2013-04-16 21:37 ` Mauro Carvalho Chehab
2013-04-18 16:42 ` Bjorn Helgaas
2013-04-25 15:22 ` Vasant Hegde
2 siblings, 0 replies; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-16 21:37 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, alsa-devel, netdev, linux-wireless, netfilter-devel,
viro, linux-pci, linux-fsdevel, linuxppc-dev, linux-media
Em 16-04-2013 15:26, David Howells escreveu:
> 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>
> 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
> ---
>
> arch/powerpc/kernel/proc_powerpc.c | 2 +-
> arch/powerpc/platforms/pseries/reconfig.c | 2 +-
> drivers/media/pci/ttpci/av7110_ir.c | 2 +-
Weird that av7110 IR uses /proc... Well, this is an old, obsolete driver for
hardware that is not sold anymore for a long time... So, be it.
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> drivers/net/irda/vlsi_ir.c | 2 +-
> drivers/net/wireless/airo.c | 34 +++++++++--------------------
> drivers/pci/proc.c | 2 +-
> fs/proc/generic.c | 13 +++++++++++
> include/linux/proc_fs.h | 5 ++++
> kernel/configs.c | 2 +-
> kernel/profile.c | 2 +-
> net/netfilter/xt_recent.c | 3 +--
> sound/core/info.c | 2 +-
> 12 files changed, 38 insertions(+), 33 deletions(-)
>
> diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
> index 41d8ee9..feb8580 100644
> --- a/arch/powerpc/kernel/proc_powerpc.c
> +++ b/arch/powerpc/kernel/proc_powerpc.c
> @@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void)
> &page_map_fops, vdso_data);
> if (!pde)
> return 1;
> - pde->size = PAGE_SIZE;
> + proc_set_size(pde, PAGE_SIZE);
>
> return 0;
> }
> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index d6491bd..f93cdf5 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
>
> ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
> if (ent)
> - ent->size = 0;
> + proc_set_size(ent, 0);
>
> return 0;
> }
> diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c
> index eb82286..0e763a7 100644
> --- a/drivers/media/pci/ttpci/av7110_ir.c
> +++ b/drivers/media/pci/ttpci/av7110_ir.c
> @@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
> if (av_cnt == 1) {
> e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
> if (e)
> - e->size = 4 + 256 * sizeof(u16);
> + proc_set_size(e, 4 + 256 * sizeof(u16));
> }
>
> tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
> diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
> index e22cd4e..5f47584 100644
> --- a/drivers/net/irda/vlsi_ir.c
> +++ b/drivers/net/irda/vlsi_ir.c
> @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> IRDA_WARNING("%s: failed to create proc entry\n",
> __func__);
> } else {
> - ent->size = 0;
> + proc_set_size(ent, 0);
> }
> idev->proc_entry = ent;
> }
> diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
> index 66e398d..21d0233 100644
> --- a/drivers/net/wireless/airo.c
> +++ b/drivers/net/wireless/airo.c
> @@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev,
> airo_entry);
> if (!apriv->proc_entry)
> goto fail;
> - apriv->proc_entry->uid = proc_kuid;
> - apriv->proc_entry->gid = proc_kgid;
> + proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
>
> /* Setup the StatsDelta */
> entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_statsdelta_ops, dev);
> if (!entry)
> goto fail_stats_delta;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Stats */
> entry = proc_create_data("Stats", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_stats_ops, dev);
> if (!entry)
> goto fail_stats;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Status */
> entry = proc_create_data("Status", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_status_ops, dev);
> if (!entry)
> goto fail_status;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Config */
> entry = proc_create_data("Config", proc_perm,
> apriv->proc_entry, &proc_config_ops, dev);
> if (!entry)
> goto fail_config;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the SSID */
> entry = proc_create_data("SSID", proc_perm,
> apriv->proc_entry, &proc_SSID_ops, dev);
> if (!entry)
> goto fail_ssid;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the APList */
> entry = proc_create_data("APList", proc_perm,
> apriv->proc_entry, &proc_APList_ops, dev);
> if (!entry)
> goto fail_aplist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the BSSList */
> entry = proc_create_data("BSSList", proc_perm,
> apriv->proc_entry, &proc_BSSList_ops, dev);
> if (!entry)
> goto fail_bsslist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the WepKey */
> entry = proc_create_data("WepKey", proc_perm,
> apriv->proc_entry, &proc_wepkey_ops, dev);
> if (!entry)
> goto fail_wepkey;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> -
> + proc_set_user(entry, proc_kuid, proc_kgid);
> return 0;
>
> fail_wepkey:
> @@ -5695,10 +5685,8 @@ static int __init airo_init_module( void )
>
> airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
>
> - if (airo_entry) {
> - airo_entry->uid = proc_kuid;
> - airo_entry->gid = proc_kgid;
> - }
> + if (airo_entry)
> + proc_set_user(airo_entry, proc_kuid, proc_kgid);
>
> for (i = 0; i < 4 && io[i] && irq[i]; i++) {
> airo_print_info("", "Trying to configure ISA adapter at irq=%d "
> diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
> index 12e4fb5..7cde7c1 100644
> --- a/drivers/pci/proc.c
> +++ b/drivers/pci/proc.c
> @@ -419,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev)
> &proc_bus_pci_operations, dev);
> if (!e)
> return -ENOMEM;
> - e->size = dev->cfg_size;
> + proc_set_size(e, dev->cfg_size);
> dev->procent = e;
>
> return 0;
> diff --git a/fs/proc/generic.c b/fs/proc/generic.c
> index 1c07cad..5f6f6c3 100644
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -498,6 +498,19 @@ out:
> return NULL;
> }
> EXPORT_SYMBOL(proc_create_data);
> +
> +void proc_set_size(struct proc_dir_entry *de, loff_t size)
> +{
> + de->size = size;
> +}
> +EXPORT_SYMBOL(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(proc_set_user);
>
> static void free_proc_entry(struct proc_dir_entry *de)
> {
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index 805edac..28a4d7e 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -130,6 +130,9 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
> extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> struct proc_dir_entry *parent);
>
> +extern void proc_set_size(struct proc_dir_entry *, loff_t);
> +extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
> +
> extern struct file *proc_ns_fget(int fd);
> extern bool proc_ns_inode(struct inode *inode);
>
> @@ -158,6 +161,8 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
> struct proc_dir_entry *parent) {return NULL;}
> static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
> umode_t mode, struct proc_dir_entry *parent) { return NULL; }
> +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) {}
>
> struct tty_driver;
> static inline void proc_tty_register_driver(struct tty_driver *driver) {};
> diff --git a/kernel/configs.c b/kernel/configs.c
> index 42e8fa0..c18b1f1 100644
> --- a/kernel/configs.c
> +++ b/kernel/configs.c
> @@ -79,7 +79,7 @@ static int __init ikconfig_init(void)
> if (!entry)
> return -ENOMEM;
>
> - entry->size = kernel_config_data_size;
> + proc_set_size(entry, kernel_config_data_size);
>
> return 0;
> }
> diff --git a/kernel/profile.c b/kernel/profile.c
> index 524ce5e..0bf4007 100644
> --- a/kernel/profile.c
> +++ b/kernel/profile.c
> @@ -600,7 +600,7 @@ int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */
> NULL, &proc_profile_operations);
> if (!entry)
> return 0;
> - entry->size = (1+prof_len) * sizeof(atomic_t);
> + proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
> hotcpu_notifier(profile_cpu_callback, 0);
> return 0;
> }
> diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
> index 3db2d38..1e657cf 100644
> --- a/net/netfilter/xt_recent.c
> +++ b/net/netfilter/xt_recent.c
> @@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
> ret = -ENOMEM;
> goto out;
> }
> - pde->uid = uid;
> - pde->gid = gid;
> + proc_set_user(pde, uid, gid);
> #endif
> spin_lock_bh(&recent_lock);
> list_add_tail(&t->list, &recent_net->tables);
> diff --git a/sound/core/info.c b/sound/core/info.c
> index 3aa8864..c7f41c3 100644
> --- a/sound/core/info.c
> +++ b/sound/core/info.c
> @@ -970,7 +970,7 @@ int snd_info_register(struct snd_info_entry * entry)
> mutex_unlock(&info_mutex);
> return -ENOMEM;
> }
> - p->size = entry->size;
> + proc_set_size(p, entry->size);
> }
> entry->p = p;
> if (entry->parent)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
@ 2013-04-16 21:39 ` Mauro Carvalho Chehab
2013-04-17 0:58 ` Greg KH
1 sibling, 0 replies; 15+ messages in thread
From: Mauro Carvalho Chehab @ 2013-04-16 21:39 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, Neela Syam Kolli, devel, linux-scsi, Jerry Chuang,
linux-wireless, viro, linux-fsdevel
Em 16-04-2013 15:26, David Howells escreveu:
> Add proc_mkdir_data() to allow procfs directories to be created that are
> annotated at the time of creation with private data rather than doing this
> post-creation. This means no access is then required to the proc_dir_entry
> struct to set this.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Neela Syam Kolli <megaraidlinux@lsi.com>
> cc: Jerry Chuang <jerry-chuang@realtek.com>
> cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> cc: linux-scsi@vger.kernel.org
> cc: devel@driverdev.osuosl.org
> cc: linux-wireless@vger.kernel.org
> ---
>
> drivers/message/i2o/i2o_proc.c | 8 ++------
> drivers/scsi/megaraid.c | 4 ++--
> drivers/staging/rtl8192u/r8192U_core.c | 3 +--
For the three patches that touch rtl8192u (patches 10, 12 and 14):
Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com>
> fs/proc/generic.c | 30 ++++++++++++------------------
> include/linux/proc_fs.h | 11 ++++++++---
> 5 files changed, 25 insertions(+), 31 deletions(-)
>
> diff --git a/drivers/message/i2o/i2o_proc.c b/drivers/message/i2o/i2o_proc.c
> index 70a840f..b7d87cd 100644
> --- a/drivers/message/i2o/i2o_proc.c
> +++ b/drivers/message/i2o/i2o_proc.c
> @@ -1913,14 +1913,12 @@ static void i2o_proc_device_add(struct proc_dir_entry *dir,
>
> osm_debug("adding device /proc/i2o/%s/%s\n", dev->iop->name, buff);
>
> - devdir = proc_mkdir(buff, dir);
> + devdir = proc_mkdir_data(buff, 0, dir, dev);
> if (!devdir) {
> osm_warn("Could not allocate procdir!\n");
> return;
> }
>
> - devdir->data = dev;
> -
> i2o_proc_create_entries(devdir, generic_dev_entries, dev);
>
> /* Inform core that we want updates about this device's status */
> @@ -1954,12 +1952,10 @@ static int i2o_proc_iop_add(struct proc_dir_entry *dir,
>
> osm_debug("adding IOP /proc/i2o/%s\n", c->name);
>
> - iopdir = proc_mkdir(c->name, dir);
> + iopdir = proc_mkdir_data(c->name, 0, dir, c);
> if (!iopdir)
> return -1;
>
> - iopdir->data = c;
> -
> i2o_proc_create_entries(iopdir, i2o_proc_generic_iop_entries, c);
>
> list_for_each_entry(dev, &c->devices, list)
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
> index a1c90bd..ef3384d 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -2818,12 +2818,12 @@ mega_create_proc_entry(int index, struct proc_dir_entry *parent)
>
> sprintf(string, "hba%d", adapter->host->host_no);
>
> - dir = adapter->controller_proc_dir_entry = proc_mkdir(string, parent);
> + dir = adapter->controller_proc_dir_entry =
> + proc_mkdir_data(string, 0, parent, adapter);
> if(!dir) {
> printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
> return;
> }
> - dir->data = adapter;
>
> for (f = mega_proc_files; f->name; f++) {
> de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops,
> diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c
> index 433c3df..d81d7d5 100644
> --- a/drivers/staging/rtl8192u/r8192U_core.c
> +++ b/drivers/staging/rtl8192u/r8192U_core.c
> @@ -672,13 +672,12 @@ void rtl8192_proc_init_one(struct net_device *dev)
> struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
>
> if (rtl8192_proc) {
> - priv->dir_dev = proc_mkdir(dev->name, rtl8192_proc);
> + priv->dir_dev = proc_mkdir_data(dev->name, 0, rtl8192_proc, dev);
> if (!priv->dir_dev) {
> RT_TRACE(COMP_ERR, "Unable to initialize /proc/net/rtl8192/%s\n",
> dev->name);
> return;
> }
> - priv->dir_dev->data = dev;
>
> for (f = rtl8192_proc_files; f->name[0]; f++) {
> if (!proc_create_data(f->name, S_IFREG | S_IRUGO,
> diff --git a/fs/proc/generic.c b/fs/proc/generic.c
> index 5f6f6c3..4074da5 100644
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -428,13 +428,17 @@ struct proc_dir_entry *proc_symlink(const char *name,
> }
> EXPORT_SYMBOL(proc_symlink);
>
> -struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
> - struct proc_dir_entry *parent)
> +struct proc_dir_entry *proc_mkdir_data(const char *name, umode_t mode,
> + struct proc_dir_entry *parent, void *data)
> {
> struct proc_dir_entry *ent;
>
> + if (mode == 0)
> + mode = S_IRUGO | S_IXUGO;
> +
> ent = __proc_create(&parent, name, S_IFDIR | mode, 2);
> if (ent) {
> + ent->data = data;
> if (proc_register(parent, ent) < 0) {
> kfree(ent);
> ent = NULL;
> @@ -442,29 +446,19 @@ struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
> }
> return ent;
> }
> -EXPORT_SYMBOL(proc_mkdir_mode);
> +EXPORT_SYMBOL_GPL(proc_mkdir_data);
>
> -struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> - struct proc_dir_entry *parent)
> +struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
> + struct proc_dir_entry *parent)
> {
> - struct proc_dir_entry *ent;
> -
> - ent = __proc_create(&parent, name, S_IFDIR | S_IRUGO | S_IXUGO, 2);
> - if (ent) {
> - ent->data = net;
> - if (proc_register(parent, ent) < 0) {
> - kfree(ent);
> - ent = NULL;
> - }
> - }
> - return ent;
> + return proc_mkdir_data(name, mode, parent, NULL);
> }
> -EXPORT_SYMBOL_GPL(proc_net_mkdir);
> +EXPORT_SYMBOL(proc_mkdir_mode);
>
> struct proc_dir_entry *proc_mkdir(const char *name,
> struct proc_dir_entry *parent)
> {
> - return proc_mkdir_mode(name, S_IRUGO | S_IXUGO, parent);
> + return proc_mkdir_data(name, 0, parent, NULL);
> }
> EXPORT_SYMBOL(proc_mkdir);
>
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index 80d9e24..e5d8f69 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -73,6 +73,8 @@ extern int remove_proc_subtree(const char *name, struct proc_dir_entry *parent);
> extern struct proc_dir_entry *proc_symlink(const char *,
> struct proc_dir_entry *, const char *);
> extern struct proc_dir_entry *proc_mkdir(const char *,struct proc_dir_entry *);
> +extern struct proc_dir_entry *proc_mkdir_data(const char *, umode_t,
> + struct proc_dir_entry *, void *);
> extern struct proc_dir_entry *proc_mkdir_mode(const char *name, umode_t mode,
> struct proc_dir_entry *parent);
>
> @@ -82,9 +84,6 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
> return proc_create_data(name, mode, parent, proc_fops, NULL);
> }
>
> -extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> - struct proc_dir_entry *parent);
> -
> 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
> @@ -153,4 +152,10 @@ static inline void *PDE_DATA(const struct inode *inode)
> return PROC_I(inode)->pde->data;
> }
>
> +static inline struct proc_dir_entry *proc_net_mkdir(
> + struct net *net, const char *name, struct proc_dir_entry *parent)
> +{
> + return proc_mkdir_data(name, 0, parent, net);
> +}
> +
> #endif /* _LINUX_PROC_FS_H */
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
2013-04-16 21:39 ` Mauro Carvalho Chehab
@ 2013-04-17 0:58 ` Greg KH
1 sibling, 0 replies; 15+ messages in thread
From: Greg KH @ 2013-04-17 0:58 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, Neela Syam Kolli, devel, Mauro Carvalho Chehab,
linux-scsi, Jerry Chuang, linux-wireless, viro, linux-fsdevel
On Tue, Apr 16, 2013 at 07:26:30PM +0100, David Howells wrote:
> Add proc_mkdir_data() to allow procfs directories to be created that are
> annotated at the time of creation with private data rather than doing this
> post-creation. This means no access is then required to the proc_dir_entry
> struct to set this.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Neela Syam Kolli <megaraidlinux@lsi.com>
> cc: Jerry Chuang <jerry-chuang@realtek.com>
> cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> cc: linux-scsi@vger.kernel.org
> cc: devel@driverdev.osuosl.org
> cc: linux-wireless@vger.kernel.org
> ---
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC]
2013-04-16 18:26 ` [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC] David Howells
@ 2013-04-17 0:59 ` Greg KH
0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2013-04-17 0:59 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, devel, linux-wireless, YAMANE Toshiaki,
Maxim Mikityanskiy, viro, linux-fsdevel
On Tue, Apr 16, 2013 at 07:26:35PM +0100, David Howells wrote:
> Create a dir under /proc/net/r8180/ named for the device and create that
> device's files under there. This means that there won't be a problem for
> multiple devices in the system (if such is possible) and it means we don't
> need to save the 'device directory' PDE any more as we can just do a proc
> subtree removal.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Maxim Mikityanskiy <maxtram95@gmail.com>
> cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
> cc: linux-wireless@vger.kernel.org
> cc: devel@driverdev.osuosl.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC]
2013-04-16 18:26 ` [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC] David Howells
@ 2013-04-17 1:00 ` Greg KH
0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2013-04-17 1:00 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, devel, Mauro Carvalho Chehab, Jerry Chuang,
linux-wireless, viro, linux-fsdevel
On Tue, Apr 16, 2013 at 07:26:39PM +0100, David Howells wrote:
> Don't need to save the PDE of a directory created under /proc/net/rtl8192/ as
> we can use proc subtree deletion to get rid of it and all its children.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jerry Chuang <jerry-chuang@realtek.com>
> cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> cc: linux-wireless@vger.kernel.org
> cc: devel@driverdev.osuosl.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC]
2013-04-16 18:26 ` [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC] David Howells
@ 2013-04-17 1:01 ` Greg KH
0 siblings, 0 replies; 15+ messages in thread
From: Greg KH @ 2013-04-17 1:01 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, devel, Mauro Carvalho Chehab, linux-scsi,
Jerry Chuang, linux-wireless, YAMANE Toshiaki, Maxim Mikityanskiy,
viro, linux-fsdevel
On Tue, Apr 16, 2013 at 07:26:46PM +0100, David Howells wrote:
> Supply an accessor function for getting the private data from the parent
> proc_dir_entry struct of the proc_dir_entry struct associated with an inode.
>
> ReiserFS, for instance, stores the super_block pointer in the proc directory
> it makes for that super_block, and a pointer to the respective seq_file show
> function in each of the proc files in that directory.
>
> This allows a reduction in the number of file_operations structs, open
> functions and seq_operations structs required. The problem otherwise is that
> each show function requires two pieces of data but only has storage for one
> per PDE (and this has no release function).
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Jerry Chuang <jerry-chuang@realtek.com>
> cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> cc: Maxim Mikityanskiy <maxtram95@gmail.com>
> cc: YAMANE Toshiaki <yamanetoshi@gmail.com>
> cc: linux-wireless@vger.kernel.org
> cc: linux-scsi@vger.kernel.org
> cc: devel@driverdev.osuosl.org
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC]
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
2013-04-16 21:37 ` Mauro Carvalho Chehab
@ 2013-04-18 16:42 ` Bjorn Helgaas
2013-04-25 15:22 ` Vasant Hegde
2 siblings, 0 replies; 15+ messages in thread
From: Bjorn Helgaas @ 2013-04-18 16:42 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel@vger.kernel.org, alsa-devel, netdev, linux-wireless,
netfilter-devel, Al Viro, linux-pci@vger.kernel.org,
linux-fsdevel, linuxppc-dev, linux-media
On Tue, Apr 16, 2013 at 12:26 PM, David Howells <dhowells@redhat.com> wrote:
> 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>
> 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
> ---
>
> arch/powerpc/kernel/proc_powerpc.c | 2 +-
> arch/powerpc/platforms/pseries/reconfig.c | 2 +-
> drivers/media/pci/ttpci/av7110_ir.c | 2 +-
> drivers/net/irda/vlsi_ir.c | 2 +-
> drivers/net/wireless/airo.c | 34 +++++++++--------------------
> drivers/pci/proc.c | 2 +-
For the drivers/pci part:
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> fs/proc/generic.c | 13 +++++++++++
> include/linux/proc_fs.h | 5 ++++
> kernel/configs.c | 2 +-
> kernel/profile.c | 2 +-
> net/netfilter/xt_recent.c | 3 +--
> sound/core/info.c | 2 +-
> 12 files changed, 38 insertions(+), 33 deletions(-)
>
> diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
> index 41d8ee9..feb8580 100644
> --- a/arch/powerpc/kernel/proc_powerpc.c
> +++ b/arch/powerpc/kernel/proc_powerpc.c
> @@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void)
> &page_map_fops, vdso_data);
> if (!pde)
> return 1;
> - pde->size = PAGE_SIZE;
> + proc_set_size(pde, PAGE_SIZE);
>
> return 0;
> }
> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index d6491bd..f93cdf5 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
>
> ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
> if (ent)
> - ent->size = 0;
> + proc_set_size(ent, 0);
>
> return 0;
> }
> diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c
> index eb82286..0e763a7 100644
> --- a/drivers/media/pci/ttpci/av7110_ir.c
> +++ b/drivers/media/pci/ttpci/av7110_ir.c
> @@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
> if (av_cnt == 1) {
> e = proc_create("av7110_ir", S_IWUSR, NULL, &av7110_ir_proc_fops);
> if (e)
> - e->size = 4 + 256 * sizeof(u16);
> + proc_set_size(e, 4 + 256 * sizeof(u16));
> }
>
> tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long) &av7110->ir);
> diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
> index e22cd4e..5f47584 100644
> --- a/drivers/net/irda/vlsi_ir.c
> +++ b/drivers/net/irda/vlsi_ir.c
> @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> IRDA_WARNING("%s: failed to create proc entry\n",
> __func__);
> } else {
> - ent->size = 0;
> + proc_set_size(ent, 0);
> }
> idev->proc_entry = ent;
> }
> diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
> index 66e398d..21d0233 100644
> --- a/drivers/net/wireless/airo.c
> +++ b/drivers/net/wireless/airo.c
> @@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev,
> airo_entry);
> if (!apriv->proc_entry)
> goto fail;
> - apriv->proc_entry->uid = proc_kuid;
> - apriv->proc_entry->gid = proc_kgid;
> + proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
>
> /* Setup the StatsDelta */
> entry = proc_create_data("StatsDelta", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_statsdelta_ops, dev);
> if (!entry)
> goto fail_stats_delta;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Stats */
> entry = proc_create_data("Stats", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_stats_ops, dev);
> if (!entry)
> goto fail_stats;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Status */
> entry = proc_create_data("Status", S_IRUGO & proc_perm,
> apriv->proc_entry, &proc_status_ops, dev);
> if (!entry)
> goto fail_status;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Config */
> entry = proc_create_data("Config", proc_perm,
> apriv->proc_entry, &proc_config_ops, dev);
> if (!entry)
> goto fail_config;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the SSID */
> entry = proc_create_data("SSID", proc_perm,
> apriv->proc_entry, &proc_SSID_ops, dev);
> if (!entry)
> goto fail_ssid;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the APList */
> entry = proc_create_data("APList", proc_perm,
> apriv->proc_entry, &proc_APList_ops, dev);
> if (!entry)
> goto fail_aplist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the BSSList */
> entry = proc_create_data("BSSList", proc_perm,
> apriv->proc_entry, &proc_BSSList_ops, dev);
> if (!entry)
> goto fail_bsslist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the WepKey */
> entry = proc_create_data("WepKey", proc_perm,
> apriv->proc_entry, &proc_wepkey_ops, dev);
> if (!entry)
> goto fail_wepkey;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> -
> + proc_set_user(entry, proc_kuid, proc_kgid);
> return 0;
>
> fail_wepkey:
> @@ -5695,10 +5685,8 @@ static int __init airo_init_module( void )
>
> airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
>
> - if (airo_entry) {
> - airo_entry->uid = proc_kuid;
> - airo_entry->gid = proc_kgid;
> - }
> + if (airo_entry)
> + proc_set_user(airo_entry, proc_kuid, proc_kgid);
>
> for (i = 0; i < 4 && io[i] && irq[i]; i++) {
> airo_print_info("", "Trying to configure ISA adapter at irq=%d "
> diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
> index 12e4fb5..7cde7c1 100644
> --- a/drivers/pci/proc.c
> +++ b/drivers/pci/proc.c
> @@ -419,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev)
> &proc_bus_pci_operations, dev);
> if (!e)
> return -ENOMEM;
> - e->size = dev->cfg_size;
> + proc_set_size(e, dev->cfg_size);
> dev->procent = e;
>
> return 0;
> diff --git a/fs/proc/generic.c b/fs/proc/generic.c
> index 1c07cad..5f6f6c3 100644
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -498,6 +498,19 @@ out:
> return NULL;
> }
> EXPORT_SYMBOL(proc_create_data);
> +
> +void proc_set_size(struct proc_dir_entry *de, loff_t size)
> +{
> + de->size = size;
> +}
> +EXPORT_SYMBOL(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(proc_set_user);
>
> static void free_proc_entry(struct proc_dir_entry *de)
> {
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index 805edac..28a4d7e 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -130,6 +130,9 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
> extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> struct proc_dir_entry *parent);
>
> +extern void proc_set_size(struct proc_dir_entry *, loff_t);
> +extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
> +
> extern struct file *proc_ns_fget(int fd);
> extern bool proc_ns_inode(struct inode *inode);
>
> @@ -158,6 +161,8 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
> struct proc_dir_entry *parent) {return NULL;}
> static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
> umode_t mode, struct proc_dir_entry *parent) { return NULL; }
> +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) {}
>
> struct tty_driver;
> static inline void proc_tty_register_driver(struct tty_driver *driver) {};
> diff --git a/kernel/configs.c b/kernel/configs.c
> index 42e8fa0..c18b1f1 100644
> --- a/kernel/configs.c
> +++ b/kernel/configs.c
> @@ -79,7 +79,7 @@ static int __init ikconfig_init(void)
> if (!entry)
> return -ENOMEM;
>
> - entry->size = kernel_config_data_size;
> + proc_set_size(entry, kernel_config_data_size);
>
> return 0;
> }
> diff --git a/kernel/profile.c b/kernel/profile.c
> index 524ce5e..0bf4007 100644
> --- a/kernel/profile.c
> +++ b/kernel/profile.c
> @@ -600,7 +600,7 @@ int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */
> NULL, &proc_profile_operations);
> if (!entry)
> return 0;
> - entry->size = (1+prof_len) * sizeof(atomic_t);
> + proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
> hotcpu_notifier(profile_cpu_callback, 0);
> return 0;
> }
> diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
> index 3db2d38..1e657cf 100644
> --- a/net/netfilter/xt_recent.c
> +++ b/net/netfilter/xt_recent.c
> @@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
> ret = -ENOMEM;
> goto out;
> }
> - pde->uid = uid;
> - pde->gid = gid;
> + proc_set_user(pde, uid, gid);
> #endif
> spin_lock_bh(&recent_lock);
> list_add_tail(&t->list, &recent_net->tables);
> diff --git a/sound/core/info.c b/sound/core/info.c
> index 3aa8864..c7f41c3 100644
> --- a/sound/core/info.c
> +++ b/sound/core/info.c
> @@ -970,7 +970,7 @@ int snd_info_register(struct snd_info_entry * entry)
> mutex_unlock(&info_mutex);
> return -ENOMEM;
> }
> - p->size = entry->size;
> + proc_set_size(p, entry->size);
> }
> entry->p = p;
> if (entry->parent)
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC]
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
2013-04-16 21:37 ` Mauro Carvalho Chehab
2013-04-18 16:42 ` Bjorn Helgaas
@ 2013-04-25 15:22 ` Vasant Hegde
2 siblings, 0 replies; 15+ messages in thread
From: Vasant Hegde @ 2013-04-25 15:22 UTC (permalink / raw)
To: David Howells
Cc: linux-kernel, alsa-devel, linux-pci, linux-wireless,
netfilter-devel, viro, netdev, linux-fsdevel, linuxppc-dev,
linux-media
On 04/16/2013 11:56 PM, David Howells wrote:
> 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>
> 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
> ---
>
> arch/powerpc/kernel/proc_powerpc.c | 2 +-
> arch/powerpc/platforms/pseries/reconfig.c | 2 +-
arch/powerpc side changes looks good.
-Vasant
> drivers/media/pci/ttpci/av7110_ir.c | 2 +-
> drivers/net/irda/vlsi_ir.c | 2 +-
> drivers/net/wireless/airo.c | 34 +++++++++--------------------
> drivers/pci/proc.c | 2 +-
> fs/proc/generic.c | 13 +++++++++++
> include/linux/proc_fs.h | 5 ++++
> kernel/configs.c | 2 +-
> kernel/profile.c | 2 +-
> net/netfilter/xt_recent.c | 3 +--
> sound/core/info.c | 2 +-
> 12 files changed, 38 insertions(+), 33 deletions(-)
>
> diff --git a/arch/powerpc/kernel/proc_powerpc.c b/arch/powerpc/kernel/proc_powerpc.c
> index 41d8ee9..feb8580 100644
> --- a/arch/powerpc/kernel/proc_powerpc.c
> +++ b/arch/powerpc/kernel/proc_powerpc.c
> @@ -83,7 +83,7 @@ static int __init proc_ppc64_init(void)
> &page_map_fops, vdso_data);
> if (!pde)
> return 1;
> - pde->size = PAGE_SIZE;
> + proc_set_size(pde, PAGE_SIZE);
>
> return 0;
> }
> diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
> index d6491bd..f93cdf5 100644
> --- a/arch/powerpc/platforms/pseries/reconfig.c
> +++ b/arch/powerpc/platforms/pseries/reconfig.c
> @@ -452,7 +452,7 @@ static int proc_ppc64_create_ofdt(void)
>
> ent = proc_create("powerpc/ofdt", S_IWUSR, NULL,&ofdt_fops);
> if (ent)
> - ent->size = 0;
> + proc_set_size(ent, 0);
>
> return 0;
> }
> diff --git a/drivers/media/pci/ttpci/av7110_ir.c b/drivers/media/pci/ttpci/av7110_ir.c
> index eb82286..0e763a7 100644
> --- a/drivers/media/pci/ttpci/av7110_ir.c
> +++ b/drivers/media/pci/ttpci/av7110_ir.c
> @@ -375,7 +375,7 @@ int av7110_ir_init(struct av7110 *av7110)
> if (av_cnt == 1) {
> e = proc_create("av7110_ir", S_IWUSR, NULL,&av7110_ir_proc_fops);
> if (e)
> - e->size = 4 + 256 * sizeof(u16);
> + proc_set_size(e, 4 + 256 * sizeof(u16));
> }
>
> tasklet_init(&av7110->ir.ir_tasklet, av7110_emit_key, (unsigned long)&av7110->ir);
> diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c
> index e22cd4e..5f47584 100644
> --- a/drivers/net/irda/vlsi_ir.c
> +++ b/drivers/net/irda/vlsi_ir.c
> @@ -1678,7 +1678,7 @@ vlsi_irda_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> IRDA_WARNING("%s: failed to create proc entry\n",
> __func__);
> } else {
> - ent->size = 0;
> + proc_set_size(ent, 0);
> }
> idev->proc_entry = ent;
> }
> diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
> index 66e398d..21d0233 100644
> --- a/drivers/net/wireless/airo.c
> +++ b/drivers/net/wireless/airo.c
> @@ -4507,73 +4507,63 @@ static int setup_proc_entry( struct net_device *dev,
> airo_entry);
> if (!apriv->proc_entry)
> goto fail;
> - apriv->proc_entry->uid = proc_kuid;
> - apriv->proc_entry->gid = proc_kgid;
> + proc_set_user(apriv->proc_entry, proc_kuid, proc_kgid);
>
> /* Setup the StatsDelta */
> entry = proc_create_data("StatsDelta", S_IRUGO& proc_perm,
> apriv->proc_entry,&proc_statsdelta_ops, dev);
> if (!entry)
> goto fail_stats_delta;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Stats */
> entry = proc_create_data("Stats", S_IRUGO& proc_perm,
> apriv->proc_entry,&proc_stats_ops, dev);
> if (!entry)
> goto fail_stats;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Status */
> entry = proc_create_data("Status", S_IRUGO& proc_perm,
> apriv->proc_entry,&proc_status_ops, dev);
> if (!entry)
> goto fail_status;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the Config */
> entry = proc_create_data("Config", proc_perm,
> apriv->proc_entry,&proc_config_ops, dev);
> if (!entry)
> goto fail_config;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the SSID */
> entry = proc_create_data("SSID", proc_perm,
> apriv->proc_entry,&proc_SSID_ops, dev);
> if (!entry)
> goto fail_ssid;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the APList */
> entry = proc_create_data("APList", proc_perm,
> apriv->proc_entry,&proc_APList_ops, dev);
> if (!entry)
> goto fail_aplist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the BSSList */
> entry = proc_create_data("BSSList", proc_perm,
> apriv->proc_entry,&proc_BSSList_ops, dev);
> if (!entry)
> goto fail_bsslist;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> + proc_set_user(entry, proc_kuid, proc_kgid);
>
> /* Setup the WepKey */
> entry = proc_create_data("WepKey", proc_perm,
> apriv->proc_entry,&proc_wepkey_ops, dev);
> if (!entry)
> goto fail_wepkey;
> - entry->uid = proc_kuid;
> - entry->gid = proc_kgid;
> -
> + proc_set_user(entry, proc_kuid, proc_kgid);
> return 0;
>
> fail_wepkey:
> @@ -5695,10 +5685,8 @@ static int __init airo_init_module( void )
>
> airo_entry = proc_mkdir_mode("driver/aironet", airo_perm, NULL);
>
> - if (airo_entry) {
> - airo_entry->uid = proc_kuid;
> - airo_entry->gid = proc_kgid;
> - }
> + if (airo_entry)
> + proc_set_user(airo_entry, proc_kuid, proc_kgid);
>
> for (i = 0; i< 4&& io[i]&& irq[i]; i++) {
> airo_print_info("", "Trying to configure ISA adapter at irq=%d "
> diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
> index 12e4fb5..7cde7c1 100644
> --- a/drivers/pci/proc.c
> +++ b/drivers/pci/proc.c
> @@ -419,7 +419,7 @@ int pci_proc_attach_device(struct pci_dev *dev)
> &proc_bus_pci_operations, dev);
> if (!e)
> return -ENOMEM;
> - e->size = dev->cfg_size;
> + proc_set_size(e, dev->cfg_size);
> dev->procent = e;
>
> return 0;
> diff --git a/fs/proc/generic.c b/fs/proc/generic.c
> index 1c07cad..5f6f6c3 100644
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -498,6 +498,19 @@ out:
> return NULL;
> }
> EXPORT_SYMBOL(proc_create_data);
> +
> +void proc_set_size(struct proc_dir_entry *de, loff_t size)
> +{
> + de->size = size;
> +}
> +EXPORT_SYMBOL(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(proc_set_user);
>
> static void free_proc_entry(struct proc_dir_entry *de)
> {
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index 805edac..28a4d7e 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -130,6 +130,9 @@ static inline struct proc_dir_entry *proc_create(const char *name, umode_t mode,
> extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name,
> struct proc_dir_entry *parent);
>
> +extern void proc_set_size(struct proc_dir_entry *, loff_t);
> +extern void proc_set_user(struct proc_dir_entry *, kuid_t, kgid_t);
> +
> extern struct file *proc_ns_fget(int fd);
> extern bool proc_ns_inode(struct inode *inode);
>
> @@ -158,6 +161,8 @@ static inline struct proc_dir_entry *proc_mkdir(const char *name,
> struct proc_dir_entry *parent) {return NULL;}
> static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
> umode_t mode, struct proc_dir_entry *parent) { return NULL; }
> +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) {}
>
> struct tty_driver;
> static inline void proc_tty_register_driver(struct tty_driver *driver) {};
> diff --git a/kernel/configs.c b/kernel/configs.c
> index 42e8fa0..c18b1f1 100644
> --- a/kernel/configs.c
> +++ b/kernel/configs.c
> @@ -79,7 +79,7 @@ static int __init ikconfig_init(void)
> if (!entry)
> return -ENOMEM;
>
> - entry->size = kernel_config_data_size;
> + proc_set_size(entry, kernel_config_data_size);
>
> return 0;
> }
> diff --git a/kernel/profile.c b/kernel/profile.c
> index 524ce5e..0bf4007 100644
> --- a/kernel/profile.c
> +++ b/kernel/profile.c
> @@ -600,7 +600,7 @@ int __ref create_proc_profile(void) /* false positive from hotcpu_notifier */
> NULL,&proc_profile_operations);
> if (!entry)
> return 0;
> - entry->size = (1+prof_len) * sizeof(atomic_t);
> + proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
> hotcpu_notifier(profile_cpu_callback, 0);
> return 0;
> }
> diff --git a/net/netfilter/xt_recent.c b/net/netfilter/xt_recent.c
> index 3db2d38..1e657cf 100644
> --- a/net/netfilter/xt_recent.c
> +++ b/net/netfilter/xt_recent.c
> @@ -401,8 +401,7 @@ static int recent_mt_check(const struct xt_mtchk_param *par,
> ret = -ENOMEM;
> goto out;
> }
> - pde->uid = uid;
> - pde->gid = gid;
> + proc_set_user(pde, uid, gid);
> #endif
> spin_lock_bh(&recent_lock);
> list_add_tail(&t->list,&recent_net->tables);
> diff --git a/sound/core/info.c b/sound/core/info.c
> index 3aa8864..c7f41c3 100644
> --- a/sound/core/info.c
> +++ b/sound/core/info.c
> @@ -970,7 +970,7 @@ int snd_info_register(struct snd_info_entry * entry)
> mutex_unlock(&info_mutex);
> return -ENOMEM;
> }
> - p->size = entry->size;
> + proc_set_size(p, entry->size);
> }
> entry->p = p;
> if (entry->parent)
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2013-04-25 15:23 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20130416182550.27773.89310.stgit@warthog.procyon.org.uk>
2013-04-16 18:26 ` [PATCH 04/28] proc: Supply PDE attribute setting accessor functions [RFC] David Howells
2013-04-16 21:37 ` Mauro Carvalho Chehab
2013-04-18 16:42 ` Bjorn Helgaas
2013-04-25 15:22 ` Vasant Hegde
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
2013-04-16 21:39 ` Mauro Carvalho Chehab
2013-04-17 0:58 ` Greg KH
2013-04-16 18:26 ` [PATCH 11/28] rtl8187se: Use a dir under /proc/net/r8180/ [RFC] David Howells
2013-04-17 0:59 ` Greg KH
2013-04-16 18:26 ` [PATCH 12/28] rtl8192u: Don't need to save device proc dir PDE [RFC] David Howells
2013-04-17 1:00 ` Greg KH
2013-04-16 18:26 ` [PATCH 13/28] airo: Use remove_proc_subtree() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 14/28] proc: Supply an accessor for getting the data from a PDE's parent [RFC] David Howells
2013-04-17 1:01 ` Greg KH
2013-04-16 18:27 ` [PATCH 20/28] hostap: proc: Use remove_proc_subtree() [RFC] David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).