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

Function setmedia

tools/ifconfig/ifmedia.c:287–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287static void
288setmedia(const char *val, int d, int s, const struct afswtch *afp)
289{
290 struct ifmediareq *ifmr;
291 int subtype;
292
293 ifmr = ifmedia_getstate(s);
294
295 /*
296 * We are primarily concerned with the top-level type.
297 * However, "current" may be only IFM_NONE, so we just look
298 * for the top-level type in the first "supported type"
299 * entry.
300 *
301 * (I'm assuming that all supported media types for a given
302 * interface will be the same top-level type..)
303 */
304 subtype = get_media_subtype(IFM_TYPE(ifmr->ifm_ulist[0]), val);
305
306 strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
307 ifr.ifr_media = (ifmr->ifm_current & IFM_IMASK) |
308 IFM_TYPE(ifmr->ifm_ulist[0]) | subtype;
309
310 ifmr->ifm_current = ifr.ifr_media;
311 callback_register(setifmediacallback, (void *)ifmr);
312}
313
314static void
315setmediaopt(const char *val, int d, int s, const struct afswtch *afp)

Callers

nothing calls this directly

Calls 4

ifmedia_getstateFunction · 0.85
get_media_subtypeFunction · 0.85
callback_registerFunction · 0.85
strlcpyFunction · 0.50

Tested by

no test coverage detected