xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: xen-devel@lists.xensource.com
Subject: [PATCH] mini-os: convert mlock macros to C functions
Date: Sun, 29 Jan 2012 13:04:14 +0100	[thread overview]
Message-ID: <b64564ad67ebbbf5ebfc.1327838654@probook.site> (raw)

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# 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@aepfle.de>

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;

                 reply	other threads:[~2012-01-29 12:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b64564ad67ebbbf5ebfc.1327838654@probook.site \
    --to=olaf@aepfle.de \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).