diff options
Diffstat (limited to 'net/ipv6/proc.c')
-rw-r--r-- | net/ipv6/proc.c | 30 |
1 files changed, 30 insertions, 0 deletions
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 | ||
349 | int 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 | |||
364 | err1: | ||
365 | free_percpu(ptr[0]); | ||
366 | ptr[0] = NULL; | ||
367 | err0: | ||
368 | return -ENOMEM; | ||
369 | } | ||
370 | |||
371 | void 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 | ||