From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44752) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTtAl-0000ab-Qf for qemu-devel@nongnu.org; Tue, 16 Sep 2014 09:52:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTtAe-0005Ys-7q for qemu-devel@nongnu.org; Tue, 16 Sep 2014 09:51:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTtAe-0005YD-11 for qemu-devel@nongnu.org; Tue, 16 Sep 2014 09:51:52 -0400 From: Markus Armbruster References: <1410620427-20089-1-git-send-email-armbru@redhat.com> <1410620427-20089-5-git-send-email-armbru@redhat.com> <20140916123848.GA27495@nodalink.com> Date: Tue, 16 Sep 2014 15:51:42 +0200 In-Reply-To: <20140916123848.GA27495@nodalink.com> (=?utf-8?Q?=22Beno?= =?utf-8?Q?=C3=AEt?= Canet"'s message of "Tue, 16 Sep 2014 12:38:48 +0000") Message-ID: <87oaufk70x.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 04/23] block: Connect BlockBackend and DriveInfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?utf-8?Q?Beno=C3=AEt?= Canet Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com Beno=C3=AEt Canet writes: >> +DriveInfo *blk_legacy_dinfo(BlockBackend *blk) >> +{ >> + return blk->legacy_dinfo; >> +} >> + >> +/* >> + * Set @blk's DriveInfo to @dinfo, and return it. >> + * @blk must not have a DriveInfo set already. > >> + * No other BlockBackend may have the same DriveInfo set. > Must we try to assert this ? > This would require an extra linked list traversal but I don't think it's a > performance path anyway. Must, no. We could. However, the obvious assert(!blk_by_legacy_dinfo(dinfo); doesn't work, because blk_by_legacy_dinfo() asserts it returns a non-null value. Either we sacrifice that assertion, or we duplicate the search loop here (yuck), or we factor it out into a helper function. I don't particularly like either of the three. But if you guys really want the precondition checked, I'll check it. > Reviewed-by: Beno=C3=AEt Canet Thanks!