svn commit: r201350 - in head: lib/libc/sys sys/kern sys/net sys/sys tools/regression/fifo/fifo_misc usr.bin/truss

Brooks Davis brooks at FreeBSD.org
Thu Dec 31 20:29:59 UTC 2009


Author: brooks
Date: Thu Dec 31 20:29:58 2009
New Revision: 201350
URL: http://svn.freebsd.org/changeset/base/201350

Log:
  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

Modified:
  head/lib/libc/sys/kqueue.2
  head/sys/kern/kern_event.c
  head/sys/net/if.c
  head/sys/net/if_vlan.c
  head/sys/sys/event.h
  head/tools/regression/fifo/fifo_misc/fifo_misc.c
  head/usr.bin/truss/syscalls.c

Modified: head/lib/libc/sys/kqueue.2
==============================================================================
--- head/lib/libc/sys/kqueue.2	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/lib/libc/sys/kqueue.2	Thu Dec 31 20:29:58 2009	(r201350)
@@ -438,19 +438,6 @@ There is a system wide limit on the numb
 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
 .An Jonathan Lemon Aq jlemon at 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.

Modified: head/sys/kern/kern_event.c
==============================================================================
--- head/sys/kern/kern_event.c	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/sys/kern/kern_event.c	Thu Dec 31 20:29:58 2009	(r201350)
@@ -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 */

Modified: head/sys/net/if.c
==============================================================================
--- head/sys/net/if.c	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/sys/net/if.c	Thu Dec 31 20:29:58 2009	(r201350)
@@ -1819,7 +1819,7 @@ if_route(struct ifnet *ifp, int flag, in
 #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 pend
 {
 	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)

Modified: head/sys/net/if_vlan.c
==============================================================================
--- head/sys/net/if_vlan.c	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/sys/net/if_vlan.c	Thu Dec 31 20:29:58 2009	(r201350)
@@ -188,7 +188,7 @@ static	int vlan_setmulti(struct ifnet *i
 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 @@ restart:
 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 sta
 
 /* 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;

Modified: head/sys/sys/event.h
==============================================================================
--- head/sys/sys/event.h	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/sys/sys/event.h	Thu Dec 31 20:29:58 2009	(r201350)
@@ -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;

Modified: head/tools/regression/fifo/fifo_misc/fifo_misc.c
==============================================================================
--- head/tools/regression/fifo/fifo_misc/fifo_misc.c	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/tools/regression/fifo/fifo_misc/fifo_misc.c	Thu Dec 31 20:29:58 2009	(r201350)
@@ -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);

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c	Thu Dec 31 19:40:51 2009	(r201349)
+++ head/usr.bin/truss/syscalls.c	Thu Dec 31 20:29:58 2009	(r201350)
@@ -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[] = {


More information about the svn-src-head mailing list