summaryrefslogtreecommitdiffstats
path: root/share/man
diff options
context:
space:
mode:
authorjh <jh@FreeBSD.org>2010-10-07 18:00:55 +0000
committerjh <jh@FreeBSD.org>2010-10-07 18:00:55 +0000
commitd93ad5245d40e2887d36fe6e876a870d16f1dc0d (patch)
treef6bd7f0b6ecbf4f251efb4a2bf7d3fa7096463ef /share/man
parent81f0eaae12838513377191ff7dd13700a9b32dad (diff)
downloadFreeBSD-src-d93ad5245d40e2887d36fe6e876a870d16f1dc0d.zip
FreeBSD-src-d93ad5245d40e2887d36fe6e876a870d16f1dc0d.tar.gz
Check the device name validity on device registration.
A new function prep_devname() sanitizes a device name by removing leading and redundant sequential slashes. The function returns an error for names which already exist or are considered invalid. A new flag MAKEDEV_CHECKNAME for make_dev_p(9) and make_dev_credf(9) indicates that the caller is prepared to handle an error related to the device name. An invalid name triggers a panic if the flag is not specified. Document the MAKEDEV_CHECKNAME flag in the make_dev(9) manual page. Idea from: kib Reviewed by: kib
Diffstat (limited to 'share/man')
-rw-r--r--share/man/man9/make_dev.923
1 files changed, 16 insertions, 7 deletions
diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9
index 9cc755f..2e35f5f 100644
--- a/share/man/man9/make_dev.9
+++ b/share/man/man9/make_dev.9
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd September 5, 2010
+.Dd October 7, 2010
.Dt MAKE_DEV 9
.Os
.Sh NAME
@@ -131,12 +131,18 @@ argument alters the operation of
.Fn make_dev_credf .
The following values are currently accepted:
.Pp
-.Bd -literal -offset indent -compact
-MAKEDEV_REF reference the created device
-MAKEDEV_NOWAIT do not sleep, may return NULL
-MAKEDEV_WAITOK allow the function to sleep to satisfy malloc
-MAKEDEV_ETERNAL created device will be never destroyed
-.Ed
+.Bl -tag -width "MAKEDEV_CHECKNAME" -compact -offset indent
+.It MAKEDEV_REF
+reference the created device
+.It MAKEDEV_NOWAIT
+do not sleep, may return NULL
+.It MAKEDEV_WAITOK
+allow the function to sleep to satisfy malloc
+.It MAKEDEV_ETERNAL
+created device will be never destroyed
+.It MAKEDEV_CHECKNAME
+return NULL if the device name is invalid or already exists
+.El
.Pp
The
.Dv MAKEDEV_WAITOK
@@ -166,6 +172,9 @@ For the convenience, use the
flag for the code that can be compiled into kernel or loaded
(and unloaded) as loadable module.
.Pp
+A panic will occur if the MAKEDEV_CHECKNAME flag is not specified
+and the device name is invalid or already exists.
+.Pp
The
.Fn make_dev_cred
function is equivalent to the call
OpenPOWER on IntegriCloud