From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: John Snow <jsnow@redhat.com>, Juan Quintela <quintela@redhat.com>,
Cleber Rosa <crosa@redhat.com>, Peter Xu <peterx@redhat.com>,
Leonardo Bras <leobras@redhat.com>
Subject: [PULL 7/7] vmstate-static-checker: Recognize "num" field
Date: Thu, 27 Apr 2023 10:25:57 +0200 [thread overview]
Message-ID: <20230427082557.20994-8-quintela@redhat.com> (raw)
In-Reply-To: <20230427082557.20994-1-quintela@redhat.com>
From: Peter Xu <peterx@redhat.com>
Recognize this field for VMS_ARRAY typed vmsd fields, then we can do proper
size matching with previous patch.
Note that this is compatible with old -dump-vmstate output, because when
"num" is not there we'll still use the old "size" only.
Signed-off-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
scripts/vmstate-static-checker.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/scripts/vmstate-static-checker.py b/scripts/vmstate-static-checker.py
index dfeee8231a..9c0e6b81f2 100755
--- a/scripts/vmstate-static-checker.py
+++ b/scripts/vmstate-static-checker.py
@@ -134,6 +134,11 @@ def exists_in_substruct(fields, item):
return check_fields_match(fields["Description"]["name"],
substruct_fields[0]["field"], item)
+def size_total(entry):
+ size = entry["size"]
+ if "num" not in entry:
+ return size
+ return size * entry["num"]
def check_fields(src_fields, dest_fields, desc, sec):
# This function checks for all the fields in a section. If some
@@ -249,17 +254,19 @@ def check_fields(src_fields, dest_fields, desc, sec):
continue
if s_item["field"] == "unused" or d_item["field"] == "unused":
- if s_item["size"] == d_item["size"]:
+ s_size = size_total(s_item)
+ d_size = size_total(d_item)
+ if s_size == d_size:
continue
if d_item["field"] == "unused":
advance_dest = False
- unused_count = d_item["size"] - s_item["size"]
+ unused_count = d_size - s_size;
continue
if s_item["field"] == "unused":
advance_src = False
- unused_count = s_item["size"] - d_item["size"]
+ unused_count = s_size - d_size
continue
print("Section \"" + sec + "\",", end=' ')
--
2.40.0
next prev parent reply other threads:[~2023-04-27 8:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 8:25 [PULL 0/7] Migration 20230426 patches Juan Quintela
2023-04-27 8:25 ` [PULL 1/7] migration: Disable postcopy + multifd migration Juan Quintela
2023-04-27 8:25 ` [PULL 2/7] MAINTAINERS: Add Leonardo and Peter as reviewers Juan Quintela
2023-04-27 8:25 ` [PULL 3/7] migration: Move migrate_use_tls() to options.c Juan Quintela
2023-04-27 8:25 ` [PULL 4/7] migration: Move qmp_migrate_set_parameters() " Juan Quintela
2023-04-27 8:25 ` [PULL 5/7] migration: Allow postcopy_ram_supported_by_host() to report err Juan Quintela
2023-04-27 8:25 ` [PULL 6/7] migration/vmstate-dump: Dump array size too as "num" Juan Quintela
2023-04-27 8:25 ` Juan Quintela [this message]
2023-04-27 13:26 ` [PULL 0/7] Migration 20230426 patches Richard Henderson
-- strict thread matches above, loose matches on Subject: below --
2023-04-26 18:12 Juan Quintela
2023-04-26 18:12 ` [PULL 7/7] vmstate-static-checker: Recognize "num" field Juan Quintela
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230427082557.20994-8-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=crosa@redhat.com \
--cc=jsnow@redhat.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).