From: Manuel Bouyer <bouyer@netbsd.org>
To: xen-devel@lists.xenproject.org
Cc: "Manuel Bouyer" <bouyer@netbsd.org>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Ian Jackson" <iwj@xenproject.org>, "Wei Liu" <wl@xen.org>
Subject: [PATCH v2] libs/call: fix build on NetBSD
Date: Tue, 26 Jan 2021 23:47:51 +0100 [thread overview]
Message-ID: <20210126224800.1246-5-bouyer@netbsd.org> (raw)
In-Reply-To: <20210126224800.1246-1-bouyer@netbsd.org>
Define PAGE_* if not already defined
Catch up with osdep interface change.
Signed-off-by: Manuel Bouyer <bouyer@netbsd.org>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
tools/libs/call/netbsd.c | 19 +++++++++++--------
tools/libs/call/private.h | 4 +++-
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/tools/libs/call/netbsd.c b/tools/libs/call/netbsd.c
index a5502da377..4dcc2919ba 100644
--- a/tools/libs/call/netbsd.c
+++ b/tools/libs/call/netbsd.c
@@ -19,12 +19,15 @@
* Split from xc_netbsd.c
*/
-#include "xc_private.h"
#include <unistd.h>
#include <fcntl.h>
#include <malloc.h>
+#include <errno.h>
#include <sys/mman.h>
+#include <sys/ioctl.h>
+
+#include "private.h"
int osdep_xencall_open(xencall_handle *xcall)
{
@@ -69,12 +72,13 @@ int osdep_xencall_close(xencall_handle *xcall)
return close(fd);
}
-void *osdep_alloc_hypercall_buffer(xencall_handle *xcall, size_t npages)
+void *osdep_alloc_pages(xencall_handle *xcall, size_t npages)
{
- size_t size = npages * XC_PAGE_SIZE;
+ size_t size = npages * PAGE_SIZE;
void *p;
+ int ret;
- ret = posix_memalign(&p, XC_PAGE_SIZE, size);
+ ret = posix_memalign(&p, PAGE_SIZE, size);
if ( ret != 0 || !p )
return NULL;
@@ -86,14 +90,13 @@ void *osdep_alloc_hypercall_buffer(xencall_handle *xcall, size_t npages)
return p;
}
-void osdep_free_hypercall_buffer(xencall_handle *xcall, void *ptr,
- size_t npages)
+void osdep_free_pages(xencall_handle *xcall, void *ptr, size_t npages)
{
- (void) munlock(ptr, npages * XC_PAGE_SIZE);
+ munlock(ptr, npages * PAGE_SIZE);
free(ptr);
}
-int do_xen_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
+int osdep_hypercall(xencall_handle *xcall, privcmd_hypercall_t *hypercall)
{
int fd = xcall->fd;
int error = ioctl(fd, IOCTL_PRIVCMD_HYPERCALL, hypercall);
diff --git a/tools/libs/call/private.h b/tools/libs/call/private.h
index 21f992b37e..7944ac5baf 100644
--- a/tools/libs/call/private.h
+++ b/tools/libs/call/private.h
@@ -12,8 +12,10 @@
#ifndef PAGE_SHIFT /* Mini-os, Yukk */
#define PAGE_SHIFT 12
#endif
-#ifndef __MINIOS__ /* Yukk */
+#ifndef PAGE_SIZE
#define PAGE_SIZE (1UL << PAGE_SHIFT)
+#endif
+#ifndef PAGE_MASK
#define PAGE_MASK (~(PAGE_SIZE-1))
#endif
--
2.29.2
next prev parent reply other threads:[~2021-01-26 23:00 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 22:47 [PATCH v2] Fix error: array subscript has type 'char' Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] NetBSD hotplug: Introduce locking functions Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] NetBSD hotplug: fix block unconfigure on destroy Manuel Bouyer
2021-01-28 11:45 ` Roger Pau Monné
2021-01-29 11:00 ` Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] NetBSD: use system-provided headers Manuel Bouyer
2021-01-28 11:21 ` Roger Pau Monné
2021-01-29 10:57 ` Manuel Bouyer
2021-01-26 22:47 ` Manuel Bouyer [this message]
2021-01-26 22:47 ` [PATCH v2] libs/foreignmemory: Implement on NetBSD Manuel Bouyer
2021-01-27 20:15 ` Andrew Cooper
2021-01-28 10:48 ` Roger Pau Monné
2021-01-28 10:52 ` Andrew Cooper
2021-01-28 11:42 ` Andrew Cooper
2021-01-29 10:51 ` Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/gnttab: implement " Manuel Bouyer
2021-01-28 11:14 ` Roger Pau Monné
2021-01-26 22:47 ` [PATCH v2] libs/light: Switch NetBSD to QEMU_XEN Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/light: fix tv_sec printf format Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/light: fix uuid on NetBSD Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/light: make it build without setresuid() Manuel Bouyer
2021-01-28 11:06 ` Ian Jackson
2021-01-29 22:51 ` Andrew Cooper
2021-01-29 23:01 ` Manuel Bouyer
2021-01-29 23:05 ` Andrew Cooper
2021-01-29 23:16 ` Manuel Bouyer
2021-01-30 18:28 ` Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/light: pass some infos to qemu Manuel Bouyer
2021-01-28 11:08 ` Roger Pau Monné
2021-01-29 10:46 ` Manuel Bouyer
2021-01-29 14:52 ` Roger Pau Monné
2021-01-30 23:07 ` Manuel Bouyer
2021-01-30 11:50 ` Manuel Bouyer
2021-02-01 8:06 ` Roger Pau Monné
2021-02-01 9:39 ` Manuel Bouyer
2021-02-01 10:54 ` Roger Pau Monné
2021-02-01 11:21 ` Manuel Bouyer
2021-01-26 22:47 ` [PATCH v2] libs/store: make build without PTHREAD_STACK_MIN Manuel Bouyer
2021-01-28 10:57 ` Roger Pau Monné
2021-01-28 11:08 ` Andrew Cooper
2021-01-29 10:43 ` Manuel Bouyer
2021-01-26 22:48 ` [PATCH v2] xenpmd.c: use dynamic allocation Manuel Bouyer
2021-01-28 10:34 ` Roger Pau Monné
2021-01-27 19:30 ` [PATCH v2] Fix error: array subscript has type 'char' Andrew Cooper
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=20210126224800.1246-5-bouyer@netbsd.org \
--to=bouyer@netbsd.org \
--cc=iwj@xenproject.org \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.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).