From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50893) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlJXx-0000aI-P9 for qemu-devel@nongnu.org; Thu, 12 Jan 2012 07:14:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlJXs-00044N-08 for qemu-devel@nongnu.org; Thu, 12 Jan 2012 07:14:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:33544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlJXr-00044A-Ku for qemu-devel@nongnu.org; Thu, 12 Jan 2012 07:14:15 -0500 Message-ID: <4F0ECF5E.1040309@redhat.com> Date: Thu, 12 Jan 2012 13:17:34 +0100 From: Kevin Wolf MIME-Version: 1.0 References: <1325858501-25741-1-git-send-email-stefanha@linux.vnet.ibm.com> <1325858501-25741-12-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1325858501-25741-12-git-send-email-stefanha@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v4 11/15] block: add bdrv_find_backing_image List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Marcelo Tosatti , qemu-devel@nongnu.org, Luiz Capitulino Am 06.01.2012 15:01, schrieb Stefan Hajnoczi: > From: Marcelo Tosatti > > Add bdrv_find_backing_image: given a BlockDriverState pointer, and an id, > traverse the backing image chain to locate the id. > > Signed-off-by: Marcelo Tosatti > Signed-off-by: Stefan Hajnoczi > --- > block.c | 17 +++++++++++++++++ > block.h | 1 + > 2 files changed, 18 insertions(+), 0 deletions(-) > > diff --git a/block.c b/block.c > index 5bfaa3a..9b688a0 100644 > --- a/block.c > +++ b/block.c > @@ -2614,6 +2614,23 @@ int bdrv_snapshot_load_tmp(BlockDriverState *bs, > return -ENOTSUP; > } > > +BlockDriverState *bdrv_find_backing_image(BlockDriverState *bs, const char *id) > +{ > + if (!bs->drv) { > + return NULL; > + } > + > + if (bs->backing_hd) { > + if (strcmp(bs->backing_file, id) == 0) { > + return bs->backing_hd; So it's not really just some id, but the backing file name? I would find it clearer to reflect that in the parameter name and the QMP error in the next patch. Kevin