ipv4 -- proc_net_fops_create
Subsystems (3)
PATCH 1/1 ipv4 -- proc_net_fops_create
Use proc_net_fops_create it is cleaner.
net/ipv4/proc.c +3 -11
@@ -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:
In article <[email protected]> (at Thu, 11 Sep 2003 15:43:57 -0700), Stephen Hemminger <[email protected]> says:
Quoted 1 line
Use
proc_net_fops_createit is cleaner.
I sent this kind of patch for net/{core,ipv4,ipv6} to David / netdev on 8th Sep. David?
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]> GPG FP: 9022 65EB 1ECF 3AD1 0BDF 80D8 4807 F894 E062 0EEA
Quoted 2 lines · On Fri, 12 Sep 2003 07:50:03 +0900 (JST) YOSHIFUJI Hideaki / _$B5HF#1QL@…
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.
PATCH 1/1 proc_net macro's for non-proc-fs case
In reply to a message not in the archiveThe 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.
include/linux/proc_fs.h +4 -3
@@ -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 ; }
Re: [PATCH] proc_net macro's for non-proc-fs case
Quoted 4 lines · On Fri, 12 Sep 2003 11:21:20 -0700 Stephen Hemminger <[email protected]>…
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.