The devices that supported EVFILT_NETDEV kqueue filters were removed in

r195175.  Remove all definitions, documentation, and usage.

fifo_misc.c:
	Remove all kqueue tests as fifo_io.c performs all those that
	would have remained.

Reviewed by:	rwatson
MFC after:	3 weeks
X-MFC note:	don't change vlan_link_state() function signature
This commit is contained in:
Brooks Davis 2009-12-31 20:29:58 +00:00
parent 70044f3070
commit a6fffd6cb0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=201350
7 changed files with 8 additions and 151 deletions

View File

@ -438,19 +438,6 @@ There is a system wide limit on the number of timers
which is controlled by the
.Va kern.kq_calloutmax
sysctl.
.It Dv EVFILT_NETDEV
Takes a descriptor to a network interface as the identifier, and the events to watch for in
.Va fflags .
It returns, when one or more of the requested events occur on the descriptor.
The events to monitor are:
.Bl -tag -width XXNOTE_LINKDOWN
.It Dv NOTE_LINKUP
The link is up.
.It Dv NOTE_LINKDOWN
The link is down.
.It Dv NOTE_LINKINV
The link state is invalid.
.El
.Pp
On return,
.Va fflags
@ -595,13 +582,6 @@ system and this manual page were written by
.An Jonathan Lemon Aq jlemon@FreeBSD.org .
.Sh BUGS
The
.Dv EVFILT_NETDEV
filter is currently only implemented for devices that use the
.Xr miibus 4
driver for LINKUP and LINKDOWN operations.
Therefore, it will not work with many non-ethernet devices.
.Pp
The
.Fa timeout
value is limited to 24 hours; longer timeouts will be silently
reinterpreted as 24 hours.

View File

@ -279,7 +279,7 @@ static struct {
{ &proc_filtops }, /* EVFILT_PROC */
{ &sig_filtops }, /* EVFILT_SIGNAL */
{ &timer_filtops }, /* EVFILT_TIMER */
{ &file_filtops }, /* EVFILT_NETDEV */
{ &null_filtops }, /* former EVFILT_NETDEV */
{ &fs_filtops }, /* EVFILT_FS */
{ &null_filtops }, /* EVFILT_LIO */
{ &user_filtops }, /* EVFILT_USER */

View File

@ -1819,7 +1819,7 @@ if_route(struct ifnet *ifp, int flag, int fam)
#endif
}
void (*vlan_link_state_p)(struct ifnet *, int); /* XXX: private from if_vlan */
void (*vlan_link_state_p)(struct ifnet *); /* XXX: private from if_vlan */
void (*vlan_trunk_cap_p)(struct ifnet *); /* XXX: private from if_vlan */
/*
@ -1845,19 +1845,12 @@ do_link_state_change(void *arg, int pending)
{
struct ifnet *ifp = (struct ifnet *)arg;
int link_state = ifp->if_link_state;
int link;
CURVNET_SET(ifp->if_vnet);
/* Notify that the link state has changed. */
rt_ifmsg(ifp);
if (link_state == LINK_STATE_UP)
link = NOTE_LINKUP;
else if (link_state == LINK_STATE_DOWN)
link = NOTE_LINKDOWN;
else
link = NOTE_LINKINV;
if (ifp->if_vlantrunk != NULL)
(*vlan_link_state_p)(ifp, link);
(*vlan_link_state_p)(ifp);
if ((ifp->if_type == IFT_ETHER || ifp->if_type == IFT_L2VLAN) &&
IFP2AC(ifp)->ac_netgraph != NULL)

View File

@ -188,7 +188,7 @@ static int vlan_setmulti(struct ifnet *ifp);
static int vlan_unconfig(struct ifnet *ifp);
static int vlan_unconfig_locked(struct ifnet *ifp);
static int vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t tag);
static void vlan_link_state(struct ifnet *ifp, int link);
static void vlan_link_state(struct ifnet *ifp);
static void vlan_capabilities(struct ifvlan *ifv);
static void vlan_trunk_capabilities(struct ifnet *ifp);
@ -525,7 +525,7 @@ vlan_ifdetach(void *arg __unused, struct ifnet *ifp)
extern void (*vlan_input_p)(struct ifnet *, struct mbuf *);
/* For if_link_state_change() eyes only... */
extern void (*vlan_link_state_p)(struct ifnet *, int);
extern void (*vlan_link_state_p)(struct ifnet *);
static int
vlan_modevent(module_t mod, int type, void *data)
@ -1231,7 +1231,7 @@ vlan_setflags(struct ifnet *ifp, int status)
/* Inform all vlans that their parent has changed link state */
static void
vlan_link_state(struct ifnet *ifp, int link)
vlan_link_state(struct ifnet *ifp)
{
struct ifvlantrunk *trunk = ifp->if_vlantrunk;
struct ifvlan *ifv;

View File

@ -38,7 +38,7 @@
#define EVFILT_PROC (-5) /* attached to struct proc */
#define EVFILT_SIGNAL (-6) /* attached to struct proc */
#define EVFILT_TIMER (-7) /* timers */
#define EVFILT_NETDEV (-8) /* network devices */
/* EVFILT_NETDEV (-8) no longer supported */
#define EVFILT_FS (-9) /* filesystem events */
#define EVFILT_LIO (-10) /* attached to lio requests */
#define EVFILT_USER (-11) /* User events */
@ -131,13 +131,6 @@ struct kevent {
#define NOTE_TRACKERR 0x00000002 /* could not track child */
#define NOTE_CHILD 0x00000004 /* am a child process */
/*
* data/hint flags for EVFILT_NETDEV, shared with userspace
*/
#define NOTE_LINKUP 0x0001 /* link is up */
#define NOTE_LINKDOWN 0x0002 /* link is down */
#define NOTE_LINKINV 0x0004 /* link state is invalid */
struct knote;
SLIST_HEAD(klist, knote);
struct kqueue;

View File

@ -148,114 +148,6 @@ test_truncate(void)
cleanfifo("testfifo", -1, -1);
}
struct filter_entry {
int fe_filter;
const char *fe_name;
int fe_error;
const char *fe_errorname;
};
static const struct filter_entry good_filter_types[] = {
{ EVFILT_READ, "EVFILT_READ", 0, "0" },
{ EVFILT_WRITE, "EVFILT_WRITE", 0, "0" },
#if WORKING_EVFILT_VNODE_ON_FIFOS
{ EVFILT_VNODE, "EVFILT_VNODE", EINVAL, "EINVAL" },
#endif
};
static const int good_filter_types_len = sizeof(good_filter_types) /
sizeof(good_filter_types[0]);
static const struct filter_entry bad_filter_types[] = {
{ EVFILT_NETDEV, "EVFILT_NETDEV", EINVAL, "EINVAL" },
};
static const int bad_filter_types_len = sizeof(bad_filter_types) /
sizeof(bad_filter_types[0]);
/*
* kqueue event-related tests are in fifo_io.c; however, that tests only
* valid invocations of kqueue. Check to make sure that some invalid filters
* that are generally allowed on file descriptors are not allowed to be
* registered with kqueue, and that if attempts are made, we get the right
* error.
*/
static void
test_kqueue(void)
{
int kqueue_fd, reader_fd, writer_fd;
struct kevent kev_set;
struct timespec timeout;
int i, ret;
makefifo("testfifo", __func__);
if (openfifo("testfifo", __func__, &reader_fd, &writer_fd) < 0) {
warn("%s: openfifo", __func__);
cleanfifo("testfifo", -1, -1);
exit(-1);
}
kqueue_fd = kqueue();
if (kqueue_fd < 0) {
warn("%s: kqueue", __func__);
cleanfifo("testfifo", reader_fd, writer_fd);
exit(-1);
}
timeout.tv_sec = 0;
timeout.tv_nsec = 0;
for (i = 0; i < good_filter_types_len; i++) {
bzero(&kev_set, sizeof(kev_set));
EV_SET(&kev_set, reader_fd, good_filter_types[i].fe_filter,
EV_ADD, 0, 0, 0);
ret = kevent(kqueue_fd, &kev_set, 1, NULL, 0, &timeout);
if (ret < 0) {
warn("%s: kevent: adding good filter %s", __func__,
good_filter_types[i].fe_name);
close(kqueue_fd);
cleanfifo("testfifo", reader_fd, writer_fd);
exit(-1);
}
bzero(&kev_set, sizeof(kev_set));
EV_SET(&kev_set, reader_fd, good_filter_types[i].fe_filter,
EV_DELETE, 0, 0, 0);
ret = kevent(kqueue_fd, &kev_set, 1, NULL, 0, &timeout);
if (ret < 0) {
warn("%s: kevent: deleting good filter %s", __func__,
good_filter_types[i].fe_name);
close(kqueue_fd);
cleanfifo("testfifo", reader_fd, writer_fd);
exit(-1);
}
}
for (i = 0; i < bad_filter_types_len; i++) {
bzero(&kev_set, sizeof(kev_set));
EV_SET(&kev_set, reader_fd, bad_filter_types[i].fe_filter,
EV_ADD, 0, 0, 0);
ret = kevent(kqueue_fd, &kev_set, 1, NULL, 0, &timeout);
if (ret >= 0) {
warnx("%s: kevent: bad filter %s succeeded, expected "
"EINVAL", __func__, bad_filter_types[i].fe_name);
close(kqueue_fd);
cleanfifo("testfifo", reader_fd, writer_fd);
exit(-1);
}
if (errno != bad_filter_types[i].fe_error) {
warn("%s: kevent: bad filter %s failed with error "
"not %s", __func__,
bad_filter_types[i].fe_name,
bad_filter_types[i].fe_errorname);
close(kqueue_fd);
cleanfifo("testfifo", reader_fd, writer_fd);
exit(-1);
}
}
close(kqueue_fd);
cleanfifo("testfifo", reader_fd, writer_fd);
}
static int
test_ioctl_setclearflag(int fd, int flag, const char *testname,
const char *fdname, const char *flagname)
@ -345,7 +237,6 @@ main(int argc, char *argv[])
test_lseek();
test_truncate();
test_kqueue();
test_ioctl();
return (0);

View File

@ -275,7 +275,7 @@ struct xlat {
static struct xlat kevent_filters[] = {
X(EVFILT_READ) X(EVFILT_WRITE) X(EVFILT_AIO) X(EVFILT_VNODE)
X(EVFILT_PROC) X(EVFILT_SIGNAL) X(EVFILT_TIMER)
X(EVFILT_NETDEV) X(EVFILT_FS) X(EVFILT_READ) XEND
X(EVFILT_FS) X(EVFILT_READ) XEND
};
static struct xlat kevent_flags[] = {