--- if_cp.c.orig Sat Mar 9 02:35:11 2002 +++ if_cp.c Sat Mar 9 03:12:16 2002 @@ -109,7 +109,36 @@ {0, 0} }; +/* Function prototypes */ +static d_open_t cp_open; +static d_close_t cp_close; +static d_ioctl_t cp_ioctl; + +#if __FreeBSD_version < 400000 +static struct cdevsw cp_cdevsw = { + cp_open, cp_close, noread, nowrite, + cp_ioctl, nullstop, nullreset, nodevtotty, + seltrue, nommap, NULL, "cp", + NULL, -1 + }; +#elif __FreeBSD_version < 500000 +static struct cdevsw cp_cdevsw = { + cp_open, cp_close, noread, nowrite, + cp_ioctl, nopoll, nommap, nostrategy, + "taupci", CDEV_MAJOR, nodump, nopsize, + D_NAGGED, -1 + }; +#else +static struct cdevsw cp_cdevsw = { + cp_open, cp_close, noread, nowrite, + cp_ioctl, nopoll, nommap, nostrategy, + "taupci", CDEV_MAJOR, nodump, nopsize, + D_NAGGED, + }; +#endif + typedef struct _bdrv_t { + dev_t dev; /* DEVFS */ cp_board_t *board; struct resource *cp_res; struct resource *cp_irq; @@ -415,6 +444,10 @@ cp_register_error (c, &cp_error); } splx (s); +#if __FreeBSD_version >= 500000 + bd->dev = make_dev(&cp_cdevsw, 0, UID_ROOT, GID_WHEEL, + 0600, "cp%d", unit); +#endif #if __FreeBSD_version >= 400000 return 0; #endif @@ -485,6 +518,10 @@ bus_release_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq); bus_release_resource (dev, SYS_RES_MEMORY, PCIR_MAPS, bd->cp_res); +#if __FreeBSD_version >= 500000 + destroy_dev(bd->dev); +#endif + adapter [b->num] = 0; free (b, M_DEVBUF); splx (s); @@ -1644,29 +1681,6 @@ } return ENOTTY; } - -#if __FreeBSD_version < 400000 -static struct cdevsw cp_cdevsw = { - cp_open, cp_close, noread, nowrite, - cp_ioctl, nullstop, nullreset, nodevtotty, - seltrue, nommap, NULL, "cp", - NULL, -1 - }; -#elif __FreeBSD_version < 500000 -static struct cdevsw cp_cdevsw = { - cp_open, cp_close, noread, nowrite, - cp_ioctl, nopoll, nommap, nostrategy, - "taupci", CDEV_MAJOR, nodump, nopsize, - D_NAGGED, -1 - }; -#else -static struct cdevsw cp_cdevsw = { - cp_open, cp_close, noread, nowrite, - cp_ioctl, nopoll, nommap, nostrategy, - "taupci", CDEV_MAJOR, nodump, nopsize, - D_NAGGED, - }; -#endif #ifdef NETGRAPH static int ng_cp_constructor (node_p *nodep)