Received: from eggs.gnu.org ([2001:4830:134:3::10]:54843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz4eG-0006sV-1a for qemu-devel@nongnu.org; Thu, 11 Dec 2014 09:23:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xz4e2-0003bC-OO for qemu-devel@nongnu.org; Thu, 11 Dec 2014 09:23:19 -0500 Received: from e06smtp12.uk.ibm.com ([195.75.94.108]:56039) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xz4e2-0003ao-7N for qemu-devel@nongnu.org; Thu, 11 Dec 2014 09:23:06 -0500 Received: from /spool/local by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Dec 2014 14:23:03 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id 339BE17D8042 for ; Thu, 11 Dec 2014 14:23:24 +0000 (GMT) Received: from d06av04.portsmouth.uk.ibm.com (d06av04.portsmouth.uk.ibm.com [9.149.37.216]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id sBBEN1sD50462872 for ; Thu, 11 Dec 2014 14:23:01 GMT Received: from d06av04.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av04.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id sBBEN0MN032074 for ; Thu, 11 Dec 2014 07:23:01 -0700 Date: Thu, 11 Dec 2014 15:22:58 +0100 From: Thomas Huth Message-ID: <20141211152258.667a567f@oc7435384737.ibm.com> In-Reply-To: <54897D41.5090106@linux.vnet.ibm.com> References: <1417802181-20834-1-git-send-email-tumanova@linux.vnet.ibm.com> <1417802181-20834-4-git-send-email-tumanova@linux.vnet.ibm.com> <20141210141458.5adf276b@oc7435384737.ibm.com> <54897D41.5090106@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3 3/5] block: Add driver methods to probe blocksizes and geometry List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ekaterina Tumanova Cc: kwolf@redhat.com, dahi@linux.vnet.ibm.com, Public KVM Mailing List , armbru@redhat.com, mihajlov@linux.vnet.ibm.com, borntraeger@de.ibm.com, stefanha@redhat.com, cornelia.huck@de.ibm.com, pbonzini@redhat.com On Thu, 11 Dec 2014 14:17:21 +0300 Ekaterina Tumanova wrote: > On 12/10/2014 04:14 PM, Thomas Huth wrote: > > On Fri, 5 Dec 2014 18:56:19 +0100 > > Ekaterina Tumanova wrote: ... > >> diff --git a/block/raw_bsd.c b/block/raw_bsd.c > >> index 401b967..cfd5249 100644 > >> --- a/block/raw_bsd.c > >> +++ b/block/raw_bsd.c > >> @@ -173,6 +173,18 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename) > >> return 1; > >> } > >> > >> +static int raw_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) > >> +{ > >> + bdrv_probe_blocksizes(bs->file, bsz); > >> + > >> + return 0; > >> +} > >> + > >> +static int raw_probe_geometry(BlockDriverState *bs, hdGeometry *geo) > >> +{ > >> + return bdrv_probe_geometry(bs->file, geo); > >> +} > >> + > >> static BlockDriver bdrv_raw = { > >> .format_name = "raw", > >> .bdrv_probe = &raw_probe, > >> @@ -190,6 +202,8 @@ static BlockDriver bdrv_raw = { > >> .has_variable_length = true, > >> .bdrv_get_info = &raw_get_info, > >> .bdrv_refresh_limits = &raw_refresh_limits, > >> + .bdrv_probe_blocksizes = &raw_probe_blocksizes, > >> + .bdrv_probe_geometry = &raw_probe_geometry, > >> .bdrv_is_inserted = &raw_is_inserted, > >> .bdrv_media_changed = &raw_media_changed, > >> .bdrv_eject = &raw_eject, > > > > Hmmm, raw_probe_blocksizes() calls bdrv_probe_blocksizes(), but when I > > look at your patch 1/5, bdrv_probe_blocksizes() wants to call > > drv->bdrv_probe_blocksizes() (i.e. raw_probe_blocksizes()) again? > > Don't you get an endless recursive loop here? Or did I miss something? > > *confused* > > > > Thomas > > No I don't :) Because raw_probe_blocksizes indeed calls > bdrv_probe_blocksizes() dispatcher, but it calls it against different > driver: "bs->file". This child points to other driver, which represents > the actual nature of the device. > > So the 2nd drv->bdrv_probe_blocksizes() call will actually be > a call to either hdev_probe_blocksizes() for "host_device" driver or > will be null for other drivers. Ah, ok, you're right of course! Thanks for the explanation and sorry for the confusion! Thomas