summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-07-23 21:52:43 +0000
committerphk <phk@FreeBSD.org>1996-07-23 21:52:43 +0000
commit507c8709748944c310d7a558ec0e27130fadb6f4 (patch)
treeb7107b6c401f05c3026e9bfb11ea285a7b376aba /sys/scsi
parentb27f4b2c811818ccd3f03bd1aad99a231b5b2b18 (diff)
downloadFreeBSD-src-507c8709748944c310d7a558ec0e27130fadb6f4.zip
FreeBSD-src-507c8709748944c310d7a558ec0e27130fadb6f4.tar.gz
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. No functional change intended nor expected. GENERIC should be about one k smaller now :-)
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c16
-rw-r--r--sys/scsi/od.c15
-rw-r--r--sys/scsi/sd.c15
-rw-r--r--sys/scsi/st.c16
4 files changed, 12 insertions, 50 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 1e2c56f..7a71341 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: cd.c,v 1.70 1996/06/12 05:10:51 gpalmer Exp $
+ * $Id: cd.c,v 1.71 1996/07/14 10:46:46 joerg Exp $
*/
#include "opt_bounce.h"
@@ -73,17 +73,11 @@ static d_strategy_t cdstrategy;
#define CDEV_MAJOR 15
#define BDEV_MAJOR 6
-extern struct cdevsw cd_cdevsw;
+static struct cdevsw cd_cdevsw;
static struct bdevsw cd_bdevsw =
{ cdopen, cdclose, cdstrategy, cdioctl, /*6*/
nodump, nopsize, 0, "cd", &cd_cdevsw, -1 };
-static struct cdevsw cd_cdevsw =
- { cdopen, cdclose, rawread, nowrite, /*15*/
- cdioctl, nostop, nullreset, nodevtotty,/* cd */
- seltrue, nommap, cdstrategy, "cd",
- &cd_bdevsw, -1 };
-
static int32_t cdstrats, cdqueues;
@@ -1417,13 +1411,9 @@ static cd_devsw_installed = 0;
static void cd_drvinit(void *unused)
{
- dev_t dev;
if( ! cd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&cd_cdevsw, NULL);
- dev = makedev(BDEV_MAJOR, 0);
- bdevsw_add(&dev,&cd_bdevsw, NULL);
+ bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &cd_bdevsw);
cd_devsw_installed = 1;
}
}
diff --git a/sys/scsi/od.c b/sys/scsi/od.c
index 610fe9a..643357f 100644
--- a/sys/scsi/od.c
+++ b/sys/scsi/od.c
@@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: od.c,v 1.15.1.3 1996/05/06 15:14:57 shun Exp $
+ * $Id: od.c,v 1.18 1996/06/16 19:58:24 joerg Exp $
*/
/*
@@ -150,16 +150,11 @@ static d_strategy_t odstrategy;
#define CDEV_MAJOR 70
#define BDEV_MAJOR 20
-extern struct cdevsw od_cdevsw;
+static struct cdevsw od_cdevsw;
static struct bdevsw od_bdevsw =
{ odopen, odclose, odstrategy, odioctl, /*20*/
nodump, nopsize, 0, "od", &od_cdevsw, -1 };
-static struct cdevsw od_cdevsw =
- { odopen, odclose, rawread, rawwrite, /*70*/
- odioctl, nostop, nullreset, nodevtotty,
- seltrue, nommap, odstrategy, "od",
- &od_bdevsw, -1 };
/*
* Actually include the interface routines
@@ -983,13 +978,9 @@ static od_devsw_installed = 0;
static void od_drvinit(void *unused)
{
- dev_t dev;
if( ! od_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&od_cdevsw, NULL);
- dev = makedev(BDEV_MAJOR, 0);
- bdevsw_add(&dev,&od_bdevsw, NULL);
+ bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &od_bdevsw);
od_devsw_installed = 1;
}
}
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index a78e727..edbce2c 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.89 1996/05/02 22:20:52 phk Exp $
+ * $Id: sd.c,v 1.90 1996/06/14 11:02:20 asami Exp $
*/
#include "opt_bounce.h"
@@ -115,16 +115,11 @@ static d_strategy_t sdstrategy;
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
-extern struct cdevsw sd_cdevsw; /* hold off the complaints for a second */
+static struct cdevsw sd_cdevsw;
static struct bdevsw sd_bdevsw =
{ sdopen, sdclose, sdstrategy, sdioctl, /*4*/
sddump, sdsize, 0, "sd", &sd_cdevsw, -1 };
-static struct cdevsw sd_cdevsw =
- { sdopen, sdclose, rawread, rawwrite, /*13*/
- sdioctl, nostop, nullreset, nodevtotty,
- seltrue, nommap, sdstrategy, "sd",
- &sd_bdevsw, -1 };
SCSI_DEVICE_ENTRIES(sd)
@@ -1055,13 +1050,9 @@ static sd_devsw_installed = 0;
static void sd_drvinit(void *unused)
{
- dev_t dev;
if( ! sd_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&sd_cdevsw, NULL);
- dev = makedev(BDEV_MAJOR, 0);
- bdevsw_add(&dev,&sd_bdevsw, NULL);
+ bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sd_bdevsw);
sd_devsw_installed = 1;
}
}
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 2bcc733..d7fe9a9 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.70 1996/06/24 04:54:32 gibbs Exp $
+ * $Id: st.c,v 1.71 1996/07/14 10:46:54 joerg Exp $
*/
/*
@@ -163,17 +163,11 @@ static d_strategy_t ststrategy;
#define CDEV_MAJOR 14
#define BDEV_MAJOR 5
-extern struct cdevsw st_cdevsw; /* hold off the complaints for a second */
+static struct cdevsw st_cdevsw;
static struct bdevsw st_bdevsw =
{ stopen, stclose, ststrategy, stioctl, /*5*/
nodump, nopsize, 0, "st", &st_cdevsw, -1 };
-static struct cdevsw st_cdevsw =
- { stopen, stclose, rawread, rawwrite, /*14*/
- stioctl, nostop, nullreset, nodevtotty,/* st */
- seltrue, nommap, ststrategy, "st",
- &st_bdevsw, -1 };
-
SCSI_DEVICE_ENTRIES(st)
static struct scsi_device st_switch =
@@ -1987,13 +1981,9 @@ static st_devsw_installed = 0;
static void
st_drvinit(void *unused)
{
- dev_t dev;
if( ! st_devsw_installed ) {
- dev = makedev(CDEV_MAJOR, 0);
- cdevsw_add(&dev,&st_cdevsw, NULL);
- dev = makedev(BDEV_MAJOR, 0);
- bdevsw_add(&dev,&st_bdevsw, NULL);
+ bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &st_bdevsw);
st_devsw_installed = 1;
}
}
OpenPOWER on IntegriCloud