Subject: Re: Bogglifying problems

From: Phil Norman <[email-masked]>
Date: Wed, 19 Nov 1997 12:36:03 +0000 (GMT)

On Tue, 18 Nov 1997, Russell King - ARM Linux Admin wrote:

> Phil Norman writes:
> > I've written a program which reads the linux partition table and works 
> > out what kind of partitions are where on the disc.  This works, and 
> > agrees with PartMan (though PartMan's calculations of partition/table 
> > sizes are too small by 1 sector - it assumes 
> > number_of_sectors=last_sector-first_sector, which is wrong).
> 
> Wrong.  PartMan is *correct*.  What is stored is the number of sectors
> actually used on the disk.  So,
> 	last used sector = first used sector + length - 1.

Yes, it is.  Very sorry Russell - you're right, I'm wrong.  My 
miscalculation is a result of what I was doing wrong (see below).

> > Can anyone shed some light on this area of utter strangeness?  Does linux 
> > really contradict itself or is it just me being stupid?
> 
> Try getting the partition calculations correct first ;).  The super block
> is indeed 1k into the disc, so you must be doing something wrong...

Yep, and here's what it was:

Right at the top of the little BASIC program I'm using to figure out 
partitions, I calculate the size of a block from what's returned to me by 
that nice FileCore_DescribeDisc call.  However, I was doing:

sector_len% = 2<<log_2_sector_len%

Spot the UTTERLY STOOOOPID mistake!  And especially stupid since I spent 3
days trying to figure out what was going wrong.  Yes, it should either be
2^log_2_sector_len% or 1<<log_2_sector_len%. 

Just call me Mr Stupid from now on.

Now that that problem's solved, things are starting to go a little 
better.  Right - I'm off to figure out this ext2fs thing.

See ya, (and sorry for the stupid email),
Phil

-- 
Phil Norman, mailing from Exeter Uni.
Programs available for download from my web page.
email:  [email-masked]
web:    http://newton.ex.ac.uk/general/ug/norman