Received: from eggs.gnu.org ([2001:4830:134:3::10]:41928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQcrA-0005ti-AU for qemu-devel@nongnu.org; Tue, 02 Feb 2016 10:27:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aQcr7-000489-Jf for qemu-devel@nongnu.org; Tue, 02 Feb 2016 10:27:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aQcr7-000483-CC for qemu-devel@nongnu.org; Tue, 02 Feb 2016 10:27:01 -0500 From: Markus Armbruster References: <1453963872-13549-1-git-send-email-vsementsov@virtuozzo.com> <1453963872-13549-3-git-send-email-vsementsov@virtuozzo.com> Date: Tue, 02 Feb 2016 16:26:58 +0100 In-Reply-To: <1453963872-13549-3-git-send-email-vsementsov@virtuozzo.com> (Vladimir Sementsov-Ogievskiy's message of "Thu, 28 Jan 2016 09:51:11 +0300") Message-ID: <8737tbjfp9.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 2/3] pcdimm: add 'type' field to PCDIMMDeviceInfo List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Vladimir Sementsov-Ogievskiy Cc: Xiao Guangrong , "Michael S. Tsirkin" , qemu-devel@nongnu.org, Stefan Hajnoczi , Igor Mammedov , "Denis V. Lunev" Vladimir Sementsov-Ogievskiy writes: > The field is needed to distinguish pc-dimm and nvdimm. > > Signed-off-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: Denis V. Lunev > CC: Stefan Hajnoczi > CC: Xiao Guangrong > CC: "Michael S. Tsirkin" > CC: Igor Mammedov > CC: Eric Blake > CC: Markus Armbruster > --- > hw/mem/pc-dimm.c | 1 + > qapi-schema.json | 5 ++++- > 2 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c > index 4f30950..7469bd4 100644 > --- a/hw/mem/pc-dimm.c > +++ b/hw/mem/pc-dimm.c > @@ -178,6 +178,7 @@ int qmp_pc_dimm_device_list(Object *obj, void *opaque) if (object_dynamic_cast(obj, TYPE_PC_DIMM)) { DeviceState *dev = DEVICE(obj); if (dev->realized) { [...] > di->size = object_property_get_int(OBJECT(dimm), PC_DIMM_SIZE_PROP, > NULL); > di->memdev = object_get_canonical_path(OBJECT(dimm->hostmem)); > + di->type = g_strdup(object_get_typename(obj)); @type is the type name of a subtype of TYPE_PC_DIMM. Current subtypes are TYPE_PC_DIMM itself and TYPE_NVDIMM, i.e. "pc-dimm" and "nvdimm". > > info->u.dimm = di; > elem->value = info; > diff --git a/qapi-schema.json b/qapi-schema.json > index 8d04897..3bcc957 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -3924,6 +3924,8 @@ > # > # @hotpluggable: true if device if could be added/removed while machine is running > # > +# @type: device type: 'pc-dimm' or 'nvdimm' (since 2.6) > +# Not wrong, but brittle: it breaks whenever someone adds another subtype and doesn't remember to update this spot. Remembering it seems unlikely, because it's somewhere else entirely. Let's document it to be the type name of a subtype of pc-dimm, and that you can query the possible values with QMP command { "execute": "qom-list-types", "arguments": { "implements": "pc-dimm", "abstract": false } } > # Since: 2.1 > ## > { 'struct': 'PCDIMMDeviceInfo', > @@ -3934,7 +3936,8 @@ > 'node': 'int', > 'memdev': 'str', > 'hotplugged': 'bool', > - 'hotpluggable': 'bool' > + 'hotpluggable': 'bool', > + 'type': 'str' > } > }