From nobody Mon Apr 6 22:01:20 2026 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=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1773789899; cv=none; d=zohomail.com; s=zohoarc; b=j5EWDqyuO59vLB0EH2qMkadO9HuJPdbm5hzfsjY1akmeJWl6xGMguR4KnYoFxxozVZ2UbYADUCM4oBeekrMW9VeMjG6ZndRZjifGKYFtPz3T4XJ+I6MpeY0Ont3MyqFxyQJ8PVObEQ0tQa9QehkTcE22zg0uunhZN5fR8BMCIKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1773789899; 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=xUBKuj9y3ughYvyRrD8j2p4lQRaYcWCVG4lkyAlW4Ok=; b=QgD0mvAwF6XnWtm5zxppFr99Wr/vW52XfGQNSYWD2jTSe3Nn9e97e7bRZjhYnYu2YiF2Vgf4Meqt+jfD9lSr2FBLUHEensapk22PnafCS2U6gPHPT0FUX2HPCXkfiEf6bc61GRKBGVsbeNaYqGcEV+hT7lLGAxZDVwsA7srh9Y0= 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=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1773789899616912.0528645909017; Tue, 17 Mar 2026 16:24:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w2dlJ-0003w5-HG; Tue, 17 Mar 2026 19:23:45 -0400 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 1w2dlH-0003vE-FL for qemu-devel@nongnu.org; Tue, 17 Mar 2026 19:23:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w2dlD-0006RR-OI for qemu-devel@nongnu.org; Tue, 17 Mar 2026 19:23:42 -0400 Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-382-iz-8clSkPd6VfyhSjIwEYA-1; Tue, 17 Mar 2026 19:23:37 -0400 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-89c4885814dso563422326d6.3 for ; Tue, 17 Mar 2026 16:23:37 -0700 (PDT) Received: from x1.local ([142.189.10.167]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89c6b9ea39asm8203806d6.37.2026.03.17.16.23.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 16:23:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773789818; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xUBKuj9y3ughYvyRrD8j2p4lQRaYcWCVG4lkyAlW4Ok=; b=g/t6EOYQ5GRC4+r6dg0LIwP040i+Jy5X1jSPnCeQt9v2hLKXspY88U4cXH/OUnLymIXtnW Ej6yTEl7mAW/mViX/NIbbDbk0p3ZzBjpeUbZ41QsL0JZVIHEEdvG3Q6s/1voq+fqk0GP7P Y7kGGwbzTVUf6QYqe1Kb+Gx4NgS0jfo= X-MC-Unique: iz-8clSkPd6VfyhSjIwEYA-1 X-Mimecast-MFC-AGG-ID: iz-8clSkPd6VfyhSjIwEYA_1773789817 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1773789817; x=1774394617; 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=xUBKuj9y3ughYvyRrD8j2p4lQRaYcWCVG4lkyAlW4Ok=; b=aXhAJluL05TYWWrDyuLzuVtjMHED0nGlNYe1hnGNuiuBEv9VLHg2+oRM0z/xXY8YuU CIiaicbtzKHZQhozCWVhxtB01eFic2F0DWY3eSg5uvDA119UvKRozsYD3q4RdBzTyEqm yhEezQ+Bs6KwJnDWgyARY9FMjNsV2YabRNQTh8F48IWdDsK/2eSepBT9HtcTQvf3t/t4 vSzS5cCutam4gLbNDhfdIF50fXqrPwZA27kRokWuAia4A9W0gLOoiyzOOmxWpuS42Mad aCTg+vl3eBV4o6/qGxjaJe5o4chpsfStH6HsKk7wvMDY0aMargKQzk45JxStZSgFHA1x EOKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773789817; x=1774394617; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=xUBKuj9y3ughYvyRrD8j2p4lQRaYcWCVG4lkyAlW4Ok=; b=YgZkHOnW3yjXKuNed2HNJFXfi3jzuKdSzDVlqvTSLKm3GDPOVDRb0heZz+jjGNDsM/ uxTpRb4NDJtsD023eSQEFv9J7AWTmeWnhZta21jd7F9mOie6ElMuQ6fSHTKbBuOxj3yy iHmvS6izwZl5ePhJhm0dej+TjCxbvMJj39ecozmbBG5mWcr04o5KL9fKqpNYPiXhxQ7P gFS/XPlcbcsJL1Lk5KN1qPHJrzraHgHscRQYHCL5WFkJCDCEIB73mqoYlUfc+VfKflBo ODzG8k1GwCvqNTfMICCLrVTZ0s4J6MZ7ujusGGQP0pwMw0mFwUwJfKu2M1qM6xFfc4pe qtRQ== X-Gm-Message-State: AOJu0YzSM0b5e5WErt0rmRv05Om3CJgXM4KrClFmbcGUVx/Z+gYljI1I Qevw5UqJiSFUR2KjCtjNJI9BY0kfLbooN0T2EY1O0H5wnpSk24WpcKf7YmaILNNe1PIQvXR0aJv pPn4Q8fj8qta3PQs1rM9ZFZpI4RdHHAPUDL1zYFC5dOaOv7DEWfm+/2rO8I8ROYI+PnzTjXtY1w CZMAIjgsw+sNYbP0d5VqfxfiM2ax2swyuAY+TXPA== X-Gm-Gg: ATEYQzxmlfh9SDKUB7IVb8qf9OD308VEOb5P1FO5b0yXN0tOelE3gl4GKaqTicwsh/P pLfVFE452HO761E1sTdbHqvzNWMk8TL/j6mNqU1al5u4DOGOFQAguoyv5qeRVIOYJGiAuqRFDMR yh1qmHyAKLqzUD7/Ap38bfoirpNC7++Oilz3jz9e+aBCyv06ND4AXMl8n/xQp6QJVpmA9qPlfDV WxfF/3l6QUTFsEf61QiAEqk3dAth0dORyvfWL7cFqDUBJvjY9FlGWQd2dL7dXtMncVZ8FJTNSwC R+DBk2HNcotB/ZUB2MzYDjGkDFZgy517McN7++HvsF2VhAEGwS4qnYeb2oj24jfPMCtlk2j0CYJ j8WmSxJ8lSi4Qrg== X-Received: by 2002:a05:6214:c67:b0:89a:870:2ea2 with SMTP id 6a1803df08f44-89c6b59c895mr23109676d6.48.1773789816778; Tue, 17 Mar 2026 16:23:36 -0700 (PDT) X-Received: by 2002:a05:6214:c67:b0:89a:870:2ea2 with SMTP id 6a1803df08f44-89c6b59c895mr23109326d6.48.1773789816311; Tue, 17 Mar 2026 16:23:36 -0700 (PDT) From: Peter Xu To: qemu-devel@nongnu.org Cc: Alexander Mikhalitsyn , Juraj Marcin , peterx@redhat.com, Fabiano Rosas Subject: [PATCH RFC 01/10] vmstate: Pass in struct itself for VMSTATE_ARRAY_OF_POINTER Date: Tue, 17 Mar 2026 19:23:23 -0400 Message-ID: <20260317232332.15209-2-peterx@redhat.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260317232332.15209-1-peterx@redhat.com> References: <20260317232332.15209-1-peterx@redhat.com> 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=170.10.133.124; envelope-from=peterx@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -3 X-Spam_score: -0.4 X-Spam_bar: / X-Spam_report: (-0.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.819, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.903, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development 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 @redhat.com) X-ZM-MESSAGEID: 1773789900379158500 Content-Type: text/plain; charset="utf-8" Passing in a pointer almost never helps. Convert it to pass in struct for further refactoring on VMS_ARRAY_OF_POINTER. Signed-off-by: Peter Xu Reviewed-by: Alexander Mikhalitsyn --- include/migration/vmstate.h | 6 +++--- tests/unit/test-vmstate.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index d4a39aa794..8992fba57d 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -547,9 +547,9 @@ extern const VMStateInfo vmstate_info_qlist; .version_id =3D (_version), \ .num =3D (_num), \ .info =3D &(_info), \ - .size =3D sizeof(_type), \ + .size =3D sizeof(_type *), \ .flags =3D VMS_ARRAY|VMS_ARRAY_OF_POINTER, \ - .offset =3D vmstate_offset_array(_state, _field, _type, _num), \ + .offset =3D vmstate_offset_array(_state, _field, _type*, _num), \ } =20 #define VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(_f, _s, _n, _v, _vmsd, _type) {= \ @@ -1093,7 +1093,7 @@ extern const VMStateInfo vmstate_info_qlist; VMSTATE_TIMER_PTR_V(_f, _s, 0) =20 #define VMSTATE_TIMER_PTR_ARRAY(_f, _s, _n) \ - VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer = *) + VMSTATE_ARRAY_OF_POINTER(_f, _s, _n, 0, vmstate_info_timer, QEMUTimer) =20 #define VMSTATE_TIMER_TEST(_f, _s, _test) \ VMSTATE_SINGLE_TEST(_f, _s, _test, 0, vmstate_info_timer, QEMUTimer) diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c index cadbab3c5e..6a42cc1a4e 100644 --- a/tests/unit/test-vmstate.c +++ b/tests/unit/test-vmstate.c @@ -668,7 +668,7 @@ const VMStateDescription vmsd_arpp =3D { .minimum_version_id =3D 1, .fields =3D (const VMStateField[]) { VMSTATE_ARRAY_OF_POINTER(ar, TestArrayOfPtrToInt, - AR_SIZE, 0, vmstate_info_int32, int32_t*), + AR_SIZE, 0, vmstate_info_int32, int32_t), VMSTATE_END_OF_LIST() } }; --=20 2.50.1