Subject: Re: Floppy driver
To: Brad Pepers <pepersb@cuug.ab.ca>
From: Mike Schwartz <mykes@shell.portal.com>
List: amiga-dev
Date: 02/28/1994 18:01:38
At  6:09 PM 2/28/94 -0700, Brad Pepers wrote:
>> In article <199402282052.MAA07825@nova.unix.portal.com>
>>mykes@shell.portal.com (Mike Schwartz) writes:
>> > I have a bit of advise here.  When I wrote MS-DOS or AmigaOS formatted
>> > floppies with my own drivers, I wrote two sectors on track 40 of the floppy
>> > to fool amigaos into thinking that the disk was indeed an AmigaOS disk but
>> > that it was 100% full.  My reasoning was that when someone sticks a disk in
>> > the drive and sees a bad volume reported by amigaos, they'd consider
>> > formatting it to use it :-)  With the 100% full (fill BAM sector with
>> > 0xffff), they saw the disk was valid and could not use DOS or some other
>> > program to write on the disk.
>> >
>> > 0xffff.  My floppy disk drivers would automatically skip writing or reading
>> > data from these two "magic" sectors.
>>
>> Um, all of this and the disk IDs you mentioned before is great for your own
>> stuff, but we need a floppy driver that can interoperate with the rest
>> of the world, ie read and write normal MS-DOS, AmigaDOS, and tar disks.
>>
>> > You also have to deal with track 0, where the boot sector goes.  Otherwise
>> > ADOS will not see it is a valid dos disk.
>>
>> Probably the best way to do this is to have the disklabel faker routine
>> report two partitions, a which skips track 0, and c which covers the
>> whole disk.  You'd use 'a' in conjunction with adosfs, and 'c' with tar,
>> msdosfs, ufs, and everything else.
>
>I'm not sure what everyone is talking about with all this stuff. The
>way I have it set up, the floppy driver just passes the whole disk of
>sectors on to higher level programs that use them. Its up to the top
>levels (filesystem, tar, ...) to use them correctly. The adosfs looks
>at sector 0 to make sure its a valid amigados boot disk. Tar and ufs
>just want direct access to the whole disk so they get it. No special
>handling needed - just 1760 512 byte sectors to do with what you will!
>
>Whats with the questions on skipping boot sectors and hiding sectors
>and providing labels? I don't see these things as driver level stuff.
>I'm sorry if I'm being daft here but I just don't understand.
>

Consider the case where you do:
tar cvfp /dev/floppy /somedir

Tar is going to create a raw archive on the floppy, which is what you want.
However, take that floppy and stick it in your drive while ADOS is running
and you get dos requesters saying "not a dos disk" and the likes.  Now,
let's say you have made such a disk and you think it's a bad/unformatted
floppy when running ados - you probably will format it and use it.  And
you've possibly wiped out a floppy you didn't want to.

When we are talking about skipping sectors, we are talking about making it
possible for you to make that tar floppy.  Then when you stick it in the
drive with ADOS running, you get a valid dos disk.  You'll even get an icon
on  your
workbench.  And by doing the bam as 0xffff, if you do ADOS info command,
the disk will show up as 100% full.

I rarely use ADOS anymore - mostly just to boot netbsd and upgrade kernels
and such.  However, when I did use ADOS, I used quarterback a lot to backup
onto floppies.  They did the same thing I'm talking about here to prevent
people from wiping out their backups.

You do point out something that is an issue though.  What other unices I
use do is have a program called fdformat.  This program low level formats
the tracks and sectors.  Then you'd use mtools or newfs to write out your
msdos bam and filesystem structures to the formatted floppy.  To determine
whether you want a 720KB or 1.44KB floppy, you specify /dev/fd0 or
/dev/fd0H1440 (for example).  The same is true when you mount a floppy:
mount -t msdos /dev/fd0H1440 /mnt

It seems that if you want to use tar, as I gave in my first example, we
should have a /dev/fd<something> that does the track/sector skipping.  In
your text,
you wrote about having 1760 raw sectors to read/write to.  In the case you
use tar, you really want 1760-3 raw sectors...

>> --
>> Ty Sarna                 "As you know, Joel, children have always looked
>> tsarna@endicor.com        up to cowboys as role models. And vice versa."
>>
>
>+----------------------------Ren & Stimpy--------------------------------+
>| "Psst. Hey Guido. It's all so clear to me now. I'm the keeper of the   |
>| cheese. And you're the lemon merchant. Get it? And he knows it. That's |
>| why he's gonna kill us. So we gotta beat it. Yeah. Before he lets      |
>| loose the marmosets on us! Don't worry, little missy! I'll save you!"  |
>+------------------ Brad Pepers -- pepersb@cuug.ab.ca -------------------+



------------------------------------------------------------------------------