diff options
Diffstat (limited to 'net/ipv4/proc.c')
-rw-r--r-- | net/ipv4/proc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ae68a691e8cd..97952d54ae84 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -391,3 +391,28 @@ out_netstat: | |||
391 | goto out; | 391 | goto out; |
392 | } | 392 | } |
393 | 393 | ||
394 | int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign) | ||
395 | { | ||
396 | BUG_ON(ptr == NULL); | ||
397 | ptr[0] = __alloc_percpu(mibsize); | ||
398 | if (!ptr[0]) | ||
399 | goto err0; | ||
400 | ptr[1] = __alloc_percpu(mibsize); | ||
401 | if (!ptr[1]) | ||
402 | goto err1; | ||
403 | return 0; | ||
404 | err1: | ||
405 | free_percpu(ptr[0]); | ||
406 | ptr[0] = NULL; | ||
407 | err0: | ||
408 | return -ENOMEM; | ||
409 | } | ||
410 | |||
411 | void snmp_mib_free(void *ptr[2]) | ||
412 | { | ||
413 | BUG_ON(ptr == NULL); | ||
414 | free_percpu(ptr[0]); | ||
415 | free_percpu(ptr[1]); | ||
416 | ptr[0] = ptr[1] = NULL; | ||
417 | } | ||
418 | |||