diff options
author | ken <ken@FreeBSD.org> | 2011-06-13 22:08:24 +0000 |
---|---|---|
committer | ken <ken@FreeBSD.org> | 2011-06-13 22:08:24 +0000 |
commit | b8dcfe0228713cd46d96c831843ee6c8bbcb84e3 (patch) | |
tree | 15e5ed1216125016e87d67a3fccfcb341ac1efd1 | |
parent | f3f56007b6ff44fbfe31c8000573e05bc31a6234 (diff) | |
download | FreeBSD-src-b8dcfe0228713cd46d96c831843ee6c8bbcb84e3.zip FreeBSD-src-b8dcfe0228713cd46d96c831843ee6c8bbcb84e3.tar.gz |
Instead of using an atomic operation to determine whether the devstat(9)
device node has been created, pass MAKEDEV_CHECKNAME in so that the devfs
code will do the check.
Use a regular static variable as before, that's good enough to keep us from
calling into devfs most of the time.
Suggested by: kib
MFC after: 1 week
Sponsored by: Spectra Logic Corporation
-rw-r--r-- | sys/kern/subr_devstat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c index 402051f..eaf6427 100644 --- a/sys/kern/subr_devstat.c +++ b/sys/kern/subr_devstat.c @@ -470,9 +470,11 @@ devstat_alloc(void) static int once; mtx_assert(&devstat_mutex, MA_NOTOWNED); - if (!once && atomic_cmpset_int(&once, 0, 1)) { - make_dev_credf(MAKEDEV_ETERNAL, &devstat_cdevsw, 0, NULL, - UID_ROOT, GID_WHEEL, 0400, DEVSTAT_DEVICE_NAME); + if (!once) { + make_dev_credf(MAKEDEV_ETERNAL | MAKEDEV_CHECKNAME, + &devstat_cdevsw, 0, NULL, UID_ROOT, GID_WHEEL, 0400, + DEVSTAT_DEVICE_NAME); + once = 1; } spp2 = NULL; mtx_lock(&devstat_mutex); |