aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2013-04-12 12:27:28 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-05-01 17:29:46 -0400
commita8ca16ea7b0abb0a7e49492d1123b715f0ec62e8 (patch)
treefe201353c71385cab2f3cc0d7235c76121f51789 /net
parent8d8b97ba499cb69fccb5fd9f2b439e3265fc3f27 (diff)
proc: Supply a function to remove a proc entry by PDE
Supply a function (proc_remove()) to remove a proc entry (and any subtree rooted there) by proc_dir_entry pointer rather than by name and (optionally) root dir entry pointer. This allows us to eliminate all remaining pde->name accesses outside of procfs. Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Grant Likely <grant.likely@linaro.or> cc: linux-acpi@vger.kernel.org cc: openipmi-developer@lists.sourceforge.net cc: devicetree-discuss@lists.ozlabs.org cc: linux-pci@vger.kernel.org cc: netdev@vger.kernel.org cc: netfilter-devel@vger.kernel.org cc: alsa-devel@alsa-project.org Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlanproc.c9
-rw-r--r--net/core/pktgen.c6
-rw-r--r--net/ipv4/netfilter/ipt_CLUSTERIP.c4
-rw-r--r--net/ipv6/proc.c3
4 files changed, 7 insertions, 15 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c
index 959ddbb0ca4d..1d0e89213a28 100644
--- a/net/8021q/vlanproc.c
+++ b/net/8021q/vlanproc.c
@@ -184,14 +184,9 @@ int vlan_proc_add_dev(struct net_device *vlandev)
184 */ 184 */
185int vlan_proc_rem_dev(struct net_device *vlandev) 185int vlan_proc_rem_dev(struct net_device *vlandev)
186{ 186{
187 struct vlan_net *vn = net_generic(dev_net(vlandev), vlan_net_id);
188
189 /** NOTE: This will consume the memory pointed to by dent, it seems. */ 187 /** NOTE: This will consume the memory pointed to by dent, it seems. */
190 if (vlan_dev_priv(vlandev)->dent) { 188 proc_remove(vlan_dev_priv(vlandev)->dent);
191 remove_proc_entry(vlan_dev_priv(vlandev)->dent->name, 189 vlan_dev_priv(vlandev)->dent = NULL;
192 vn->proc_vlan_dir);
193 vlan_dev_priv(vlandev)->dent = NULL;
194 }
195 return 0; 190 return 0;
196} 191}
197 192
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index f6af4fe59f2e..6c41e979dc88 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1904,7 +1904,7 @@ static void pktgen_change_name(const struct pktgen_net *pn, struct net_device *d
1904 if (pkt_dev->odev != dev) 1904 if (pkt_dev->odev != dev)
1905 continue; 1905 continue;
1906 1906
1907 remove_proc_entry(pkt_dev->entry->name, pn->proc_dir); 1907 proc_remove(pkt_dev->entry);
1908 1908
1909 pkt_dev->entry = proc_create_data(dev->name, 0600, 1909 pkt_dev->entry = proc_create_data(dev->name, 0600,
1910 pn->proc_dir, 1910 pn->proc_dir,
@@ -3576,8 +3576,6 @@ static void _rem_dev_from_if_list(struct pktgen_thread *t,
3576static int pktgen_remove_device(struct pktgen_thread *t, 3576static int pktgen_remove_device(struct pktgen_thread *t,
3577 struct pktgen_dev *pkt_dev) 3577 struct pktgen_dev *pkt_dev)
3578{ 3578{
3579 struct pktgen_net *pn = t->net;
3580
3581 pr_debug("remove_device pkt_dev=%p\n", pkt_dev); 3579 pr_debug("remove_device pkt_dev=%p\n", pkt_dev);
3582 3580
3583 if (pkt_dev->running) { 3581 if (pkt_dev->running) {
@@ -3597,7 +3595,7 @@ static int pktgen_remove_device(struct pktgen_thread *t,
3597 _rem_dev_from_if_list(t, pkt_dev); 3595 _rem_dev_from_if_list(t, pkt_dev);
3598 3596
3599 if (pkt_dev->entry) 3597 if (pkt_dev->entry)
3600 remove_proc_entry(pkt_dev->entry->name, pn->proc_dir); 3598 proc_remove(pkt_dev->entry);
3601 3599
3602#ifdef CONFIG_XFRM 3600#ifdef CONFIG_XFRM
3603 free_SAs(pkt_dev); 3601 free_SAs(pkt_dev);
diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index e4738fef070a..0b732efd32e2 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -105,7 +105,7 @@ clusterip_config_entry_put(struct clusterip_config *c)
105 * functions are also incrementing the refcount on their own, 105 * functions are also incrementing the refcount on their own,
106 * so it's safe to remove the entry even if it's in use. */ 106 * so it's safe to remove the entry even if it's in use. */
107#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
108 remove_proc_entry(c->pde->name, c->pde->parent); 108 proc_remove(c->pde);
109#endif 109#endif
110 return; 110 return;
111 } 111 }
@@ -736,7 +736,7 @@ static void __exit clusterip_tg_exit(void)
736{ 736{
737 pr_info("ClusterIP Version %s unloading\n", CLUSTERIP_VERSION); 737 pr_info("ClusterIP Version %s unloading\n", CLUSTERIP_VERSION);
738#ifdef CONFIG_PROC_FS 738#ifdef CONFIG_PROC_FS
739 remove_proc_entry(clusterip_procdir->name, clusterip_procdir->parent); 739 proc_remove(clusterip_procdir);
740#endif 740#endif
741 nf_unregister_hook(&cip_arp_ops); 741 nf_unregister_hook(&cip_arp_ops);
742 xt_unregister_target(&clusterip_tg_reg); 742 xt_unregister_target(&clusterip_tg_reg);
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 7ea6e180139c..537d9ee7209f 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -287,8 +287,7 @@ int snmp6_unregister_dev(struct inet6_dev *idev)
287 return -ENOENT; 287 return -ENOENT;
288 if (!idev->stats.proc_dir_entry) 288 if (!idev->stats.proc_dir_entry)
289 return -EINVAL; 289 return -EINVAL;
290 remove_proc_entry(idev->stats.proc_dir_entry->name, 290 proc_remove(idev->stats.proc_dir_entry);
291 net->mib.proc_net_devsnmp6);
292 idev->stats.proc_dir_entry = NULL; 291 idev->stats.proc_dir_entry = NULL;
293 return 0; 292 return 0;
294} 293}