From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org,
Neela Syam Kolli <megaraidlinux@lsi.com>,
devel@driverdev.osuosl.org, linux-scsi@vger.kernel.org,
Jerry Chuang <jerry-chuang@realtek.com>,
linux-wireless@vger.kernel.org, viro@zeniv.linux.org.uk,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH 10/28] proc: Add proc_mkdir_data() [RFC]
Date: Tue, 16 Apr 2013 18:39:55 -0300 [thread overview]
Message-ID: <516DC52B.7090705@redhat.com> (raw)
In-Reply-To: <20130416182630.27773.83021.stgit@warthog.procyon.org.uk>
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 */
>
next prev parent reply other threads:[~2013-04-16 21:39 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 18:25 [PATCH 00/28] Privatise procfs internals [RFC] David Howells
2013-04-16 18:25 ` [PATCH 01/28] Include missing linux/slab.h inclusions [RFC] David Howells
[not found] ` <20130416182554.27773.86004.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-17 0:56 ` Greg KH
2013-04-16 18:25 ` [PATCH 02/28] Include missing linux/magic.h " David Howells
2013-04-16 18:26 ` [PATCH 03/28] proc: Split kcore bits from linux/procfs.h into linux/kcore.h [RFC] David Howells
2013-04-16 21:37 ` KOSAKI Motohiro
2013-04-16 22:07 ` David Howells
2013-04-16 22:13 ` KOSAKI Motohiro
2013-04-17 9:13 ` Ralf Baechle
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
[not found] ` <20130416182606.27773.55054.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-25 15:22 ` Vasant Hegde
2013-04-16 18:26 ` [PATCH 05/28] proc: Uninline pid_delete_dentry() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 06/28] proc: Move proc_fd() to fs/proc/fd.h [RFC] David Howells
2013-04-16 18:26 ` [PATCH 07/28] proc: Split the namespace stuff out into linux/proc_ns.h [RFC] David Howells
2013-04-16 18:26 ` [PATCH 08/28] proc: Move PDE_NET() to fs/proc/proc_net.c [RFC] David Howells
2013-04-16 18:26 ` [PATCH 09/28] proc: Move some bits from linux/proc_fs.h to linux/{of.h, signal.h, tty.h} [RFC] David Howells
2013-04-17 0:57 ` Greg Kroah-Hartman
2013-04-17 14:59 ` Grant Likely
2013-04-16 18:26 ` [PATCH 10/28] proc: Add proc_mkdir_data() [RFC] David Howells
2013-04-16 21:39 ` Mauro Carvalho Chehab [this message]
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
[not found] ` <20130416182635.27773.93633.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
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
[not found] ` <20130416182639.27773.60503.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
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:26 ` [PATCH 15/28] reiserfs: Don't access the proc_dir_entry in r_open(), r_start() r_show() [RFC] David Howells
2013-04-16 18:26 ` [PATCH 16/28] zoran: Don't print proc_dir_entry data in debug [RFC] David Howells
2013-04-16 21:32 ` Mauro Carvalho Chehab
2013-04-16 18:26 ` [PATCH 17/28] drm: Constify drm_proc_list[] [RFC] David Howells
2013-04-16 18:27 ` [PATCH 18/28] drm: proc: Use minor->index to label things, not PDE->name [RFC] David Howells
2013-04-16 18:27 ` [PATCH 19/28] drm: proc: Use remove_proc_subtree() [RFC] David Howells
2013-04-16 18:27 ` [PATCH 21/28] dgrp: Clean up the use of procfs [RFC] David Howells
2013-04-17 1:02 ` Greg KH
2013-04-16 18:27 ` [PATCH 22/28] ppc: Clean up rtas_flash driver somewhat [RFC] David Howells
2013-04-25 14:33 ` Vasant Hegde
2013-04-16 18:27 ` [PATCH 23/28] ppc: Clean up scanlog [RFC] David Howells
2013-04-25 15:01 ` Vasant Hegde
2013-04-16 18:27 ` [PATCH 24/28] proc: Supply an accessor to get the name in a proc_dir_entry struct [RFC] David Howells
2013-04-16 22:20 ` Harald Welte
[not found] ` <20130416182550.27773.89310.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-16 18:27 ` [PATCH 20/28] hostap: proc: Use remove_proc_subtree() [RFC] David Howells
2013-04-16 18:27 ` [PATCH 25/28] proc: Supply an accessor to get the process ID associated with some proc files [RFC] David Howells
[not found] ` <20130416182730.27773.88726.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2013-04-17 1:53 ` Li Zefan
2013-04-18 18:39 ` Tejun Heo
2013-04-16 18:27 ` [PATCH 26/28] proc: Supply a function to remove a proc entry by PDE [RFC] David Howells
2013-04-17 15:03 ` Grant Likely
2013-04-18 16:41 ` Bjorn Helgaas
2013-04-18 20:34 ` David Howells
2013-04-21 22:01 ` Rafael J. Wysocki
2013-04-16 18:27 ` [PATCH 27/28] proc: Make the PROC_I() and PDE() macros internal to procfs [RFC] David Howells
2013-04-16 18:27 ` [PATCH 28/28] proc: Move non-public stuff from linux/proc_fs.h to fs/proc/internal.h [RFC] David Howells
2013-05-01 20:51 ` [PATCH 00/28] Privatise procfs internals [RFC] Geert Uytterhoeven
2013-05-03 20:27 ` Geert Uytterhoeven
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=516DC52B.7090705@redhat.com \
--to=mchehab@redhat.com \
--cc=devel@driverdev.osuosl.org \
--cc=dhowells@redhat.com \
--cc=jerry-chuang@realtek.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=megaraidlinux@lsi.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).