Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Feb 1995 16:26:07 -0500 (EST)
From:      Peter Dufault <dufault@hda.com>
To:        julian@freefall.cdrom.com, hackers@freefall.cdrom.com
Subject:   Driver switches in conf.c
Message-ID:  <199502232126.QAA04033@hda.com>

next in thread | raw e-mail | index | archive | help
In the current SCSI code there is a fair amount of common code in the
type drivers that could be collapsed by something such as:

int sdopen(dev_t dev)
{
	return scsiopen(dev, &sd_switch);
}

where sd_switch is a SCSI specific structure that describes the
unique code of a SCSI type driver and the common code is handled
in scsiopen and then call sd_open with validated SCSI data structures.

However, for new devices (as an example an Optronic's Image Setter
produced by one of our valued clients) it seems silly to manually
create oisopen, oisclose, oisioctl instead of vectoring directly into
scsiopen and passing the appropriate switch from within conf.c.

That is, instead of

> disk oi0 at scbus0 target 1 unit 1

in config and then essentially oiopen, oiclose, oiioctl functions
that go directly to scsiopen, scsiclose, scsiioctl, and I would
somehow set it up in conf.c so that an indication of the "oi" device
is passed in.

I thought of having config generate

> extern scsi_device sd_switch;
> int sdopen(dev_t dev) { return scsiopen(dev, &sd_switch); }

for each SCSI device in ioconf.c, but this seems flakey.

Is there a good way to do this?  For now I'm just planning on going
with the "do it by hand each time" approach but that "offends my
aesthetic".

-- 
Peter Dufault               Real Time Machine Control and Simulation
HD Associates, Inc.         Voice: 508 433 6936
dufault@hda.com             Fax:   508 433 5267



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199502232126.QAA04033>