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

[Xen-devel] [PATCH] mini-os: convert mlock macros to C functions


  • To: xen-devel@xxxxxxxxxxxxxxxxxxx
  • From: Olaf Hering <olaf@xxxxxxxxx>
  • Date: Sun, 29 Jan 2012 13:04:14 +0100
  • Delivery-date: Sun, 29 Jan 2012 12:05:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1327838577 -3600
# Node ID b64564ad67ebbbf5ebfceabbd0afa281d950f9a3
# Parent  34cf64e8b3f099a556b670ca96e0f3f695557a11
mini-os: convert mlock macros to C functions

mlock and munlock are implemented as macros in mini-os. Their usage
requires casting in common code.  Convert them to C syntax and provide
an empty dummy function.  Remove the now unneeded (void) cast from two
munlock calls.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>

diff -r 34cf64e8b3f0 -r b64564ad67eb extras/mini-os/include/posix/sys/mman.h
--- a/extras/mini-os/include/posix/sys/mman.h
+++ b/extras/mini-os/include/posix/sys/mman.h
@@ -16,7 +16,7 @@
 
 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t 
offset) asm("mmap64");
 int munmap(void *start, size_t length);
-#define munlock(addr, len) ((void)(addr), (void)(len), 0)
-#define mlock(addr, len) ((void)(addr), (void)(len), 0)
+static inline mlock(const void *addr, size_t len) { return 0; }
+static inline munlock(const void *addr, size_t len) { return 0; }
 
 #endif /* _POSIX_SYS_MMAN_H */
diff -r 34cf64e8b3f0 -r b64564ad67eb tools/libxc/xc_linux_osdep.c
--- a/tools/libxc/xc_linux_osdep.c
+++ b/tools/libxc/xc_linux_osdep.c
@@ -106,7 +106,7 @@ static void *linux_privcmd_alloc_hyperca
 
 static void linux_privcmd_free_hypercall_buffer(xc_interface *xch, 
xc_osdep_handle h, void *ptr, int npages)
 {
-    (void) munlock(ptr, npages * XC_PAGE_SIZE);
+    munlock(ptr, npages * XC_PAGE_SIZE);
     free(ptr);
 }
 
diff -r 34cf64e8b3f0 -r b64564ad67eb tools/libxc/xc_mem_paging.c
--- a/tools/libxc/xc_mem_paging.c
+++ b/tools/libxc/xc_mem_paging.c
@@ -87,7 +87,7 @@ int xc_mem_paging_load(xc_interface *xch
                                 buffer, NULL, gfn);
 
     old_errno = errno;
-    (void) munlock(buffer, XC_PAGE_SIZE);
+    munlock(buffer, XC_PAGE_SIZE);
     errno = old_errno;
 
     return rc;

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


 


Rackspace

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