Re: FINAL CALL: device driver megapatch in 8-10 hours.

From: M. Warner Losh <imp_at_bsdimp.com>
Date: Sat, 21 Feb 2004 12:40:38 -0700 (MST)
In message: <32558.1077361668_at_critter.freebsd.dk>
            Poul-Henning Kamp <phk_at_phk.freebsd.dk> writes:
: 	http://phk.freebsd.dk/patch/sysN.patch
: 
: Now would be a really good time to look at it...

Index: dev/cx/if_cx.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/cx/if_cx.c,v
retrieving revision 1.3
diff -u -r1.3 if_cx.c
--- dev/cx/if_cx.c	14 Feb 2004 21:00:23 -0000	1.3
+++ dev/cx/if_cx.c	15 Feb 2004 19:04:52 -0000
_at__at_ -2514,6 +2514,7 _at__at_
 #if __FreeBSD_version < 400000
 struct isa_driver cxdriver = { cx_probe, cx_attach, "cx" };
 static struct cdevsw cx_cdevsw = {
+	.d_version =	D_VERSION,
 	cx_open,	cx_close,	cx_read,	cx_write,
 	cx_ioctl,	cx_stop,	noreset,	cx_devtotty,
 	ttpoll,		nommap,		NULL,		"cx",
_at__at_ -2521,6 +2522,7 _at__at_
 };
 #elif  __FreeBSD_version < 500000
 static struct cdevsw cx_cdevsw = {
+	.d_version =	D_VERSION,
 	cx_open,	cx_close,	cx_read,	cx_write,
 	cx_ioctl,	ttypoll,	nommap,		nostrategy,
 	"cx",		CDEV_MAJOR,	nodump,		nopsize,
_at__at_ -2528,6 +2530,7 _at__at_
 };
 #elif __FreeBSD_version == 500000
 static struct cdevsw cx_cdevsw = {
+	.d_version =	D_VERSION,
 	cx_open,	cx_close,	cx_read,	cx_write,
 	cx_ioctl,	ttypoll,	nommap,		nostrategy,
 	"cx",		CDEV_MAJOR,	nodump,		nopsize,
_at__at_ -2535,6 +2538,7 _at__at_
 	};
 #elif __FreeBSD_version <= 501000 
 static struct cdevsw cx_cdevsw = {
+	.d_version =	D_VERSION,
 	.d_open     = cx_open,
 	.d_close    = cx_close,
 	.d_read     = cx_read,
_at__at_ -2550,15 +2554,15 _at__at_
 };
 #else /* __FreeBSD_version > 501000 */
 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,
+	.d_flags    = D_TTY | D_NEEDGIANT,
 };
 #endif
 
The first three are likely wrong.  if_cx is maintained outside the
tree for the most part, so it supports more versions than we normally
have in the tree.

Index: dev/firewire/fwdev.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/firewire/fwdev.c,v
retrieving revision 1.36
diff -u -r1.36 fwdev.c
--- dev/firewire/fwdev.c	22 Jan 2004 14:41:17 -0000	1.36
+++ dev/firewire/fwdev.c	15 Feb 2004 19:04:52 -0000
_at__at_ -62,7 +62,6 _at__at_
 #include <dev/firewire/fwmem.h>
 #include <dev/firewire/iec68113.h>
 
-#define CDEV_MAJOR 127
 #define	FWNODE_INVAL 0xffff
 
 static	d_open_t	fw_open;
_at__at_ -74,8 +73,8 _at__at_
 static	d_mmap_t	fw_mmap;
 static	d_strategy_t	fw_strategy;
 
-struct cdevsw firewire_cdevsw = 
-{
+struct cdevsw firewire_cdevsw = {
+	.d_version =	D_VERSION,
 #if __FreeBSD_version >= 500104
 	.d_open =	fw_open,
 	.d_close =	fw_close,
_at__at_ -86,8 +85,7 _at__at_
 	.d_mmap =	fw_mmap,
 	.d_strategy =	fw_strategy,
 	.d_name =	"fw",
-	.d_maj =	CDEV_MAJOR,
-	.d_flags =	D_MEM
+	.d_flags =	D_MEM | D_NEEDGIANT
 #else

This also gets the .d_version wrong for the versions of FreeBSD this
driver supports.

Index: dev/usb/ulpt.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ulpt.c,v
retrieving revision 1.59
diff -u -r1.59 ulpt.c
--- dev/usb/ulpt.c	28 Sep 2003 20:48:13 -0000	1.59
+++ dev/usb/ulpt.c	15 Feb 2004 19:04:55 -0000
_at__at_ -134,6 +134,7 _at__at_
 dev_type_ioctl(ulptioctl);
 
 const struct cdevsw ulpt_cdevsw = {
+	.d_version =	D_VERSION,
 	ulptopen, ulptclose, noread, ulptwrite, ulptioctl,
 	nostop, notty, nopoll, nommap, nokqfilter,
 };
_at__at_ -145,15 +146,15 _at__at_
 Static d_write_t ulptwrite;
 Static d_ioctl_t ulptioctl;
 
-#define ULPT_CDEV_MAJOR 113
 
 Static struct cdevsw ulpt_cdevsw = {
+	.d_version =	D_VERSION,
+	.d_flags =	D_NEEDGIANT,
 	.d_open =	ulptopen,
 	.d_close =	ulptclose,
 	.d_write =	ulptwrite,
 	.d_ioctl =	ulptioctl,
 	.d_name =	"ulpt",
-	.d_maj =	ULPT_CDEV_MAJOR,
 #if __FreeBSD_version < 500014
 	.d_bmaj		-1
 #endif

Again with the bogus version in the first hunk of this.

otherwise things look good.

Warner
Received on Sat Feb 21 2004 - 10:41:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:44 UTC