[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/11] hw/virtio/virtio-mem: Use qemu_ram_get_fd() helper
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 06/11] hw/virtio/virtio-mem: Use qemu_ram_get_fd() helper |
Date: |
Tue, 23 May 2023 18:35:55 +0200 |
Avoid accessing RAMBlock internals, use the provided
qemu_ram_get_fd() getter to get the file descriptor.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/virtio/virtio-mem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/virtio/virtio-mem.c b/hw/virtio/virtio-mem.c
index 538b695c29..74e63bd47a 100644
--- a/hw/virtio/virtio-mem.c
+++ b/hw/virtio/virtio-mem.c
@@ -135,7 +135,7 @@ static bool virtio_mem_has_shared_zeropage(RAMBlock *rb)
* anonymous RAM. In any other case, reading unplugged *can* populate a
* fresh page, consuming actual memory.
*/
- return !qemu_ram_is_shared(rb) && rb->fd < 0 &&
+ return !qemu_ram_is_shared(rb) && qemu_ram_get_fd(rb) < 0 &&
qemu_ram_pagesize(rb) == qemu_real_host_page_size();
}
#endif /* VIRTIO_MEM_HAS_LEGACY_GUESTS */
--
2.38.1
- Re: [PATCH 01/11] softmmu: Introduce qemu_target_page_mask/qemu_target_page_align helpers, (continued)
- [PATCH 02/11] hw/scsi: Introduce VHOST_SCSI_COMMON symbol in Kconfig, Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 03/11] hw/scsi: Rearrange meson.build, Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 04/11] hw/scsi: Rename target-specific source set as 'specific_virtio_scsi_ss', Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 05/11] hw/virtio: Introduce VHOST_VSOCK_COMMON symbol in Kconfig, Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 06/11] hw/virtio/virtio-mem: Use qemu_ram_get_fd() helper,
Philippe Mathieu-Daudé <=
- [PATCH 08/11] hw/virtio/virtio-iommu: Use target-agnostic qemu_target_page_mask(), Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 07/11] hw/virtio/vhost-vsock: Include missing 'virtio/virtio-bus.h' header, Philippe Mathieu-Daudé, 2023/05/23
- [PATCH 09/11] hw/virtio: Remove unnecessary 'virtio-access.h' header, Philippe Mathieu-Daudé, 2023/05/23