From: Boris Ostrovsky Subject: [PATCH v8 4/5] libxc: Provide set_xen_guest_handle_offset macro Date: Wed, 6 May 2015 14:15:01 -0400 Message-ID: <1430936102-3465-5-git-send-email-boris.ostrovsky@oracle.com> References: <1430936102-3465-1-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1430936102-3465-1-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: ian.jackson@eu.citrix.com, ian.campbell@citrix.com, wei.liu2@citrix.com, stefano.stabellini@eu.citrix.com, dgdegra@tycho.nsa.gov, jbeulich@suse.com, andrew.cooper3@citrix.com, keir@xen.org Cc: elena.ufimtseva@oracle.com, dario.faggioli@citrix.com, boris.ostrovsky@oracle.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org Add set_xen_guest_handle_offset() macro that can be used for setting xen_guest_handle to an offset into hypercall buffer. Signed-off-by: Boris Ostrovsky --- tools/libxc/include/xenctrl.h | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 8c8eae6..4e6f62c 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -322,16 +322,21 @@ typedef struct xc_hypercall_buffer xc_hypercall_buffer_t; * Set a xen_guest_handle in a type safe manner, ensuring that the * data pointer has been correctly allocated. */ -#undef set_xen_guest_handle -#define set_xen_guest_handle(_hnd, _val) \ +#undef set_xen_guest_handle_offset +#define set_xen_guest_handle_offset(_hnd, _val, _off) \ do { \ xc_hypercall_buffer_t _hcbuf_hnd1; \ typeof(XC__HYPERCALL_BUFFER_NAME(_val)) *_hcbuf_hnd2 = \ HYPERCALL_BUFFER(_val); \ (void) (&_hcbuf_hnd1 == _hcbuf_hnd2); \ - set_xen_guest_handle_raw(_hnd, (_hcbuf_hnd2)->hbuf); \ + set_xen_guest_handle_raw(_hnd, \ + (_hcbuf_hnd2)->hbuf + (_off)); \ } while (0) +#undef set_xen_guest_handle +#define set_xen_guest_handle(_hnd, _val) \ + set_xen_guest_handle_offset(_hnd, _val, 0) + /* Use with set_xen_guest_handle in place of NULL */ extern xc_hypercall_buffer_t XC__HYPERCALL_BUFFER_NAME(HYPERCALL_BUFFER_NULL); -- 1.7.1