--- vmmon-only/freebsd/driver.c_original Wed Mar 5 19:22:35 2003 +++ vmmon-only/freebsd/driver.c Wed Mar 5 19:22:44 2003 @@ -155,6 +155,14 @@ /* static struct cdevsw vmmon_cdevsw = { */ static struct cdevsw vmmon_cdevsw = { +#if __FreeBSD_version >= 500104 + .d_open = FreeBSD_Driver_Open, + .d_close = FreeBSD_Driver_Close, + .d_ioctl = FreeBSD_Driver_Ioctl, + .d_poll = FreeBSD_Driver_Poll, + .d_name = DEVICE_NAME, + .d_maj = CDEV_MAJOR +#else /* open */ FreeBSD_Driver_Open, /* close */ FreeBSD_Driver_Close, /* read */ noread, @@ -169,8 +177,7 @@ /* psize */ nopsize, /* flags */ 0, /* bmaj */ -1 - - +#endif }; @@ -242,7 +249,11 @@ sprintf(freebsdState.deviceBuf,DEVICE_NAME); freebsdState.major = CDEV_MAJOR; freebsdState.minor = CDEV_MINOR; +#if __FreeBSD_version < 500104 retval = cdevsw_add(&vmmon_cdevsw); +#else + retval = 0; +#endif #endif if (retval) { @@ -273,12 +284,14 @@ int retval=0; destroy_dev(vmmon_dev); +#if __FreeBSD_version < 500104 retval = cdevsw_remove(&vmmon_cdevsw); if (retval) { Warning("Module %s: error unregistering\n", freebsdState.deviceBuf); } else { Log("Module %s: unloaded\n", freebsdState.deviceBuf); } +#endif return 0; } --- vmnet-only/freebsd/vmnet.c_original Wed Mar 5 19:21:51 2003 +++ vmnet-only/freebsd/vmnet.c Wed Mar 5 19:22:00 2003 @@ -103,6 +103,16 @@ static int vmnet_modeevent(module_t mod, int cmd, void *arg); static struct cdevsw vmnet_cdevsw = { +#if __FreeBSD_version >= 500104 + .d_open = vmnet_open, + .d_close = vmnet_close, + .d_read = vmnet_read, + .d_write = vmnet_write, + .d_ioctl = vmnet_ioctl, + .d_poll = vmnet_poll, + .d_name = DEVICE_NAME, + .d_maj = CDEV_MAJOR +#else /* open */ vmnet_open, /* close */ vmnet_close, /* read */ vmnet_read, @@ -115,10 +125,11 @@ /* maj */ CDEV_MAJOR, /* dump */ nodump, /* psize */ nopsize, - /* flags */ 0, - /* bmaj */ -1 + /* flags */ 0, -/* bmaj */ -1 +#endif }; + /* * Now declare the module to the system. * IMPORTANT: Must be before netgraph node declaration. @@ -164,7 +175,7 @@ s = splimp(); if_attach(ifp); - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + ether_ifattach(ifp); bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header)); splx(s); @@ -604,11 +615,13 @@ static int init_module(void) { -int error; + int error = 0; +#if __FreeBSD_version < 500104 error = cdevsw_add(&vmnet_cdevsw); if (error) return error; +#endif return error; } @@ -618,7 +631,7 @@ static int cleanup_module(void) { - int error; + int error = 0; struct vmnet_softc *sc; DLog(Lenter, ""); @@ -629,7 +642,9 @@ return error; } } +#if __FreeBSD_version < 500104 error = cdevsw_remove(&vmnet_cdevsw); +#endif DLog(Linfo, "return %d", error); return error; }