1. Fix compilation and panic while system boot problem after makedev was

changed to unde2dev.

Approved by: imp (mentor)
This commit is contained in:
Roman Kurakin 2004-03-02 16:44:07 +00:00
parent 752aeaf074
commit 232c8325ba

View File

@ -19,7 +19,7 @@
* as long as this message is kept with the software, all derivative * as long as this message is kept with the software, all derivative
* works or modified versions. * works or modified versions.
* *
* Cronyx Id: if_cx.c,v 1.1.2.22 2004/02/05 17:10:19 rik Exp $ * Cronyx Id: if_cx.c,v 1.1.2.23 2004/02/26 17:56:40 rik Exp $
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__FBSDID("$FreeBSD$"); __FBSDID("$FreeBSD$");
@ -2548,9 +2548,21 @@ static struct cdevsw cx_cdevsw = {
.d_dump = nodump, .d_dump = nodump,
.d_flags = D_TTY, .d_flags = D_TTY,
}; };
#else /* __FreeBSD_version > 501000 */ #elif __FreeBSD_version < 502103
static struct cdevsw cx_cdevsw = { static struct cdevsw cx_cdevsw = {
.d_version = D_VERSION, .d_open = cx_open,
.d_close = cx_close,
.d_read = cx_read,
.d_write = cx_write,
.d_ioctl = cx_ioctl,
.d_poll = ttypoll,
.d_name = "cx",
.d_maj = CDEV_MAJOR,
.d_flags = D_TTY,
};
#else /* __FreeBSD_version >= 502103 */
static struct cdevsw cx_cdevsw = {
.d_version = D_VERSION,
.d_open = cx_open, .d_open = cx_open,
.d_close = cx_close, .d_close = cx_close,
.d_read = cx_read, .d_read = cx_read,
@ -3105,10 +3117,16 @@ static int cx_modevent (module_t mod, int type, void *unused)
static int load_count = 0; static int load_count = 0;
struct cdevsw *cdsw; struct cdevsw *cdsw;
#if __FreeBSD_version >= 502103
dev = udev2dev (makeudev(CDEV_MAJOR, 0)); dev = udev2dev (makeudev(CDEV_MAJOR, 0));
#else
dev = makedev (CDEV_MAJOR, 0);
#endif
switch (type) { switch (type) {
case MOD_LOAD: case MOD_LOAD:
if ((cdsw = devsw (dev)) && cdsw->d_maj == CDEV_MAJOR) { if (dev != NODEV &&
(cdsw = devsw (dev)) &&
cdsw->d_maj == CDEV_MAJOR) {
printf ("Sigma driver is already in system\n"); printf ("Sigma driver is already in system\n");
return (EEXIST); return (EEXIST);
} }