All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Pau Monne <roger.pau@citrix.com>
To: <xen-devel@lists.xenproject.org>
Cc: Roger Pau Monne <roger.pau@citrix.com>,
	Ian Jackson <iwj@xenproject.org>, Wei Liu <wl@xen.org>
Subject: [PATCH 2/2] libs/devicemodel: add dm_op support for FreeBSD
Date: Tue,  5 Jan 2021 11:25:46 +0100	[thread overview]
Message-ID: <20210105102546.88462-3-roger.pau@citrix.com> (raw)
In-Reply-To: <20210105102546.88462-1-roger.pau@citrix.com>

The FreeBSD ioctls have the same fields has the Linux ones, so the
same file can be shared between both OSes.

No functional change for OSes different than FreeBSD.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
 tools/include/xen-sys/FreeBSD/privcmd.h      | 15 +++++++++++++++
 tools/libs/devicemodel/Makefile              |  4 ++--
 tools/libs/devicemodel/{linux.c => common.c} |  0
 3 files changed, 17 insertions(+), 2 deletions(-)
 rename tools/libs/devicemodel/{linux.c => common.c} (100%)

diff --git a/tools/include/xen-sys/FreeBSD/privcmd.h b/tools/include/xen-sys/FreeBSD/privcmd.h
index 603aad67d5..649ad443c7 100644
--- a/tools/include/xen-sys/FreeBSD/privcmd.h
+++ b/tools/include/xen-sys/FreeBSD/privcmd.h
@@ -66,12 +66,27 @@ struct ioctl_privcmd_mmapresource {
 };
 typedef struct ioctl_privcmd_mmapresource privcmd_mmap_resource_t;
 
+struct privcmd_dmop_buf {
+	void *uptr; /* pointer to memory (in calling process) */
+	size_t size; /* size of the buffer */
+};
+typedef struct privcmd_dmop_buf privcmd_dm_op_buf_t;
+
+struct ioctl_privcmd_dmop {
+	domid_t dom; /* target domain */
+	unsigned int num; /* num of buffers */
+	const struct privcmd_dmop_buf *ubufs; /* array of buffers */
+};
+typedef struct ioctl_privcmd_dmop privcmd_dm_op_t;
+
 #define IOCTL_PRIVCMD_HYPERCALL					\
 	_IOWR('E', 0, struct ioctl_privcmd_hypercall)
 #define IOCTL_PRIVCMD_MMAPBATCH					\
 	_IOWR('E', 1, struct ioctl_privcmd_mmapbatch)
 #define IOCTL_PRIVCMD_MMAP_RESOURCE				\
 	_IOW('E', 2, struct ioctl_privcmd_mmapresource)
+#define IOCTL_PRIVCMD_DM_OP					\
+	_IOW('E', 3, struct ioctl_privcmd_dmop)
 #define IOCTL_PRIVCMD_RESTRICT					\
 	_IOW('E', 4, domid_t)
 
diff --git a/tools/libs/devicemodel/Makefile b/tools/libs/devicemodel/Makefile
index b67fc0fac1..500de7adc5 100644
--- a/tools/libs/devicemodel/Makefile
+++ b/tools/libs/devicemodel/Makefile
@@ -5,8 +5,8 @@ MAJOR    = 1
 MINOR    = 3
 
 SRCS-y                 += core.c
-SRCS-$(CONFIG_Linux)   += linux.c
-SRCS-$(CONFIG_FreeBSD) += compat.c
+SRCS-$(CONFIG_Linux)   += common.c
+SRCS-$(CONFIG_FreeBSD) += common.c
 SRCS-$(CONFIG_SunOS)   += compat.c
 SRCS-$(CONFIG_NetBSD)  += compat.c
 SRCS-$(CONFIG_MiniOS)  += compat.c
diff --git a/tools/libs/devicemodel/linux.c b/tools/libs/devicemodel/common.c
similarity index 100%
rename from tools/libs/devicemodel/linux.c
rename to tools/libs/devicemodel/common.c
-- 
2.29.2



  parent reply	other threads:[~2021-01-05 10:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05 10:25 [PATCH 0/2] libs: implement some missing functions on FreeBSD Roger Pau Monne
2021-01-05 10:25 ` [PATCH 1/2] libs/foreignmemory: implement the " Roger Pau Monne
2021-01-05 10:25 ` Roger Pau Monne [this message]
2021-01-05 11:52 ` [PATCH 0/2] libs: implement some " Wei Liu

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=20210105102546.88462-3-roger.pau@citrix.com \
    --to=roger.pau@citrix.com \
    --cc=iwj@xenproject.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.