Lines Matching defs:ifc
286 struct if_clone *ifc;
292 ifc = if_clone_lookup(name, &unit);
293 if (ifc == NULL)
305 while ((bytoff < ifc->ifc_bmlen)
306 && (ifc->ifc_units[bytoff] == 0xff))
308 if (bytoff >= ifc->ifc_bmlen)
310 while ((ifc->ifc_units[bytoff] & (1 << bitoff)) != 0)
315 if (unit > ifc->ifc_maxunit)
318 err = (*ifc->ifc_create)(ifc, unit);
330 KASSERT((ifc->ifc_units[bytoff] & (1 << bitoff)) == 0,
332 ifc->ifc_units[bytoff] |= (1 << bitoff);
358 struct if_clone *ifc;
363 ifc = if_clone_lookup(name, &unit);
364 if (ifc == NULL)
367 if (unit < ifc->ifc_minifs)
374 if (ifc->ifc_destroy == NULL)
377 (*ifc->ifc_destroy)(ifp);
384 KASSERT((ifc->ifc_units[bytoff] & (1 << bitoff)) != 0,
386 ifc->ifc_units[bytoff] &= ~(1 << bitoff);
397 struct if_clone *ifc;
401 for (ifc = LIST_FIRST(&if_cloners); ifc != NULL;) {
402 for (cp = name, i = 0; i < ifc->ifc_namelen; i++, cp++) {
403 if (ifc->ifc_name[i] != *cp)
408 ifc = LIST_NEXT(ifc, ifc_list);
429 return (ifc);
436 if_clone_attach(struct if_clone *ifc)
443 KASSERT(ifc->ifc_minifs - 1 <= ifc->ifc_maxunit,
445 __func__, ifc->ifc_name, ifc->ifc_minifs,
446 ifc->ifc_maxunit + 1));
450 maxclone = ifc->ifc_maxunit + 1;
454 ifc->ifc_units = _MALLOC(len, M_CLONE, M_WAITOK | M_ZERO);
455 bzero(ifc->ifc_units, len);
456 ifc->ifc_bmlen = len;
458 LIST_INSERT_HEAD(&if_cloners, ifc, ifc_list);
461 for (unit = 0; unit < ifc->ifc_minifs; unit++) {
462 err = (*ifc->ifc_create)(ifc, unit);
465 __func__, ifc->ifc_name, unit));
470 ifc->ifc_units[bytoff] |= (1 << bitoff);
478 if_clone_detach(struct if_clone *ifc)
481 LIST_REMOVE(ifc, ifc_list);
482 FREE(ifc->ifc_units, M_CLONE);
494 struct if_clone *ifc;
508 for (ifc = LIST_FIRST(&if_cloners); ifc != NULL && count != 0;
509 ifc = LIST_NEXT(ifc, ifc_list), count--, dst += IFNAMSIZ) {
510 strlcpy(outbuf, ifc->ifc_name, IFNAMSIZ);
1168 struct ifconf64 * ifc = (struct ifconf64 *)data;
1172 ? ifc->ifc_req64 : CAST_USER_ADDR_T(ifc->ifc_req);
1173 return (ifconf(cmd, user_addr, &ifc->ifc_len));