diff mbox

[v7,1/2] libs/gnttab: introduce grant copy interface

Message ID 20160919155823.GP30319@citrix.com
State New
Headers show

Commit Message

Wei Liu Sept. 19, 2016, 3:58 p.m. UTC
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@gmail.com>
> Reviewed-by: David Vrabel <david.vrabel@citrix.com>

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@citrix.com>
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(-)

Comments

Wei Liu Sept. 19, 2016, 4:20 p.m. UTC | #1
On Mon, Sep 19, 2016 at 04:58:23PM +0100, Wei Liu wrote:
> 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@gmail.com>
> > Reviewed-by: David Vrabel <david.vrabel@citrix.com>
> 
> 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@citrix.com>
> Date: Mon, 19 Sep 2016 16:50:35 +0100
> Subject: [PATCH] fixup! libs/gnttab: introduce grant copy interface
> 

Squashed the fixup into this patch and pushed to staging.
diff mbox

Patch

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;