From nobody Fri Mar 27 05:06:51 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=none dis=none) header.from=yandex-team.ru ARC-Seal: i=1; a=rsa-sha256; t=1772659497; cv=none; d=zohomail.com; s=zohoarc; b=jiJtogoi/KF8yKoM0oXQ7ZLcV0liIpsEg/viUhRmTV9PyDIPG3PJj0tQcCr8nxIEIebItgbSndlmVr3OFZ6V5QFSKyad25zqGk+UuRHf7IQs/MraSOpQoZIMGLL5b1VUE50ROi7nVJuotQhk36C5nZTCxoy+gr0VKJpgvUMtCbg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772659497; 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=jM+edWLBaGe5x10EknnS2lq0Zw3RvzU/TRD06qcJuJ8=; b=ZdO377Z1mui67Q/zTutc5U6fpuJ3EyNo0iiJ5uaC9k9fG6ZmmCcp5p1jQAJli2rkBbyw5se1wtYlO3YH19g/6R7txoS7u3aGsCtbkhJikS3zPdGWrlKyEfP60Qc5HR4UYPKSpDiVsTbUtb/qPDryKGtSwF7Uo0cPNHpZzo9lkSY= 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 1772659497337981.1680440549441; Wed, 4 Mar 2026 13:24:57 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxth2-0004oN-BB; Wed, 04 Mar 2026 16:23:46 -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 1vxtgc-0004k5-Lz for qemu-devel@nongnu.org; Wed, 04 Mar 2026 16:23:20 -0500 Received: from forwardcorp1b.mail.yandex.net ([178.154.239.136]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxtgZ-0003SR-Np for qemu-devel@nongnu.org; Wed, 04 Mar 2026 16:23:18 -0500 Received: from mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net [IPv6:2a02:6b8:c0c:bf1f:0:640:c739:0]) by forwardcorp1b.mail.yandex.net (Yandex) with ESMTPS id 5BFF980885; Thu, 05 Mar 2026 00:23:14 +0300 (MSK) Received: from vsementsov-lin (unknown [2a02:6bf:8080:921::1:1b]) by mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net (smtpcorp/Yandex) with ESMTPSA id 5NwBA90AmW20-BNhmuhJR; Thu, 05 Mar 2026 00:23:13 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1772659393; bh=jM+edWLBaGe5x10EknnS2lq0Zw3RvzU/TRD06qcJuJ8=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=LkpKhwfJ+D/bKVGvVCk0NX29gPOkNqA7hR9w5pd4i4fuY0XJMw+jrsfvE1kzNPWlI pt+6TodvWTwi6maDNoIs2FvQuiXpndXg47itGco+4ytp6dhNQfc3jsNyjHNEjdXUMC Mh6EU3ms/ZUgm8lr4fqQz8F0XrrE/eXF74EnUEKQ= Authentication-Results: mail-nwsmtp-smtp-corp-main-66.iva.yp-c.yandex.net; dkim=pass header.i=@yandex-team.ru From: Vladimir Sementsov-Ogievskiy To: peterx@redhat.com Cc: farosas@suse.de, vsementsov@yandex-team.ru, qemu-devel@nongnu.org Subject: [PATCH v3 12/18] migration: VMStateInfo: introduce new handlers with errp Date: Thu, 5 Mar 2026 00:22:56 +0300 Message-ID: <20260304212303.667141-13-vsementsov@yandex-team.ru> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260304212303.667141-1-vsementsov@yandex-team.ru> References: <20260304212303.667141-1-vsementsov@yandex-team.ru> 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=178.154.239.136; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1b.mail.yandex.net X-Spam_score_int: 0 X-Spam_score: -0.0 X-Spam_bar: / X-Spam_report: (-0.0 / 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_VALIDITY_RPBL_BLOCKED=0.703, RCVD_IN_VALIDITY_SAFE_BLOCKED=1.386, SPF_HELO_NONE=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 @yandex-team.ru) X-ZM-MESSAGEID: 1772659499456158500 Content-Type: text/plain; charset="utf-8" Add new APIs with errp, to allow handlers report good error messages. We'll convert existing handlers soon. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Peter Xu --- include/migration/vmstate.h | 17 ++++++++++++++--- migration/vmstate.c | 4 ++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 85838a49aee..77d58d27d41 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -32,12 +32,16 @@ typedef struct VMStateInfo VMStateInfo; typedef struct VMStateField VMStateField; =20 -/* VMStateInfo allows customized migration of objects that don't fit in +/* + * VMStateInfo allows customized migration of objects that don't fit in * any category in VMStateFlags. Additional information is always passed - * into get and put in terms of field and vmdesc parameters. However + * into load and save in terms of field and vmdesc parameters. However * these two parameters should only be used in cases when customized * handling is needed, such as QTAILQ. For primitive data types such as - * integer, field and vmdesc parameters should be ignored inside get/put. + * integer, field and vmdesc parameters should be ignored inside load/save. + * + * @get and @put are deprecated copies of @load and @save. For new interfa= ces + * use @load and @save. */ struct VMStateInfo { const char *name; @@ -46,6 +50,13 @@ struct VMStateInfo { int coroutine_mixed_fn (*put)(QEMUFile *f, void *pv, size_t size, const VMStateField *field, JSONWriter *vmdesc); + bool coroutine_mixed_fn (*load)(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, + Error **errp); + bool coroutine_mixed_fn (*save)(QEMUFile *f, void *pv, size_t size, + const VMStateField *field, + JSONWriter *vmdesc, + Error **errp); }; =20 enum VMStateFlags { diff --git a/migration/vmstate.c b/migration/vmstate.c index 8825aa3b1f1..f16626d7d11 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -170,6 +170,8 @@ static bool vmstate_load_field(QEMUFile *f, void *pv, s= ize_t size, } else if (field->flags & VMS_VSTRUCT) { return vmstate_load_state(f, field->vmsd, pv, field->struct_versio= n_id, errp) >=3D 0; + } else if (field->info->load) { + return field->info->load(f, pv, size, field, errp); } =20 if (field->info->get(f, pv, size, field) < 0) { @@ -495,6 +497,8 @@ static bool vmstate_save_field(QEMUFile *f, void *pv, s= ize_t size, return vmstate_save_state_v(f, field->vmsd, pv, vmdesc, field->struct_version_id, errp) >=3D 0; + } else if (field->info->save) { + return field->info->save(f, pv, size, field, vmdesc, errp); } =20 if (field->info->put(f, pv, size, field, vmdesc) < 0) { --=20 2.52.0