summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-24 06:29:23 +0000
committerphk <phk@FreeBSD.org>2004-09-24 06:29:23 +0000
commit88cf2bf7b82579a978618774cc0acaed5ce25233 (patch)
tree9ad037a4ac83069da15f57724a6ebca9a3f018f6
parent19aa7ffe990d68c65df35f584c21bdf8b46a2856 (diff)
downloadFreeBSD-src-88cf2bf7b82579a978618774cc0acaed5ce25233.zip
FreeBSD-src-88cf2bf7b82579a978618774cc0acaed5ce25233.tar.gz
Hold threadref while we throb cdevsw in devtoname()
-rw-r--r--sys/kern/kern_conf.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index e3e9495..53d006b 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -621,20 +621,24 @@ const char *
devtoname(struct cdev *dev)
{
char *p;
+ struct cdevsw *csw;
int mynor;
if (dev->si_name[0] == '#' || dev->si_name[0] == '\0') {
p = dev->si_name;
- if (devsw(dev))
- sprintf(p, "#%s/", devsw(dev)->d_name);
- else
- sprintf(p, "#%d/", major(dev));
+ sprintf(p, "#%d", major(dev));
+ p += strlen(p);
+ csw = dev_refthread(dev);
+ if (csw != NULL) {
+ sprintf(p, "(%s)", csw->d_name);
+ dev_relthread(dev);
+ }
p += strlen(p);
mynor = minor(dev);
if (mynor < 0 || mynor > 255)
- sprintf(p, "%#x", (u_int)mynor);
+ sprintf(p, "/%#x", (u_int)mynor);
else
- sprintf(p, "%d", mynor);
+ sprintf(p, "/%d", mynor);
}
return (dev->si_name);
}
OpenPOWER on IntegriCloud