netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ipv4 -- proc_net_fops_create
@ 2003-09-11 22:43 Stephen Hemminger
  2003-09-11 22:50 ` YOSHIFUJI Hideaki / 吉藤英明
       [not found] ` <20030911235405.GA74116@compsoc.man.ac.uk>
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Hemminger @ 2003-09-11 22:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Use proc_net_fops_create it is cleaner.

diff -Nru a/net/ipv4/proc.c b/net/ipv4/proc.c
--- a/net/ipv4/proc.c	Thu Sep 11 15:36:06 2003
+++ b/net/ipv4/proc.c	Thu Sep 11 15:36:06 2003
@@ -240,20 +240,12 @@
 	int rc = 0;
 	struct proc_dir_entry *p;
 
-	p = create_proc_entry("netstat", S_IRUGO, proc_net);
-	if (!p)
+	if (!proc_net_fops_create("netstat", S_IRUGO, &netstat_seq_fops))
 		goto out_netstat;
-	p->proc_fops = &netstat_seq_fops;
-
-	p = create_proc_entry("snmp", S_IRUGO, proc_net);
-	if (!p)
+	if (!proc_net_fops_create("snmp", S_IRUGO, &snmp_seq_fops))
 		goto out_snmp;
-	p->proc_fops = &snmp_seq_fops;
-
-	p = create_proc_entry("sockstat", S_IRUGO, proc_net);
-	if (!p)
+	if (!proc_net_fops_create("sockstat", S_IRUGO, &sockstat_seq_fops))
 		goto out_sockstat;
-	p->proc_fops = &sockstat_seq_fops;
 out:
 	return rc;
 out_sockstat:

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipv4 -- proc_net_fops_create
  2003-09-11 22:43 [PATCH] ipv4 -- proc_net_fops_create Stephen Hemminger
@ 2003-09-11 22:50 ` YOSHIFUJI Hideaki / 吉藤英明
  2003-09-11 23:03   ` David S. Miller
       [not found] ` <20030911235405.GA74116@compsoc.man.ac.uk>
  1 sibling, 1 reply; 5+ messages in thread
From: YOSHIFUJI Hideaki / 吉藤英明 @ 2003-09-11 22:50 UTC (permalink / raw)
  To: shemminger; +Cc: davem, netdev

In article <20030911154357.6b31891c.shemminger@osdl.org> (at Thu, 11 Sep 2003 15:43:57 -0700), Stephen Hemminger <shemminger@osdl.org> says:

> Use proc_net_fops_create it is cleaner.

I sent this kind of patch for net/{core,ipv4,ipv6} to David / netdev on 
8th Sep. David?

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] ipv4 -- proc_net_fops_create
  2003-09-11 22:50 ` YOSHIFUJI Hideaki / 吉藤英明
@ 2003-09-11 23:03   ` David S. Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2003-09-11 23:03 UTC (permalink / raw)
  To: YOSHIFUJI Hideaki / _$B5HF#1QL@; +Cc: shemminger, netdev

On Fri, 12 Sep 2003 07:50:03 +0900 (JST)
YOSHIFUJI Hideaki / _$B5HF#1QL@ <yoshfuji@linux-ipv6.org> wrote:

> I sent this kind of patch for net/{core,ipv4,ipv6} to David / netdev on 
> 8th Sep. David?

I'm heavily backlogged and haven't been able to apply any patches.
Sorry.  I'll try to do some today.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] proc_net macro's for non-proc-fs case
       [not found] ` <20030911235405.GA74116@compsoc.man.ac.uk>
@ 2003-09-12 18:21   ` Stephen Hemminger
  2003-09-13  0:13     ` David S. Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2003-09-12 18:21 UTC (permalink / raw)
  To: John Levon; +Cc: David Miller, netdev

The following should work better. They have the desired properties that:
	- return value makes sense for those that might check
	- arguments fops and info don't have to be defined (ie can be #ifdef'd out)
	- generate no warnings for null effect.

diff -Nru a/include/linux/proc_fs.h b/include/linux/proc_fs.h
--- a/include/linux/proc_fs.h	Fri Sep 12 11:19:07 2003
+++ b/include/linux/proc_fs.h	Fri Sep 12 11:19:07 2003
@@ -185,9 +185,10 @@
 #else
 
 #define proc_root_driver NULL
-#define proc_net_fops_create(name,mode,fops) do {} while(0)
-static inline struct proc_dir_entry *proc_net_create(const char *name, mode_t mode, 
-	get_info_t *get_info) {return NULL;}
+#define proc_net NULL
+
+#define proc_net_fops_create(name, mode, fops)  ({ (void)(mode), NULL; })
+#define proc_net_create(name, mode, info)	({ (void)(mode), NULL; })
 static inline void proc_net_remove(const char *name) {}
 
 static inline struct dentry *proc_pid_unhash(struct task_struct *p) { return NULL; }

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] proc_net macro's for non-proc-fs case
  2003-09-12 18:21   ` [PATCH] proc_net macro's for non-proc-fs case Stephen Hemminger
@ 2003-09-13  0:13     ` David S. Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David S. Miller @ 2003-09-13  0:13 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: levon, netdev

On Fri, 12 Sep 2003 11:21:20 -0700
Stephen Hemminger <shemminger@osdl.org> wrote:

> The following should work better. They have the desired properties that:
> 	- return value makes sense for those that might check
> 	- arguments fops and info don't have to be defined (ie can be #ifdef'd out)
> 	- generate no warnings for null effect.

Looks good, applied thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-09-13  0:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-11 22:43 [PATCH] ipv4 -- proc_net_fops_create Stephen Hemminger
2003-09-11 22:50 ` YOSHIFUJI Hideaki / 吉藤英明
2003-09-11 23:03   ` David S. Miller
     [not found] ` <20030911235405.GA74116@compsoc.man.ac.uk>
2003-09-12 18:21   ` [PATCH] proc_net macro's for non-proc-fs case Stephen Hemminger
2003-09-13  0:13     ` David S. Miller

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).