aboutsummaryrefslogtreecommitdiff
path: root/block/vdi.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2011-05-31 15:01:46 +0200
committerKevin Wolf <kwolf@redhat.com>2011-06-08 11:56:40 +0200
commit99cce9fa4e091fd7ead1926e1c0db016ef293f36 (patch)
treee38c8c5675a9ab2c5a8e51f6c614decaaadb1aeb /block/vdi.c
parentd220894e025ea85d604a2cdc1eef541ed516728e (diff)
downloadqemu-99cce9fa4e091fd7ead1926e1c0db016ef293f36.zip
qemu-99cce9fa4e091fd7ead1926e1c0db016ef293f36.tar.gz
qemu-99cce9fa4e091fd7ead1926e1c0db016ef293f36.tar.bz2
qemu-img create: Fix displayed default cluster size
When not specifying a cluster size on the command line, qemu-img printed a cluster size of 0: Formatting '/tmp/test.qcow2', fmt=qcow2 size=67108864 encryption=off cluster_size=0 This patch adds the default cluster size to the QEMUOptionParameter list, so that it displays the default value that is used. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/vdi.c')
-rw-r--r--block/vdi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/vdi.c b/block/vdi.c
index 701745b..4c9e201 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -87,6 +87,7 @@ void uuid_unparse(const uuid_t uu, char *out);
#define MiB (KiB * KiB)
#define SECTOR_SIZE 512
+#define DEFAULT_CLUSTER_SIZE (1 * MiB)
#if defined(CONFIG_VDI_DEBUG)
#define logout(fmt, ...) \
@@ -803,7 +804,7 @@ static int vdi_create(const char *filename, QEMUOptionParameter *options)
int result = 0;
uint64_t bytes = 0;
uint32_t blocks;
- size_t block_size = 1 * MiB;
+ size_t block_size = DEFAULT_CLUSTER_SIZE;
uint32_t image_type = VDI_TYPE_DYNAMIC;
VdiHeader header;
size_t i;
@@ -921,7 +922,8 @@ static QEMUOptionParameter vdi_create_options[] = {
{
.name = BLOCK_OPT_CLUSTER_SIZE,
.type = OPT_SIZE,
- .help = "VDI cluster (block) size"
+ .help = "VDI cluster (block) size",
+ .value = { .n = DEFAULT_CLUSTER_SIZE },
},
#endif
#if defined(CONFIG_VDI_STATIC_IMAGE)