Fix signedness of minor2unit().

This commit is contained in:
Poul-Henning Kamp 2005-03-08 10:40:03 +00:00
parent ec346d1040
commit 3238ec33e1
2 changed files with 6 additions and 6 deletions

View File

@ -259,12 +259,12 @@ dev2unit(struct cdev *x)
return (minor2unit(minor(x)));
}
int
minor2unit(int _minor)
u_int
minor2unit(u_int _minor)
{
KASSERT((_minor & ~MAXMINOR) == 0, ("Illegal minor %x", _minor));
return ((_minor & 0xff) | (_minor >> 8));
return ((_minor & 0xff) | ((_minor >> 8) & 0xffff00));
}
int
@ -463,7 +463,7 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con
return (dev);
}
KASSERT(!(dev->si_flags & SI_NAMED),
("make_dev() by driver %s on pre-existing device (maj=%d, min=%d, name=%s)",
("make_dev() by driver %s on pre-existing device (maj=%d, min=%x, name=%s)",
devsw->d_name, major(dev), minor(dev), devtoname(dev)));
va_start(ap, fmt);

View File

@ -220,7 +220,7 @@ struct cdevsw {
#define NUMCDEVSW 256
#define MAXMINOR 0xffff00ff
#define MAXMINOR 0xffff00ffU
/*
* XXX: do not use MAJOR_AUTO unless you have no choice. In general drivers
@ -269,7 +269,7 @@ int dev2unit(struct cdev *_dev);
void dev_lock(void);
void dev_unlock(void);
int unit2minor(int _unit);
int minor2unit(int _minor);
u_int minor2unit(u_int _minor);
void setconf(void);
void devfs_create(struct cdev *dev);