From nobody Thu Oct 30 15:31:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 15258184613744.260684643168929; Tue, 8 May 2018 15:27:41 -0700 (PDT) Received: from localhost ([::1]:53577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGB5A-0006e7-JW for importer@patchew.org; Tue, 08 May 2018 18:27:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fGAsu-0002sD-Fg for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fGAst-0001KW-Ew for qemu-devel@nongnu.org; Tue, 08 May 2018 18:15:00 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35367) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fGAst-0001Ju-8L for qemu-devel@nongnu.org; Tue, 08 May 2018 18:14:59 -0400 Received: by mail-wm0-x244.google.com with SMTP id o78-v6so24237693wmg.0 for ; Tue, 08 May 2018 15:14:59 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-189-60.clienti.tiscali.it. [78.12.189.60]) by smtp.gmail.com with ESMTPSA id c15-v6sm14020129edr.78.2018.05.08.15.14.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 15:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=6PSYm+s7FhR4KDDDHrL9owlCcphcfFkTCLZ7kVaomUg=; b=G1iSXfKyd+o6SHVws+e0RaoUUPkk28w0X/QV/CyfedSG6oB9ZaIzYmdNYITAz5pVAu ZHKyceM/0g75kR0UtLYX8qbJ9pcAQOxARY5qSCN659o1qowiqTXNZKcrzYxKDQDg0qHp BKEo+E/XzN304mjsGEtwAflXxhV/STgic512HhDlMaIGcT3UZEikMNEhGlp2cPHXNaIY cN/Hd18x9Tls+lnALw4nDmBkt+mT0OTjMSWWQ8J2GnO3rnpAqLfvH3tMDi9Om3L1V666 8fl6XLkkt9pUqS5WdIGU1767ZhlkCRX5wkaKwFy5uuPg2Ne3Vc6PexLm548V6SHWfK7x 854A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=6PSYm+s7FhR4KDDDHrL9owlCcphcfFkTCLZ7kVaomUg=; b=hRzLwr/Ca216a9akEhcfDl3/jTAGfy5jZlwkXTc0tMr7NMqnb556Ko/xbXxnAmxZlc Krju2WwcDLtKTlBC61/Xh7Or1CGWOD/EWsLZXRkzgJc3/Kl+2PTCID5OMWlI1vmOaRpI JXsJfc1PLHd2+/Cod4nCnw3aZSxpNu13BcjRnE+DfigbpM/E5xB89ydg3LcI0okKq6QH HXFR+xW/MxBx424XRcmHJ0X2SNq78IVIU/YkLGD7gKAg9vZEw0nGiFy8q7ZXxcAoj9uS I5NlDsP7AgF9+XsyMPmom1jzWN7/DcfLoM2yK07wkcZUcI4XynG0ZYKi8tzUJ8VG0VqS maJw== X-Gm-Message-State: ALQs6tD5D/8XGK6GBNPkL9TrnOEnvZ3U69Vcf7z0j5TqUQchqGpIfhHQ /lr3ug4UsCM4dek3UI/EMovnCev3 X-Google-Smtp-Source: AB8JxZrlstbz47t+lCIeEkP/6SXghuO3AtJU0xTTzV6uETE3K3Jro5jDsNhc+hYwbgmWaNeMFTFJLw== X-Received: by 2002:a50:bd84:: with SMTP id y4-v6mr44118834edh.18.1525817697941; Tue, 08 May 2018 15:14:57 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 9 May 2018 00:14:23 +0200 Message-Id: <1525817687-34620-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> References: <1525817687-34620-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 06/30] memdev: remove "id" property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The "id" property is unnecessary and can be replaced simply with object_get_canonical_path_component. This patch mostly undoes commit e1ff3c67e8 ("monitor: fix qmp/hmp query-memdev not reporting IDs of memory backends", 2017-01-12). Signed-off-by: Paolo Bonzini --- backends/hostmem.c | 26 -------------------------- include/sysemu/hostmem.h | 1 - numa.c | 2 +- qom/object_interfaces.c | 6 ------ 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/backends/hostmem.c b/backends/hostmem.c index 6a0c474..3627e61 100644 --- a/backends/hostmem.c +++ b/backends/hostmem.c @@ -369,24 +369,6 @@ host_memory_backend_can_be_deleted(UserCreatable *uc) } } =20 -static char *get_id(Object *o, Error **errp) -{ - HostMemoryBackend *backend =3D MEMORY_BACKEND(o); - - return g_strdup(backend->id); -} - -static void set_id(Object *o, const char *str, Error **errp) -{ - HostMemoryBackend *backend =3D MEMORY_BACKEND(o); - - if (backend->id) { - error_setg(errp, "cannot change property value"); - return; - } - backend->id =3D g_strdup(str); -} - static bool host_memory_backend_get_share(Object *o, Error **errp) { HostMemoryBackend *backend =3D MEMORY_BACKEND(o); @@ -434,18 +416,11 @@ host_memory_backend_class_init(ObjectClass *oc, void = *data) &HostMemPolicy_lookup, host_memory_backend_get_policy, host_memory_backend_set_policy, &error_abort); - object_class_property_add_str(oc, "id", get_id, set_id, &error_abort); object_class_property_add_bool(oc, "share", host_memory_backend_get_share, host_memory_backend_set_share, &error_abort); } =20 -static void host_memory_backend_finalize(Object *o) -{ - HostMemoryBackend *backend =3D MEMORY_BACKEND(o); - g_free(backend->id); -} - static const TypeInfo host_memory_backend_info =3D { .name =3D TYPE_MEMORY_BACKEND, .parent =3D TYPE_OBJECT, @@ -454,7 +429,6 @@ static const TypeInfo host_memory_backend_info =3D { .class_init =3D host_memory_backend_class_init, .instance_size =3D sizeof(HostMemoryBackend), .instance_init =3D host_memory_backend_init, - .instance_finalize =3D host_memory_backend_finalize, .interfaces =3D (InterfaceInfo[]) { { TYPE_USER_CREATABLE }, { } diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index bc36899..5beb0ef 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -52,7 +52,6 @@ struct HostMemoryBackend { Object parent; =20 /* protected */ - char *id; uint64_t size; bool merge, dump; bool prealloc, force_prealloc, is_mapped, share; diff --git a/numa.c b/numa.c index 70b150e..aac22a9 100644 --- a/numa.c +++ b/numa.c @@ -580,7 +580,7 @@ static int query_memdev(Object *obj, void *opaque) =20 m->value =3D g_malloc0(sizeof(*m->value)); =20 - m->value->id =3D object_property_get_str(obj, "id", NULL); + m->value->id =3D object_get_canonical_path_component(obj); m->value->has_id =3D !!m->value->id; =20 m->value->size =3D object_property_get_uint(obj, "size", diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c index 980ffc2..72b97a8 100644 --- a/qom/object_interfaces.c +++ b/qom/object_interfaces.c @@ -65,12 +65,6 @@ Object *user_creatable_add_type(const char *type, const = char *id, =20 assert(qdict); obj =3D object_new(type); - if (object_property_find(obj, "id", NULL)) { - object_property_set_str(obj, id, "id", &local_err); - if (local_err) { - goto out; - } - } visit_start_struct(v, NULL, NULL, 0, &local_err); if (local_err) { goto out; --=20 1.8.3.1