[comp.unix.questions] Need RAM disk driver code

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

I am in search of RAM disk driver example code for BSD4.3.  I've already
posted a similar request in comp.sys.next and comp.unix.internals... no
response yet.  Here's why:

I have a NeXT computer with no floppy drive.  I also have a Mac IIci running
A/UX with a floppy drive.  Much of NeXT software distribution is now done on
UNIX format 1.44Meg floppies.  A/UX can't MOUNT the NeXT floppies, but it CAN
read all the bytes off them using something like

cat /dev/rfloppy0 > flopdisk.image

I can move flopdisk.image over to the NeXT using Ethernet.  I'd like to be
able to somehow mount that image as (perhaps) a read only block device.  It
occurs to me that a RAM disk driver would be ideal here.  I could make a
1.44Meg RAM disk.  Assuming the driver supported both RAW and block I/O, I
could do:

cat flopdisk.image > /dev/rrd0a
mount /dev/rd0a /pseudofloppy

What I need from you folks is an example driver for BSD 4.3 based perhaps on
the template block driver in "Writing a UNIX device driver" by Egan and 
Teixeira.  I tried doing it myself, but it doesn't work.  The NeXT seems to
have some different arguments to the driver entry points even than 4.3, but
a known good 4.3 RAM disk driver would be a GREAT starting point.

I asked in comp.sys.next, but didn't get any response in about a week.  People
look at me funny when I ask for a UNIX ram disk ("You do after all have virtual
memory...").  I hope the above justifies my need.  If anyone can think of
another way to do it I'd be pysched to hear it.  I take it that if I was using
Suns I could use ND...  NeXT even has major device numbers reserved for a 
RAM disk's RAW and block I/O.  They don't however seem to include the driver.

Any help would be appreciated!

--Steve

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

mouse@thunder.mcrcim.mcgill.edu (der Mouse) (05/24/91)

In article <9105200434.AA19778@well.sf.ca.us>, squeegee@well.UUCP (Stephen C. Gilardi) writes:

> I am in search of RAM disk driver example code for BSD4.3.  [...]  I
> have a NeXT computer with no floppy drive.

Well, a NeXT is not 4.3; it's Mach with a 4.3 compatability layer
slapped on.  (It's a reasonably good layer at the syscall level, but
it's a long way from 4.3 in terms of real use - full flamage available
by mail.)  I don't know for sure what their driver internals look like,
but a quick look at a couple of include files makes it look as though
their driver interface isn't too far from the Berkeley one.  Just
beware that a driver that works on 4.3 will not necessarily plug&play.

> [...stuff on floppy...Mac IIci A/UX can read them...can get data file
> on NeXT with floppy contents on it...]  I'd like to be able to
> somehow mount that image as (perhaps) a read only block device.

A RAMdisk would solve this problem, yes.  But you don't really need it.
The filesystem format is really not complicated.  If the floppy
filesystem format is the normal Berkeley filesystem format, I have
programs I wrote that I can send you that are capable of reading stuff
off of it, given the disk contents, even in a file.

Don't you just love binary distributions? :-(

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu