From nobody Wed Nov 27 13:00:28 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1699254430; cv=none; d=zohomail.com; s=zohoarc; b=Yr14touHl+4QTmm2eNyVNE9pryHkDj1KNzF0hIWxySPOsxsYxDOQpWjFJBbOE30bH+rOVsn4ZIg7SJmNuZDXQta9BfhyFb6WH+rT7TBw3SIKmFKTNv/gQLSMIt4Vo+e7kvX5E8l++Pj/8hBA9dFZJHrAXB6XslQ/0QCbFu0sdSU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1699254430; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8KgC7l6+Ks9UAAd1eXGQex3KmmjQLxfw8YM2XKWIPZQ=; b=MnbeTsLnQuGkEPyuQ2BSkSCdlmPYOkSyzg/Hv/AmcgRHmyy9BpPOwlv4DS0FLiyo7f+ywW04g6hZJ0XriX4Kx+YsDx2B2EFDAZX6L42IHOPNPl4OOx61n4ccIY/JPkh5PvJIDEemCcyIGWovW1YQiTU9qA7QcwFUrsC4/EtirZQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1699254430343361.9955704059871; Sun, 5 Nov 2023 23:07:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qztZC-0004OO-Ll; Mon, 06 Nov 2023 01:58:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qztZA-0004O4-VL for qemu-devel@nongnu.org; Mon, 06 Nov 2023 01:58:32 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qztZ9-0001MP-6v for qemu-devel@nongnu.org; Mon, 06 Nov 2023 01:58:32 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1cc9784dbc1so21373725ad.2 for ; Sun, 05 Nov 2023 22:58:30 -0800 (PST) Received: from stoup.. ([71.212.149.95]) by smtp.gmail.com with ESMTPSA id c3-20020a170902d48300b001c62e3e1286sm5167130plg.166.2023.11.05.22.58.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Nov 2023 22:58:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1699253910; x=1699858710; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8KgC7l6+Ks9UAAd1eXGQex3KmmjQLxfw8YM2XKWIPZQ=; b=ynFGfCPFDl69Zj+9CrfjiMwnh3jeDsTw+WxklhXDMmqb5SJZRMxzlX5hyjv82dOv1J n+LXMnmmn4V+pwrIYskJ53qlGY9gDhG9Rq7FB/XL1uKycyfhUic6Uw/qlVJ+nFxsK/NQ ZF2jl0j3ZIXxfj5QEv2hps4mVyKqDJkwLYwNIyvQ8rGXPVObGZP8dmkocVlvA0brfRVw cCrvzzfvCxAL2d0X/JpC0Qxk6XOEA7PUBGYxNlfOH4jJ6ofqq8UOGxRoieYHO52b1m3e 0zQ3SS2EmuT8O3ZgtaK32EVVg+HkUE2ttPir6AsWZJnfWu0uEd9HaK4M3lmesn+rbqvd 6MOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699253910; x=1699858710; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8KgC7l6+Ks9UAAd1eXGQex3KmmjQLxfw8YM2XKWIPZQ=; b=EzPOD1Mp2o2CwhBJw5ifkHK1fgDs28fPwqjiJjc/0KOKcTgX+LA72ok5Fm0xanTHNb m8zC2BUcxaAa6Q9Uj2PeF0Q+k6xJJUCtET9SFkLkECgb2INXETQgQ9OoC+ImhpnKxv2c z8wcBCIrGf/QNoOvEae3rFSfg6Z/T469A/KAxZ8WbsSJH0ErOKwCmCKErSTyXCzqC+aQ ff4NRI1xdW3PHF7Urry+mMQlx326mUrZptBY6uQIYDXiQPZ1h2vZ1gLyeKV0X1anngkb xcXkXIm18mDS3uW2r6hD3mNcZGiXOZCC8oqkQ52+jIINbsA2yLLITnv8kWA1gc8SBo2M jbiA== X-Gm-Message-State: AOJu0YxPhLOiWgl+rAlUtvPIJlaQ4lMK6jF9GleoRBykYJ3B7OcfCWAO ob4N1/WciXDcJFlBLuhZ/vANXJx8o2Mta7M+5H4= X-Google-Smtp-Source: AGHT+IHPX9EDwzcpsrVimZ8QhM6hONVkhribI8fJG5xZ1ctSXvAZzHyDI/r7i0f/AjEQm5pYB8hFbA== X-Received: by 2002:a17:903:245:b0:1c5:d8a3:8789 with SMTP id j5-20020a170903024500b001c5d8a38789mr27131552plh.4.1699253909800; Sun, 05 Nov 2023 22:58:29 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: quintela@redhat.com, peterx@redhat.com, farosas@suse.de, leobras@redhat.com Subject: [PATCH 01/71] migration: Make VMStateDescription.subsections const Date: Sun, 5 Nov 2023 22:57:17 -0800 Message-Id: <20231106065827.543129-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231106065827.543129-1-richard.henderson@linaro.org> References: <20231106065827.543129-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1699254431188100005 Content-Type: text/plain; charset="utf-8" Allow the array of pointers to itself be const. Propagate this through the copies of this field. Signed-off-by: Richard Henderson Reviewed-by: Juan Quintela Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Philippe Mathieu-Daud=C3=A9 --- include/migration/vmstate.h | 2 +- migration/savevm.c | 12 ++++++------ migration/vmstate.c | 15 +++++++++------ 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 9821918631..294d2d8486 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -209,7 +209,7 @@ struct VMStateDescription { bool (*dev_unplug_pending)(void *opaque); =20 const VMStateField *fields; - const VMStateDescription **subsections; + const VMStateDescription * const *subsections; }; =20 extern const VMStateInfo vmstate_info_bool; diff --git a/migration/savevm.c b/migration/savevm.c index bc98c2ea6f..77a81937cd 100644 --- a/migration/savevm.c +++ b/migration/savevm.c @@ -551,11 +551,11 @@ static void dump_vmstate_vmsf(FILE *out_file, const V= MStateField *field, } =20 static void dump_vmstate_vmss(FILE *out_file, - const VMStateDescription **subsection, + const VMStateDescription *subsection, int indent) { - if (*subsection !=3D NULL) { - dump_vmstate_vmsd(out_file, *subsection, indent, true); + if (subsection !=3D NULL) { + dump_vmstate_vmsd(out_file, subsection, indent, true); } } =20 @@ -597,7 +597,7 @@ static void dump_vmstate_vmsd(FILE *out_file, fprintf(out_file, "\n%*s]", indent, ""); } if (vmsd->subsections !=3D NULL) { - const VMStateDescription **subsection =3D vmsd->subsections; + const VMStateDescription * const *subsection =3D vmsd->subsections; bool first; =20 fprintf(out_file, ",\n%*s\"Subsections\": [\n", indent, ""); @@ -606,7 +606,7 @@ static void dump_vmstate_vmsd(FILE *out_file, if (!first) { fprintf(out_file, ",\n"); } - dump_vmstate_vmss(out_file, subsection, indent + 2); + dump_vmstate_vmss(out_file, *subsection, indent + 2); subsection++; first =3D false; } @@ -831,7 +831,7 @@ void unregister_savevm(VMStateIf *obj, const char *idst= r, void *opaque) static void vmstate_check(const VMStateDescription *vmsd) { const VMStateField *field =3D vmsd->fields; - const VMStateDescription **subsection =3D vmsd->subsections; + const VMStateDescription * const *subsection =3D vmsd->subsections; =20 if (field) { while (field->name) { diff --git a/migration/vmstate.c b/migration/vmstate.c index b7723a4187..5876062d48 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -452,13 +452,16 @@ int vmstate_save_state_v(QEMUFile *f, const VMStateDe= scription *vmsd, } =20 static const VMStateDescription * -vmstate_get_subsection(const VMStateDescription **sub, char *idstr) +vmstate_get_subsection(const VMStateDescription * const *sub, + const char *idstr) { - while (sub && *sub) { - if (strcmp(idstr, (*sub)->name) =3D=3D 0) { - return *sub; + if (sub) { + const VMStateDescription *s; + for (s =3D *sub; s ; s =3D *++sub) { + if (strcmp(idstr, s->name) =3D=3D 0) { + return s; + } } - sub++; } return NULL; } @@ -517,7 +520,7 @@ static int vmstate_subsection_load(QEMUFile *f, const V= MStateDescription *vmsd, static int vmstate_subsection_save(QEMUFile *f, const VMStateDescription *= vmsd, void *opaque, JSONWriter *vmdesc) { - const VMStateDescription **sub =3D vmsd->subsections; + const VMStateDescription * const *sub =3D vmsd->subsections; bool vmdesc_has_subsections =3D false; int ret =3D 0; =20 --=20 2.34.1