This patch prepares for the subsequent patches.

Signed-off-by: Hu Tao <hu...@cn.fujitsu.com>
---
 block/qcow2.c         | 6 +++---
 include/block/block.h | 6 ++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/block/qcow2.c b/block/qcow2.c
index f29aa88..32cb39f 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1614,7 +1614,7 @@ static int qcow2_create(const char *filename, 
QEMUOptionParameter *options,
     uint64_t sectors = 0;
     int flags = 0;
     size_t cluster_size = DEFAULT_CLUSTER_SIZE;
-    int prealloc = 0;
+    int prealloc = PREALLOC_OFF;
     int version = 3;
     Error *local_err = NULL;
     int ret;
@@ -1635,9 +1635,9 @@ static int qcow2_create(const char *filename, 
QEMUOptionParameter *options,
             }
         } else if (!strcmp(options->name, BLOCK_OPT_PREALLOC)) {
             if (!options->value.s || !strcmp(options->value.s, "off")) {
-                prealloc = 0;
+                prealloc = PREALLOC_OFF;
             } else if (!strcmp(options->value.s, "metadata")) {
-                prealloc = 1;
+                prealloc = PREALLOC_METADATA;
             } else {
                 error_setg(errp, "Invalid preallocation mode: '%s'",
                            options->value.s);
diff --git a/include/block/block.h b/include/block/block.h
index 36efaea..3732f25 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -527,4 +527,10 @@ int bdrv_debug_remove_breakpoint(BlockDriverState *bs, 
const char *tag);
 int bdrv_debug_resume(BlockDriverState *bs, const char *tag);
 bool bdrv_debug_is_suspended(BlockDriverState *bs, const char *tag);
 
+enum prealloc_mode {
+    PREALLOC_OFF = 0,
+    PREALLOC_METADATA,
+    PREALLOC_FULL,
+};
+
 #endif
-- 
1.7.11.7


Reply via email to