From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNn16-0001JW-Eq for qemu-devel@nongnu.org; Mon, 25 Jan 2016 14:41:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNn10-0000rJ-Pj for qemu-devel@nongnu.org; Mon, 25 Jan 2016 14:41:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNn10-0000rE-Km for qemu-devel@nongnu.org; Mon, 25 Jan 2016 14:41:30 -0500 From: John Snow Date: Mon, 25 Jan 2016 14:41:17 -0500 Message-Id: <1453750885-16066-6-git-send-email-jsnow@redhat.com> In-Reply-To: <1453750885-16066-1-git-send-email-jsnow@redhat.com> References: <1453750885-16066-1-git-send-email-jsnow@redhat.com> Subject: [Qemu-devel] [PULL 05/13] fdc: add disk field List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, jsnow@redhat.com Currently, 'drive' is used both to represent the current diskette type as well as the current drive type. This patch adds a 'disk' field that is updated explicitly to match the type of the disk. As of this patch, disk and drive are always the same, but forthcoming patches to change the behavior of pick_geometry will invalidate this assumption. disk does not need to be migrated because it is not user-visible state nor is it currently used for any calculations. It is purely informative, and will be rebuilt automatically via fd_revalidate on the new host. Reviewed-by: Eric Blake Signed-off-by: John Snow Message-id: 1453495865-9649-5-git-send-email-jsnow@redhat.com --- hw/block/fdc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index e37934d..18e363b 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -141,6 +141,7 @@ typedef struct FDrive { uint8_t track; uint8_t sect; /* Media */ + FloppyDriveType disk; /* Current disk type */ FDiskFlags flags; uint8_t last_sect; /* Nb sector per track */ uint8_t max_track; /* Nb of tracks */ @@ -158,6 +159,7 @@ static void fd_init(FDrive *drv) drv->drive = FLOPPY_DRIVE_TYPE_NONE; drv->perpendicular = 0; /* Disk */ + drv->disk = FLOPPY_DRIVE_TYPE_NONE; drv->last_sect = 0; drv->max_track = 0; } @@ -287,6 +289,7 @@ static void pick_geometry(FDrive *drv) drv->max_track = parse->max_track; drv->last_sect = parse->last_sect; drv->drive = parse->drive; + drv->disk = drv->media_inserted ? parse->drive : FLOPPY_DRIVE_TYPE_NONE; drv->media_rate = parse->rate; } -- 2.4.3