freebsd-skq/sys/scsi/uk.c
Julian Elischer 53ac6efbd8 OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c..
my next trick will be to define cdevsw[] and bdevsw[]
as empty arrays and remove all those DAMNED defines as well..

Each of these drivers has a SYSINIT linker set entry
that comes in very early.. and asks teh driver to add it's own
entry to the two devsw[] tables.

some slight reworking of the commits from yesterday (added the SYSINIT
stuff and some usually wrong but token DEVFS entries to all these
devices.

BTW does anyone know where the 'ata' entries in conf.c actually reside?
seems we don't actually have a 'ataopen() etc...

If you want to add a new device in conf.c
please  make sure I know
so I can keep it up to date too..

as before, this is all dependent on #if defined(JREMOD)
(and #ifdef DEVFS in parts)
1995-11-29 10:49:16 +00:00

81 lines
1.5 KiB
C

/*
* Driver for a device we can't identify.
* by Julian Elischer (julian@tfs.com)
*
* $Id: uk.c,v 1.9 1995/05/30 08:13:56 rgrimes Exp $
*
* If you find that you are adding any code to this file look closely
* at putting it in "scsi_driver.c" instead.
*/
#include <sys/param.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
#define CDEV_MAJOR 31
#endif /*JREMOD*/
SCSI_DEVICE_ENTRIES(uk)
struct scsi_device uk_switch =
{
NULL,
NULL,
NULL,
NULL,
"uk",
0,
{0, 0},
SDEV_ONCE_ONLY, /* Only one open allowed */
0,
"Unknown",
ukopen,
0,
T_UNKNOWN,
0,
0,
0,
0,
0,
0,
};
#ifdef JREMOD
struct cdevsw uk_cdevsw =
{ ukopen, ukclose, noread, nowrite, /*31*/
ukioctl, nostop, nullreset, nodevtotty,/* unknown */
seltrue, nommap, NULL }; /* scsi */
static uk_devsw_installed = 0;
static void uk_drvinit(void *unused)
{
dev_t dev;
if( ! uk_devsw_installed ) {
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&uk_cdevsw,NULL);
uk_devsw_installed = 1;
#ifdef DEVFS
{
int x;
/* default for a simple device with no probe routine (usually delete this) */
x=devfs_add_devsw(
/* path name devsw minor type uid gid perm*/
"/", "uk", major(dev), 0, DV_CHR, 0, 0, 0600);
}
}
#endif
}
SYSINIT(ukdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,uk_drvinit,NULL)
#endif /* JREMOD */