Subject: Re: finding the "raw" partition on portable disks
To: None <tech-kern@NetBSD.org>
From: David Young <dyoung@pobox.com>
List: tech-kern
Date: 04/18/2007 16:42:58
On Wed, Apr 18, 2007 at 10:01:49PM +0100, David Laight wrote:
> On Wed, Apr 18, 2007 at 03:51:13PM -0500, David Young wrote:
> > I am working to support portability of disks from one architecture to
> > another---for example, i386 to evbmips.
> >
> > Here is a routine that I wrote to hunt a disk's partition table for the
> > "raw" partition. The routine prefers the architecture's raw partition
> > (RAW_PART'th partition) but, allowing for the possibility that the
> > RAW_PART'th partition does not span the disk, searches for a partition
> > that does. What do you think, do I select the raw partition using the
> > right criteria?
>
>
> Hmmm fix the kernels?
> The i386 (at least) kernel will always set the RAW_PART to match the
> entire disk, regardless as to what was read from the disk itself.
I still wonder whether it is correct that the raw partition's functional
role is "the partition that spans the disk", i.e., sector 0 through the
last sector. This code in bounds_check_with_label() suggests that the
raw partition could start on an arbitrary sector,
#if RAW_PART == 3
labelsector = lp->d_partitions[2].p_offset;
#else
labelsector = lp->d_partitions[RAW_PART].p_offset;
#endif
It seems that lp->d_partitions[RAW_PART].p_offset could be replaced by
a constant, 0.
Thanks for your help.
Dave
--
David Young OJC Technologies
dyoung@ojctech.com Urbana, IL * (217) 278-3933