qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe()


From: Chunqiang Tang
Subject: [Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe()
Date: Fri, 25 Feb 2011 17:38:05 -0500

This patch is part of the Fast Virtual Disk (FVD) proposal.
See http://wiki.qemu.org/Features/FVD.

This patch adds FVD's implementation of the bdrv_probe() interface.

Signed-off-by: Chunqiang Tang <address@hidden>
---
 block/fvd-misc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/block/fvd-misc.c b/block/fvd-misc.c
index 61e39bb..6315218 100644
--- a/block/fvd-misc.c
+++ b/block/fvd-misc.c
@@ -163,7 +163,14 @@ static void fvd_close(BlockDriverState * bs)
 
 static int fvd_probe(const uint8_t * buf, int buf_size, const char *filename)
 {
-    return 0;
+    const FvdHeader *header = (const void *)buf;
+
+    if (buf_size >= sizeof(uint32_t) &&
+        le32_to_cpu(header->magic) == FVD_MAGIC) {
+        return 100;
+    } else {
+        return 0;
+    }
 }
 
 static int fvd_is_allocated(BlockDriverState * bs, int64_t sector_num,
-- 
1.7.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]