From 237e3ac2e92ccb019632944daf987795322d4090 Mon Sep 17 00:00:00 2001 From: phk Date: Sat, 29 Jan 2005 16:50:04 +0000 Subject: [PATCH] Use MAXMINOR --- sys/dev/md/md.c | 2 +- sys/kern/kern_conf.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c index 4c5e55763442..041c511ef5bb 100644 --- a/sys/dev/md/md.c +++ b/sys/dev/md/md.c @@ -1183,7 +1183,7 @@ g_md_init(struct g_class *mp __unused) MD_NAME, mdunits, name, len, ptr); md_preloaded(ptr, len); } - status_dev = make_dev(&mdctl_cdevsw, 0xffff00ff, UID_ROOT, GID_WHEEL, + status_dev = make_dev(&mdctl_cdevsw, MAXMINOR, UID_ROOT, GID_WHEEL, 0600, MDCTL_NAME); g_topology_lock(); } diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 5b67f9150a1d..5575e6b2b92a 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -252,7 +252,7 @@ minor(struct cdev *x) { if (x == NULL) return NODEV; - return(x->si_udev & 0xffff00ff); + return(x->si_udev & MAXMINOR); } int @@ -268,7 +268,7 @@ int minor2unit(int _minor) { - KASSERT((_minor & 0xff00) == 0, ("Illegal minor %x", _minor)); + KASSERT((_minor & ~MAXMINOR) == 0, ("Illegal minor %x", _minor)); return ((_minor & 0xff) | (_minor >> 8)); } @@ -351,13 +351,13 @@ findcdev(dev_t udev) int uminor(dev_t dev) { - return (dev & 0xffff00ff); + return (dev & MAXMINOR); } int umajor(dev_t dev) { - return ((dev & 0xff00) >> 8); + return ((dev & ~MAXMINOR) >> 8); } static void @@ -455,7 +455,7 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con va_list ap; int i; - KASSERT((minornr & ~0xffff00ff) == 0, + KASSERT((minornr & ~MAXMINOR) == 0, ("Invalid minor (0x%x) in make_dev", minornr)); if (!(devsw->d_flags & D_INIT))