[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] libs/devicemodel: add dm_op support for FreeBSD


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 5 Jan 2021 11:25:46 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PMEZP4C+IxP09H0PSYuAz/LURUqWwnKgCKWBqQ8xn4A=; b=jjJDZoVRrFpxECt3bjufCCAmbkvqcCkG+B04rNQ7OvWK79sOP1q7Pd9AfMGhg9pAZY4tHJrSMRyCJSeMxWUg9aYUckcEDuEHCx3d37spb8qm31ViiOhTuMzeFH1GugYX6Q1p/L+QPf1wMSVDOUWsPjK14gIjvGHlTAJYi7MtJ01UGmSAxdnTwWz+QaK4yJ5cGKcju+niNHW6ZEyg9UEKqRbO1ItTZUKnAU3t72PG2qOAO1LbVutXK4a+6hnRaWp3AqKXEUXhPVd+cOLMuCnzeUqVxOGQu4MTpSQYnMTcxAf6OBYHxe7pWjso7vBx2MJeeaocv2gZjFRyxH6fguFyzA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hcJQqBoAyzsOM7l4Cqf26BsVyC+Tmljr5NLBbq4AAV7p3rCXu9mD+Wzx2B8b+p9G6+sa6712J8yTY2L5b9oJewKu7608Tv2lOcetl2LuuLX8C733CRNUNy5ZbbQlvmQEG6FTqNTw2OAjth/QmDUtnz9Ag8ktzc3npUg/31HkJRa1Tsyfm4U5kG/RiPV/K4vJglUYcltickgzGBmzjL/sRsR+rLtYV+svldi84vogncIFJD4JOIGGVXyR3Mfi/ouRCwIcaSd5YTyC8ifpp+PtzbAoPBjrjIiWyXt7QfygiMowbuPOkoh4XtZt6mIQkSwyZdM1XdCGG8bGZGGPUFXbDw==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 05 Jan 2021 10:30:04 +0000
  • Ironport-sdr: jwD+1rUDWwkebDl13cSUoLm8PsZ3KrklF6hzdC1Y8IF7CT3R04n8uOHbA2K3JahrtMVDxD4Oax YVwZ0t5px5TW/aRJ152jdQv2xkga6lYV2IZNJLEFTOf9nrWGxCr4Uij/OcWOgUA+fXn6SGkWf0 SgeaQOTww4lpqZgUPM/beNdtTxvpdsVd42XaCTMMsOaYxj7XLbgkEeipazWzXNyGwrT4zNnhlL HXO6Lrg6A7dLxmkjPjb5RXdWWpDPoTSRfQqAXZyCUqb+JB/OUDBWxJ1RPQocFpapakVXfNX2mR MhY=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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@xxxxxxxxxx>
---
 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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.