* [PATCH] contrib/ivshmem-server: allow 2G ivshmem region
@ 2023-05-11 20:06 Erika Hunhoff
0 siblings, 0 replies; only message in thread
From: Erika Hunhoff @ 2023-05-11 20:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Erika Hunhoff
The ivshmem-server failed when configured with the following:
./ivshmem-server -F -S ivshmem-file -l 2G
This is because the ivshmem_server_ftruncate fails without calling
ftruncate.
This commit allows the ivshmem-server to create a region of size 2G.
Signed-off-by: Erika Hunhoff <hunhoff.erika@gmail.com>
---
contrib/ivshmem-server/ivshmem-server.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/contrib/ivshmem-server/ivshmem-server.c b/contrib/ivshmem-server/ivshmem-server.c
index 2f3c7320a6..ef31f07914 100644
--- a/contrib/ivshmem-server/ivshmem-server.c
+++ b/contrib/ivshmem-server/ivshmem-server.c
@@ -239,13 +239,17 @@ ivshmem_server_ftruncate(int fd, unsigned shmsize)
return 0;
}
- while (shmsize <= IVSHMEM_SERVER_MAX_HUGEPAGE_SIZE) {
+ /*
+ * This is a do-while loop in case
+ * shmsize > IVSHMEM_SERVER_MAX_HUGEPAGE_SIZE
+ */
+ do {
ret = ftruncate(fd, shmsize);
if (ret == 0) {
return ret;
}
shmsize *= 2;
- }
+ } while (shmsize <= IVSHMEM_SERVER_MAX_HUGEPAGE_SIZE);
return -1;
}
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-11 22:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-11 20:06 [PATCH] contrib/ivshmem-server: allow 2G ivshmem region Erika Hunhoff
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).