From patchwork Fri Aug 30 14:30:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 271307 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A869F2C0101 for ; Sat, 31 Aug 2013 00:35:22 +1000 (EST) Received: from localhost ([::1]:50836 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFPnE-0005U1-HL for incoming@patchwork.ozlabs.org; Fri, 30 Aug 2013 10:35:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48514) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFPjH-0008G8-9n for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VFPjB-0002k1-9k for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VFPjB-0002jt-1O for qemu-devel@nongnu.org; Fri, 30 Aug 2013 10:31:09 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7UEV7sg015193 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Aug 2013 10:31:07 -0400 Received: from dhcp-200-207.str.redhat.com (dhcp-192-197.str.redhat.com [10.33.192.197]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r7UEUslD022950; Fri, 30 Aug 2013 10:31:06 -0400 From: Kevin Wolf To: anthony@codemonkey.ws Date: Fri, 30 Aug 2013 16:30:35 +0200 Message-Id: <1377873051-18981-11-git-send-email-kwolf@redhat.com> In-Reply-To: <1377873051-18981-1-git-send-email-kwolf@redhat.com> References: <1377873051-18981-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PULL 10/26] raw_bsd: introduce "special members" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Laszlo Ersek On 08/05/13 15:03, Paolo Bonzini wrote: > > [...] > > 3) These members are special > > .format_name is the string "raw" > .bdrv_open raw_open should set bs->sg to bs->file->sg and return 0 > .bdrv_close raw_close should do nothing > .bdrv_probe raw_probe should just return 1. v1->v2: On 08/20/13 10:11, Kevin Wolf wrote: > Am 16.08.2013 um 16:15 hat Laszlo Ersek geschrieben: >> +static int raw_probe(void) >> +{ >> + return 1; >> +} > > Maybe add a comment here like "smallest possible positive score so that > raw is used if and only if no other block driver works". Signed-off-by: Laszlo Ersek Signed-off-by: Kevin Wolf --- block/raw_bsd.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/block/raw_bsd.c b/block/raw_bsd.c index 5bcbe71..b1d7209 100644 --- a/block/raw_bsd.c +++ b/block/raw_bsd.c @@ -112,3 +112,26 @@ static TYPE raw_create(void) { return bdrv_create_file(); } + +static const char *raw_format_name(void) +{ + return "raw"; +} + +static int raw_open(BlockDriverState *bs) +{ + bs->sg = bs->file->sg; + return 0; +} + +static void raw_close(void) +{ +} + +static int raw_probe(void) +{ + /* smallest possible positive score so that raw is used if and only if no + * other block driver works + */ + return 1; +}