Revision 0e7e1989 block/vmdk.c
b/block/vmdk.c | ||
---|---|---|
687 | 687 |
return 0; |
688 | 688 |
} |
689 | 689 |
|
690 |
static int vmdk_create(const char *filename, int64_t total_size, |
|
691 |
const char *backing_file, int flags) |
|
690 |
static int vmdk_create(const char *filename, QEMUOptionParameter *options) |
|
692 | 691 |
{ |
693 | 692 |
int fd, i; |
694 | 693 |
VMDK4Header header; |
... | ... | |
713 | 712 |
"ddb.adapterType = \"ide\"\n"; |
714 | 713 |
char desc[1024]; |
715 | 714 |
const char *real_filename, *temp_str; |
715 |
int64_t total_size = 0; |
|
716 |
const char *backing_file = NULL; |
|
717 |
int flags = 0; |
|
718 |
|
|
719 |
// Read out options |
|
720 |
while (options && options->name) { |
|
721 |
if (!strcmp(options->name, BLOCK_OPT_SIZE)) { |
|
722 |
total_size = options->value.n / 512; |
|
723 |
} else if (!strcmp(options->name, BLOCK_OPT_BACKING_FILE)) { |
|
724 |
backing_file = options->value.s; |
|
725 |
} else if (!strcmp(options->name, BLOCK_OPT_COMPAT6)) { |
|
726 |
flags |= options->value.n ? BLOCK_FLAG_COMPAT6: 0; |
|
727 |
} |
|
728 |
options++; |
|
729 |
} |
|
716 | 730 |
|
717 | 731 |
/* XXX: add support for backing file */ |
718 | 732 |
if (backing_file) { |
... | ... | |
812 | 826 |
bdrv_flush(s->hd); |
813 | 827 |
} |
814 | 828 |
|
829 |
|
|
830 |
static QEMUOptionParameter vmdk_create_options[] = { |
|
831 |
{ BLOCK_OPT_SIZE, OPT_SIZE }, |
|
832 |
{ BLOCK_OPT_BACKING_FILE, OPT_STRING }, |
|
833 |
{ BLOCK_OPT_COMPAT6, OPT_FLAG }, |
|
834 |
{ NULL } |
|
835 |
}; |
|
836 |
|
|
815 | 837 |
static BlockDriver bdrv_vmdk = { |
816 | 838 |
.format_name = "vmdk", |
817 | 839 |
.instance_size = sizeof(BDRVVmdkState), |
... | ... | |
823 | 845 |
.bdrv_create = vmdk_create, |
824 | 846 |
.bdrv_flush = vmdk_flush, |
825 | 847 |
.bdrv_is_allocated = vmdk_is_allocated, |
848 |
|
|
849 |
.create_options = vmdk_create_options, |
|
826 | 850 |
}; |
827 | 851 |
|
828 | 852 |
static void bdrv_vmdk_init(void) |
Also available in: Unified diff