... 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);
}
xen-unstable.hg-2.patch
Description: Text Data
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|