[comp.os.minix] MacMinix raw-mode floppy driver v0.1 From Mix

nemossan@uitec.ac.jp (Sakurao NEMOTO) (04/09/91)

The following is a portation from NIKKEI-MIX, Japanese commercial-BBS.  If
you want to contact with original author, please post here,  comp.os.minix
or e-mail me, nemossan@uitec.ac.jp.

		91.04.09 (Tu) 12:00  nemossan@mix,  nemossan@uitec.ac.jp
------------------------------------------------------------------------
==========
minix/fixes No.575, From: n.nonaka, 2551-chars, Tue Apr  9 00:43:52 1991
----------
title:	MacMinix raw floppy V0.1

In MacMinix, block-devices such as FD/HD are accessed as File-systems on
MacOS.  I made a device driver which directly access FDs.  Its minor numbers
are
	16:	for internal-FDD
	17:	for external-FDD,

thus, please made devices, for example
	# mknod /dev/rfd0 b 2 16 1440


There may be no-use if you are using conventional-FDD, (I mead *NOT* super-
drive), but if you are using super-drive, you can access 3.5-inched 720kB/
1440kB FDs.  I suppose this device-driver is mountable on ST-Minix, but I
have not checked.
					n.nonake@mix
					    (translated by nemossan@mix)
------------------------------- cut here -------------------------
    Andrew Tanenbaum, MINIX, (C)1987. Reproduced by permission of
    Prentice Hall, Englewood Cliffs, New Jersey.
*** floppy.c.old	Thu Nov  1 23:29:14 1990
--- floppy.c	Tue Apr  9 00:11:54 1991
***************
*** 102,107 ****
--- 102,108 ----
  {
  /* Carry out a read or write request from the disk. */
    int r, device, errors = 0;
+   int raw = 0;
    register struct floppy *f;
    IOParam *pbio;
    message m;
***************
*** 110,115 ****
--- 111,120 ----

    /* Decode the f_message parameters. */
    device = m_ptr->DEVICE;
+   if (device >= 16) {
+ 	device -= 16;
+ 	raw = 1;
+   }
    if (device < 0 || device >= NR_DEVICES)
  	return(EIO);
    if (m_ptr->COUNT != BLOCK_SIZE)
***************
*** 124,134 ****
    f = &floppy[device];

    /* check for eof */
    if ((m_ptr->POSITION / BLOCK_SIZE) > f->nblocks)
  	return(0);
    pbio = &f->pb.ParamBlkType.ioParam;
    f->pb.ioCompletion = (char *)f_int;
!   pbio->ioRefNum = f->fref;
    pbio->ioActCount = 0;
    pbio->ioBuffer = (char *)user_phys;
    pbio->ioReqCount = m_ptr->COUNT;
--- 129,148 ----
    f = &floppy[device];

    /* check for eof */
+   if (raw) {
+ 	f->nblocks = 1440;
+   }
    if ((m_ptr->POSITION / BLOCK_SIZE) > f->nblocks)
  	return(0);
    pbio = &f->pb.ParamBlkType.ioParam;
    f->pb.ioCompletion = (char *)f_int;
!   if (raw) {
! 	pbio->ioRefNum = -5;
! 	f->pb.ioVRefNum = device + 1;
!   }
!   else {
! 	pbio->ioRefNum = f->fref;
!   }
    pbio->ioActCount = 0;
    pbio->ioBuffer = (char *)user_phys;
    pbio->ioReqCount = m_ptr->COUNT;
------------------------------- cut here -------------------------

		91.04.09 (Tu) 12:08  nemossan@mix,  nemossan@uitec.ac.jp