Skip to contentSkip to conversation

sctp: use proc_remove_subtree()

PATCH Applied Al Viro 2 participants 6 messages Mar 14, 2018 – Mar 18, 2018

Subsystems (3)
lore
Share & tools
lore

Al Viro

author
#0 lore raw

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
index f7ae6b0a21d0..3f90134008e9 100644
@@ -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

author
#1 lore raw
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...

maintainer
#2 lore raw

From: 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.

author
#3 lore raw
Quoted 8 lines · David Miller

From: Al Viro <[email protected]>
Date: Wed, 14 Mar 2018 20:51:19 +0000

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

author
#4 lore raw

PATCH v2 1/1 sctp: use proc_remove_subtree()

In reply to 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...

---
 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
index f7ae6b0a21d0..72c5b8fc3232 100644
@@ -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
index aeea6da81441..fd2684ad94c8 100644
@@ -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

maintainer Applied
#5 lore raw

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

Applied, thanks Al.