Commit c8522bdf46b322334444489d28b64792e674e067

Authored by balrog
1 parent f2df5260

Give emulated drives more monitor-friendly name strings.


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3776 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 9 additions and 1 deletions
@@ -4844,6 +4844,8 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine) @@ -4844,6 +4844,8 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
4844 { 4844 {
4845 char buf[128]; 4845 char buf[128];
4846 char file[1024]; 4846 char file[1024];
  4847 + char devname[128];
  4848 + const char *mediastr = "";
4847 BlockInterfaceType interface; 4849 BlockInterfaceType interface;
4848 enum { MEDIA_DISK, MEDIA_CDROM } media; 4850 enum { MEDIA_DISK, MEDIA_CDROM } media;
4849 int bus_id, unit_id; 4851 int bus_id, unit_id;
@@ -4875,9 +4877,11 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine) @@ -4875,9 +4877,11 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
4875 !strcmp(machine->name, "versatileab")) { 4877 !strcmp(machine->name, "versatileab")) {
4876 interface = IF_SCSI; 4878 interface = IF_SCSI;
4877 max_devs = MAX_SCSI_DEVS; 4879 max_devs = MAX_SCSI_DEVS;
  4880 + strcpy(devname, "scsi");
4878 } else { 4881 } else {
4879 interface = IF_IDE; 4882 interface = IF_IDE;
4880 max_devs = MAX_IDE_DEVS; 4883 max_devs = MAX_IDE_DEVS;
  4884 + strcpy(devname, "ide");
4881 } 4885 }
4882 media = MEDIA_DISK; 4886 media = MEDIA_DISK;
4883 4887
@@ -4900,6 +4904,7 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine) @@ -4900,6 +4904,7 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
4900 } 4904 }
4901 4905
4902 if (get_param_value(buf, sizeof(buf), "if", str)) { 4906 if (get_param_value(buf, sizeof(buf), "if", str)) {
  4907 + strncpy(devname, buf, sizeof(devname));
4903 if (!strcmp(buf, "ide")) { 4908 if (!strcmp(buf, "ide")) {
4904 interface = IF_IDE; 4909 interface = IF_IDE;
4905 max_devs = MAX_IDE_DEVS; 4910 max_devs = MAX_IDE_DEVS;
@@ -5057,7 +5062,10 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine) @@ -5057,7 +5062,10 @@ static int drive_init(const char *str, int snapshot, QEMUMachine *machine)
5057 5062
5058 /* init */ 5063 /* init */
5059 5064
5060 - snprintf(buf, sizeof(buf), "drive%d", nb_drives); 5065 + if (interface == IF_IDE || interface == IF_SCSI)
  5066 + mediastr = (media == MEDIA_CDROM) ? "-cd" : "-hd";
  5067 + snprintf(buf, sizeof(buf), max_devs ? "%1$s%4$i%2$s%3$i" : "%s%s%i",
  5068 + devname, mediastr, unit_id, bus_id);
5061 bdrv = bdrv_new(buf); 5069 bdrv = bdrv_new(buf);
5062 drives_table[nb_drives].bdrv = bdrv; 5070 drives_table[nb_drives].bdrv = bdrv;
5063 drives_table[nb_drives].interface = interface; 5071 drives_table[nb_drives].interface = interface;