From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBh2c-0000Ec-UT for qemu-devel@nongnu.org; Tue, 20 Aug 2013 04:11:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBh2W-0001kR-Qt for qemu-devel@nongnu.org; Tue, 20 Aug 2013 04:11:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51109) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBh2W-0001kF-IG for qemu-devel@nongnu.org; Tue, 20 Aug 2013 04:11:44 -0400 Date: Tue, 20 Aug 2013 10:11:45 +0200 From: Kevin Wolf Message-ID: <20130820081145.GB2384@dhcp-200-207.str.redhat.com> References: <1376662507-5212-1-git-send-email-lersek@redhat.com> <1376662507-5212-5-git-send-email-lersek@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1376662507-5212-5-git-send-email-lersek@redhat.com> Subject: Re: [Qemu-devel] [PATCH 4/7] raw_bsd: introduce "special members" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: pbonzini@redhat.com, aliguori@us.ibm.com, hch@lst.de, qemu-devel@nongnu.org Am 16.08.2013 um 16:15 hat Laszlo Ersek geschrieben: > 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. > > Signed-off-by: Laszlo Ersek > --- > block/raw_bsd.c | 20 ++++++++++++++++++++ > 1 files changed, 20 insertions(+), 0 deletions(-) > > diff --git a/block/raw_bsd.c b/block/raw_bsd.c > index 5bcbe71..86e018d 100644 > --- a/block/raw_bsd.c > +++ b/block/raw_bsd.c > @@ -112,3 +112,23 @@ 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; I know that Paolo explicitly made this requirement, but I think it is ugly. We should instead fix bdrv_is_sg() to look at bs->file if it exists, like many other functions already do, and change the two readers of bs->sg in block.c to use bdrv_is_sg(). > + return 0; > +} > + > +static void raw_close(void) > +{ > +} > + > +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". Kevin