aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>2007-04-20 18:56:48 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:11 -0400
commit49ed67a9eee3c756263feed4474e4fcf5c8eaed2 (patch)
tree41e989b08578e3a76c055c3f45ae4fc24dae59a2 /net/ipv6
parentbf99f1bde3b3009af74874f3465f6861431fbb66 (diff)
[IPV6] SNMP: Move some statistic bits to net/ipv6/proc.c.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6')
-rw-r--r--net/ipv6/af_inet6.c33
-rw-r--r--net/ipv6/proc.c30
2 files changed, 30 insertions, 33 deletions
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index df31cdd33cda..825d03e87ae0 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -712,39 +712,6 @@ int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb)
712 712
713EXPORT_SYMBOL_GPL(ipv6_opt_accepted); 713EXPORT_SYMBOL_GPL(ipv6_opt_accepted);
714 714
715int
716snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign)
717{
718 if (ptr == NULL)
719 return -EINVAL;
720
721 ptr[0] = __alloc_percpu(mibsize);
722 if (!ptr[0])
723 goto err0;
724
725 ptr[1] = __alloc_percpu(mibsize);
726 if (!ptr[1])
727 goto err1;
728
729 return 0;
730
731err1:
732 free_percpu(ptr[0]);
733 ptr[0] = NULL;
734err0:
735 return -ENOMEM;
736}
737
738void
739snmp6_mib_free(void *ptr[2])
740{
741 if (ptr == NULL)
742 return;
743 free_percpu(ptr[0]);
744 free_percpu(ptr[1]);
745 ptr[0] = ptr[1] = NULL;
746}
747
748static int __init init_ipv6_mibs(void) 715static int __init init_ipv6_mibs(void)
749{ 716{
750 if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib), 717 if (snmp6_mib_init((void **)ipv6_statistics, sizeof (struct ipstats_mib),
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 0dc551501519..5c3ce1c687c9 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -346,4 +346,34 @@ int snmp6_free_dev(struct inet6_dev *idev)
346 return 0; 346 return 0;
347} 347}
348 348
349int snmp6_mib_init(void *ptr[2], size_t mibsize, size_t mibalign)
350{
351 if (ptr == NULL)
352 return -EINVAL;
353
354 ptr[0] = __alloc_percpu(mibsize);
355 if (!ptr[0])
356 goto err0;
357
358 ptr[1] = __alloc_percpu(mibsize);
359 if (!ptr[1])
360 goto err1;
361
362 return 0;
363
364err1:
365 free_percpu(ptr[0]);
366 ptr[0] = NULL;
367err0:
368 return -ENOMEM;
369}
370
371void snmp6_mib_free(void *ptr[2])
372{
373 if (ptr == NULL)
374 return;
375 free_percpu(ptr[0]);
376 free_percpu(ptr[1]);
377 ptr[0] = ptr[1] = NULL;
378}
349 379