*BSD News Article 34775


Return to BSD News archive

Newsgroups: comp.os.386bsd.development
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!convex!hermes.oc.com!news.unt.edu!cs.utexas.edu!howland.reston.ans.net!agate!tfs.com!julian
From: julian@tfs.com (Julian Elischer)
Subject: Re: FreeBSD 2.0: someone please fix mount_pcfs
Message-ID: <Cux7vD.MwL@tfs.com>
Organization: TRW Financial Systems, Oakland, CA
References: <32uvui$dov@Venus.mcs.com> <331v11$kjs@news.u.washington.edu> <335mao$20r@u.cc.utah.edu> <vanepp.777418589@sfu.ca>
Date: Mon, 22 Aug 1994 05:14:01 GMT
Lines: 87

In article <vanepp.777418589@sfu.ca>,
Peter Van Epp <vanepp@fraser.sfu.ca> wrote:
>terry@cs.weber.edu (Terry Lambert) writes:
>
>>In article <331v11$kjs@news.u.washington.edu> tzs@u.washington.edu (Tim Smith) writes:
>...
>
[ true statements deleted ]

ok,here's the way I see it..
becaue of various things done early on, the driver has no idea
of what the geometry of the drive is..

for the *BSD partition, it starts off, by looking at the ending
cyl/hd/sec location of the last block of the *BSD partition,
and 'deduces' the geometry from this. It doesn't "ask the BIOS"
or get the value from the boot block, because this would fail 
badly for a drive the BIOS did not know about..
Many people turn off their IDE/ESDI drive from the BIOS's
point of view, so that they will boot off the SCSI disk, but they
still want to access the ESDI/IDE drive once BSD is up.
If we asked the BIOS about this drive we get no (or worse, bad)
information.

The problem with this 'deduced' geometry is that it is possible
for the BSD partition to not end on a cylinder boundary,
though we try make it do so by default.

example:
SCSI disks often have a 'variable' geometry.
What I do is take the number of heads, and the numnber of
cylinders and the total number of sectors, and
do: S=T/(C*H) to calculate a value
that approximates the number of sectors in a track,
however the total disk capacity then gets
calculated as S*C*H which (as S was truncated to an integer)
is less than the original T (total capacity reported by the drive).

Some people set their partitions to recover this last
piece of space (part of a 'virtual' cylinder)
and thus their partition doesn't end on what
the BIOS considers top the a cylinder boundary.

This is why the FreeBSD 'fdisk' program allows you to
set by hand the valuse for 'ending cyl/head and sector'
so that you can FORCE the values, to contain the number
of sectors/track and number of heads, even if
that doesn't calculate out to the ending sector of the
partition. Later on, once the disklable has been loaded,
this information is overwritten in memory by the geometry
(hopefully the same) that was read off the disklabel,
but if there is no disklabel, then the this geometry
information remains in the 'in-core' version of the 
disklabel and is used 'forever'. (or until a disklabel
is installed)

to make this work for a disk containing only a DOS
partition, (or some other OS) the following changes need to be made
to the disksubr routines.
1/ the 'deduced' geometry can be deduced from other partitions if 
the BSD partition is not present.
2/ in the absence of a real disklabel, some of the partition
fields in the in-core disklabel should be set to the
MBR partitions that ARE present, so that /dev/rxdn[efgh]
becode useable devices, pointing to the 
1st,2nd,3rd and 4th MBR partitions respectively.
If this is done by default, just before the disklabel is
sought, then a failure to find a disklabel will leave these
values in place, and 'voila' we can access these partitions.
If a disklabel IS found then we have finer control, but
it's not absolutly needed.

having written all this out, and cleared it up in my mind,
I thonk I'll go and do it..
look for a patch soon.


julian
+----------------------------------+       ______ _  __
|   __--_|\  Julian Elischer       |       \     U \/ / On assignment
|  /       \ julian@tfs.com        +------>x   USA    \ in a very strange
| (   OZ    ) 300 lakeside Dr. oakland CA. \___   ___ | country !
+- X_.---._/  USA+(510) 645-3137(wk)           \_/   \\            
          v