aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-06 22:11:20 +0000
committerbalrog <balrog@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-06 22:11:20 +0000
commitc8522bdf46b322334444489d28b64792e674e067 (patch)
treecc1febb53fa1060951ffb33814b2f374d15ff934
parentf2df526058b5815111aabca8db01f427891f006e (diff)
Give emulated drives more monitor-friendly name strings.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3776 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 6614bbdae1..5b7e97e6de 100644
--- a/vl.c
+++ b/vl.c
@@ -4844,6 +4844,8 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
{
char buf[128];
char file[1024];
+ char devname[128];
+ const char *mediastr = "";
BlockInterfaceType interface;
enum { MEDIA_DISK, MEDIA_CDROM } media;
int bus_id, unit_id;
@@ -4875,9 +4877,11 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
!strcmp(machine->name, "versatileab")) {
interface = IF_SCSI;
max_devs = MAX_SCSI_DEVS;
+ strcpy(devname, "scsi");
} else {
interface = IF_IDE;
max_devs = MAX_IDE_DEVS;
+ strcpy(devname, "ide");
}
media = MEDIA_DISK;
@@ -4900,6 +4904,7 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
}
if (get_param_value(buf, sizeof(buf), "if", str)) {
+ strncpy(devname, buf, sizeof(devname));
if (!strcmp(buf, "ide")) {
interface = IF_IDE;
max_devs = MAX_IDE_DEVS;
@@ -5057,7 +5062,10 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
/* init */
- snprintf(buf, sizeof(buf), "drive%d", nb_drives);
+ if (interface == IF_IDE || interface == IF_SCSI)
+ mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd";
+ snprintf(buf, sizeof(buf), max_devs ? "%1$s%4$i%2$s%3$i" : "%s%s%i",
+ devname, mediastr, unit_id, bus_id);
bdrv = bdrv_new(buf);
drives_table[nb_drives].bdrv = bdrv;
drives_table[nb_drives].interface = interface;