[comp.os.minix] more on dosread problem

hall@cod.NOSC.MIL (Robert R. Hall) (10/26/89)

For a MFM disk drive which has 17 sectors/track, If I assign 
/dev/dosC with major = 3, minor = 0, I find dosread.c begins reading
with disk sector 0.  But the DOS boot sector was found at sector 17.
If I change /dev/dosC to minor = 1, then dosread.c starts with disk
sector 18 (has been rounded to the next 1k byte boundary) missed by
one sector.

And for a RRL disk drive which has 26 sectors/track, the boot sector
is on sector 26 and with  /dev/dosC assigned with minor = 1, dosread
starts with sector 26 and dosread works just fine.

The conclusion of this is, that for dosread works or not depends
on whether or not you disk drive has an even or odd number of sector
per track.

Robert R. Hall
hall@nosc.mil

ast@cs.vu.nl (Andy Tanenbaum) (10/27/89)

In article <1679@cod.NOSC.MIL> hall@cod.NOSC.MIL (Robert R. Hall) writes:
>The conclusion of this is, that for dosread works or not depends
>on whether or not you disk drive has an even or odd number of sector
>per track.

Close, but not quite.  The issue is whether a partition starts at an
odd or even sector, which is often correlated with the number of sectors
per track, but is not the same.

The next piece of message is actually aimed at Bruce Evans, but I think
it is important enough to discuss it publicly.

I think the current STUPID_WINI_ADJUST is a real pain and would like to
get rid of it.  Making the driver do the adjustment automatically is
easy, but would mess up reading DOS partitions, where you can't tolerate
the adjustment.  How about the following solution.

We add a new command to fdisk to mark a partition as MINIX.  Before using
mkfs on a partition made with either the DOS or MINIX fdisk, you would have
to run fdisk and issue the command to write some O/S code saying this is
MINIX.  Once we had required that, the driver could do the STUPID_WINI_ADJUST
on MINIX partitions only.  I think this solves the problem in a way that
users can understand.  Before running MINIX on the hard disk, you have to
run fdisk (from the floppy system) and mark the MINIX partitions as such.
After that, everything is automatic, with even or odd partitions, even or
odd heads etc.

Code is needed in two places.

1. In at_wini.c when reading the partition table to check for a MINIX
   partition, and also the 

   #ifdef STUPID_WINI_ADJUST

   becomes

   if (stupid_wini_adjust)

   where stupid_wini_adjust depends on whether the partition being accessed
   is MINIX or not and starts odd/even or not.    All of this information is
   present in the partition table and can be read in during the initial
   access.

 2. Fdisk, to write MINIX code into the partition table.  A nice side effect
    is that fdisk can now list partitions as MINIX in the display.

What do people think of this idea?  I would really like to get away from 
having binaries that are compiled without STUPID_WINI_ADJUST and don't work
on some disks and vice versa.

Andy Tanenbaum (ast@cs.vu.nl)