aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-07-07 15:42:52 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-07-14 17:59:42 +0100
commit96d851a64b42aea4974f2c25a56cd2a05f34905d (patch)
treeca04485fc41a977ef27b44710245a86464bf775b /scripts
parentb08199c6fbea194fac7f97fd8eaa7f3fb7186600 (diff)
downloadqemu-96d851a64b42aea4974f2c25a56cd2a05f34905d.zip
qemu-96d851a64b42aea4974f2c25a56cd2a05f34905d.tar.gz
qemu-96d851a64b42aea4974f2c25a56cd2a05f34905d.tar.bz2
scripts/coccinelle/memory-region-init-ram.cocci: New script
Add a coccinelle script that can be used to automatically convert manual sequences of memory_region_init_ram_nomigrate() vmstate_register_ram{,_global}() to use the new memory_region_init_ram() Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1499438577-7674-7-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/memory-region-init-ram.cocci38
1 files changed, 38 insertions, 0 deletions
diff --git a/scripts/coccinelle/memory-region-init-ram.cocci b/scripts/coccinelle/memory-region-init-ram.cocci
new file mode 100644
index 0000000..d290150
--- /dev/null
+++ b/scripts/coccinelle/memory-region-init-ram.cocci
@@ -0,0 +1,38 @@
+// Replace by-hand memory_region_init_ram_nomigrate/vmstate_register_ram
+// code sequences with use of the new memory_region_init_ram function.
+// Similarly for the _rom and _rom_device functions.
+// We don't try to replace sequences with a non-NULL owner, because
+// there are none in the tree that can be automatically converted
+// (and only a handful that can be manually converted).
+@@
+expression MR;
+expression NAME;
+expression SIZE;
+expression ERRP;
+@@
+-memory_region_init_ram_nomigrate(MR, NULL, NAME, SIZE, ERRP);
++memory_region_init_ram(MR, NULL, NAME, SIZE, ERRP);
+ ...
+-vmstate_register_ram_global(MR);
+@@
+expression MR;
+expression NAME;
+expression SIZE;
+expression ERRP;
+@@
+-memory_region_init_rom_nomigrate(MR, NULL, NAME, SIZE, ERRP);
++memory_region_init_rom(MR, NULL, NAME, SIZE, ERRP);
+ ...
+-vmstate_register_ram_global(MR);
+@@
+expression MR;
+expression OPS;
+expression OPAQUE;
+expression NAME;
+expression SIZE;
+expression ERRP;
+@@
+-memory_region_init_rom_device_nomigrate(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
++memory_region_init_rom_device(MR, NULL, OPS, OPAQUE, NAME, SIZE, ERRP);
+ ...
+-vmstate_register_ram_global(MR);