summaryrefslogtreecommitdiffstats
path: root/softmmu
diff options
context:
space:
mode:
authorStefan Hajnoczi2022-10-13 20:59:05 +0200
committerStefan Hajnoczi2022-10-26 20:56:42 +0200
commit6d998f3cbfebabea7882848a65c38f454d2a37c4 (patch)
treea53270b8b78ddd1fa5b341a323f0e629206303d8 /softmmu
parentblock: add BlockRAMRegistrar (diff)
downloadqemu-6d998f3cbfebabea7882848a65c38f454d2a37c4.tar.gz
qemu-6d998f3cbfebabea7882848a65c38f454d2a37c4.tar.xz
qemu-6d998f3cbfebabea7882848a65c38f454d2a37c4.zip
exec/cpu-common: add qemu_ram_get_fd()
Add a function to get the file descriptor for a RAMBlock. Device emulation code typically uses the MemoryRegion APIs but vhost-style code may use RAMBlock directly for sharing guest memory with another process. This new API will be used by the libblkio block driver so it can share guest memory via .bdrv_register_buf(). Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 20221013185908.1297568-11-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'softmmu')
-rw-r--r--softmmu/physmem.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 56e03e07b5..d9578ccfd4 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -1748,6 +1748,11 @@ void qemu_ram_unset_migratable(RAMBlock *rb)
rb->flags &= ~RAM_MIGRATABLE;
}
+int qemu_ram_get_fd(RAMBlock *rb)
+{
+ return rb->fd;
+}
+
/* Called with iothread lock held. */
void qemu_ram_set_idstr(RAMBlock *new_block, const char *name, DeviceState *dev)
{