[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 10/13] exec/cpu-common: add qemu_ram_get_fd()
From: |
Stefan Hajnoczi |
Subject: |
[PULL 10/13] exec/cpu-common: add qemu_ram_get_fd() |
Date: |
Wed, 26 Oct 2022 14:58:43 -0400 |
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>
---
include/exec/cpu-common.h | 1 +
softmmu/physmem.c | 5 +++++
2 files changed, 6 insertions(+)
diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h
index c493510ee9..6feaa40ca7 100644
--- a/include/exec/cpu-common.h
+++ b/include/exec/cpu-common.h
@@ -92,6 +92,7 @@ void qemu_ram_set_uf_zeroable(RAMBlock *rb);
bool qemu_ram_is_migratable(RAMBlock *rb);
void qemu_ram_set_migratable(RAMBlock *rb);
void qemu_ram_unset_migratable(RAMBlock *rb);
+int qemu_ram_get_fd(RAMBlock *rb);
size_t qemu_ram_pagesize(RAMBlock *block);
size_t qemu_ram_pagesize_largest(void);
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)
{
--
2.37.3
- [PULL 00/13] Block patches, Stefan Hajnoczi, 2022/10/26
- [PULL 01/13] coroutine: add flag to re-queue at front of CoQueue, Stefan Hajnoczi, 2022/10/26
- [PULL 02/13] blkio: add libblkio block driver, Stefan Hajnoczi, 2022/10/26
- [PULL 03/13] numa: call ->ram_block_removed() in ram_block_notifer_remove(), Stefan Hajnoczi, 2022/10/26
- [PULL 05/13] block: use BdrvRequestFlags type for supported flag fields, Stefan Hajnoczi, 2022/10/26
- [PULL 06/13] block: add BDRV_REQ_REGISTERED_BUF request flag, Stefan Hajnoczi, 2022/10/26
- [PULL 07/13] block: return errors from bdrv_register_buf(), Stefan Hajnoczi, 2022/10/26
- [PULL 08/13] numa: use QLIST_FOREACH_SAFE() for RAM block notifiers, Stefan Hajnoczi, 2022/10/26
- [PULL 04/13] block: pass size to bdrv_unregister_buf(), Stefan Hajnoczi, 2022/10/26
- [PULL 10/13] exec/cpu-common: add qemu_ram_get_fd(),
Stefan Hajnoczi <=
- [PULL 11/13] stubs: add qemu_ram_block_from_host() and qemu_ram_get_fd(), Stefan Hajnoczi, 2022/10/26
- [PULL 12/13] blkio: implement BDRV_REQ_REGISTERED_BUF optimization, Stefan Hajnoczi, 2022/10/26
- [PULL 09/13] block: add BlockRAMRegistrar, Stefan Hajnoczi, 2022/10/26
- [PULL 13/13] virtio-blk: use BDRV_REQ_REGISTERED_BUF optimization hint, Stefan Hajnoczi, 2022/10/26
- Re: [PULL 00/13] Block patches, Stefan Hajnoczi, 2022/10/31