Mark the AddressSpace structure const when it is only accessed read-only.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
 include/system/memory.h  | 2 +-
 system/memory-internal.h | 5 +++--
 system/memory.c          | 2 +-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/system/memory.h b/include/system/memory.h
index d7b18b632d5..1417132f6d9 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -1201,7 +1201,7 @@ struct FlatView {
     MemoryRegion *root;
 };
 
-static inline FlatView *address_space_to_flatview(AddressSpace *as)
+static inline FlatView *address_space_to_flatview(const AddressSpace *as)
 {
     return qatomic_rcu_read(&as->current_map);
 }
diff --git a/system/memory-internal.h b/system/memory-internal.h
index 5f0524756eb..0066ffdffb6 100644
--- a/system/memory-internal.h
+++ b/system/memory-internal.h
@@ -20,12 +20,13 @@ static inline AddressSpaceDispatch 
*flatview_to_dispatch(FlatView *fv)
     return fv->dispatch;
 }
 
-static inline AddressSpaceDispatch *address_space_to_dispatch(AddressSpace *as)
+static inline
+AddressSpaceDispatch *address_space_to_dispatch(const AddressSpace *as)
 {
     return flatview_to_dispatch(address_space_to_flatview(as));
 }
 
-FlatView *address_space_get_flatview(AddressSpace *as);
+FlatView *address_space_get_flatview(const AddressSpace *as);
 void flatview_unref(FlatView *view);
 
 extern const MemoryRegionOps unassigned_mem_ops;
diff --git a/system/memory.c b/system/memory.c
index 17a7bcd9af7..bd12184a879 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -819,7 +819,7 @@ static void address_space_add_del_ioeventfds(AddressSpace 
*as,
     }
 }
 
-FlatView *address_space_get_flatview(AddressSpace *as)
+FlatView *address_space_get_flatview(const AddressSpace *as)
 {
     FlatView *view;
 
-- 
2.53.0


Reply via email to