summaryrefslogtreecommitdiffstats
path: root/sys/sys/conf.h
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 /sys/sys/conf.h
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 'sys/sys/conf.h')
-rw-r--r--sys/sys/conf.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 6c60601..5f1ef18 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -263,11 +263,12 @@ struct cdev *make_dev(struct cdevsw *_devsw, int _unit, uid_t _uid, gid_t _gid,
struct cdev *make_dev_cred(struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _perms,
const char *_fmt, ...) __printflike(7, 8);
-#define MAKEDEV_REF 0x01
-#define MAKEDEV_WHTOUT 0x02
-#define MAKEDEV_NOWAIT 0x04
-#define MAKEDEV_WAITOK 0x08
-#define MAKEDEV_ETERNAL 0x10
+#define MAKEDEV_REF 0x01
+#define MAKEDEV_WHTOUT 0x02
+#define MAKEDEV_NOWAIT 0x04
+#define MAKEDEV_WAITOK 0x08
+#define MAKEDEV_ETERNAL 0x10
+#define MAKEDEV_CHECKNAME 0x20
struct cdev *make_dev_credf(int _flags,
struct cdevsw *_devsw, int _unit,
struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode,
OpenPOWER on IntegriCloud