MCPcopy Create free account
hub / github.com/F-Stack/f-stack / if_clone_alloc

Function if_clone_alloc

freebsd/net/if_clone.c:351–367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351static struct if_clone *
352if_clone_alloc(const char *name, int maxunit)
353{
354 struct if_clone *ifc;
355
356 KASSERT(name != NULL, ("%s: no name\n", __func__));
357
358 ifc = malloc(sizeof(struct if_clone), M_CLONE, M_WAITOK | M_ZERO);
359 strncpy(ifc->ifc_name, name, IFCLOSIZ-1);
360 IF_CLONE_LOCK_INIT(ifc);
361 IF_CLONE_ADDREF(ifc);
362 ifc->ifc_maxunit = maxunit ? maxunit : IF_MAXUNIT;
363 ifc->ifc_unrhdr = new_unrhdr(0, ifc->ifc_maxunit, &ifc->ifc_mtx);
364 LIST_INIT(&ifc->ifc_iflist);
365
366 return (ifc);
367}
368
369static int
370if_clone_attach(struct if_clone *ifc)

Callers 2

if_clone_advancedFunction · 0.85
if_clone_simpleFunction · 0.85

Calls 3

mallocFunction · 0.85
strncpyFunction · 0.85
new_unrhdrFunction · 0.85

Tested by

no test coverage detected