Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 May 2008 23:40:21 +0300
From:      Andriy Gapon <avg@icyb.net.ua>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: devctl (alike?) for devfs
Message-ID:  <4829FCB5.8030308@icyb.net.ua>
In-Reply-To: <20080513191610.GK18958@deviant.kiev.zoral.com.ua>
References:  <480FBAB9.1000904@icyb.net.ua> <48103F36.6060707@icyb.net.ua> <200804240811.26183.jhb@freebsd.org> <4810FD1E.70602@icyb.net.ua> <20080425095009.GD18958@deviant.kiev.zoral.com.ua> <4811E6BC.4060306@icyb.net.ua> <20080425143646.GF18958@deviant.kiev.zoral.com.ua> <48275C0C.2040601@icyb.net.ua> <20080511214833.GB18958@deviant.kiev.zoral.com.ua> <4829E658.3000605@icyb.net.ua> <20080513191610.GK18958@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020209090703020207030305
Content-Type: text/plain; charset=KOI8-U; format=flowed
Content-Transfer-Encoding: 7bit

on 13/05/2008 22:16 Kostik Belousov said the following:
> I looked at your previous patch, and it seems it is much simpler to
> do drop the devmtx once more then to try to abuse free lists.
> In the destroy_devl(), after the 
> 
> 	while (dev->si_threadcount != 0) {
> 		/* Use unique dummy wait ident */
> 		msleep(&csw, &devmtx, PRIBIO, "devdrn", hz / 10);
> 	}
> 
> loop, add
> 
> 	mtx_unlock(&devmtx);
> 	if (!cold)
> 		devctl_notify("DEVFS", dev->si_name, "DESTROY", NULL);
> 	mtx_lock(&devmtx);

Thank you again! This is simply perfect.


-- 
Andriy Gapon

--------------020209090703020207030305
Content-Type: text/plain;
 name="devfs-notify.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="devfs-notify.diff"

diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 1db25f8..f90e469 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/param.h>
 #include <sys/kernel.h>
 #include <sys/systm.h>
+#include <sys/bus.h>
 #include <sys/bio.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
@@ -706,6 +707,10 @@ make_dev_credv(int flags, struct cdevsw *devsw, int minornr,
 	devfs_create(dev);
 	clean_unrhdrl(devfs_inos);
 	dev_unlock_and_free();
+
+	if (!cold)
+		devctl_notify("DEVFS", dev->si_name, "CREATE", NULL);
+
 	return (dev);
 }
 
@@ -794,6 +799,10 @@ make_dev_alias(struct cdev *pdev, const char *fmt, ...)
 	clean_unrhdrl(devfs_inos);
 	dev_unlock();
 	dev_depends(pdev, dev);
+
+	if (!cold)
+		devctl_notify("DEVFS", dev->si_name, "CREATE", NULL);
+
 	return (dev);
 }
 
@@ -842,6 +851,12 @@ destroy_devl(struct cdev *dev)
 		msleep(&csw, &devmtx, PRIBIO, "devdrn", hz / 10);
 	}
 
+	if (!cold) {
+		mtx_unlock(&devmtx);
+		devctl_notify("DEVFS", dev->si_name, "DESTROY", NULL);
+		mtx_lock(&devmtx);
+	}
+
 	dev->si_drv1 = 0;
 	dev->si_drv2 = 0;
 	bzero(&dev->__si_u, sizeof(dev->__si_u));

--------------020209090703020207030305--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4829FCB5.8030308>