|
Lines 396-413
Link Here
|
| 396 |
eject_device(bs, force); |
396 |
eject_device(bs, force); |
| 397 |
} |
397 |
} |
| 398 |
|
398 |
|
| 399 |
static void do_change_block(const char *device, const char *filename) |
399 |
static void do_change_block(const char *device, const char *filename, const char *fmt) |
| 400 |
{ |
400 |
{ |
| 401 |
BlockDriverState *bs; |
401 |
BlockDriverState *bs; |
|
|
402 |
BlockDriver *drv = NULL; |
| 402 |
|
403 |
|
| 403 |
bs = bdrv_find(device); |
404 |
bs = bdrv_find(device); |
| 404 |
if (!bs) { |
405 |
if (!bs) { |
| 405 |
term_printf("device not found\n"); |
406 |
term_printf("device not found\n"); |
| 406 |
return; |
407 |
return; |
| 407 |
} |
408 |
} |
|
|
409 |
if (fmt) { |
| 410 |
drv = bdrv_find_format(fmt); |
| 411 |
if (!drv) { |
| 412 |
term_printf("invalid format %s\n", fmt); |
| 413 |
return; |
| 414 |
} |
| 415 |
} |
| 408 |
if (eject_device(bs, 0) < 0) |
416 |
if (eject_device(bs, 0) < 0) |
| 409 |
return; |
417 |
return; |
| 410 |
bdrv_open(bs, filename, 0); |
418 |
bdrv_open2(bs, filename, 0, drv); |
| 411 |
qemu_key_check(bs, filename); |
419 |
qemu_key_check(bs, filename); |
| 412 |
} |
420 |
} |
| 413 |
|
421 |
|
|
Lines 426-437
Link Here
|
| 426 |
} |
434 |
} |
| 427 |
} |
435 |
} |
| 428 |
|
436 |
|
| 429 |
static void do_change(const char *device, const char *target) |
437 |
static void do_change(const char *device, const char *target, const char *fmt) |
| 430 |
{ |
438 |
{ |
| 431 |
if (strcmp(device, "vnc") == 0) { |
439 |
if (strcmp(device, "vnc") == 0) { |
| 432 |
do_change_vnc(target); |
440 |
do_change_vnc(target); |
| 433 |
} else { |
441 |
} else { |
| 434 |
do_change_block(device, target); |
442 |
do_change_block(device, target, fmt); |
| 435 |
} |
443 |
} |
| 436 |
} |
444 |
} |
| 437 |
|
445 |
|
|
Lines 1339-1346
Link Here
|
| 1339 |
"", "quit the emulator" }, |
1347 |
"", "quit the emulator" }, |
| 1340 |
{ "eject", "-fB", do_eject, |
1348 |
{ "eject", "-fB", do_eject, |
| 1341 |
"[-f] device", "eject a removable medium (use -f to force it)" }, |
1349 |
"[-f] device", "eject a removable medium (use -f to force it)" }, |
| 1342 |
{ "change", "BF", do_change, |
1350 |
{ "change", "BFs?", do_change, |
| 1343 |
"device filename", "change a removable medium" }, |
1351 |
"device filename [format]", "change a removable medium, optional format" }, |
| 1344 |
{ "screendump", "F", do_screen_dump, |
1352 |
{ "screendump", "F", do_screen_dump, |
| 1345 |
"filename", "save screen into PPM image 'filename'" }, |
1353 |
"filename", "save screen into PPM image 'filename'" }, |
| 1346 |
{ "logfile", "F", do_logfile, |
1354 |
{ "logfile", "F", do_logfile, |