Skip to contentSkip to conversation

add support for drive names.

PATCH New Gerd Hoffmann 1 participant 1 message Jul 2, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add support for drive names.

-drive accepts the new name= now, allowing to explicitely name your drives. They will show up with that name in "info block" if specified, otherwise the existing namimg scheme is used to autogenerate one.

There is also a new function to lookup drives by name. Not used yet. The plan is to link disk drivers and drives using the drive name instead of passing around pointers to BlockDriveState.

The patch depends on the "kill drives_table" sent earlier today.

---
 sysemu.h |    2 ++
 vl.c     |   49 +++++++++++++++++++++++++++++++------------------
 2 files changed, 33 insertions(+), 18 deletions(-)
sysemu.h +2 -0
index 36d6aaa..f8c2729 100644
@@ -160,6 +160,7 @@ typedef enum {
 
 typedef struct DriveInfo {
     BlockDriverState *bdrv;
+    char name[32];
     const char *devaddr;
     BlockInterfaceType type;
     int bus;
@@ -177,6 +178,7 @@ typedef struct DriveInfo {
 extern TAILQ_HEAD(drivelist, DriveInfo) drives;
 
 extern DriveInfo *drive_get(BlockInterfaceType type, int bus, int unit);
+extern DriveInfo *drive_get_byname(char *name);
 extern int drive_get_max_bus(BlockInterfaceType type);
 extern void drive_uninit(BlockDriverState *bdrv);
 extern void drive_remove(int index);
vl.c +31 -18

99 lines not on this page · raw message

Signature · 1 line
1.6.2.5