From nobody Fri Mar 27 04:58:10 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=1772659585; cv=none; d=zohomail.com; s=zohoarc; b=UrMVziHaeoGGhk0F5Z+mMp3poTaaXleWZX/7B70aHbigZzOiAWSNuIQjVjEjCniFbZMMhOjn+cI9if5gSYyPCOoANR65bLvX3gYrqw2y7DuYJgW+mmQ8ePNOp9YIZq3pyL7lopW0sgKyS5/woa3++AW2wULaXJRs5IiD3LzhLhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772659585; 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=zW1uDKfjnTVD0YjhG3GjFT4pda1YwyAiaCR7ZWj6+VU=; b=H8HfNTRn5bS3At/DVILQigXwGSAQRSJc9wOB7pYj3gtcyrVWEF5K/8DPdN+rakiUb0lYiv0xNj2hIfr1uyqnQPigQ0E3N2v+Z+DtPdzgjx5q+JonUclQCKSvTVueVccSjbgpgZdjD/l8vHbKI7jymIAssD52H90fQJOvKqV66PE= 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 177265958552967.68719084109568; Wed, 4 Mar 2026 13:26:25 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vxth8-0004qM-0F; Wed, 04 Mar 2026 16:23:50 -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 1vxtgb-0004k1-Hl for qemu-devel@nongnu.org; Wed, 04 Mar 2026 16:23:20 -0500 Received: from forwardcorp1d.mail.yandex.net ([2a02:6b8:c41:1300:1:45:d181:df01]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vxtgX-0003RV-HR for qemu-devel@nongnu.org; Wed, 04 Mar 2026 16:23:17 -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 forwardcorp1d.mail.yandex.net (Yandex) with ESMTPS id C131D807BB; Thu, 05 Mar 2026 00:23:09 +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-3eRvfXnG; Thu, 05 Mar 2026 00:23:09 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex-team.ru; s=default; t=1772659389; bh=zW1uDKfjnTVD0YjhG3GjFT4pda1YwyAiaCR7ZWj6+VU=; h=Message-ID:Date:In-Reply-To:Cc:Subject:References:To:From; b=iJd+RXHvjnxInH/x1B98GsZXxQgc0FZjQ3s2k204h14MhHCLBdanScYEvAzmycaxg JrvG3wSoxxdRf2UcbwnGC95JTl3sPly7V7szfmCmtPt6SteVk4PDacBPLUENYH4HgD je0GWKi98VEcX/jHWxfGQGfJAzsRepEP9aEL1xCs= 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 04/18] migration: vmstate_load_state(): add some newlines Date: Thu, 5 Mar 2026 00:22:48 +0300 Message-ID: <20260304212303.667141-5-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=2a02:6b8:c41:1300:1:45:d181:df01; envelope-from=vsementsov@yandex-team.ru; helo=forwardcorp1d.mail.yandex.net 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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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: 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: 1772659588447139100 Content-Type: text/plain; charset="utf-8" Split logical blocks by newlines, that simplify reading the code. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fabiano Rosas Reviewed-by: Peter Xu --- migration/vmstate.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/migration/vmstate.c b/migration/vmstate.c index 5111e7a141f..dd7cd279937 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -139,6 +139,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, int ret =3D 0; =20 trace_vmstate_load_state(vmsd->name, version_id); + if (version_id > vmsd->version_id) { error_setg(errp, "%s: incoming version_id %d is too new " "for local version_id %d", @@ -146,6 +147,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL); return -EINVAL; } + if (version_id < vmsd->minimum_version_id) { error_setg(errp, "%s: incoming version_id %d is too old " "for local minimum version_id %d", @@ -153,6 +155,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL); return -EINVAL; } + if (vmsd->pre_load_errp) { if (!vmsd->pre_load_errp(opaque, errp)) { error_prepend(errp, "pre load hook failed for: '%s', " @@ -171,9 +174,12 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescr= iption *vmsd, return ret; } } + while (field->name) { bool exists =3D vmstate_field_exists(vmsd, field, opaque, version_= id); + trace_vmstate_load_state_field(vmsd->name, field->name, exists); + if (exists) { void *first_elem =3D opaque + field->offset; int i, n_elems =3D vmstate_n_elems(opaque, field); @@ -184,6 +190,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, first_elem =3D *(void **)first_elem; assert(first_elem || !n_elems || !size); } + for (i =3D 0; i < n_elems; i++) { void *curr_elem =3D first_elem + size * i; const VMStateField *inner_field; @@ -235,6 +242,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, vmsd->name, ret); } } + if (ret < 0) { qemu_file_set_error(f, ret); trace_vmstate_load_field_error(field->name, ret); @@ -249,11 +257,13 @@ int vmstate_load_state(QEMUFile *f, const VMStateDesc= ription *vmsd, field++; } assert(field->flags =3D=3D VMS_END); + ret =3D vmstate_subsection_load(f, vmsd, opaque, errp); if (ret !=3D 0) { qemu_file_set_error(f, ret); return ret; } + if (vmsd->post_load_errp) { if (!vmsd->post_load_errp(opaque, version_id, errp)) { error_prepend(errp, "post load hook failed for: %s, version_id= : " @@ -271,7 +281,9 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescri= ption *vmsd, ret); } } + trace_vmstate_load_state_end(vmsd->name, "end", ret); + return ret; } =20 --=20 2.52.0