From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmiSA-0006UE-7b for qemu-devel@nongnu.org; Tue, 20 May 2014 07:43:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmiRz-0000es-Q4 for qemu-devel@nongnu.org; Tue, 20 May 2014 07:43:30 -0400 Received: from oxygen.pond.sub.org ([2a01:4f8:201:233:1::3]:36975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmiRz-0000dP-JH for qemu-devel@nongnu.org; Tue, 20 May 2014 07:43:19 -0400 Received: from blackfin.pond.sub.org (p5B32B92B.dip0.t-ipconnect.de [91.50.185.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by oxygen.pond.sub.org (Postfix) with ESMTPSA id 8B8082016C for ; Tue, 20 May 2014 13:43:14 +0200 (CEST) From: Markus Armbruster References: <1399858555-9672-1-git-send-email-famz@redhat.com> <1399858555-9672-4-git-send-email-famz@redhat.com> <87d2f9q2pi.fsf@blackfin.pond.sub.org> <20140519143752.GC4060@noname.redhat.com> <20140519153752.GC11553@localhost.localdomain> Date: Tue, 20 May 2014 13:43:13 +0200 In-Reply-To: <20140519153752.GC11553@localhost.localdomain> (Jeff Cody's message of "Mon, 19 May 2014 11:37:52 -0400") Message-ID: <8738g4wu9a.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v19 03/16] block: Introduce op_blockers to BlockDriverState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody Cc: Kevin Wolf , Fam Zheng , hbrock@redhat.com, qemu-devel@nongnu.org, rjones@redhat.com, imain@redhat.com, stefanha@redhat.com, pbonzini@redhat.com Jeff Cody writes: > On Mon, May 19, 2014 at 04:37:52PM +0200, Kevin Wolf wrote: >> Am 19.05.2014 um 16:10 hat Markus Armbruster geschrieben: >> > Fam Zheng writes: [...] >> > > diff --git a/block.c b/block.c >> > > index b749d31..32338ca 100644 >> > > --- a/block.c >> > > +++ b/block.c [...] >> > > @@ -5269,6 +5275,75 @@ void bdrv_unref(BlockDriverState *bs) >> > > } >> > > } >> > > >> > > +struct BdrvOpBlocker { >> > > + Error *reason; >> > > + QLIST_ENTRY(BdrvOpBlocker) list; >> > > +}; >> > > + >> > > +bool bdrv_op_is_blocked(BlockDriverState *bs, BlockOpType op, Error **errp) >> > > +{ >> > > + BdrvOpBlocker *blocker; >> > > + assert((int) op >= 0 && op < BLOCK_OP_TYPE_MAX); >> > >> > Space between cast and its operand is unusual. Please don't respin just >> > for that. >> >> That was a surprising statement for me. Do you have an idea how to grep >> for casts? I tried '*)' just in order to find _some_ examples of casts, >> and there doesn't seem to be a clear winner. But if there is one, it >> appears to be the version with space. >> >> (I won't reject patches with either style.) >> > > This just searches for pointer casts - it isn't perfect, but pretty > decent if you just want to get a sampling: > > grep -E "\([a-zA-Z0-9_]+[\\*\ ]+\)" * -rHnI Challenge! I used $ gdb -batch -ex "info types" qemu-system-x86_64 | sed -n 's/^typedef .* \([^ ]*\);/\1/p' types | sort -u to find typedef names, turned them into a regexp, and topped it off with one matching predefined scalar types. Let that be T. I git-grepped for -E '\((T) *\**\)', and found too many sizeof(T), QLIST_ENTRY(T) and such, so I filtered out the hits where the last non-space letter before the (T) is a letter. This passed visual muster, although it's of course neither 100% complete nor 100% correct. Close enough. This gave me roughly 6000 probable casts. >75% are not followed by space. In block-land (as defined by MAINTAINERS), it's close to 80%. Three thirds majority may not quite qualify for "clear winner" in matters of code formatting. I dislike space between cast and operand because the cast operator has a high operator precedence.