[OpenBIOS] Patch for auto partition selection

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Dec 4 23:22:24 CET 2012


On 04/12/12 19:29, Programmingkid wrote:

> Here is an updated patch with the above issues fixed.
> Signed-off-by : John Arbuckle <programmingkidx at gmail.com
> <mailto:programmingkidx at gmail.com>>

This is much, much improved. Can you now understand how much easier this 
is to test and review the patch below, compared to your original submission?

> Index: trunk/openbios-devel/packages/mac-parts.c
> ===================================================================
> --- trunk/openbios-devel/packages/mac-parts.c(revision 1075)
> +++ trunk/openbios-devel/packages/mac-parts.c(working copy)
> @@ -164,16 +164,10 @@
> for (parnum = 1; parnum <= __be32_to_cpu(par.pmMapBlkCnt); parnum++) {
> SEEK( bs * parnum );
> READ( &par, sizeof(par) );
> -if( __be16_to_cpu(par.pmSig) != DESC_PART_SIGNATURE ||
> - !__be32_to_cpu(par.pmPartBlkCnt) )
> -break;
> -

Interesting. So the above looks like a bug - I'd expect that break to be 
a continue so that invalid entries are just skipped, rather than 
terminating the entire loop. Does your patch still work if you leave the 
above if statement in? If not, does it then work if you swap the above 
"break" for a "continue"?

> DPRINTF("found partition type: %s with status %x\n", par.pmPartType,
> __be32_to_cpu(par.pmPartStatus));
>
>
> -/* If we have a valid, allocated and readable partition... */
> -if( (__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsValid) &&
> -(__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsAllocated) &&
> -(__be32_to_cpu(par.pmPartStatus) & kPartitionAUXIsReadable) ) {
> +/* If an Apple_HFS or Apple_HFSX partition was found */
> +if(strcmp(par.pmPartType, "Apple_HFS") == 0 || strcmp(par.pmPartType,
> "Apple_HFSX") == 0) {
> offs = (long long)__be32_to_cpu(par.pmPyPartStart) * bs;
> size = (long long)__be32_to_cpu(par.pmPartBlkCnt) * bs;
>
>
> @@ -196,9 +190,7 @@
> }
> }
> }
> -
> -} else {
> -/* Another partition was explicitly requested */
> +} else {/* Another partition was explicitly requested */
> SEEK( bs * parnum );
> READ( &par, sizeof(par) );

I'd like to wait back from the results of Amadeusz's testing before 
committing a revised version of this - I can see from what has been 
shown already that I need to make some additional changes to mac-parts.c 
and then subsequently rebase the patch on that. It may be that at this 
point the changes become so minimal I can just commit it myself.


ATB,

Mark.



More information about the OpenBIOS mailing list