Received: from [140.186.70.92] (port=49211 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt6SM-00068I-7H for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:48:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pt6S6-0004kg-3M for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:48:13 -0500 Received: from e4.ny.us.ibm.com ([32.97.182.144]:52281) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pt6S6-0004kH-18 for qemu-devel@nongnu.org; Fri, 25 Feb 2011 17:47:58 -0500 Received: from d01dlp01.pok.ibm.com (d01dlp01.pok.ibm.com [9.56.224.56]) by e4.ny.us.ibm.com (8.14.4/8.13.1) with ESMTP id p1PMSsxs006682 for ; Fri, 25 Feb 2011 17:29:00 -0500 Received: from d01relay07.pok.ibm.com (d01relay07.pok.ibm.com [9.56.227.147]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id 479B038C8039 for ; Fri, 25 Feb 2011 17:47:57 -0500 (EST) Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay07.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p1PMluFG2809908 for ; Fri, 25 Feb 2011 17:47:56 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p1PMlu3L021033 for ; Fri, 25 Feb 2011 19:47:56 -0300 From: Chunqiang Tang Date: Fri, 25 Feb 2011 17:38:05 -0500 Message-Id: <1298673486-3573-25-git-send-email-ctang@us.ibm.com> In-Reply-To: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> References: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> Subject: [Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe() List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Chunqiang Tang 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 --- 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