Skip to contentSkip to conversation

timer.c: Cast time value so that it has the correct type

PATCH In review Ian Jackson 3 participants 3 messages Aug 19, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 timer.c: Cast time value so that it has the correct type

We'd prefer to avoid PRI macros in xen itself, so instead we cast the value to long to match the printf format. Without this, the build fails on some compilers.

xen/common/timer.c +1 -1
diff -r a05a2d559931 xen/common/timer.c
@@ -500,7 +500,7 @@ static void dump_timer(struct timer *t, 
 static void dump_timer(struct timer *t, s_time_t now)
 {
     printk("  ex=%8ldus timer=%p cb=%p(%p)",
-           (t->expires - now) / 1000, t, t->function, t->data);
+           (long)((t->expires - now) / 1000), t, t->function, t->data);
     print_symbol(" %s\n", (unsigned long)t->function);
 }
#1 lore raw
Quoted 1 line · Ian Jackson

We'd prefer to avoid PRI macros in xen itself

I don't think we would; we even define a bunch of our own. :)

Quoted 3 lines

, so instead we cast the
value to long to match the printf format. Without this, the build fails on some compilers.

This is the wrong fix; on PAE builds the value will be truncated from 64 bits to 32.

Cheers,

Tim.

Quoted 19 lines

diff -r a05a2d559931 xen/common/timer.c

xen/common/timer.c +1 -1
@@ -500,7 +500,7 @@ static void dump_timer(struct timer *t, 
 static void dump_timer(struct timer *t, s_time_t now)
 {
     printk("  ex=%8ldus timer=%p cb=%p(%p)",
-           (t->expires - now) / 1000, t, t->function, t->data);
+           (long)((t->expires - now) / 1000), t, t->function, t->data);
     print_symbol(" %s\n", (unsigned long)t->function);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#2 lore raw

This is my mistake, I'll do a patch to use the appropriate PRI macro.

-- Keir

Quoted 35 lines · Tim Deegan
Quoted 1 line · Ian Jackson

We'd prefer to avoid PRI macros in xen itself

I don't think we would; we even define a bunch of our own. :)

Quoted 3 lines

, so instead we cast the
value to long to match the printf format. Without this, the build fails on some compilers.

This is the wrong fix; on PAE builds the value will be truncated from 64 bits to 32.

Cheers,

Tim.

Quoted 19 lines

diff -r a05a2d559931 xen/common/timer.c

xen/common/timer.c Thu Aug 19 15:12:36 2010 +0100 renamed from xen/common/timer.c Thu Aug 19 14:46:32 2010 +0100 +1 -1
@@ -500,7 +500,7 @@ static void dump_timer(struct timer *t,
 static void dump_timer(struct timer *t, s_time_t now)
 {
     printk("  ex=%8ldus timer=%p cb=%p(%p)",
-           (t->expires - now) / 1000, t, t->function, t->data);
+           (long)((t->expires - now) / 1000), t, t->function, t->data);
     print_symbol(" %s\n", (unsigned long)t->function);
 }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel