From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XK7Pl-0008Gb-B5 for qemu-devel@nongnu.org; Wed, 20 Aug 2014 11:03:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XK7Pf-0007QU-6j for qemu-devel@nongnu.org; Wed, 20 Aug 2014 11:03:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29647) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XK7Pe-0007QN-VH for qemu-devel@nongnu.org; Wed, 20 Aug 2014 11:02:59 -0400 Date: Wed, 20 Aug 2014 23:03:12 +0800 From: Fam Zheng Message-ID: <20140820150312.GB2770@T430.redhat.com> References: <1408528887-22200-1-git-send-email-famz@redhat.com> <1408528887-22200-7-git-send-email-famz@redhat.com> <53F4A363.5020904@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <53F4A363.5020904@redhat.com> Subject: Re: [Qemu-devel] [PATCH 6/6] iscsi: Move iqn generation code to util List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, mjt@tls.msk.ru, qemu-devel@nongnu.org, stefanha@redhat.com On Wed, 08/20 15:32, Paolo Bonzini wrote: > Il 20/08/2014 12:01, Fam Zheng ha scritto: > > diff --git a/util/iqn.c b/util/iqn.c > > new file mode 100644 > > index 0000000..c8d1eda > > --- /dev/null > > +++ b/util/iqn.c > > @@ -0,0 +1,38 @@ > > +/* > > + * iqn generat function > > + * > > + * Copyright Red Hat, Inc., 2014 > > + * > > + * Author: Paolo Bonzini > > Why me? :) For the copied uuid part :) > > > + * Fam Zheng > > + * > > + * This work is licensed under the terms of the GNU GPL, version 2 or > > + * later. See the COPYING file in the top-level directory. > > + */ > > + > > +#include > > +#include "qemu/error-report.h" > > +#include "qemu-common.h" > > +#include "sysemu/sysemu.h" > > +#include "qmp-commands.h" > > + > > +char *iqn_generate(const char *prefix) > > +{ > > + const char *name; > > + char *iqn; > > + UuidInfo *uuid_info; > > + > > + uuid_info = qmp_query_uuid(NULL); > > + if (strcmp(uuid_info->UUID, UUID_NONE) == 0) { > > + name = qemu_get_vm_name(); > > + } else { > > + name = uuid_info->UUID; > > + } > > + iqn = g_strdup_printf("%s%s%s", > > + prefix, > > + name ? ":" : "", > > + name ? : ""); > > + qapi_free_UuidInfo(uuid_info); > > + > > + return iqn; > > +} > > > > Ouch, this is ugly... I cannot think of any other way to do it, but > perhaps Benoit's QMP-in-tools series could help here? I'll have a look to see if it helps. > > In any case, if we need it I think there's no need to keep the argument > to iqn_generate. Fam