Commit 2490fc23 authored by Keir Fraser's avatar Keir Fraser

libxc: eliminate static variables, use xentoollog; API change

This patch eliminate the global variables in libxenctrl (used for
logging and error reporting).

Instead the information which was in the global variables is now in a
new xc_interface* opaque structure, which xc_interface open returns
instead of the raw file descriptor; furthermore, logging is done via
xentoollog.

There are three new parameters to xc_interface_open to control the
logging, but existing callers can just pass "0" for all three to get
the old behaviour.

All libxc callers have been adjusted accordingly.

Also update QEMU_TAG for corresponding qemu change.
Signed-off-by: default avatarIan Jackson <ian.jackson@eu.citrix.com>
parent 97170f28
......@@ -154,9 +154,9 @@ QEMU_REMOTE=http://xenbits.xensource.com/git-http/qemu-xen-unstable.git
# CONFIG_QEMU ?= ../qemu-xen.git
CONFIG_QEMU ?= $(QEMU_REMOTE)
QEMU_TAG ?= 805ed3b20492d2f4bb465bfda65cedd286e23209
# Fri May 21 15:46:55 2010 +0100
# Wait for frontend state Connected before connecting the backend
QEMU_TAG ?= ffb0cf2ad55e952dae55e6166c4fcea79be6cd30
# Thu Apr 15 17:01:15 2010 +0100
# Change callers of libxc to use new libxc API.
# Optional components
XENSTAT_XENTOP ?= y
......
......@@ -84,7 +84,8 @@
#define NOFILE 32
extern int xc_evtchn_close(int fd);
extern int xc_interface_close(int fd);
struct xc_interface;
extern int xc_interface_close_core(struct xc_interface*, int fd);
extern int xc_gnttab_close(int fd);
pthread_mutex_t fd_lock = PTHREAD_MUTEX_INITIALIZER;
......@@ -413,7 +414,7 @@ int close(int fd)
}
#endif
case FTYPE_XC:
xc_interface_close(fd);
xc_interface_close_core(0,fd);
return 0;
case FTYPE_EVTCHN:
xc_evtchn_close(fd);
......
......@@ -50,7 +50,7 @@ static unsigned long *pages;
static unsigned long *pages_mfns;
static unsigned long allocated;
int pin_table(int xc_handle, unsigned int type, unsigned long mfn,
int pin_table(xc_interface *xc_handle, unsigned int type, unsigned long mfn,
domid_t dom);
/* We need mfn to appear as target_pfn, so exchange with the MFN there */
......@@ -109,7 +109,7 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
int rc;
domid_t domid = DOMID_SELF;
xen_pfn_t pfn;
int xc_handle;
xc_interface *xc_handle;
unsigned long i;
void *seg;
xen_pfn_t boot_page_mfn = virt_to_mfn(&_boot_page);
......@@ -118,9 +118,9 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
unsigned long nr_m2p_updates;
DEBUG("booting with cmdline %s\n", cmdline);
xc_handle = xc_interface_open();
xc_handle = xc_interface_open(0,0,0);
dom = xc_dom_allocate(cmdline, features);
dom = xc_dom_allocate(xc_handle, cmdline, features);
dom->allocate = kexec_allocate;
dom->kernel_blob = kernel;
......@@ -160,7 +160,7 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
#endif
/* equivalent of xc_dom_mem_init */
dom->arch_hooks = xc_dom_find_arch_hooks(dom->guest_type);
dom->arch_hooks = xc_dom_find_arch_hooks(xc_handle, dom->guest_type);
dom->total_pages = start_info.nr_pages;
/* equivalent of arch_setup_meminit */
......@@ -238,7 +238,7 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
munmap((void*) pages[pfn], PAGE_SIZE);
/* Pin the boot page table base */
if ( (rc = pin_table(dom->guest_xc,
if ( (rc = pin_table(dom->xch,
#ifdef __i386__
MMUEXT_PIN_L3_TABLE,
#endif
......
......@@ -24,7 +24,6 @@
#include "io.h"
#include <xs.h>
#include <xen/io/console.h>
#include <xenctrl.h>
#include <stdlib.h>
#include <errno.h>
......@@ -68,7 +67,7 @@ static int log_time_hv_needts = 1;
static int log_time_guest_needts = 1;
static int log_hv_fd = -1;
static evtchn_port_or_error_t log_hv_evtchn = -1;
static int xc_handle = -1;
static xc_interface *xch; /* why does xenconsoled have two xc handles ? */
static int xce_handle = -1;
struct buffer {
......@@ -932,7 +931,7 @@ static void handle_hv_logs(void)
if ((port = xc_evtchn_pending(xce_handle)) == -1)
return;
if (xc_readconsolering(xc_handle, &bufptr, &size, 0, 1, &index) == 0 && size > 0) {
if (xc_readconsolering(xch, &bufptr, &size, 0, 1, &index) == 0 && size > 0) {
int logret;
if (log_time_hv)
logret = write_with_timestamp(log_hv_fd, buffer, size,
......@@ -972,8 +971,8 @@ void handle_io(void)
int ret;
if (log_hv) {
xc_handle = xc_interface_open();
if (xc_handle == -1) {
xch = xc_interface_open(0,0,0);
if (!xch) {
dolog(LOG_ERR, "Failed to open xc handle: %d (%s)",
errno, strerror(errno));
goto out;
......@@ -1124,9 +1123,9 @@ void handle_io(void)
close(log_hv_fd);
log_hv_fd = -1;
}
if (xc_handle != -1) {
xc_interface_close(xc_handle);
xc_handle = -1;
if (xch) {
xc_interface_close(xch);
xch = 0;
}
if (xce_handle != -1) {
xc_evtchn_close(xce_handle);
......
......@@ -38,7 +38,7 @@
#include "utils.h"
struct xs_handle *xs;
int xc;
xc_interface *xc;
static void child_exit(int sig)
{
......@@ -116,8 +116,8 @@ bool xen_setup(void)
goto out;
}
xc = xc_interface_open();
if (xc == -1) {
xc = xc_interface_open(0,0,0);
if (!xc) {
dolog(LOG_ERR, "Failed to contact hypervisor (%m)");
goto out;
}
......@@ -137,7 +137,7 @@ bool xen_setup(void)
out:
if (xs)
xs_daemon_close(xs);
if (xc != -1)
if (xc)
xc_interface_close(xc);
return false;
}
......
......@@ -24,6 +24,7 @@
#include <stdbool.h>
#include <syslog.h>
#include <stdio.h>
#include <xenctrl.h>
#include "xs.h"
......@@ -31,7 +32,7 @@ void daemonize(const char *pidfile);
bool xen_setup(void);
extern struct xs_handle *xs;
extern int xc;
extern xc_interface *xc;
#if 1
#define dolog(val, fmt, ...) do { \
......
......@@ -39,7 +39,7 @@
#define TRACE_ENTER /* printf("enter %s\n", __FUNCTION__) */
static int xc_handle;
static xc_interface *xc_handle;
static inline int
curvcpuid()
......
......@@ -40,7 +40,7 @@
#include <xen/arch-ia64/debug_op.h>
#endif
static int xc_handle = 0;
static xc_interface *xc_handle = 0;
static int domid = 0;
static vcpu_guest_context_t *cur_ctx;
static int cur_vcpu;
......@@ -59,7 +59,7 @@ static int cur_vcpu;
int virt_to_phys (int is_inst, unsigned long vaddr, unsigned long *paddr);
/* wrapper for vcpu_gest_context_any_t */
static int xc_ia64_vcpu_getcontext(int xc_handle,
static int xc_ia64_vcpu_getcontext(xc_interface *xc_handle,
uint32_t domid,
uint32_t vcpu,
vcpu_guest_context_t *ctxt)
......@@ -660,10 +660,10 @@ void print_tr (vcpu_guest_context_t *ctx)
int lock_pages (void *addr, size_t len);
void unlock_pages (void *addr, size_t len);
int do_xen_hypercall (int xc_handle, privcmd_hypercall_t *hypercall);
int do_xen_hypercall (xc_interface *xc_handle, privcmd_hypercall_t *hypercall);
#ifdef HAVE_DEBUG_OP
static int do_ia64_debug_op (int xc_handle,
static int do_ia64_debug_op (xc_interface *xc_handle,
unsigned long cmd, unsigned long domain,
xen_ia64_debug_op_t *op)
{
......@@ -1663,7 +1663,7 @@ void xenitp (int vcpu)
}
}
xc_interface_close (xc_handle);
ret = xc_interface_close (xc_handle);
if (ret < 0) {
perror ("xc_interface_close");
exit (-1);
......
......@@ -20,9 +20,8 @@
#include <stdint.h>
#include <sys/ioctl.h>
#include <libflask.h>
#include <xenctrl.h>
int flask_load(int xc_handle, char *buf, uint32_t size)
int flask_load(xc_interface *xc_handle, char *buf, uint32_t size)
{
int err;
flask_op_t op;
......@@ -37,7 +36,7 @@ int flask_load(int xc_handle, char *buf, uint32_t size)
return 0;
}
int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid)
int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid)
{
int err;
flask_op_t op;
......@@ -54,7 +53,7 @@ int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid)
return 0;
}
int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size)
int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size)
{
int err;
flask_op_t op;
......@@ -71,7 +70,7 @@ int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size)
return 0;
}
int flask_getenforce(int xc_handle)
int flask_getenforce(xc_interface *xc_handle)
{
int err;
flask_op_t op;
......@@ -91,7 +90,7 @@ int flask_getenforce(int xc_handle)
return mode;
}
int flask_setenforce(int xc_handle, int mode)
int flask_setenforce(xc_interface *xc_handle, int mode)
{
int err;
flask_op_t op;
......@@ -110,7 +109,7 @@ int flask_setenforce(int xc_handle, int mode)
return 0;
}
int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext)
int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext)
{
int err;
flask_op_t op;
......@@ -139,7 +138,7 @@ int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext)
}
int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high,
int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
char *scontext)
{
int err;
......@@ -169,7 +168,7 @@ int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high,
}
int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high,
int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
char *scontext)
{
int err;
......@@ -199,7 +198,7 @@ int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high,
}
int flask_add_device(int xc_handle, unsigned long device, char *scontext)
int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext)
{
int err;
flask_op_t op;
......@@ -228,7 +227,7 @@ int flask_add_device(int xc_handle, unsigned long device, char *scontext)
}
int flask_del_pirq(int xc_handle, unsigned int pirq)
int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq)
{
int err;
flask_op_t op;
......@@ -257,7 +256,7 @@ int flask_del_pirq(int xc_handle, unsigned int pirq)
}
int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high)
int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high)
{
int err;
flask_op_t op;
......@@ -286,7 +285,7 @@ int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high)
}
int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high)
int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high)
{
int err;
flask_op_t op;
......@@ -315,7 +314,7 @@ int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high)
}
int flask_del_device(int xc_handle, unsigned long device)
int flask_del_device(xc_interface *xc_handle, unsigned long device)
{
int err;
flask_op_t op;
......@@ -343,7 +342,7 @@ int flask_del_device(int xc_handle, unsigned long device)
}
int flask_access(int xc_handle, const char *scon, const char *tcon,
int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
u_int16_t tclass, u_int32_t req,
u_int32_t *allowed, u_int32_t *decided,
u_int32_t *auditallow, u_int32_t *auditdeny,
......@@ -407,7 +406,7 @@ int flask_access(int xc_handle, const char *scon, const char *tcon,
}
int flask_avc_hashstats(int xc_handle, char *buf, int size)
int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size)
{
int err;
flask_op_t op;
......@@ -425,7 +424,7 @@ int flask_avc_hashstats(int xc_handle, char *buf, int size)
return 0;
}
int flask_avc_cachestats(int xc_handle, char *buf, int size)
int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size)
{
int err;
flask_op_t op;
......@@ -443,7 +442,7 @@ int flask_avc_cachestats(int xc_handle, char *buf, int size)
return 0;
}
int flask_policyvers(int xc_handle, char *buf, int size)
int flask_policyvers(xc_interface *xc_handle, char *buf, int size)
{
int err;
flask_op_t op;
......@@ -461,7 +460,7 @@ int flask_policyvers(int xc_handle, char *buf, int size)
return 0;
}
int flask_getavc_threshold(int xc_handle)
int flask_getavc_threshold(xc_interface *xc_handle)
{
int err;
flask_op_t op;
......@@ -481,7 +480,7 @@ int flask_getavc_threshold(int xc_handle)
return threshold;
}
int flask_setavc_threshold(int xc_handle, int threshold)
int flask_setavc_threshold(xc_interface *xc_handle, int threshold)
{
int err;
flask_op_t op;
......
......@@ -14,32 +14,33 @@
#include <stdint.h>
#include <xen/xen.h>
#include <xen/xsm/flask_op.h>
#include <xenctrl.h>
int flask_load(int xc_handle, char *buf, uint32_t size);
int flask_context_to_sid(int xc_handle, char *buf, uint32_t size, uint32_t *sid);
int flask_sid_to_context(int xc_handle, int sid, char *buf, uint32_t size);
int flask_getenforce(int xc_handle);
int flask_setenforce(int xc_handle, int mode);
int flask_add_pirq(int xc_handle, unsigned int pirq, char *scontext);
int flask_add_ioport(int xc_handle, unsigned long low, unsigned long high,
int flask_load(xc_interface *xc_handle, char *buf, uint32_t size);
int flask_context_to_sid(xc_interface *xc_handle, char *buf, uint32_t size, uint32_t *sid);
int flask_sid_to_context(xc_interface *xc_handle, int sid, char *buf, uint32_t size);
int flask_getenforce(xc_interface *xc_handle);
int flask_setenforce(xc_interface *xc_handle, int mode);
int flask_add_pirq(xc_interface *xc_handle, unsigned int pirq, char *scontext);
int flask_add_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high,
char *scontext);
int flask_add_iomem(int xc_handle, unsigned long low, unsigned long high,
int flask_add_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high,
char *scontext);
int flask_add_device(int xc_handle, unsigned long device, char *scontext);
int flask_del_pirq(int xc_handle, unsigned int pirq);
int flask_del_ioport(int xc_handle, unsigned long low, unsigned long high);
int flask_del_iomem(int xc_handle, unsigned long low, unsigned long high);
int flask_del_device(int xc_handle, unsigned long device);
int flask_access(int xc_handle, const char *scon, const char *tcon,
int flask_add_device(xc_interface *xc_handle, unsigned long device, char *scontext);
int flask_del_pirq(xc_interface *xc_handle, unsigned int pirq);
int flask_del_ioport(xc_interface *xc_handle, unsigned long low, unsigned long high);
int flask_del_iomem(xc_interface *xc_handle, unsigned long low, unsigned long high);
int flask_del_device(xc_interface *xc_handle, unsigned long device);
int flask_access(xc_interface *xc_handle, const char *scon, const char *tcon,
u_int16_t tclass, u_int32_t req,
u_int32_t *allowed, u_int32_t *decided,
u_int32_t *auditallow, u_int32_t *auditdeny,
u_int32_t *seqno);
int flask_avc_cachestats(int xc_handle, char *buf, int size);
int flask_policyvers(int xc_handle, char *buf, int size);
int flask_avc_hashstats(int xc_handle, char *buf, int size);
int flask_getavc_threshold(int xc_handle);
int flask_setavc_threshold(int xc_handle, int threshold);
int flask_avc_cachestats(xc_interface *xc_handle, char *buf, int size);
int flask_policyvers(xc_interface *xc_handle, char *buf, int size);
int flask_avc_hashstats(xc_interface *xc_handle, char *buf, int size);
int flask_getavc_threshold(xc_interface *xc_handle);
int flask_setavc_threshold(xc_interface *xc_handle, int threshold);
#define flask_add_single_ioport(x, l, s) flask_add_ioport(x, l, l, s)
#define flask_add_single_iomem(x, l, s) flask_add_iomem(x, l, l, s)
#define flask_del_single_ioport(x, l) flask_del_ioport(x, l, l)
......
......@@ -27,13 +27,13 @@ static void usage (int argCnt, const char *args[])
int main (int argCnt, const char *args[])
{
int ret;
int xch = 0;
xc_interface *xch = 0;
if (argCnt != 1)
usage(argCnt, args);
xch = xc_interface_open();
if ( xch < 0 )
xch = xc_interface_open(0,0,0);
if ( !xch )
{
fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
strerror(errno));
......
......@@ -35,7 +35,7 @@ int main (int argCnt, const char *args[])
void *polMemCp = NULL;
struct stat info;
int ret;
int xch = 0;
xc_interface *xch = 0;
if (argCnt != 2)
usage(argCnt, args);
......@@ -70,8 +70,8 @@ int main (int argCnt, const char *args[])
goto cleanup;
}
xch = xc_interface_open();
if ( xch < 0 )
xch = xc_interface_open(0,0,0);
if ( !xch )
{
fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
strerror(errno));
......
......@@ -27,15 +27,15 @@ static void usage (int argCnt, const char *args[])
int main (int argCnt, const char *args[])
{
int ret = 0;
int xch = 0;
xc_interface *xch = 0;
long mode = 0;
char *end;
if (argCnt != 2)
usage(argCnt, args);
xch = xc_interface_open();
if ( xch < 0 )
xch = xc_interface_open(0,0,0);
if ( !xch )
{
fprintf(stderr, "Unable to create interface to xenctrl: %s\n",
strerror(errno));
......
......@@ -168,8 +168,9 @@ void terminate_mount_request(struct fs_mount *mount)
}
xenbus_write_backend_state(mount, STATE_CLOSED);
xc_gnttab_munmap(mount->gnth, mount->ring.sring, mount->shared_ring_size);
xc_gnttab_close(mount->gnth);
xc_gnttab_munmap(mount->xch, mount->gnth,
mount->ring.sring, mount->shared_ring_size);
xc_gnttab_close(mount->xch, mount->gnth);
xc_evtchn_unbind(mount->evth, mount->local_evtchn);
xc_evtchn_close(mount->evth);
......@@ -213,6 +214,9 @@ static void handle_connection(int frontend_dom_id, int export_id, char *frontend
mount = (struct fs_mount*)malloc(sizeof(struct fs_mount));
memset(mount, 0, sizeof(struct fs_mount));
mount->xch = xc_interface_open(0,0,XC_OPENFLAG_DUMMY);
if (!mount->xch) goto error;
mount->dom_id = frontend_dom_id;
mount->export = export;
mount->mount_id = mount_id++;
......@@ -239,14 +243,14 @@ static void handle_connection(int frontend_dom_id, int export_id, char *frontend
goto error;
}
mount->gnth = -1;
mount->gnth = xc_gnttab_open();
mount->gnth = xc_gnttab_open(mount->xch);
if (mount->gnth < 0) {
FS_DEBUG("ERROR: Couldn't open gnttab!\n");
goto error;
}
for(i=0; i<mount->shared_ring_size; i++)
dom_ids[i] = mount->dom_id;
sring = xc_gnttab_map_grant_refs(mount->gnth,
sring = xc_gnttab_map_grant_refs(mount->xch, mount->gnth,
mount->shared_ring_size,
dom_ids,
mount->grefs,
......@@ -279,13 +283,16 @@ static void handle_connection(int frontend_dom_id, int export_id, char *frontend
error:
xenbus_write_backend_state(mount, STATE_CLOSED);
if (sring)
xc_gnttab_munmap(mount->gnth, mount->ring.sring, mount->shared_ring_size);
xc_gnttab_munmap(mount->xch, mount->gnth,
mount->ring.sring, mount->shared_ring_size);
if (mount->gnth > 0)
xc_gnttab_close(mount->gnth);
xc_gnttab_close(mount->xch, mount->gnth);
if (mount->local_evtchn > 0)
xc_evtchn_unbind(mount->evth, mount->local_evtchn);
if (mount->evth > 0)
xc_evtchn_close(mount->evth);
if (mount->xch)
xc_interface_close(mount->xch);
}
static void await_connections(void)
......@@ -472,7 +479,7 @@ int main(void)
/* Close the connection to XenStore when we are finished with everything */
xs_daemon_close(xsh);
#if 0
int xc_handle;
xc_interface *xc_handle;
char *shared_page;
int prot = PROT_READ | PROT_WRITE;
......
......@@ -44,6 +44,7 @@ struct fs_mount
int mount_id; /* = backend id */
grant_ref_t grefs[MAX_RING_SIZE];
evtchn_port_t remote_evtchn;
xc_interface *xch; /* just for error logging, so a dummy */
int evth; /* Handle to the event channel */
evtchn_port_t local_evtchn;
int gnth;
......
......@@ -75,7 +75,7 @@ static void dispatch_file_open(struct fs_mount *mount, struct fsif_request *req)
FS_DEBUG("Dispatching file open operation (gref=%d).\n", req->u.fopen.gref);
/* Read the request, and open file */
file_name = xc_gnttab_map_grant_ref(mount->gnth,
file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
mount->dom_id,
req->u.fopen.gref,
PROT_READ);
......@@ -99,7 +99,7 @@ static void dispatch_file_open(struct fs_mount *mount, struct fsif_request *req)
}
}
out:
if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
......@@ -159,7 +159,7 @@ static void dispatch_file_read(struct fs_mount *mount, struct fsif_request *req)
assert(req->u.fread.len > 0);
count = (req->u.fread.len - 1) / XC_PAGE_SIZE + 1;
assert(count <= FSIF_NR_READ_GNTS);
buf = xc_gnttab_map_domain_grant_refs(mount->gnth,
buf = xc_gnttab_map_domain_grant_refs(mount->xch, mount->gnth,
count,
mount->dom_id,
req->u.fread.grefs,
......@@ -192,7 +192,8 @@ static void dispatch_file_read(struct fs_mount *mount, struct fsif_request *req)
priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
if (aio_read(&priv_req->aiocb) < 0) {
FS_DEBUG("ERROR: aio_read failed errno=%d\n", errno);
xc_gnttab_munmap(mount->gnth, priv_req->page, priv_req->count);
xc_gnttab_munmap(mount->xch, mount->gnth,
priv_req->page, priv_req->count);
terminate_mount_request(mount);
}
......@@ -208,7 +209,8 @@ static void end_file_read(struct fs_mount *mount, struct fs_request *priv_req)
uint16_t req_id;
/* Release the grant */
if (xc_gnttab_munmap(mount->gnth, priv_req->page, priv_req->count) != 0) {
if (xc_gnttab_munmap(mount->xch, mount->gnth,
priv_req->page, priv_req->count) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
......@@ -234,7 +236,7 @@ static void dispatch_file_write(struct fs_mount *mount, struct fsif_request *req
assert(req->u.fwrite.len > 0);
count = (req->u.fwrite.len - 1) / XC_PAGE_SIZE + 1;
assert(count <= FSIF_NR_WRITE_GNTS);
buf = xc_gnttab_map_domain_grant_refs(mount->gnth,
buf = xc_gnttab_map_domain_grant_refs(mount->xch, mount->gnth,
count,
mount->dom_id,
req->u.fwrite.grefs,
......@@ -267,7 +269,8 @@ static void dispatch_file_write(struct fs_mount *mount, struct fsif_request *req
priv_req->aiocb.aio_sigevent.sigev_value.sival_ptr = priv_req;
if (aio_write(&priv_req->aiocb) < 0) {
FS_DEBUG("ERROR: aio_write failed errno=%d\n", errno);
xc_gnttab_munmap(mount->gnth, priv_req->page, priv_req->count);
xc_gnttab_munmap(mount->xch, mount->gnth,
priv_req->page, priv_req->count);
terminate_mount_request(mount);
}
......@@ -284,7 +287,8 @@ static void end_file_write(struct fs_mount *mount, struct fs_request *priv_req)
uint16_t req_id;
/* Release the grant */
if (xc_gnttab_munmap(mount->gnth, priv_req->page, priv_req->count) != 0) {
if (xc_gnttab_munmap(mount->xch, mount->gnth,
priv_req->page, priv_req->count) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
......@@ -391,7 +395,7 @@ static void dispatch_remove(struct fs_mount *mount, struct fsif_request *req)
FS_DEBUG("Dispatching remove operation (gref=%d).\n", req->u.fremove.gref);
/* Read the request, and open file */
file_name = xc_gnttab_map_grant_ref(mount->gnth,
file_name = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
mount->dom_id,
req->u.fremove.gref,
PROT_READ);
......@@ -405,7 +409,7 @@ static void dispatch_remove(struct fs_mount *mount, struct fsif_request *req)
ret = remove(file_name);
}
FS_DEBUG("Got ret: %d\n", ret);
if (xc_gnttab_munmap(mount->gnth, file_name, 1) != 0) {
if (xc_gnttab_munmap(mount->xch, mount->gnth, file_name, 1) != 0) {
FS_DEBUG("ERROR: xc_gnttab_munmap failed errno=%d\n", errno);
terminate_mount_request(mount);
}
......@@ -433,7 +437,7 @@ static void dispatch_rename(struct fs_mount *mount, struct fsif_request *req)
FS_DEBUG("Dispatching rename operation (gref=%d).\n", req->u.fremove.gref);
/* Read the request, and open file */
buf = xc_gnttab_map_grant_ref(mount->gnth,
buf = xc_gnttab_map_grant_ref(mount->xch, mount->gnth,
mount->dom_id,
req->u.frename.gref,
PROT_READ);
......@@ -451,7 +455,7 @@ static void dispatch_rename(struct fs_mount *mount, struct fsif_request *req)
ret = rename(old_file_name, new_file_name);
}
FS_DEBUG("Got ret: %d\n", ret);
if (xc_gnttab_munmap(mount->gnth, buf, 1) != 0) {
if (xc_gnttab_munmap(mount->xch, mount->gnth, buf, 1) != 0) {