From owner-cvs-sys Wed Jul 24 03:43:57 1996 Return-Path: owner-cvs-sys Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id DAA11501 for cvs-sys-outgoing; Wed, 24 Jul 1996 03:43:57 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id DAA11495; Wed, 24 Jul 1996 03:43:52 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.12/8.6.9) id UAA21158; Wed, 24 Jul 1996 20:26:07 +1000 Date: Wed, 24 Jul 1996 20:26:07 +1000 From: Bruce Evans Message-Id: <199607241026.UAA21158@godzilla.zeta.org.au> To: CVS-committers@freefall.freebsd.org, cvs-all@freefall.freebsd.org, cvs-sys@freefall.freebsd.org, phk@freefall.freebsd.org Subject: Re: cvs commit: src/sys/dev/ccd ccd.c src/sys/dev/vn vn.c src/sys/sys conf.h src/sys/i386/isa fd.c mcd.c scd.c wcd.c wd.c wt.c src/sys/i386/isa/matcd matcd.c src/sys/kern kern_conf.c src/sys/scsi cd.c od.c sd.c st.c Sender: owner-cvs-sys@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Modified: sys/dev/ccd ccd.c > sys/dev/vn vn.c > sys/i386/isa fd.c mcd.c scd.c wcd.c wd.c wt.c > sys/i386/isa/matcd matcd.c > sys/kern kern_conf.c > sys/scsi cd.c od.c sd.c st.c > sys/sys conf.h > Log: > Make a "DWIM" function for adding [bc]devsw entries for bdev drivers. > > Saves about 280 butes of source per driver, 56 bytes in object size > and another 56 bytes moves from data to bss. This broke wcd, which has bogusly different open and close functions for cdevs and bdevs. Compiling LINT gives a nice warning that the cdev open and close functions are no longer used. This change interferes with the correct change, which is to nuke the SYSINIT()s and call bdevsw_add() and cdevsw_add() in the device attach functions. These functions should eventually have a different interface that doesn't involve the driver knowing its own device number. The main wastages in the previous interface were the makedevs and the always-NULL pointers. Changing [bc]devsw_add() to take args (int major, struct [bc]devsw *new) would save about the same amount of space as using the new generic interface for bdev drivers, and more space for cdev-only drivers. However, this might break the intended final interface, which may involve passing back the `old' devsw pointer and a reconstructed device number. Changing to bdevsw_add_generic() has already broken it. However^2, the final interface should involve device descriptors instead of numbers, and overwriting an in-use device descriptor should be an error so `old' pointers should be useless (they would always point to a garbage devsw). Thus the current interface is not worth preserving. Bruce