diff mbox

[v4,04/12] fdc: add disk field

Message ID 1453272694-17106-5-git-send-email-jsnow@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

John Snow Jan. 20, 2016, 6:51 a.m. UTC
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.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 hw/block/fdc.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Eric Blake Jan. 20, 2016, 8:35 p.m. UTC | #1
On 01/19/2016 11:51 PM, John Snow wrote:
> 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.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  hw/block/fdc.c | 3 +++
>  1 file changed, 3 insertions(+)
> 

Reviewed-by: Eric Blake <eblake@redhat.com>
John Snow Jan. 20, 2016, 8:59 p.m. UTC | #2
On 01/20/2016 03:35 PM, Eric Blake wrote:
> On 01/19/2016 11:51 PM, John Snow wrote:
>> 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.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>  hw/block/fdc.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
> 
> Reviewed-by: Eric Blake <eblake@redhat.com>
> 

Grazie.

--js
diff mbox

Patch

diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index 041f1aa..e72a906 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -140,6 +140,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           */
@@ -157,6 +158,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;
 }
@@ -286,6 +288,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;
 }