All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix tool pygrub build on x64
@ 2005-05-16 19:15 Jerone Young
  2005-05-16 21:13 ` Vincent Hanquez
  0 siblings, 1 reply; 6+ messages in thread
From: Jerone Young @ 2005-05-16 19:15 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

This fixes tool pygrub to build on x86-64 systems. Currently gcc is
saying there are incompatible pointer type passed into function
ext2fs_file_read. The address of variable n is used in ext2fs_file_read
which takes an "unsigned int *" as the 4th variable. "n" is currently
declared as an "size_t" which is an "int". This declares n as an
"unsigned int" instead of using type "size_t".

-- 
Jerone Young
IBM Linux Technology Center
jyoung5@us.ibm.com
512-838-1157 (T/L: 678-1157)

[-- Attachment #2: pygrub_x64_patch.diff --]
[-- Type: text/x-patch, Size: 399 bytes --]

--- tools/pygrub/src/fsys/ext2/ext2module.c.orig	2005-05-16 13:41:31.833244872 -0500
+++ tools/pygrub/src/fsys/ext2/ext2module.c	2005-05-16 13:49:44.573336992 -0500
@@ -55,7 +55,7 @@ static PyObject *
 ext2_file_read (Ext2File *file, PyObject *args)
 {
     int err, size = 0;
-    size_t n, total = 0;
+    unsigned int n, total = 0;
     PyObject * buffer = NULL;
 
     if (file->file == NULL) {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH] fix tool pygrub build on x64
  2005-05-16 19:15 [PATCH] fix tool pygrub build on x64 Jerone Young
@ 2005-05-16 21:13 ` Vincent Hanquez
  2005-05-16 21:22   ` Jerone Young
  2005-05-16 21:28   ` Jerone Young
  0 siblings, 2 replies; 6+ messages in thread
From: Vincent Hanquez @ 2005-05-16 21:13 UTC (permalink / raw)
  To: Jerone Young; +Cc: xen-devel

On Mon, May 16, 2005 at 02:15:33PM -0500, Jerone Young wrote:
> This fixes tool pygrub to build on x86-64 systems. Currently gcc is
> saying there are incompatible pointer type passed into function
> ext2fs_file_read. The address of variable n is used in ext2fs_file_read
> which takes an "unsigned int *" as the 4th variable. "n" is currently
> declared as an "size_t" which is an "int". This declares n as an
> "unsigned int" instead of using type "size_t".

size_t is "unsigned long" not "int"

-- 
Vincent Hanquez

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

* Re: [PATCH] fix tool pygrub build on x64
  2005-05-16 21:13 ` Vincent Hanquez
@ 2005-05-16 21:22   ` Jerone Young
  2005-05-16 21:33     ` Vincent Hanquez
  2005-05-16 21:28   ` Jerone Young
  1 sibling, 1 reply; 6+ messages in thread
From: Jerone Young @ 2005-05-16 21:22 UTC (permalink / raw)
  To: Vincent Hanquez; +Cc: xen-devel

Maybe on i386 but not x86-64.

On Mon, 2005-05-16 at 23:13 +0200, Vincent Hanquez wrote:
> On Mon, May 16, 2005 at 02:15:33PM -0500, Jerone Young wrote:
> > This fixes tool pygrub to build on x86-64 systems. Currently gcc is
> > saying there are incompatible pointer type passed into function
> > ext2fs_file_read. The address of variable n is used in ext2fs_file_read
> > which takes an "unsigned int *" as the 4th variable. "n" is currently
> > declared as an "size_t" which is an "int". This declares n as an
> > "unsigned int" instead of using type "size_t".
> 
> size_t is "unsigned long" not "int"
> 
-- 
Jerone Young
IBM Linux Technology Center
jyoung5@us.ibm.com
512-838-1157 (T/L: 678-1157)

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

* Re: [PATCH] fix tool pygrub build on x64
  2005-05-16 21:13 ` Vincent Hanquez
  2005-05-16 21:22   ` Jerone Young
@ 2005-05-16 21:28   ` Jerone Young
  2005-05-16 21:43     ` Vincent Hanquez
  1 sibling, 1 reply; 6+ messages in thread
From: Jerone Young @ 2005-05-16 21:28 UTC (permalink / raw)
  To: Vincent Hanquez; +Cc: xen-devel

Ok,
	To better followup my findings you will see that size_t is of type
__kernel_size_t. On i386 in "asm-i386/posix_types.h" you have:
typedef unsigned int    __kernel_size_t;

Where as on x86-64 you in "asm-x86_64/posix_types.h" you have:

typedef unsigned long   __kernel_size_t;

I must have typed "unsigned int" by accident. Sorry. But the fix is
still valid.

Where as in 
On Mon, 2005-05-16 at 23:13 +0200, Vincent Hanquez wrote:
> On Mon, May 16, 2005 at 02:15:33PM -0500, Jerone Young wrote:
> > This fixes tool pygrub to build on x86-64 systems. Currently gcc is
> > saying there are incompatible pointer type passed into function
> > ext2fs_file_read. The address of variable n is used in ext2fs_file_read
> > which takes an "unsigned int *" as the 4th variable. "n" is currently
> > declared as an "size_t" which is an "int". This declares n as an
> > "unsigned int" instead of using type "size_t".
> 
> size_t is "unsigned long" not "int"
> 
-- 
Jerone Young
IBM Linux Technology Center
jyoung5@us.ibm.com
512-838-1157 (T/L: 678-1157)

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

* Re: [PATCH] fix tool pygrub build on x64
  2005-05-16 21:22   ` Jerone Young
@ 2005-05-16 21:33     ` Vincent Hanquez
  0 siblings, 0 replies; 6+ messages in thread
From: Vincent Hanquez @ 2005-05-16 21:33 UTC (permalink / raw)
  To: Jerone Young; +Cc: xen-devel, Vincent Hanquez

On Mon, May 16, 2005 at 04:22:33PM -0500, Jerone Young wrote:
> Maybe on i386 but not x86-64.

you can just try the following program and prove that size_t is an
unsigned long:

int main(int argc, char **argv) { printf("%d\n", sizeof(size_t)); }

-- 
Vincent Hanquez

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

* Re: [PATCH] fix tool pygrub build on x64
  2005-05-16 21:28   ` Jerone Young
@ 2005-05-16 21:43     ` Vincent Hanquez
  0 siblings, 0 replies; 6+ messages in thread
From: Vincent Hanquez @ 2005-05-16 21:43 UTC (permalink / raw)
  To: Jerone Young; +Cc: xen-devel, Vincent Hanquez

On Mon, May 16, 2005 at 04:28:03PM -0500, Jerone Young wrote:
> I must have typed "unsigned int" by accident. Sorry. But the fix is
> still valid.

sure. I was just nit picking.

-- 
Vincent Hanquez

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

end of thread, other threads:[~2005-05-16 21:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-16 19:15 [PATCH] fix tool pygrub build on x64 Jerone Young
2005-05-16 21:13 ` Vincent Hanquez
2005-05-16 21:22   ` Jerone Young
2005-05-16 21:33     ` Vincent Hanquez
2005-05-16 21:28   ` Jerone Young
2005-05-16 21:43     ` Vincent Hanquez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.