xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ocaml: fix ocaml xc compilation on 32 bit
@ 2010-05-20 12:13 Ian Campbell
  2010-05-20 12:24 ` Christoph Egger
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2010-05-20 12:13 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell

  cc1: warnings being treated as errors
  xc_lib.c: In function 'xc_domain_get_pfn_list':
  xc_lib.c:1217: error: assignment from incompatible pointer type

The XEN_DOMCTL_getmemlist interface has been 32/64 invariante since
13594:30af6cfdb05c and uint64_t is now the correct type for the PFN
list on all word sizes.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc.h
--- a/tools/ocaml/libs/xc/xc.h	Thu May 20 12:44:14 2010 +0100
+++ b/tools/ocaml/libs/xc/xc.h	Thu May 20 13:12:55 2010 +0100
@@ -141,7 +141,7 @@
 int xc_shadow_allocation_set(int handle, unsigned int domid,
 			     uint32_t mb);
 int xc_domain_get_pfn_list(int handle, unsigned int domid,
-                           xen_pfn_t *pfn_array, unsigned long max_pfns);
+                           uint64_t *pfn_array, unsigned long max_pfns);
 int xc_hvm_check_pvdriver(int handle, unsigned int domid);
 
 int xc_domain_assign_device(int handle, unsigned int domid,
diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc_lib.c
--- a/tools/ocaml/libs/xc/xc_lib.c	Thu May 20 12:44:14 2010 +0100
+++ b/tools/ocaml/libs/xc/xc_lib.c	Thu May 20 13:12:55 2010 +0100
@@ -1208,7 +1208,7 @@
 }
 
 int xc_domain_get_pfn_list(int handle, unsigned int domid,
-                           xen_pfn_t *pfn_array, unsigned long max_pfns)
+                           uint64_t *pfn_array, unsigned long max_pfns)
 {
 	int ret;
 	DECLARE_DOMCTL(XEN_DOMCTL_getmemlist, domid);
diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc_stubs.c
--- a/tools/ocaml/libs/xc/xc_stubs.c	Thu May 20 12:44:14 2010 +0100
+++ b/tools/ocaml/libs/xc/xc_stubs.c	Thu May 20 13:12:55 2010 +0100
@@ -952,11 +952,11 @@
 	CAMLlocal2(array, v);
 	unsigned long c_nr_pfns;
 	long ret, i;
-	xen_pfn_t *c_array;
+	uint64_t *c_array;
 
 	c_nr_pfns = Nativeint_val(nr_pfns);
 
-	c_array = malloc(sizeof(xen_pfn_t) * c_nr_pfns);
+	c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
 	if (!c_array)
 		caml_raise_out_of_memory();

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocaml: fix ocaml xc compilation on 32 bit
  2010-05-20 12:13 [PATCH] ocaml: fix ocaml xc compilation on 32 bit Ian Campbell
@ 2010-05-20 12:24 ` Christoph Egger
  2010-05-20 12:56   ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2010-05-20 12:24 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell

On Thursday 20 May 2010 14:13:06 Ian Campbell wrote:
>   cc1: warnings being treated as errors
>   xc_lib.c: In function 'xc_domain_get_pfn_list':
>   xc_lib.c:1217: error: assignment from incompatible pointer type
>
> The XEN_DOMCTL_getmemlist interface has been 32/64 invariante since
> 13594:30af6cfdb05c and uint64_t is now the correct type for the PFN
> list on all word sizes.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
> diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc.h
> --- a/tools/ocaml/libs/xc/xc.h	Thu May 20 12:44:14 2010 +0100
> +++ b/tools/ocaml/libs/xc/xc.h	Thu May 20 13:12:55 2010 +0100
> @@ -141,7 +141,7 @@
>  int xc_shadow_allocation_set(int handle, unsigned int domid,
>  			     uint32_t mb);
>  int xc_domain_get_pfn_list(int handle, unsigned int domid,
> -                           xen_pfn_t *pfn_array, unsigned long max_pfns);
> +                           uint64_t *pfn_array, unsigned long max_pfns);
>  int xc_hvm_check_pvdriver(int handle, unsigned int domid);
>
>  int xc_domain_assign_device(int handle, unsigned int domid,
> diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc_lib.c
> --- a/tools/ocaml/libs/xc/xc_lib.c	Thu May 20 12:44:14 2010 +0100
> +++ b/tools/ocaml/libs/xc/xc_lib.c	Thu May 20 13:12:55 2010 +0100
> @@ -1208,7 +1208,7 @@
>  }
>
>  int xc_domain_get_pfn_list(int handle, unsigned int domid,
> -                           xen_pfn_t *pfn_array, unsigned long max_pfns)
> +                           uint64_t *pfn_array, unsigned long max_pfns)
>  {
>  	int ret;
>  	DECLARE_DOMCTL(XEN_DOMCTL_getmemlist, domid);
> diff -r df369d08f429 -r df09eb0ada11 tools/ocaml/libs/xc/xc_stubs.c
> --- a/tools/ocaml/libs/xc/xc_stubs.c	Thu May 20 12:44:14 2010 +0100
> +++ b/tools/ocaml/libs/xc/xc_stubs.c	Thu May 20 13:12:55 2010 +0100
> @@ -952,11 +952,11 @@
>  	CAMLlocal2(array, v);
>  	unsigned long c_nr_pfns;
>  	long ret, i;
> -	xen_pfn_t *c_array;
> +	uint64_t *c_array;
>
>  	c_nr_pfns = Nativeint_val(nr_pfns);
>
> -	c_array = malloc(sizeof(xen_pfn_t) * c_nr_pfns);
> +	c_array = malloc(sizeof(uint64_t) * c_nr_pfns);

Wouldn't it be better to have here

+	c_array = calloc(c_nr_pfns, sizeof(uint64_t));

?

>  	if (!c_array)
>  		caml_raise_out_of_memory();
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Andrew Bowd, Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocaml: fix ocaml xc compilation on 32 bit
  2010-05-20 12:24 ` Christoph Egger
@ 2010-05-20 12:56   ` Ian Campbell
  2010-05-20 13:13     ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2010-05-20 12:56 UTC (permalink / raw)
  To: Christoph Egger; +Cc: xen-devel@lists.xensource.com

On Thu, 2010-05-20 at 13:24 +0100, Christoph Egger wrote:
> On Thursday 20 May 2010 14:13:06 Ian Campbell wrote:

> > -	c_array = malloc(sizeof(xen_pfn_t) * c_nr_pfns);
> > +	c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
> 
> Wouldn't it be better to have here
> 
> +	c_array = calloc(c_nr_pfns, sizeof(uint64_t));

I suppose so but that would be an unrelated change, please post a patch
if you think it is worth it.

Ian.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ocaml: fix ocaml xc compilation on 32 bit
  2010-05-20 12:56   ` Ian Campbell
@ 2010-05-20 13:13     ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2010-05-20 13:13 UTC (permalink / raw)
  To: Ian Campbell, Christoph Egger; +Cc: xen-devel@lists.xensource.com

On 20/05/2010 13:56, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:

>>> - c_array = malloc(sizeof(xen_pfn_t) * c_nr_pfns);
>>> + c_array = malloc(sizeof(uint64_t) * c_nr_pfns);
>> 
>> Wouldn't it be better to have here
>> 
>> + c_array = calloc(c_nr_pfns, sizeof(uint64_t));
> 
> I suppose so but that would be an unrelated change, please post a patch
> if you think it is worth it.

Who cares either way. calloc() has potential extra overhead for clearing the
memory, which is presumably not required in this case.

 K.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-20 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-20 12:13 [PATCH] ocaml: fix ocaml xc compilation on 32 bit Ian Campbell
2010-05-20 12:24 ` Christoph Egger
2010-05-20 12:56   ` Ian Campbell
2010-05-20 13:13     ` Keir Fraser

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).