diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:47 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2010-12-03 09:36:47 +0000 |
commit | 3143748ef690c9c2206817a8a6b5f97e744b795d (patch) | |
tree | 180c09be929ff5a6be67897fa8c9b5c9200262b8 /tools | |
parent | f32797d3310d8eb1851b07249f5270f1be1ae39a (diff) | |
download | xen-3143748ef690c9c2206817a8a6b5f97e744b795d.tar.gz xen-3143748ef690c9c2206817a8a6b5f97e744b795d.tar.bz2 xen-3143748ef690c9c2206817a8a6b5f97e744b795d.zip |
libxc: osdep: convert xc_map_foreign_range()
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxc/xc_foreign_memory.c | 19 | ||||
-rw-r--r-- | tools/libxc/xc_linux.c | 6 | ||||
-rw-r--r-- | tools/libxc/xc_minios.c | 8 | ||||
-rw-r--r-- | tools/libxc/xc_netbsd.c | 11 | ||||
-rw-r--r-- | tools/libxc/xc_solaris.c | 13 | ||||
-rw-r--r-- | tools/libxc/xenctrlosdep.h | 2 |
6 files changed, 44 insertions, 15 deletions
diff --git a/tools/libxc/xc_foreign_memory.c b/tools/libxc/xc_foreign_memory.c index 953f63bbaf..95d1d43c78 100644 --- a/tools/libxc/xc_foreign_memory.c +++ b/tools/libxc/xc_foreign_memory.c @@ -20,8 +20,15 @@ #include "xc_private.h" +void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, + int size, int prot, unsigned long mfn) +{ + return xch->ops->u.privcmd.map_foreign_range(xch, xch->ops_handle, + dom, size, prot, mfn); +} + void *xc_map_foreign_batch(xc_interface *xch, uint32_t dom, int prot, - xen_pfn_t *arr, int num ) + xen_pfn_t *arr, int num) { return xch->ops->u.privcmd.map_foreign_batch(xch, xch->ops_handle, dom, prot, arr, num); @@ -33,3 +40,13 @@ void *xc_map_foreign_bulk(xc_interface *xch, uint32_t dom, int prot, return xch->ops->u.privcmd.map_foreign_bulk(xch, xch->ops_handle, dom, prot, arr, err, num); } + +/* + * Local variables: + * mode: C + * c-set-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/tools/libxc/xc_linux.c b/tools/libxc/xc_linux.c index 76d4791845..aa70cc8763 100644 --- a/tools/libxc/xc_linux.c +++ b/tools/libxc/xc_linux.c @@ -283,8 +283,9 @@ static void *linux_privcmd_map_foreign_bulk(xc_interface *xch, xc_osdep_handle h return addr; } -void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, int size, int prot, - unsigned long mfn) +static void *linux_privcmd_map_foreign_range(xc_interface *xch, xc_osdep_handle h, + uint32_t dom, int size, int prot, + unsigned long mfn) { xen_pfn_t *arr; int num; @@ -335,6 +336,7 @@ static struct xc_osdep_ops linux_privcmd_ops = { .map_foreign_batch = &linux_privcmd_map_foreign_batch, .map_foreign_bulk = &linux_privcmd_map_foreign_bulk, + .map_foreign_range = &linux_privcmd_map_foreign_range, }, }; diff --git a/tools/libxc/xc_minios.c b/tools/libxc/xc_minios.c index 624889d193..83b5e324ec 100644 --- a/tools/libxc/xc_minios.c +++ b/tools/libxc/xc_minios.c @@ -134,9 +134,10 @@ static void *minios_privcmd_map_foreign_batch(xc_interface *xch, xc_osdep_handl return (void *) addr; } -void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, - int size, int prot, - unsigned long mfn) +static void *minios_privcmd_map_foreign_range(xc_interface *xch, xc_osdep_handle h, + uint32_t dom, + int size, int prot, + unsigned long mfn) { unsigned long pt_prot = 0; #ifdef __ia64__ @@ -190,6 +191,7 @@ static struct xc_osdep_ops minios_privcmd_ops = { .map_foreign_batch = &minios_privcmd_map_foreign_batch, .map_foreign_bulk = &minios_privcmd_map_foreign_bulk, + .map_foreign_range = &minios_privcmd_map_foreign_range, }, }; diff --git a/tools/libxc/xc_netbsd.c b/tools/libxc/xc_netbsd.c index 671ae2c3a6..00f4ffc2a3 100644 --- a/tools/libxc/xc_netbsd.c +++ b/tools/libxc/xc_netbsd.c @@ -108,10 +108,12 @@ static void *netbsd_privcmd_map_foreign_batch(xc_interface *xch, xc_osdep_handle } -void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, - int size, int prot, - unsigned long mfn) +static void *netbsd_privcmd_map_foreign_range(xc_interface *xch, xc_osdep_handle h, + uint32_t dom, + int size, int prot, + unsigned long mfn) { + int fd = (int)h; privcmd_mmap_t ioctlx; privcmd_mmap_entry_t entry; void *addr; @@ -127,7 +129,7 @@ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, entry.va=(unsigned long) addr; entry.mfn=mfn; entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT; - if ( ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) + if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) { int saved_errno = errno; PERROR("xc_map_foreign_range: ioctl failed"); @@ -183,6 +185,7 @@ static struct xc_osdep_ops netbsd_privcmd_ops = { .map_foreign_batch = &netbsd_privcmd_map_foreign_batch, .map_foreign_bulk = &xc_map_foreign_bulk_compat, + .map_foreign_range = &netbsd_privcmd_map_foreign_range, }, }; diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c index 8152868e7c..d9af863c6e 100644 --- a/tools/libxc/xc_solaris.c +++ b/tools/libxc/xc_solaris.c @@ -101,14 +101,16 @@ static void *solaris_privcmd_map_foreign_batch(xc_interface *xch, xc_osdep_handl } -void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, - int size, int prot, - unsigned long mfn) +static void *xc_map_foreign_range(xc_interface *xch, xc_osdep_handle h, + uint32_t dom, + int size, int prot, + unsigned long mfn) { + int fd = (int)fd; privcmd_mmap_t ioctlx; privcmd_mmap_entry_t entry; void *addr; - addr = mmap(NULL, size, prot, MAP_SHARED, xch->fd, 0); + addr = mmap(NULL, size, prot, MAP_SHARED, fd, 0); if ( addr == MAP_FAILED ) return NULL; @@ -118,7 +120,7 @@ void *xc_map_foreign_range(xc_interface *xch, uint32_t dom, entry.va=(unsigned long) addr; entry.mfn=mfn; entry.npages=(size+PAGE_SIZE-1)>>PAGE_SHIFT; - if ( ioctl(xch->fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) + if ( ioctl(fd, IOCTL_PRIVCMD_MMAP, &ioctlx) < 0 ) { int saved_errno = errno; (void)munmap(addr, size); @@ -173,6 +175,7 @@ static struct xc_osdep_ops solaris_privcmd_ops = { .map_foreign_batch = &solaris_privcmd_map_foreign_batch, .map_foreign_bulk = &xc_map_foreign_bulk_compat, + .map_foreign_range = &solaris_privcmd_map_foreign_range, }, }; diff --git a/tools/libxc/xenctrlosdep.h b/tools/libxc/xenctrlosdep.h index 204b9e87e9..eadbbc0808 100644 --- a/tools/libxc/xenctrlosdep.h +++ b/tools/libxc/xenctrlosdep.h @@ -68,6 +68,8 @@ struct xc_osdep_ops xen_pfn_t *arr, int num); void *(*map_foreign_bulk)(xc_interface *xch, xc_osdep_handle h, uint32_t dom, int prot, const xen_pfn_t *arr, int *err, unsigned int num); + void *(*map_foreign_range)(xc_interface *xch, xc_osdep_handle h, uint32_t dom, int size, int prot, + unsigned long mfn); } privcmd; } u; }; |