[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 03/32] vvfat: Fix partition table
From: |
Markus Armbruster |
Subject: |
Re: [Qemu-devel] [PATCH 03/32] vvfat: Fix partition table |
Date: |
Sat, 30 Jun 2012 07:37:54 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) |
Blue Swirl <address@hidden> writes:
> On Fri, Jun 29, 2012 at 3:34 PM, Markus Armbruster <address@hidden> wrote:
>> Unless parameter ":floppy:" is given, vvfat creates a virtual image
>> with DOS MBR defining a single partition which holds the FAT file
>> system. The size of the virtual image depends on the width of the
>> FAT: 32 MiB (CHS 64, 16, 63) for 12 bit FAT, 504 MiB (CHS 1024, 16,
>> 63) for 16 and 32 bit FAT, leaving (64*16-1)*63 = 64449 and
>> (1024*16-1)*64 = 1032129 sectors for the partition.
>>
>> However, it screws up the end of the partition in the MBR:
>>
>> FAT width param. start CHS end CHS start LBA size
>> :32: 0,1,1 1023,14,63 63 1032065
>> :16: 0,1,1 1023,14,55 63 1032057
>> :12: 0,1,1 63,14,55 63 64377
>>
>> The actual FAT file system nevertheless assumes the partition has
>> 1032129 or 64449 sectors. Oops.
>>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>> block/vvfat.c | 7 ++++---
>> 1 files changed, 4 insertions(+), 3 deletions(-)
>>
>> diff --git a/block/vvfat.c b/block/vvfat.c
>> index 0fd3367..62745b5 100644
>> --- a/block/vvfat.c
>> +++ b/block/vvfat.c
>> @@ -394,11 +394,12 @@ static void init_mbr(BDRVVVFATState* s)
>>
>> /* LBA is used when partition is outside the CHS geometry */
>> lba = sector2CHS(s->bs, &partition->start_CHS,
>> s->first_sectors_number-1);
>> - lba|= sector2CHS(s->bs, &partition->end_CHS, s->sector_count);
>> + lba |= sector2CHS(s->bs, &partition->end_CHS, s->bs->total_sectors - 1);
>>
>> /*LBA partitions are identified only by start/length_sector_long not by
>> CHS*/
>> - partition->start_sector_long =cpu_to_le32(s->first_sectors_number-1);
>> - partition->length_sector_long=cpu_to_le32(s->sector_count -
>> s->first_sectors_number+1);
>> + partition->start_sector_long = cpu_to_le32(s->first_sectors_number-1);
>
> Spaces around '-'. Thanks for fixing the other cases, BTW.
Got it, thanks!
[...]
- [Qemu-devel] [PATCH 00/32] Disk geometry cleanup, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 04/32] vvfat: Do not clobber the user's geometry, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 29/32] qtest: Test we don't put hard disk info into CMOS for a CD-ROM, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 05/32] qtest: Tidy up temporary files properly, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 03/32] vvfat: Fix partition table, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 21/32] ide: qdev properties for disk geometry, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 01/32] fdc: Drop broken code for user-defined floppy geometry, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 09/32] hd-geometry: Add tracepoints, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 16/32] blockdev: Save geometry in DriveInfo, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 11/32] hd-geometry: Factor out guess_chs_for_size(), Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 02/32] fdc: Move floppy geometry guessing back from block.c, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 14/32] hd-geometry: Cut out block layer translation middleman, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 07/32] block: Factor bdrv_read_unthrottled() out of guess_disk_lchs(), Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 28/32] ide pc: Put hard disk info into CMOS only for hard disks, Markus Armbruster, 2012/06/29
- [Qemu-devel] [PATCH 15/32] ide pc: Cut out the block layer geometry middleman, Markus Armbruster, 2012/06/29