From patchwork Fri Feb 25 22:38:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunqiang Tang X-Patchwork-Id: 84594 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EC319B7103 for ; Sat, 26 Feb 2011 10:30:10 +1100 (EST) Received: from localhost ([127.0.0.1]:33817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pt762-0005SU-TJ for incoming@patchwork.ozlabs.org; Fri, 25 Feb 2011 18:29:14 -0500 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 Received: from localhost.localdomain ([9.59.229.24]) by d01av03.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id p1PMlp9N020693; Fri, 25 Feb 2011 19:47:55 -0300 From: Chunqiang Tang To: qemu-devel@nongnu.org Date: Fri, 25 Feb 2011 17:38:05 -0500 Message-Id: <1298673486-3573-25-git-send-email-ctang@us.ibm.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> References: <1298673486-3573-1-git-send-email-ctang@us.ibm.com> X-Content-Scanned: Fidelis XPS MAILER X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 32.97.182.144 Cc: Chunqiang Tang Subject: [Qemu-devel] [PATCH 25/26] FVD: add impl of interface bdrv_probe() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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,