On Thu, Jan 22, 2009 at 08:26:24PM +0100, Petr Uzel wrote: > Hi, > attached patch seems to fix the problem for me. I'd appreciate any > feedback.
One drawback of the patch below I'm now aware of: When creating new extended partition (not modifying existing one), the bootcode is not filled with zeroes and will contain some random stuff instead (not sure if this might cause some kind of problems). We should preserve the bootcode only in case there was extended partition before. How could we find this out (in a clean way - I mean _not_ with global 'preserver_ext_bootcode' variable) ? > > --- > libparted/labels/dos.c | 6 ++++-- > 1 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c > index cb7e45e..a300a87 100644 > --- a/libparted/labels/dos.c > +++ b/libparted/labels/dos.c > @@ -1059,7 +1059,8 @@ write_ext_table (const PedDisk* disk, > > lba_offset = ped_disk_extended_partition (disk)->geom.start; > > - memset (&table, 0, sizeof (DosRawTable)); > + ped_device_read (disk->dev, &table, sector, 1); > + memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition)); > table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC); > > if (!fill_raw_part (&table.partitions[0], logical, sector)) > @@ -1093,7 +1094,8 @@ write_empty_table (const PedDisk* disk, PedSector > sector) > > PED_ASSERT (disk != NULL, return 0); > > - memset (&table, 0, sizeof (DosRawTable)); > + ped_device_read (disk->dev, &table, sector, 1); > + memset (&(table.partitions), 0, 4 * sizeof(DosRawPartition)); > table.magic = PED_CPU_TO_LE16 (MSDOS_MAGIC); > > return ped_device_write (disk->dev, (void*) &table, sector, 1); > -- > 1.6.0.2 -- Best regards / s pozdravem Petr Uzel, Packages maintainer --------------------------------------------------------------------- SUSE LINUX, s.r.o. e-mail: [email protected] Lihovarská 1060/12 tel: +420 284 028 964 190 00 Prague 9 fax: +420 284 028 951 Czech Republic http://www.suse.cz _______________________________________________ parted-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/parted-devel

