mini-os: convert mlock macros to C functions
authorOlaf Hering <olaf@aepfle.de>
Tue, 31 Jan 2012 11:33:35 +0000 (11:33 +0000)
committerOlaf Hering <olaf@aepfle.de>
Tue, 31 Jan 2012 11:33:35 +0000 (11:33 +0000)
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@aepfle.de>
extras/mini-os/include/posix/sys/mman.h
tools/libxc/xc_linux_osdep.c
tools/libxc/xc_mem_paging.c

index 3b9ef19aa1243e8a1afe9b2cce045482cc234060..4d349792b6f9e0444a822dbc4bc4f97dff01b883 100644 (file)
@@ -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 */
index 02df9c5ba0d7a27182a1bbb0944156a30bddde78..4ee970d9c0cdfe8792bb025a8bfc888b505a185f 100644 (file)
@@ -106,7 +106,7 @@ static void *linux_privcmd_alloc_hypercall_buffer(xc_interface *xch, xc_osdep_ha
 
 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);
 }
 
index 0c309b5e2ff1905ae100c349633ef98bdd332a5f..a108a5c4cfe5a328f71a742b8cb2888a190c4c24 100644 (file)
@@ -87,7 +87,7 @@ int xc_mem_paging_load(xc_interface *xch, domid_t domain_id,
                                 buffer, NULL, gfn);
 
     old_errno = errno;
-    (void) munlock(buffer, XC_PAGE_SIZE);
+    munlock(buffer, XC_PAGE_SIZE);
     errno = old_errno;
 
     return rc;