From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Deegan Subject: Re: [PATCH 4/5] xen: Enforce casting for guest_handle_cast Date: Thu, 14 Jun 2012 15:27:51 +0100 Message-ID: <20120614142751.GF90181@ocelot.phlegethon.org> References: <1338476832-26653-1-git-send-email-jean.guyader@citrix.com> <1338476832-26653-5-git-send-email-jean.guyader@citrix.com> <4FC7AEBD020000780008774C@nat28.tlf.novell.com> <20120614140815.GB22025@spongy> <20120614142614.GE90181@ocelot.phlegethon.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20120614142614.GE90181@ocelot.phlegethon.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jean Guyader Cc: Jan Beulich , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org At 15:26 +0100 on 14 Jun (1339687574), Tim Deegan wrote: > At 15:08 +0100 on 14 Jun (1339686495), Jean Guyader wrote: > > Maybe I should put here the reason that led me to do something > > like that. Here is what I'm trying to do: > > > > XEN_GUEST_HANDLE (uint8_t) slop_hnd = > > guest_handle_cast (pfn_list_hnd, uint8_t); > > guest_handle_add_offset (slop_hnd, sizeof (v4v_pfn_list_t)); > > pfn_hnd = guest_handle_cast (slop_hnd, v4v_pfn_t); > > > > I need to cast to uint8_t first to get the add_offset to behave > > correctly. Maybe what I need would need a new macro that would > > do those two operations. > > > > What would be the proper way to doing something like this? > > You could avoid it altogether by dropping struct v4v_ring_data, and > passing a v4v_pfn_t array directly with the 'npage' as a separate > hypercall argument. AFAICS struct v4v_ring_data has no other useful > fields. Excuse me, I meant struct v4v_pfn_list_t. Tim.