@samitouri / QOSamiQemu / commits / 712e2b9aa8

system/memory: Constify various AddressSpace arguments (flatview)

Mark the AddressSpace structure const when it is only accessed read-only. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Message-Id: <20260319191017.12636-2-philmd@linaro.org>

Philippe Mathieu-Daudé committed Mar 19, 2026 at 13:26 UTC 712e2b9aa847a66671cd2a3a667149fc5120fc7a
3 files changed +5 -4
include/system/memory.h
+1 -1
@@ -1201,7 +1201,7 @@ struct FlatView {
1201 MemoryRegion *root;
1202 };
1203
1204 -static inline FlatView *address_space_to_flatview(AddressSpace *as)
1204 +static inline FlatView *address_space_to_flatview(const AddressSpace *as)
1205 {
1206 return qatomic_rcu_read(&as->current_map);
1207 }
system/memory-internal.h
+3 -2
@@ -20,12 +20,13 @@ static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
20 return fv->dispatch;
21 }
22
23 -static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
23 +static inline
24 +AddressSpaceDispatch *address_space_to_dispatch(const AddressSpace *as)
25 {
26 return flatview_to_dispatch(address_space_to_flatview(as));
27 }
28
28 -FlatView *address_space_get_flatview(AddressSpace *as);
29 +FlatView *address_space_get_flatview(const AddressSpace *as);
30 void flatview_unref(FlatView *view);
31
32 extern const MemoryRegionOps unassigned_mem_ops;
system/memory.c
+1 -1
@@ -820,7 +820,7 @@ static void address_space_add_del_ioeventfds(AddressSpace *as,
820 }
821 }
822
823 -FlatView *address_space_get_flatview(AddressSpace *as)
823 +FlatView *address_space_get_flatview(const AddressSpace *as)
824 {
825 FlatView *view;
826