summaryrefslogtreecommitdiffstats
path: root/sys/scsi/worm.c
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
committerjulian <julian@FreeBSD.org>1995-12-08 11:19:42 +0000
commit1900eea896e2aaeae8a9fa8affa5fded2068c9b4 (patch)
tree5150d199464d64c1021f91b2c2f112d48546a8bf /sys/scsi/worm.c
parentaaf9d7f10ecc63adae1dc4f55cfd31a2926c605a (diff)
downloadFreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.zip
FreeBSD-src-1900eea896e2aaeae8a9fa8affa5fded2068c9b4.tar.gz
Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are in the same file as their devsw structure. I've also added DEVFS support for nearly every device in the system, however many of the devices have 'incorrect' names under DEVFS because I couldn't quickly work out the correct naming conventions. (but devfs won't be coming on line for a month or so anyhow so that doesn't matter) If you "OWN" a device which would normally have an entry in /dev then search for the devfs_add_devsw() entries and munge to make them right.. check out similar devices to see what I might have done in them in you can't see what's going on.. for a laugh compare conf.c conf.h defore and after... :) I have not doen DEVFS entries for any DISKSLICE devices yet as that will be a much more complicated job.. (pass 5 :) pass 4 will be to make the devsw tables of type (cdevsw * ) rather than (cdevsw) seems to work here.. complaints to the usual places.. :)
Diffstat (limited to 'sys/scsi/worm.c')
-rw-r--r--sys/scsi/worm.c68
1 files changed, 35 insertions, 33 deletions
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c
index 8878bd2..b065bf8 100644
--- a/sys/scsi/worm.c
+++ b/sys/scsi/worm.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: worm.c,v 1.12 1995/11/29 14:41:09 julian Exp $
+ * $Id: worm.c,v 1.13 1995/12/05 07:14:27 julian Exp $
*/
/* XXX This is PRELIMINARY.
@@ -55,24 +55,23 @@
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/proc.h>
-#include <scsi/scsi_all.h>
-#include <scsi/scsiconf.h>
-#include <scsi/scsi_disk.h>
-
-#ifdef JREMOD
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
-#define CDEV_MAJOR 62
-#endif /*JREMOD*/
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+#include <scsi/scsi_disk.h>
struct scsi_data {
struct buf_queue_head buf_queue;
u_int32 n_blks; /* Number of blocks (0 for bogus) */
u_int32 blk_size; /* Size of each blocks */
+#ifdef DEVFS
+ void *devfs_token; /* more elaborate later */
+#endif
};
static void wormstart(u_int32 unit, u_int32 flags);
@@ -85,22 +84,34 @@ static errval worm_close(dev_t dev, int flag, int fmt, struct proc *p,
struct scsi_link *sc_link);
static void worm_strategy(struct buf *bp, struct scsi_link *sc_link);
+static d_open_t wormopen;
+static d_close_t wormclose;
+static d_ioctl_t wormioctl;
+d_strategy_t wormstrategy;
+
+#define CDEV_MAJOR 62
+struct cdevsw worm_cdevsw =
+ { wormopen, wormclose, rawread, rawwrite, /*62*/
+ wormioctl, nostop, nullreset, nodevtotty,/* worm */
+ seltrue, nommap, wormstrategy };
+
+
SCSI_DEVICE_ENTRIES(worm)
static struct scsi_device worm_switch =
{
- NULL,
- wormstart, /* we have a queue, and this is how we service it */
- NULL,
- NULL,
- "worm",
- 0,
+ NULL,
+ wormstart, /* we have a queue, and this is how we service it */
+ NULL,
+ NULL,
+ "worm",
+ 0,
{0, 0},
SDEV_ONCE_ONLY, /* Only one open allowed */
wormattach,
"Write-Once",
wormopen,
- sizeof(struct scsi_data),
+ sizeof(struct scsi_data),
T_WORM,
0,
0,
@@ -147,7 +158,13 @@ wormattach(struct scsi_link *sc_link)
if (worm_size(sc_link, SCSI_NOSLEEP | SCSI_NOMASK) == 0)
printf("- can't get capacity.");
else
- printf("with %ld %ld byte blocks.", worm->n_blks, worm->blk_size);
+ printf("with %ld %ld byte blocks.",
+ worm->n_blks, worm->blk_size);
+#ifdef DEVFS
+
+ worm->devfs_token = devfs_add_devsw( "/", "rworm", &worm_cdevsw, 0,
+ DV_CHR, 0, 0, 0600);
+#endif
return 0;
}
@@ -358,15 +375,10 @@ worm_close(dev_t dev, int flag, int fmt, struct proc *p,
return 0;
}
-#ifdef JREMOD
-struct cdevsw worm_cdevsw =
- { wormopen, wormclose, rawread, rawwrite, /*62*/
- wormioctl, nostop, nullreset, nodevtotty,/* worm */
- seltrue, nommap, wormstrategy };
-
static worm_devsw_installed = 0;
-static void worm_drvinit(void *unused)
+static void
+worm_drvinit(void *unused)
{
dev_t dev;
@@ -374,19 +386,9 @@ static void worm_drvinit(void *unused)
dev = makedev(CDEV_MAJOR,0);
cdevsw_add(&dev,&worm_cdevsw,NULL);
worm_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*/
- "/", "rworm", major(dev), 0, DV_CHR, 0, 0, 0600);
- }
-#endif
}
}
SYSINIT(wormdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,worm_drvinit,NULL)
-#endif /* JREMOD */
OpenPOWER on IntegriCloud