]> git.proxmox.com Git - mirror_qemu.git/commit
softmmu/physmem: Distinguish between file access mode and mmap protection
authorDavid Hildenbrand <david@redhat.com>
Wed, 6 Sep 2023 12:04:54 +0000 (14:04 +0200)
committerDavid Hildenbrand <david@redhat.com>
Tue, 19 Sep 2023 08:23:21 +0000 (10:23 +0200)
commit5c52a219bbd38724650e27e14741190d3004e26b
tree9e760230da4920275865786986d3bf3bbdcce04d
parent3a1258399bdf4d4412cbfde36d0d94965eec87b6
softmmu/physmem: Distinguish between file access mode and mmap protection

There is a difference between how we open a file and how we mmap it,
and we want to support writable private mappings of readonly files. Let's
define RAM_READONLY and RAM_READONLY_FD flags, to replace the single
"readonly" parameter for file-related functions.

In memory_region_init_ram_from_fd() and memory_region_init_ram_from_file(),
initialize mr->readonly based on the new RAM_READONLY flag.

While at it, add some RAM_* flags we missed to add to the list of accepted
flags in the documentation of some functions.

No change in functionality intended. We'll make use of both flags next
and start setting them independently for memory-backend-file.

Message-ID: <20230906120503.359863-3-david@redhat.com>
Acked-by: Peter Xu <peterx@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
backends/hostmem-file.c
include/exec/memory.h
include/exec/ram_addr.h
softmmu/memory.c
softmmu/physmem.c