Add serial number support for virtio_blk

[brought forward to current qemu-kvm.git]

This patch implements the missing qemu logic to
interpret a '-drive .. serial=XYZ ..' flag for
a virtio_blk device.

The serial number string is contained in a
skeletal IDENTIFY DEVICE data structure and
this structure is made available to the guest
virtio_blk driver via pci i/o region 0.

Signed-off-by: john cooper <john.cooper@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
john cooper 2009-06-22 14:26:51 -04:00 committed by Anthony Liguori
parent 024589f182
commit bf011293fa
3 changed files with 65 additions and 1 deletions

View file

@ -154,6 +154,8 @@ typedef enum {
BLOCK_ERR_STOP_ANY
} BlockInterfaceErrorAction;
#define BLOCK_SERIAL_STRLEN 20
typedef struct DriveInfo {
BlockDriverState *bdrv;
const char *devaddr;
@ -163,7 +165,7 @@ typedef struct DriveInfo {
int used;
int drive_opt_idx;
BlockInterfaceErrorAction onerror;
char serial[21];
char serial[BLOCK_SERIAL_STRLEN + 1];
} DriveInfo;
#define MAX_IDE_DEVS 2