From: "Jan Beulich" Subject: [PATCH] tmem cleanup Date: Mon, 15 Jun 2009 14:47:06 +0100 Message-ID: <4A366CFA0200007800005B2B@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Content-Disposition: inline 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: dan.magenheimer@oracle.com List-Id: xen-devel@lists.xenproject.org - don't mis-use guest handle for passing an MFN value - eliminate unnecessary (and misplaced) use of XEN_GUEST_HANDLE_64 - use copy_from_guest() instead of __copy_from_guest() for loading the argument structure Signed-off-by: Jan Beulich --- 2009-06-10.orig/xen/common/tmem_xen.c 2009-05-27 13:54:07.0000000= 00 +0200 +++ 2009-06-10/xen/common/tmem_xen.c 2009-06-15 15:00:48.000000000 = +0200 @@ -87,10 +87,7 @@ static inline void *cli_mfn_to_va(tmem_c unsigned long cli_mfn; p2m_type_t t; =20 - - if (is_pv_32on64_vcpu(current)) - cmfn.p =3D (void *)((unsigned long)cmfn.p & 0xffffffffUL); - cli_mfn =3D mfn_x(gfn_to_mfn(current->domain,(unsigned long)cmfn.p,&t)= ); + cli_mfn =3D mfn_x(gfn_to_mfn(current->domain, cmfn, &t)); if (t !=3D p2m_ram_rw) return NULL; if (pcli_mfn !=3D NULL) --- 2009-06-10.orig/xen/include/public/tmem.h 2009-05-27 13:54:07.0000000= 00 +0200 +++ 2009-06-10/xen/include/public/tmem.h 2009-06-15 14:58:25.0000000= 00 +0200 @@ -66,7 +66,7 @@ =20 =20 #ifndef __ASSEMBLY__ -typedef XEN_GUEST_HANDLE(void) tmem_cli_mfn_t; +typedef xen_pfn_t tmem_cli_mfn_t; typedef XEN_GUEST_HANDLE(char) tmem_cli_va_t; struct tmem_op { uint32_t cmd; @@ -95,7 +95,6 @@ struct tmem_op { }; typedef struct tmem_op tmem_op_t; DEFINE_XEN_GUEST_HANDLE(tmem_op_t); -typedef XEN_GUEST_HANDLE_64(tmem_op_t) tmem_cli_op_t; =20 #endif =20 --- 2009-06-10.orig/xen/include/xen/tmem_xen.h 2009-05-27 13:54:07.0000000= 00 +0200 +++ 2009-06-10/xen/include/xen/tmem_xen.h 2009-06-15 15:11:54.0000000= 00 +0200 @@ -281,12 +281,12 @@ static inline bool_t tmh_current_is_priv /* these typedefs are in the public/tmem.h interface typedef XEN_GUEST_HANDLE(void) cli_mfn_t; typedef XEN_GUEST_HANDLE(char) cli_va_t; -typedef XEN_GUEST_HANDLE(tmem_op_t) cli_tmemop_t; */ +typedef XEN_GUEST_HANDLE(tmem_op_t) tmem_cli_op_t; =20 static inline int tmh_get_tmemop_from_client(tmem_op_t *op, tmem_cli_op_t = uops) { - return __copy_from_guest(op, uops, 1); + return copy_from_guest(op, uops, 1); } =20 static inline void tmh_copy_to_client_buf_offset(tmem_cli_va_t clibuf, = int off,