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

Function setmediainst

tools/ifconfig/ifmedia.c:353–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353static void
354setmediainst(const char *val, int d, int s, const struct afswtch *afp)
355{
356 struct ifmediareq *ifmr;
357 int inst;
358
359 ifmr = ifmedia_getstate(s);
360
361 inst = atoi(val);
362 if (inst < 0 || inst > (int)IFM_INST_MAX)
363 errx(1, "invalid media instance: %s", val);
364
365 strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
366 ifr.ifr_media = (ifmr->ifm_current & ~IFM_IMASK) | inst << IFM_ISHIFT;
367
368 ifmr->ifm_current = ifr.ifr_media;
369 callback_register(setifmediacallback, (void *)ifmr);
370}
371
372static void
373setmediamode(const char *val, int d, int s, const struct afswtch *afp)

Callers

nothing calls this directly

Calls 3

ifmedia_getstateFunction · 0.85
callback_registerFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected