From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58424) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkwhY-0004xq-JN for qemu-devel@nongnu.org; Thu, 15 May 2014 10:32:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WkwhS-0007zY-F2 for qemu-devel@nongnu.org; Thu, 15 May 2014 10:32:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46408) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkwhR-0007zL-VQ for qemu-devel@nongnu.org; Thu, 15 May 2014 10:31:58 -0400 Date: Thu, 15 May 2014 10:31:53 -0400 From: Jeff Cody Message-ID: <20140515143153.GJ8452@localhost.localdomain> References: <5374CC3B.8090007@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5374CC3B.8090007@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/5] block: add helper function to determine if a BDS is in a chain List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: kwolf@redhat.com, benoit.canet@irqsave.net, pkrempa@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com On Thu, May 15, 2014 at 08:16:27AM -0600, Eric Blake wrote: > On 05/14/2014 09:20 PM, Jeff Cody wrote: > > This is a small helper function, to determine if 'base' is in the > > chain of BlockDriverState 'top'. It returns true if it is in the chain, > > and false otherwise. > > > > If either argument is NULL, it will also return false. > > > > Signed-off-by: Jeff Cody > > --- > > block.c | 9 +++++++++ > > include/block/block.h | 1 + > > 2 files changed, 10 insertions(+) > > > > > > > +bool bdrv_is_in_chain(BlockDriverState *top, BlockDriverState *base) > > No doc comments inline, and not everyone has the commit message handy. > Which means someone trying to learn what this command does has to read > the function. Maybe copy the commit message into code comments as well. > OK > Bikeshedding: If I'm reading code, and see bdrv_is_in_chain(a, b), my > first inclination would be to read that as "return true if node a is in > chain b". But if I were to see bdrv_chain_contains(a, b), I would parse > that as "return true if chain a contains node b". I think you either > want to swap argument order, or rename the function. I like the bdrv_chain_contains() as the function name, it is clearer. I'll use that. > > The function itself looks useful, though, once we agree on the naming. >