Revision 751c6a17 hw/qdev.c
b/hw/qdev.c | ||
---|---|---|
267 | 267 |
BlockDriverState *qdev_init_bdrv(DeviceState *dev, BlockInterfaceType type) |
268 | 268 |
{ |
269 | 269 |
int unit = next_block_unit[type]++; |
270 |
int index;
|
|
270 |
DriveInfo *dinfo;
|
|
271 | 271 |
|
272 |
index = drive_get_index(type, 0, unit); |
|
273 |
if (index == -1) { |
|
274 |
return NULL; |
|
275 |
} |
|
276 |
return drives_table[index].bdrv; |
|
272 |
dinfo = drive_get(type, 0, unit); |
|
273 |
return dinfo ? dinfo->bdrv : NULL; |
|
277 | 274 |
} |
278 | 275 |
|
279 | 276 |
BusState *qdev_get_child_bus(DeviceState *dev, const char *name) |
... | ... | |
296 | 293 |
{ |
297 | 294 |
int bus = next_scsi_bus++; |
298 | 295 |
int unit; |
299 |
int index;
|
|
296 |
DriveInfo *dinfo;
|
|
300 | 297 |
|
301 | 298 |
for (unit = 0; unit < MAX_SCSI_DEVS; unit++) { |
302 |
index = drive_get_index(IF_SCSI, bus, unit);
|
|
303 |
if (index == -1) {
|
|
299 |
dinfo = drive_get(IF_SCSI, bus, unit);
|
|
300 |
if (!dinfo) {
|
|
304 | 301 |
continue; |
305 | 302 |
} |
306 |
attach(host, drives_table[index].bdrv, unit);
|
|
303 |
attach(host, dinfo->bdrv, unit);
|
|
307 | 304 |
} |
308 | 305 |
} |
309 | 306 |
|
Also available in: Unified diff