From edde8745558036b9a4f3142bfd15320e21bab393 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Fri, 26 Sep 2008 14:31:24 +0000 Subject: [PATCH] Rename the `minor' argument of make_dev(9) to `unit'. To prevent any further confusion about device minor and unit numbers, we'd better just refer to device unit numbers. Many people still think the numbers we show inside devfs have any relation to the numbers passed to make_dev(9), which is not the case. Discussed with: kib --- share/man/man9/make_dev.9 | 12 ++++++------ sys/kern/kern_conf.c | 18 +++++++++--------- sys/sys/conf.h | 6 +++--- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/share/man/man9/make_dev.9 b/share/man/man9/make_dev.9 index e7aee91a098b..7eb1ecd4cb35 100644 --- a/share/man/man9/make_dev.9 +++ b/share/man/man9/make_dev.9 @@ -44,11 +44,11 @@ and DEVFS registration for devices .In sys/param.h .In sys/conf.h .Ft struct cdev * -.Fn make_dev "struct cdevsw *cdevsw" "int minor" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Fn make_dev "struct cdevsw *cdevsw" "int unit" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... .Ft struct cdev * -.Fn make_dev_cred "struct cdevsw *cdevsw" "int minor" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... .Ft struct cdev * -.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int minor" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... +.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... .Ft struct cdev * .Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ... .Ft void @@ -148,14 +148,14 @@ The .Fn make_dev_cred function is equivalent to the call .Bd -literal -offset indent -make_dev_credf(0, cdevsw, minor, cr, uid, gid, perms, fmt, ...); +make_dev_credf(0, cdevsw, unit, cr, uid, gid, perms, fmt, ...); .Ed . .Pp The .Fn make_dev function call is the same as .Bd -literal -offset indent -make_dev_credf(0, cdevsw, minor, NULL, uid, gid, perms, fmt, ...); +make_dev_credf(0, cdevsw, unit, NULL, uid, gid, perms, fmt, ...); .Ed . .Pp The @@ -184,7 +184,7 @@ that are available to store state. Both fields are of type .Ft void * . These are designed to replace the -.Fa minor +.Fa unit argument to .Fn make_dev . .Pp diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index c276c8783527..daf7e0c6bfa2 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -55,7 +55,7 @@ static void destroy_devl(struct cdev *dev); static int destroy_dev_sched_cbl(struct cdev *dev, void (*cb)(void *), void *arg); static struct cdev *make_dev_credv(int flags, - struct cdevsw *devsw, int minornr, + struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, va_list ap); @@ -649,7 +649,7 @@ prep_cdevsw(struct cdevsw *devsw) } struct cdev * -make_dev_credv(int flags, struct cdevsw *devsw, int minornr, +make_dev_credv(int flags, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, va_list ap) { @@ -659,7 +659,7 @@ make_dev_credv(int flags, struct cdevsw *devsw, int minornr, dev = devfs_alloc(); dev_lock(); prep_cdevsw(devsw); - dev = newdev(devsw, minornr, dev); + dev = newdev(devsw, unit, dev); if (flags & MAKEDEV_REF) dev_refl(dev); if (dev->si_flags & SI_CHEAPCLONE && @@ -701,34 +701,34 @@ make_dev_credv(int flags, struct cdevsw *devsw, int minornr, } struct cdev * -make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int mode, +make_dev(struct cdevsw *devsw, int unit, uid_t uid, gid_t gid, int mode, const char *fmt, ...) { struct cdev *dev; va_list ap; va_start(ap, fmt); - dev = make_dev_credv(0, devsw, minornr, NULL, uid, gid, mode, fmt, ap); + dev = make_dev_credv(0, devsw, unit, NULL, uid, gid, mode, fmt, ap); va_end(ap); return (dev); } struct cdev * -make_dev_cred(struct cdevsw *devsw, int minornr, struct ucred *cr, uid_t uid, +make_dev_cred(struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, ...) { struct cdev *dev; va_list ap; va_start(ap, fmt); - dev = make_dev_credv(0, devsw, minornr, cr, uid, gid, mode, fmt, ap); + dev = make_dev_credv(0, devsw, unit, cr, uid, gid, mode, fmt, ap); va_end(ap); return (dev); } struct cdev * -make_dev_credf(int flags, struct cdevsw *devsw, int minornr, +make_dev_credf(int flags, struct cdevsw *devsw, int unit, struct ucred *cr, uid_t uid, gid_t gid, int mode, const char *fmt, ...) { @@ -736,7 +736,7 @@ make_dev_credf(int flags, struct cdevsw *devsw, int minornr, va_list ap; va_start(ap, fmt); - dev = make_dev_credv(flags, devsw, minornr, cr, uid, gid, mode, + dev = make_dev_credv(flags, devsw, unit, cr, uid, gid, mode, fmt, ap); va_end(ap); diff --git a/sys/sys/conf.h b/sys/sys/conf.h index 8128fa7c87c4..ec7d7d025364 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -258,15 +258,15 @@ void dev_ref(struct cdev *dev); void dev_refl(struct cdev *dev); void dev_rel(struct cdev *dev); void dev_strategy(struct cdev *dev, struct buf *bp); -struct cdev *make_dev(struct cdevsw *_devsw, int _minor, uid_t _uid, gid_t _gid, +struct cdev *make_dev(struct cdevsw *_devsw, int _unit, uid_t _uid, gid_t _gid, int _perms, const char *_fmt, ...) __printflike(6, 7); -struct cdev *make_dev_cred(struct cdevsw *_devsw, int _minor, +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 0x1 #define MAKEDEV_WHTOUT 0x2 struct cdev *make_dev_credf(int _flags, - struct cdevsw *_devsw, int _minornr, + struct cdevsw *_devsw, int _unit, struct ucred *_cr, uid_t _uid, gid_t _gid, int _mode, const char *_fmt, ...) __printflike(8, 9); struct cdev *make_dev_alias(struct cdev *_pdev, const char *_fmt, ...) __printflike(2, 3);