|
From: | Eric Blake |
Subject: | Re: [PATCH v2] Avoid address_space_rw() with a constant is_write argument |
Date: | Tue, 18 Feb 2020 07:33:21 -0600 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 |
On 2/18/20 6:56 AM, Philippe Mathieu-Daudé wrote:
+++ b/scripts/coccinelle/as_rw_const.cocci @@ -0,0 +1,30 @@ +// Avoid uses of address_space_rw() with a constant is_write argument. +// Usage: +// spatch --sp-file as-rw-const.spatch --dir . --in-placeNitpick, script is now scripts/coccinelle/as_rw_const.cocci. Reviewed-by: Philippe Mathieu-Daudé <address@hidden>+ +@@ +expression E1, E2, E3, E4, E5; +symbol false; +@@ + +- address_space_rw(E1, E2, E3, E4, E5, false) ++ address_space_read(E1, E2, E3, E4, E5) +@@ +expression E1, E2, E3, E4, E5; +@@ + +- address_space_rw(E1, E2, E3, E4, E5, 0) ++ address_space_read(E1, E2, E3, E4, E5)
This feels a bit redundant. Doesn't coccinelle have enough smarts about isomorphisms (such as 0 == false, 1 == true) that it could get by with one @@ hunk instead of 2, if we come up with the right way to represent any isomorphism to a constant value? But admittedly, I don't know what that representation would actually be, and your verbose patch works even if it is not the most concise possible. So don't let my remarks hold this patch up.
-- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
[Prev in Thread] | Current Thread | [Next in Thread] |