From: Erika Hunhoff <hunhoff.erika@gmail.com>
To: qemu-devel@nongnu.org
Cc: Erika Hunhoff <hunhoff.erika@gmail.com>
Subject: [PATCH] contrib/ivshmem-server: allow 2G ivshmem region
Date: Thu, 11 May 2023 13:06:39 -0700 [thread overview]
Message-ID: <20230511200639.1197930-1-hunhoff.erika@gmail.com> (raw)
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
reply other threads:[~2023-05-11 22:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230511200639.1197930-1-hunhoff.erika@gmail.com \
--to=hunhoff.erika@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).