diff options
author | Shriram Rajagopalan <rshriram@cs.ubc.ca> | 2011-12-01 15:35:02 +0000 |
---|---|---|
committer | Shriram Rajagopalan <rshriram@cs.ubc.ca> | 2011-12-01 15:35:02 +0000 |
commit | de869779a0b7c411a69b787ec01b485492b40f32 (patch) | |
tree | f1fb58a194fbb928a560b40f9c8b58b09daa470a /tools/libxc/xc_linux.c | |
parent | 3a313ac80e9e0316393c8034a32aae34e8f3373c (diff) | |
download | xen-de869779a0b7c411a69b787ec01b485492b40f32.tar.gz xen-de869779a0b7c411a69b787ec01b485492b40f32.tar.bz2 xen-de869779a0b7c411a69b787ec01b485492b40f32.zip |
tools/libxc: introduce xc_memalign in xc_{minios,linux,solaris,netbsd}.c
Move (page aligned) buffer allocations in {os}_privcmd_alloc_hypercall_buffer
into a global function xc_memalign. This API is also used by Remus
compression code to allocate compression caches that need to be page aligned.
Signed-off-by: Shriram Rajagopalan <rshriram@cs.ubc.ca>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Brendan Cully <brendan@cs.ubc.ca>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_linux.c')
-rw-r--r-- | tools/libxc/xc_linux.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index 9acf27573e..5504df6cba 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -55,6 +55,18 @@ void discard_file_cache(xc_interface *xch, int fd, int flush) errno = saved_errno; } +void *xc_memalign(xc_interface *xch, size_t alignment, size_t size) +{ + int ret; + void *ptr; + + ret = posix_memalign(&ptr, alignment, size); + if (ret != 0 || !ptr) + return NULL; + + return ptr; +} + /* * Local variables: * mode: C |