From patchwork Wed Oct 5 07:12:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 117748 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7994FB6F95 for ; Wed, 5 Oct 2011 18:12:36 +1100 (EST) Received: from localhost ([::1]:43208 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBLeb-0005cM-Sz for incoming@patchwork.ozlabs.org; Wed, 05 Oct 2011 03:12:33 -0400 Received: from eggs.gnu.org ([140.186.70.92]:56096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBLeK-0005RH-UF for qemu-devel@nongnu.org; Wed, 05 Oct 2011 03:12:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBLeJ-0005Mj-JT for qemu-devel@nongnu.org; Wed, 05 Oct 2011 03:12:16 -0400 Received: from mail-ww0-f53.google.com ([74.125.82.53]:55000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBLeJ-0005I9-Em for qemu-devel@nongnu.org; Wed, 05 Oct 2011 03:12:15 -0400 Received: by mail-ww0-f53.google.com with SMTP id 14so1754242wwg.10 for ; Wed, 05 Oct 2011 00:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:subject:date:message-id:x-mailer:in-reply-to :references; bh=RhIwqiNE5JOK6AyRRD/QmDrfPIolrSOy6oIAx+73ev0=; b=RxuOHcPHEqzjclVu7qIkDT0FprgGlOpGj1YOClQKihp1agp50/Z26Oi+JVnvDlmsnX +MSMpd/XpAnK0cYbMfKI40ZSkt9AOxc0QSTBWXQUMsqwZKBbkep41T9ODfk1VDXdxFQJ LEyLw/zFQRPzm6dCu2R4gQCqJowdCD2PlCNZo= Received: by 10.216.132.198 with SMTP id o48mr2689839wei.7.1317798735011; Wed, 05 Oct 2011 00:12:15 -0700 (PDT) Received: from localhost.localdomain (93-34-218-143.ip51.fastwebnet.it. [93.34.218.143]) by mx.google.com with ESMTPS id s30sm1186914wbm.12.2011.10.05.00.12.14 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Oct 2011 00:12:14 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 5 Oct 2011 09:12:05 +0200 Message-Id: <1317798728-28938-4-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1317798728-28938-1-git-send-email-pbonzini@redhat.com> References: <1317798728-28938-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.53 Subject: [Qemu-devel] [PATCH 3/6] vvfat: need to use first_sectors_number to distinguish fdd/hdd X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 --- 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);