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

Re: [Xen-devel] [PATCH v7 1/2] libs/gnttab: introduce grant copy interface



On Wed, Sep 14, 2016 at 09:10:02PM +0200, Paulina Szubarczyk wrote:
> In a linux part an ioctl(gntdev, IOCTL_GNTDEV_GRANT_COPY, ..)
> system call is invoked. In mini-os the operation is yet not
> implemented. For the OSs that does not implement gnttab the
> call of the grant copy operation causes abort.
> 
> Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx>
> Reviewed-by: David Vrabel <david.vrabel@xxxxxxxxxx>

Paulina, this is mostly for your information. No action is needed on
your side. Thanks for putting in the effort to contribute to Xen.

Because Ian prefers another way of dealing with BUILD_BUG_ON, I've sent
out another patch for that.  I also write the following patch to fix up
this patch.

---8<---
From 096fef32bffaef5b3e273bdfe75d620d8a7c8792 Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@xxxxxxxxxx>
Date: Mon, 19 Sep 2016 16:50:35 +0100
Subject: [PATCH] fixup! libs/gnttab: introduce grant copy interface

---
 tools/libs/gnttab/linux.c | 116 +++++++++++++++++++++++-----------------------
 1 file changed, 59 insertions(+), 57 deletions(-)

diff --git a/tools/libs/gnttab/linux.c b/tools/libs/gnttab/linux.c
index 6bd9bd2..69b7e26 100644
--- a/tools/libs/gnttab/linux.c
+++ b/tools/libs/gnttab/linux.c
@@ -31,6 +31,8 @@
 #include <xen/sys/gntdev.h>
 #include <xen/sys/gntalloc.h>
 
+#include <xen-tools/libs.h>
+
 #include "private.h"
 
 #define DEVXEN "/dev/xen/"
@@ -244,63 +246,63 @@ int osdep_gnttab_grant_copy(xengnttab_handle *xgt,
     int fd = xgt->fd;
     struct ioctl_gntdev_grant_copy copy;
 
-    XENGNTTAB_BUILD_BUG_ON(sizeof(struct ioctl_gntdev_grant_copy_segment) !=
-                           sizeof(xengnttab_grant_copy_segment_t));
-
-    XENGNTTAB_BUILD_BUG_ON(__alignof__(struct ioctl_gntdev_grant_copy_segment) 
!=
-                           __alignof__(xengnttab_grant_copy_segment_t));
-
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    source.virt) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    source.virt));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    source.foreign) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    source.foreign));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    source.foreign.ref) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    source.foreign));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    source.foreign.offset) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    source.foreign.offset));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    source.foreign.domid) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    source.foreign.domid));
-
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    dest.virt) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    dest.virt));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    dest.foreign) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    dest.foreign));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    dest.foreign.ref) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    dest.foreign));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    dest.foreign.offset) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    dest.foreign.offset));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    dest.foreign.domid) !=
-                           offsetof(xengnttab_grant_copy_segment_t,
-                                    dest.foreign.domid));
-
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    len) !=
-                           offsetof(xengnttab_grant_copy_segment_t, len));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    flags) !=
-                           offsetof(xengnttab_grant_copy_segment_t, flags));
-    XENGNTTAB_BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
-                                    status) !=
-                           offsetof(xengnttab_grant_copy_segment_t, status));
+    BUILD_BUG_ON(sizeof(struct ioctl_gntdev_grant_copy_segment) !=
+                 sizeof(xengnttab_grant_copy_segment_t));
+
+    BUILD_BUG_ON(__alignof__(struct ioctl_gntdev_grant_copy_segment) !=
+                 __alignof__(xengnttab_grant_copy_segment_t));
+
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          source.virt) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          source.virt));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          source.foreign) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          source.foreign));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          source.foreign.ref) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          source.foreign));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          source.foreign.offset) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          source.foreign.offset));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          source.foreign.domid) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          source.foreign.domid));
+
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          dest.virt) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          dest.virt));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          dest.foreign) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          dest.foreign));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          dest.foreign.ref) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          dest.foreign));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          dest.foreign.offset) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          dest.foreign.offset));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          dest.foreign.domid) !=
+                 offsetof(xengnttab_grant_copy_segment_t,
+                          dest.foreign.domid));
+
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          len) !=
+                 offsetof(xengnttab_grant_copy_segment_t, len));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          flags) !=
+                 offsetof(xengnttab_grant_copy_segment_t, flags));
+    BUILD_BUG_ON(offsetof(struct ioctl_gntdev_grant_copy_segment,
+                          status) !=
+                 offsetof(xengnttab_grant_copy_segment_t, status));
 
     copy.segments = (struct ioctl_gntdev_grant_copy_segment *)segs;
     copy.count = count;
-- 
2.1.4

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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