From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bVHUn-0004Mh-LY for qemu-devel@nongnu.org; Thu, 04 Aug 2016 08:11:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bVHUh-0004Cu-W4 for qemu-devel@nongnu.org; Thu, 04 Aug 2016 08:11:29 -0400 Date: Thu, 4 Aug 2016 14:11:11 +0200 From: Kevin Wolf Message-ID: <20160804121111.GA4938@noname.redhat.com> References: <1470312212-3005-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1470312212-3005-1-git-send-email-kwolf@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.7] block/qdev: Let 'drive' property fall back to node name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org Am 04.08.2016 um 14:03 hat Kevin Wolf geschrieben: > If a qdev block device is created with an anonymous BlockBackend (i.e. > a node name rather than a BB name was given for the drive property), > qdev used to return an empty string when the property was read. This > patch fixes it to return the node name instead. > > Signed-off-by: Kevin Wolf As always, the moment you send out a patch, you notice that it's broken. > diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c > index 2ba2504..25b24aa 100644 > --- a/hw/core/qdev-properties-system.c > +++ b/hw/core/qdev-properties-system.c > @@ -126,7 +126,13 @@ static void release_drive(Object *obj, const char *name, void *opaque) > > static char *print_drive(void *ptr) > { > - return g_strdup(blk_name(ptr)); > + const char *name; > + > + name = blk_name(ptr); > + if (!*name) { > + name = bdrv_get_node_name(blk_bs(ptr)); blk_bs(ptr) can be NULL. Self-NACK, v2 is coming. > + } > + return g_strdup(name); > } Kevin