{
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;
!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;
}
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;
/* 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;