sctp: use proc_remove_subtree()
Subsystems (3)
use proc_remove_subtree() for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...
--- include/net/sctp/sctp.h | 9 +-------- net/sctp/proc.c | 90 +++++++++++++++++++++--------------------------------------------------------------------- net/sctp/protocol.c | 57 ++++++--------------------------------------------------- 3 files changed, 28 insertions(+), 128 deletions(-)
include/net/sctp/sctp.h +1 -8
@@ -180,14 +180,7 @@ struct sctp_transport *sctp_epaddr_lookup_transport(/* * sctp/proc.c */ -int sctp_snmp_proc_init (struct net *net); -void sctp_snmp_proc_exit (struct net *net); -int sctp_eps_proc_init (struct net *net); -void sctp_eps_proc_exit (struct net *net); -int sctp_assocs_proc_init (struct net *net); -void sctp_assocs_proc_exit (struct net *net); -int sctp_remaddr_proc_init (struct net *net); -void sctp_remaddr_proc_exit (struct net *net); +int __net_init sctp_proc_init (struct net *net);/* * sctp/offload.c
net/sctp/proc.c +21 -69
121 lines not on this page · raw message
net/sctp/protocol.c +6 -51
79 lines not on this page · raw message
Quoted 3 lines · Al Viro
use
proc_remove_subtree()for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...
... and sctp_dbg_objcnt_exit() can be removed as well - remove_proc_subtree() will get that sucker automatically. Either a trivial addition, or equally trivial followup...
David Miller
maintainerFrom: Al Viro <[email protected]>
Date: Wed, 14 Mar 2018 20:51:19 +0000
Quoted 8 lines · Al Viro
Quoted 3 lines
use
proc_remove_subtree()for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...... and
sctp_dbg_objcnt_exit()can be removed as well -remove_proc_subtree()will get that sucker automatically. Either a trivial addition, or equally trivial followup...
Please add it to this patch and resubmit.
Thanks Al.
Quoted 8 lines · David Miller
From: Al Viro <[email protected]>
Date: Wed, 14 Mar 2018 20:51:19 +0000Quoted 5 lines · Al Viro
Quoted 3 lines
use
proc_remove_subtree()for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...
Quoted 5 lines
Quoted 3 lines
... and
sctp_dbg_objcnt_exit()can be removed as well -remove_proc_subtree()will get that sucker automatically. Either a trivial addition, or equally trivial followup...Please add it to this patch and resubmit.
Done...
PATCH v2 1/1 sctp: use proc_remove_subtree()
In reply to Al Virouse proc_remove_subtree() for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...
--- include/net/sctp/sctp.h | 11 +---------- net/sctp/objcnt.c | 8 -------- net/sctp/proc.c | 90 +++++++++++++++++++++--------------------------------------------------------------------- net/sctp/protocol.c | 59 ++++++----------------------------------------------------- 4 files changed, 28 insertions(+), 140 deletions(-)
include/net/sctp/sctp.h +1 -10
@@ -180,14 +180,7 @@ struct sctp_transport *sctp_epaddr_lookup_transport(/* * sctp/proc.c */ -int sctp_snmp_proc_init (struct net *net); -void sctp_snmp_proc_exit (struct net *net); -int sctp_eps_proc_init (struct net *net); -void sctp_eps_proc_exit (struct net *net); -int sctp_assocs_proc_init (struct net *net); -void sctp_assocs_proc_exit (struct net *net); -int sctp_remaddr_proc_init (struct net *net); -void sctp_remaddr_proc_exit (struct net *net); +int __net_init sctp_proc_init (struct net *net);/* * sctp/offload.c
@@ -318,7 +311,6 @@ atomic_t sctp_dbg_objcnt_## name = ATOMIC_INIT(0) {.label= #name, .counter= &sctp_dbg_objcnt_## name} void sctp_dbg_objcnt_init(struct net *); -void sctp_dbg_objcnt_exit(struct net *); #else
@@ -326,7 +318,6 @@ void sctp_dbg_objcnt_exit(struct net *);#define SCTP_DBG_OBJCNT_DEC (name)static inline void sctp_dbg_objcnt_init (struct net *net) {return ; } -static inline void sctp_dbg_objcnt_exit (struct net *net) {return ; }#endif /* CONFIG_SCTP_DBG_OBJCOUNT */
net/sctp/objcnt.c +0 -8
@@ -130,11 +130,3 @@ void sctp_dbg_objcnt_init(struct net *net)if (!ent)pr_warn ("sctp_dbg_objcnt: Unable to create /proc entry.\n" ); } - -/* Cleanup the objcount entry in the proc filesystem. */ -void sctp_dbg_objcnt_exit (struct net *net) -{ -remove_proc_entry ("sctp_dbg_objcnt" , net->sctp.proc_net_sctp); -} - -
net/sctp/proc.c +21 -69
121 lines not on this page · raw message
net/sctp/protocol.c +6 -53
81 lines not on this page · raw message
From: Al Viro <[email protected]>
Date: Fri, 16 Mar 2018 23:32:51 +0000
Quoted 5 lines
use
proc_remove_subtree()for subtree removal, both on setup failure halfway through and on teardown. No need to make simple things complex...Signed-off-by Al Viro <[email protected]>
Applied, thanks Al.