[comp.sys.next] RAM Disk for Next?

squeegee@well.UUCP (Stephen C. Gilardi) (05/14/91)

Summary: 

With a RAM disk driver for the NeXT, we who can read 1.44Meg disks on other
machines can put off bying a floppy drive for a while.  Can someone tell me
where I can find such a driver?  I've tried and failed so far to write one
myself.  If a driver isn't already available, would someone with 4.3BSD driver
experience be willing to look at about 2 pages of C code that I've written
based on the template block driver in the book "Writing A UNIX Device Driver."

Thanks,

--Steve
squeegee@well.sf.ca.us (== well!squeegee@apple.com)

Details:

I have a NeXT machine with no floppy drive. I also have a Mac IIci with A/UX
which means that I can read 1.44Meg floppies. Under A/UX, I can get an image of
the floppy disk into a file using: 

cat /dev/rfloppy0 > LotusImprov1.img 

I can then move that file to the NeXT over ethernet. If I had a RAMDisk driver
for the NeXT (called rd), then I could do the following: 

cat LotusImprov1.img > /dev/rrd0a /etc/mount /dev/rd0a '/Improv Disk 1' 

and the contents of the disk would be available to the NeXT. 

This same technique could be used by several others who have posted mentioning
that they can read the (bytes on the) disk, but can't mount it. 

In (at least) Release 2.0, NeXT has made provisions for a RAM Disk. For example
the file /dev/MAKEDEV includes the following:

# Disks:
#       rd*     RAM disk
#       od*     Optical disk
#       oc      Optical disk controller
#       sd*     SCSI disks
#       fd*     Floppy disks

[... stuff deleted ...]

od*|rd*|sd*)
        umask 2 ; unit=`expr $i : '..\(.*\)'`
        case $i in
        od*) name=od; blk=2; chr=9;;
        rd*) name=rd; blk=5; chr=15;;
        sd*) name=sd; blk=6; chr=14;;
        esac

This tells me that there are two major device numbers reserved for a RAM disk
(5 for the block driver, and 15 for the raw driver).  It also tells me that
NeXT has at least considered providing a RAM Disk.

Does anyone know where I can find the driver?  It's almost surely under about
20K bytes in size.  It's probably called "rd_reloc" and is loaded with the
KernLoader utility routine (kl_util -a rd_reloc).

Failing that, does anyone here know about drivers for BSD4.3?  I bought the
book "Writing A UNIX Device Driver" by Egan & Teixeira.  It's referred to
in the NeXT documentation.  I tried to write my own based on the template
block driver given in that book.  I found in the NeXT online docs that some
of the routines have some extra parameters on the NeXT.  The NeXT docs don't
explicitly list the arguments of the read, write, strategy, etc. routines
for a UNIX-style driver.  Any help would be appreciated!  If someone with
experience would be willing to look over the code (about 2 pages) I've written
and try to figure out why all it down now is panic the machine, that'd be
great.

Thanks!

--Steve