Deleted Added
full compact
devd.cc (147973) devd.cc (150949)
1/*-
2 * Copyright (c) 2002-2003 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

29 */
30
31// TODO list:
32// o devd.conf and devd man pages need a lot of help:
33// - devd needs to document the unix domain socket
34// - devd.conf needs more details on the supported statements.
35
36#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2003 M. Warner Losh.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 20 unchanged lines hidden (view full) ---

29 */
30
31// TODO list:
32// o devd.conf and devd man pages need a lot of help:
33// - devd needs to document the unix domain socket
34// - devd.conf needs more details on the supported statements.
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 147973 2005-07-13 17:28:11Z marcus $");
37__FBSDID("$FreeBSD: head/sbin/devd/devd.cc 150949 2005-10-04 22:22:51Z imp $");
38
39#include <sys/param.h>
40#include <sys/socket.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43#include <sys/types.h>
44#include <sys/un.h>
45

--- 170 unchanged lines hidden (view full) ---

216
217media::~media()
218{
219}
220
221bool
222media::do_match(config &c)
223{
38
39#include <sys/param.h>
40#include <sys/socket.h>
41#include <sys/stat.h>
42#include <sys/sysctl.h>
43#include <sys/types.h>
44#include <sys/un.h>
45

--- 170 unchanged lines hidden (view full) ---

216
217media::~media()
218{
219}
220
221bool
222media::do_match(config &c)
223{
224 string value = c.get_variable("device-name");
224 string value;
225 struct ifmediareq ifmr;
226 bool retval;
227 int s;
228
225 struct ifmediareq ifmr;
226 bool retval;
227 int s;
228
229 // Since we can be called from both a device attach/detach
230 // context where device-name is defined and what we want,
231 // as well as from a link status context, where subsystem is
232 // the name of interest, first try device-name and fall back
233 // to subsystem if none exists.
234 value = c.get_variable("device-name");
235 if (value.length() == 0)
236 string value = c.get_variable("subsystem");
229 if (Dflag)
230 fprintf(stderr, "Testing media type of %s against 0x%x\n",
231 value.c_str(), _type);
232
233 retval = false;
234
235 s = socket(PF_INET, SOCK_DGRAM, 0);
236 if (s >= 0) {

--- 698 unchanged lines hidden ---
237 if (Dflag)
238 fprintf(stderr, "Testing media type of %s against 0x%x\n",
239 value.c_str(), _type);
240
241 retval = false;
242
243 s = socket(PF_INET, SOCK_DGRAM, 0);
244 if (s >= 0) {

--- 698 unchanged lines hidden ---