All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts
@ 2010-08-29  9:43 Avi Kivity
  2010-08-29 21:09 ` Alexander Graf
  2010-09-04 10:08 ` Blue Swirl
  0 siblings, 2 replies; 3+ messages in thread
From: Avi Kivity @ 2010-08-29  9:43 UTC (permalink / raw)
  To: Anthony Liguori, qemu-devel

stat() fields can be more or less anything depending on configuration, cast
explicitly to uint64_t to avoid printf() format mismatches.

Signed-off-by: Avi Kivity <avi@redhat.com>
---
 hw/ivshmem.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/ivshmem.c b/hw/ivshmem.c
index bbb5cba..9a61c69 100644
--- a/hw/ivshmem.c
+++ b/hw/ivshmem.c
@@ -351,9 +351,10 @@ static int check_shm_size(IVShmemState *s, int fd) {
     fstat(fd, &buf);
 
     if (s->ivshmem_size > buf.st_size) {
-        fprintf(stderr, "IVSHMEM ERROR: Requested memory size greater");
-        fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n",
-                                          s->ivshmem_size, buf.st_size);
+        fprintf(stderr,
+                "IVSHMEM ERROR: Requested memory size greater"
+                " than shared object size (%" PRIu64 " > %" PRIu64")\n",
+                s->ivshmem_size, (uint64_t)buf.st_size);
         return -1;
     } else {
         return 0;
-- 
1.7.1

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

* Re: [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts
  2010-08-29  9:43 [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts Avi Kivity
@ 2010-08-29 21:09 ` Alexander Graf
  2010-09-04 10:08 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Graf @ 2010-08-29 21:09 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel


On 29.08.2010, at 11:43, Avi Kivity wrote:

> stat() fields can be more or less anything depending on configuration, cast
> explicitly to uint64_t to avoid printf() format mismatches.
> 
> Signed-off-by: Avi Kivity <avi@redhat.com>

I got a very similar patch in my queue:

         fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n",
-                                          s->ivshmem_size, buf.st_size);
+                                          s->ivshmem_size, (ulong)buf.st_size);

But I guess your version is better - it loses less bits :).

Acked-by: Alexander Graf <agraf@suse.de>


Alex

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

* Re: [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts
  2010-08-29  9:43 [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts Avi Kivity
  2010-08-29 21:09 ` Alexander Graf
@ 2010-09-04 10:08 ` Blue Swirl
  1 sibling, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2010-09-04 10:08 UTC (permalink / raw)
  To: Avi Kivity; +Cc: qemu-devel

Thanks, applied.

On Sun, Aug 29, 2010 at 9:43 AM, Avi Kivity <avi@redhat.com> wrote:
> stat() fields can be more or less anything depending on configuration, cast
> explicitly to uint64_t to avoid printf() format mismatches.
>
> Signed-off-by: Avi Kivity <avi@redhat.com>
> ---
>  hw/ivshmem.c |    7 ++++---
>  1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ivshmem.c b/hw/ivshmem.c
> index bbb5cba..9a61c69 100644
> --- a/hw/ivshmem.c
> +++ b/hw/ivshmem.c
> @@ -351,9 +351,10 @@ static int check_shm_size(IVShmemState *s, int fd) {
>     fstat(fd, &buf);
>
>     if (s->ivshmem_size > buf.st_size) {
> -        fprintf(stderr, "IVSHMEM ERROR: Requested memory size greater");
> -        fprintf(stderr, " than shared object size (%" PRIu64 " > %ld)\n",
> -                                          s->ivshmem_size, buf.st_size);
> +        fprintf(stderr,
> +                "IVSHMEM ERROR: Requested memory size greater"
> +                " than shared object size (%" PRIu64 " > %" PRIu64")\n",
> +                s->ivshmem_size, (uint64_t)buf.st_size);
>         return -1;
>     } else {
>         return 0;
> --
> 1.7.1
>
>
>

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

end of thread, other threads:[~2010-09-04 10:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-29  9:43 [Qemu-devel] [PATCH] Fix ivshmem build on 32-bit hosts Avi Kivity
2010-08-29 21:09 ` Alexander Graf
2010-09-04 10:08 ` Blue Swirl

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.