svn commit: r296146 - stable/9/sys/dev/filemon

Bryan Drewery bdrewery at FreeBSD.org
Sat Feb 27 20:57:36 UTC 2016


Author: bdrewery
Date: Sat Feb 27 20:57:34 2016
New Revision: 296146
URL: https://svnweb.freebsd.org/changeset/base/296146

Log:
  MFC r242088:
  
    Desupport pre-FreeBSD 7.1.

Modified:
  stable/9/sys/dev/filemon/filemon.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/filemon/filemon.c
==============================================================================
--- stable/9/sys/dev/filemon/filemon.c	Sat Feb 27 20:54:23 2016	(r296145)
+++ stable/9/sys/dev/filemon/filemon.c	Sat Feb 27 20:57:34 2016	(r296146)
@@ -99,47 +99,11 @@ static TAILQ_HEAD(, filemon) filemons_in
 static TAILQ_HEAD(, filemon) filemons_free = TAILQ_HEAD_INITIALIZER(filemons_free);
 static struct sx access_lock;
 
-#if __FreeBSD_version < 701000
-static struct clonedevs *filemon_clones;
-static eventhandler_tag	eh_tag;
-#else
 static struct cdev *filemon_dev;
-#endif
 
 #include "filemon_lock.c"
 #include "filemon_wrapper.c"
 
-#if __FreeBSD_version < 701000
-static void
-filemon_clone(void *arg, struct ucred *cred, char *name, int namelen,
-    struct cdev **dev)
-{
-	int u = -1;
-	size_t len;
-
-	if (*dev != NULL)
-		return;
-
-	len = strlen(name);
-
-	if (len != 7)
-		return;
-
-	if (bcmp(name,"filemon", 7) != 0)
-		return;
-
-	/* Clone the device to the new minor number. */
-	if (clone_create(&filemon_clones, &filemon_cdevsw, &u, dev, 0) != 0)
-		/* Create the /dev/filemonNN entry. */
-		*dev = make_dev_cred(&filemon_cdevsw, u, cred, UID_ROOT,
-		    GID_WHEEL, 0666, "filemon%d", u);
-	if (*dev != NULL) {
-		dev_ref(*dev);
-		(*dev)->si_flags |= SI_CHEAPCLONE;
-	}
-}
-#endif
-
 static void
 filemon_dtr(void *data)
 {
@@ -176,11 +140,7 @@ filemon_ioctl(struct cdev *dev, u_long c
 	struct filemon *filemon;
 	struct proc *p;
 
-#if __FreeBSD_version < 701000
-	filemon = dev->si_drv1;
-#else
 	devfs_get_cdevpriv((void **) &filemon);
-#endif
 
 	switch (cmd) {
 	/* Set the output file descriptor. */
@@ -239,11 +199,7 @@ filemon_open(struct cdev *dev, int oflag
 
 	filemon->pid = curproc->p_pid;
 
-#if __FreeBSD_version < 701000
-	dev->si_drv1 = filemon;
-#else
 	devfs_set_cdevpriv(filemon, filemon_dtr);
-#endif
 
 	/* Get exclusive write access. */
 	filemon_lock_write();
@@ -261,14 +217,6 @@ static int
 filemon_close(struct cdev *dev __unused, int flag __unused, int fmt __unused,
     struct thread *td __unused)
 {
-#if __FreeBSD_version < 701000
-	filemon_dtr(dev->si_drv1);
-
-	dev->si_drv1 = NULL;
-
-	/* Schedule this cloned device to be destroyed. */
-	destroy_dev_sched(dev);
-#endif
 
 	return (0);
 }
@@ -281,16 +229,8 @@ filemon_load(void *dummy __unused)
 	/* Install the syscall wrappers. */
 	filemon_wrapper_install();
 
-#if __FreeBSD_version < 701000
-	/* Enable device cloning. */
-	clone_setup(&filemon_clones);
-
-	/* Setup device cloning events. */
-	eh_tag = EVENTHANDLER_REGISTER(dev_clone, filemon_clone, 0, 1000);
-#else
 	filemon_dev = make_dev(&filemon_cdevsw, 0, UID_ROOT, GID_WHEEL, 0666,
 	    "filemon");
-#endif
 }
 
 static int
@@ -305,9 +245,7 @@ filemon_unload(void)
 	if (TAILQ_FIRST(&filemons_inuse) != NULL)
 		error = EBUSY;
 	else {
-#if __FreeBSD_version >= 701000
 		destroy_dev(filemon_dev);
-#endif
 
 		/* Deinstall the syscall wrappers. */
 		filemon_wrapper_deinstall();
@@ -317,19 +255,6 @@ filemon_unload(void)
 	filemon_unlock_write();
 
 	if (error == 0) {
-#if __FreeBSD_version < 701000
-		/*
-		 * Check if there is still an event handler callback registered.
-		*/
-		if (eh_tag != 0) {
-			/* De-register the device cloning event handler. */
-			EVENTHANDLER_DEREGISTER(dev_clone, eh_tag);
-			eh_tag = 0;
-
-			/* Stop device cloning. */
-			clone_cleanup(&filemon_clones);
-		}
-#endif
 		/* free() filemon structs free list. */
 		filemon_lock_write();
 		while ((filemon = TAILQ_FIRST(&filemons_free)) != NULL) {


More information about the svn-src-stable-9 mailing list