WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 2 of 2] Change GET_C_STRUCT to Intf_val to follow the

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2 of 2] Change GET_C_STRUCT to Intf_val to follow the common naming scheme of OCaml macro
From: Zheng Li <dev@xxxxxxxx>
Date: Fri, 30 Sep 2011 15:40:00 +0000
Delivery-date: Fri, 30 Sep 2011 08:44:12 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1317397198@eta>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1317397198@eta>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8.3
... and for better readabilities.


Signed-off-by: Zheng Li <dev@xxxxxxxx>


 tools/ocaml/libs/mmap/mmap_stubs.c |  34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)


----
diff --git a/tools/ocaml/libs/mmap/mmap_stubs.c 
b/tools/ocaml/libs/mmap/mmap_stubs.c
--- a/tools/ocaml/libs/mmap/mmap_stubs.c
+++ b/tools/ocaml/libs/mmap/mmap_stubs.c
@@ -28,7 +28,7 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
-#define GET_C_STRUCT(a) ((struct mmap_interface *) a)
+#define Intf_val(a) ((struct mmap_interface *) a)
 
 static int mmap_interface_init(struct mmap_interface *intf,
                                int fd, int pflag, int mflag,
@@ -61,27 +61,27 @@ CAMLprim value stub_mmap_init(value fd, 
 
        result = caml_alloc(sizeof(struct mmap_interface), Abstract_tag);
 
-       if (mmap_interface_init(GET_C_STRUCT(result), Int_val(fd),
+       if (mmap_interface_init(Intf_val(result), Int_val(fd),
                                c_pflag, c_mflag,
                                Int_val(len), Int_val(offset)))
                caml_failwith("mmap");
        CAMLreturn(result);
 }
 
-CAMLprim value stub_mmap_final(value interface)
+CAMLprim value stub_mmap_final(value intf)
 {
-       CAMLparam1(interface);
+       CAMLparam1(intf);
 
-       if (GET_C_STRUCT(interface)->addr != MAP_FAILED)
-               munmap(GET_C_STRUCT(interface)->addr, 
GET_C_STRUCT(interface)->len);
-       GET_C_STRUCT(interface)->addr = MAP_FAILED;
+       if (Intf_val(intf)->addr != MAP_FAILED)
+               munmap(Intf_val(intf)->addr, Intf_val(intf)->len);
+       Intf_val(intf)->addr = MAP_FAILED;
 
        CAMLreturn(Val_unit);
 }
 
-CAMLprim value stub_mmap_read(value interface, value start, value len)
+CAMLprim value stub_mmap_read(value intf, value start, value len)
 {
-       CAMLparam3(interface, start, len);
+       CAMLparam3(intf, start, len);
        CAMLlocal1(data);
        int c_start;
        int c_len;
@@ -89,33 +89,33 @@ CAMLprim value stub_mmap_read(value inte
        c_start = Int_val(start);
        c_len = Int_val(len);
 
-       if (c_start > GET_C_STRUCT(interface)->len)
+       if (c_start > Intf_val(intf)->len)
                caml_invalid_argument("start invalid");
-       if (c_start + c_len > GET_C_STRUCT(interface)->len)
+       if (c_start + c_len > Intf_val(intf)->len)
                caml_invalid_argument("len invalid");
 
        data = caml_alloc_string(c_len);
-       memcpy((char *) data, GET_C_STRUCT(interface)->addr + c_start, c_len);
+       memcpy((char *) data, Intf_val(intf)->addr + c_start, c_len);
 
        CAMLreturn(data);
 }
 
-CAMLprim value stub_mmap_write(value interface, value data,
+CAMLprim value stub_mmap_write(value intf, value data,
                                value start, value len)
 {
-       CAMLparam4(interface, data, start, len);
+       CAMLparam4(intf, data, start, len);
        int c_start;
        int c_len;
 
        c_start = Int_val(start);
        c_len = Int_val(len);
 
-       if (c_start > GET_C_STRUCT(interface)->len)
+       if (c_start > Intf_val(intf)->len)
                caml_invalid_argument("start invalid");
-       if (c_start + c_len > GET_C_STRUCT(interface)->len)
+       if (c_start + c_len > Intf_val(intf)->len)
                caml_invalid_argument("len invalid");
 
-       memcpy(GET_C_STRUCT(interface)->addr + c_start, (char *) data, c_len);
+       memcpy(Intf_val(intf)->addr + c_start, (char *) data, c_len);
 
        CAMLreturn(Val_unit);
 }

Attachment: xen-unstable.hg-2.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel