Revision 5efa9d5a qemu-img.c
b/qemu-img.c | ||
---|---|---|
542 | 542 |
drv = bdrv_find_format(out_fmt); |
543 | 543 |
if (!drv) |
544 | 544 |
error("Unknown file format '%s'", out_fmt); |
545 |
if (flags & BLOCK_FLAG_COMPRESS && drv != &bdrv_qcow && drv != &bdrv_qcow2)
|
|
545 |
if (flags & BLOCK_FLAG_COMPRESS && strcmp(drv->format_name, "qcow") && strcmp(drv->format_name, "qcow2"))
|
|
546 | 546 |
error("Compression not supported for this file format"); |
547 |
if (flags & BLOCK_FLAG_ENCRYPT && drv != &bdrv_qcow && drv != &bdrv_qcow2)
|
|
547 |
if (flags & BLOCK_FLAG_ENCRYPT && strcmp(drv->format_name, "qcow") && strcmp(drv->format_name, "qcow2"))
|
|
548 | 548 |
error("Encryption not supported for this file format"); |
549 |
if (flags & BLOCK_FLAG_COMPAT6 && drv != &bdrv_vmdk)
|
|
549 |
if (flags & BLOCK_FLAG_COMPAT6 && strcmp(drv->format_name, "vmdk"))
|
|
550 | 550 |
error("Alternative compatibility level not supported for this file format"); |
551 | 551 |
if (flags & BLOCK_FLAG_ENCRYPT && flags & BLOCK_FLAG_COMPRESS) |
552 | 552 |
error("Compression and encryption not supported at the same time"); |
... | ... | |
655 | 655 |
if (n > bs_offset + bs_sectors - sector_num) |
656 | 656 |
n = bs_offset + bs_sectors - sector_num; |
657 | 657 |
|
658 |
if (drv != &bdrv_host_device) {
|
|
658 |
if (strcmp(drv->format_name, "host_device")) {
|
|
659 | 659 |
if (!bdrv_is_allocated(bs[bs_i], sector_num - bs_offset, |
660 | 660 |
n, &n1)) { |
661 | 661 |
sector_num += n1; |
... | ... | |
682 | 682 |
If the output is to a host device, we also write out |
683 | 683 |
sectors that are entirely 0, since whatever data was |
684 | 684 |
already there is garbage, not 0s. */ |
685 |
if (drv == &bdrv_host_device || out_baseimg ||
|
|
685 |
if (strcmp(drv->format_name, "host_device") == 0 || out_baseimg ||
|
|
686 | 686 |
is_allocated_sectors(buf1, n, &n1)) { |
687 | 687 |
if (bdrv_write(out_bs, sector_num, buf1, n1) < 0) |
688 | 688 |
error("error while writing"); |
Also available in: Unified diff