[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/6] vvfat: need to use first_sectors_number to dist
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH 3/6] vvfat: need to use first_sectors_number to distinguish fdd/hdd |
Date: |
Wed, 5 Oct 2011 09:12:05 +0200 |
This is consistent with what "real" floppies have, so file(1)
now actually recognizes the VVFAT image as a 1.44 MB floppy.
Signed-off-by: Paolo Bonzini <address@hidden>
---
block/vvfat.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/vvfat.c b/block/vvfat.c
index bc2dd4c..eb91642 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -968,7 +968,7 @@ static int init_directories(BDRVVVFATState* s,
bootsector->number_of_fats=0x2; /* number of FATs */
bootsector->root_entries=cpu_to_le16(s->sectors_of_root_directory*0x10);
bootsector->total_sectors16=s->sector_count>0xffff?0:cpu_to_le16(s->sector_count);
-
bootsector->media_type=(s->fat_type!=12?0xf8:s->sector_count==5760?0xf9:0xf8);
/* media descriptor */
+ bootsector->media_type=(s->first_sectors_number>1?0xf8:0xf0); /* media
descriptor (f8=hd, f0=3.5 fd)*/
s->fat.pointer[0] = bootsector->media_type;
bootsector->sectors_per_fat=cpu_to_le16(s->sectors_per_fat);
bootsector->sectors_per_track=cpu_to_le16(s->bs->secs);
@@ -977,7 +977,7 @@ static int init_directories(BDRVVVFATState* s,
bootsector->total_sectors=cpu_to_le32(s->sector_count>0xffff?s->sector_count:0);
/* LATER TODO: if FAT32, this is wrong */
- bootsector->u.fat16.drive_number=s->fat_type==12?0:0x80; /* assume this is
hda (TODO) */
+ bootsector->u.fat16.drive_number=s->first_sectors_number==1?0:0x80; /*
fda=0, hda=0x80 */
bootsector->u.fat16.current_head=0;
bootsector->u.fat16.signature=0x29;
bootsector->u.fat16.id=cpu_to_le32(0xfabe1afd);
--
1.7.6
- [Qemu-devel] [PATCH 0/6] misc vvfat fixes, Paolo Bonzini, 2011/10/05
- [Qemu-devel] [PATCH 2/6] vvfat: do not fail if the disk has spare sectors, Paolo Bonzini, 2011/10/05
- [Qemu-devel] [PATCH 1/6] vvfat: fix out of bounds array_get usage, Paolo Bonzini, 2011/10/05
- [Qemu-devel] [PATCH 3/6] vvfat: need to use first_sectors_number to distinguish fdd/hdd,
Paolo Bonzini <=
- [Qemu-devel] [PATCH 5/6] vvfat: do not hardcode sector counts in error message, Paolo Bonzini, 2011/10/05
- [Qemu-devel] [PATCH 6/6] vvfat: reorganize computation of disk geometry, Paolo Bonzini, 2011/10/05
- [Qemu-devel] [PATCH 4/6] vvfat: unify and correct computation of sector count, Paolo Bonzini, 2011/10/05
- [Qemu-devel] ping Re: [PATCH 0/6] misc vvfat fixes, Paolo Bonzini, 2011/10/27