From: Ian Campbell Subject: [PATCH 06 of 25] libxc: convert watchdog interface over to hypercall buffers Date: Fri, 22 Oct 2010 15:15:48 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com Cc: Ian Campbell List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Ian Campbell # Date 1287756891 -3600 # Node ID ae3069299aaee8067deb74fe678029c29eb15717 # Parent a535e89658c09f6a491213e0f2373de775fbabb1 libxc: convert watchdog interface over to hypercall buffers Signed-off-by: Ian Campbell diff -r a535e89658c0 -r ae3069299aae tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Fri Oct 22 15:14:51 2010 +0100 +++ b/tools/libxc/xc_domain.c Fri Oct 22 15:14:51 2010 +0100 @@ -374,24 +374,25 @@ int xc_watchdog(xc_interface *xch, uint32_t timeout) { int ret = -1; - sched_watchdog_t arg; DECLARE_HYPERCALL; + DECLARE_HYPERCALL_BUFFER(sched_watchdog_t, arg); + + arg = xc_hypercall_buffer_alloc(xch, arg, sizeof(*arg)); + if ( arg == NULL ) + { + PERROR("Could not allocate memory for xc_watchdog hypercall"); + goto out1; + } hypercall.op = __HYPERVISOR_sched_op; hypercall.arg[0] = (unsigned long)SCHEDOP_watchdog; - hypercall.arg[1] = (unsigned long)&arg; - arg.id = id; - arg.timeout = timeout; - - if ( lock_pages(xch, &arg, sizeof(arg)) != 0 ) - { - PERROR("Could not lock memory for Xen hypercall"); - goto out1; - } + hypercall.arg[1] = HYPERCALL_BUFFER_AS_ARG(arg); + arg->id = id; + arg->timeout = timeout; ret = do_xen_hypercall(xch, &hypercall); - unlock_pages(xch, &arg, sizeof(arg)); + xc_hypercall_buffer_free(xch, arg); out1: return ret;