On Sat, Jan 07, 2012 at 02:04:51PM -0500, erik quanstrom wrote:
> On Sat Jan 7 13:30:33 EST 2012, [email protected] wrote:
> > The explanation is arithmetic truncation. disk/fdisk.c does this:
> >
> > p->start = lba/sec2cyl;
> >
> > and, if modifications are done (for example creating a Plan9 partition,
> > of marking a primary partition active), when written back, the entries
> > are "restored" by:
> >
> > *endlba = (vlong)p->start*sec2cyl;
> >
> can you just set sec2cyl=1?
This wouls probably do the trick. But the code is clean and setting just
this is not---to my taste.
The ideal would be to simply patch the existing with changed values (no
need to be efficient for 4 * 16 bytes), and leave clearly alone values
set by others.
And to verify the magic signature for, at least, the active partition
(it would have spot the problem).
--
Thierry Laronde <tlaronde +AT+ polynum +dot+ com>
http://www.kergis.com/
Key fingerprint = 0FF7 E906 FBAF FE95 FD89 250D 52B1 AE95 6006 F40C