* [Qemu-devel] [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
@ 2010-05-27 10:22 Jes.Sorensen
2010-05-27 10:44 ` [Qemu-devel] " Michael S. Tsirkin
0 siblings, 1 reply; 7+ messages in thread
From: Jes.Sorensen @ 2010-05-27 10:22 UTC (permalink / raw)
To: qemu-devel; +Cc: blauwirbel, Jes Sorensen
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
The format statement expects unsigned long on x86_64, but receives
unsigned long long, so gcc exits with an error.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
hw/vhost_net.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 26dae79..606aa0c 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -100,7 +100,7 @@ struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
}
if (~net->dev.features & net->dev.backend_features) {
fprintf(stderr, "vhost lacks feature mask %" PRIu64 " for backend\n",
- ~net->dev.features & net->dev.backend_features);
+ (uint64_t)(~net->dev.features & net->dev.backend_features));
vhost_dev_cleanup(&net->dev);
goto fail;
}
--
1.6.5.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:22 [Qemu-devel] [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2 Jes.Sorensen
@ 2010-05-27 10:44 ` Michael S. Tsirkin
2010-05-27 10:55 ` Jes Sorensen
0 siblings, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2010-05-27 10:44 UTC (permalink / raw)
To: Jes.Sorensen; +Cc: blauwirbel, qemu-devel
On Thu, May 27, 2010 at 12:22:29PM +0200, Jes.Sorensen@redhat.com wrote:
> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
>
> The format statement expects unsigned long on x86_64, but receives
> unsigned long long, so gcc exits with an error.
>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
should just be reverted. We have unsigned long, it should be printed
woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
> ---
> hw/vhost_net.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/vhost_net.c b/hw/vhost_net.c
> index 26dae79..606aa0c 100644
> --- a/hw/vhost_net.c
> +++ b/hw/vhost_net.c
> @@ -100,7 +100,7 @@ struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
> }
> if (~net->dev.features & net->dev.backend_features) {
> fprintf(stderr, "vhost lacks feature mask %" PRIu64 " for backend\n",
> - ~net->dev.features & net->dev.backend_features);
> + (uint64_t)(~net->dev.features & net->dev.backend_features));
> vhost_dev_cleanup(&net->dev);
> goto fail;
> }
How about just (untested):
vhost: fix build broken by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
revert over-zealous PRIu64 conversion from
0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Does this help?
diff --git a/hw/vhost_net.c b/hw/vhost_net.c
index 26dae79..2e292ee 100644
--- a/hw/vhost_net.c
+++ b/hw/vhost_net.c
@@ -99,7 +99,7 @@ struct vhost_net *vhost_net_init(VLANClientState *backend, int devfd)
goto fail;
}
if (~net->dev.features & net->dev.backend_features) {
- fprintf(stderr, "vhost lacks feature mask %" PRIu64 " for backend\n",
+ fprintf(stderr, "vhost lacks feature mask %llu for backend\n",
~net->dev.features & net->dev.backend_features);
vhost_dev_cleanup(&net->dev);
goto fail;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:44 ` [Qemu-devel] " Michael S. Tsirkin
@ 2010-05-27 10:55 ` Jes Sorensen
2010-05-27 10:53 ` Michael S. Tsirkin
2010-05-27 10:54 ` Michael S. Tsirkin
0 siblings, 2 replies; 7+ messages in thread
From: Jes Sorensen @ 2010-05-27 10:55 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: blauwirbel, qemu-devel
On 05/27/10 12:44, Michael S. Tsirkin wrote:
> On Thu, May 27, 2010 at 12:22:29PM +0200, Jes.Sorensen@redhat.com wrote:
>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>
>> Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
>>
>> The format statement expects unsigned long on x86_64, but receives
>> unsigned long long, so gcc exits with an error.
>>
>> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
> should just be reverted. We have unsigned long, it should be printed
> woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
That is an option too. Problem is just that unsigned long is 32 bit on
32 bit systems and Windows (even for 64 bit) so if we need more flags we
need to be careful with it.
Cheers,
Jes
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:55 ` Jes Sorensen
@ 2010-05-27 10:53 ` Michael S. Tsirkin
2010-05-27 10:59 ` Jes Sorensen
2010-05-27 10:54 ` Michael S. Tsirkin
1 sibling, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2010-05-27 10:53 UTC (permalink / raw)
To: Jes Sorensen; +Cc: blauwirbel, qemu-devel
On Thu, May 27, 2010 at 12:55:49PM +0200, Jes Sorensen wrote:
> On 05/27/10 12:44, Michael S. Tsirkin wrote:
> > On Thu, May 27, 2010 at 12:22:29PM +0200, Jes.Sorensen@redhat.com wrote:
> >> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> >>
> >> Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
> >>
> >> The format statement expects unsigned long on x86_64, but receives
> >> unsigned long long, so gcc exits with an error.
> >>
> >> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> >
> > I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
> > should just be reverted. We have unsigned long, it should be printed
> > woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
>
> That is an option too. Problem is just that unsigned long is 32 bit on
> 32 bit systems and Windows (even for 64 bit) so if we need more flags we
> need to be careful with it.
>
> Cheers,
> Jes
I don't understand, sorry.
This field is unsigned long long, not unsigned long.
%ll will print unsigned long long
for any standard printf, whatever its length.
--
MST
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:53 ` Michael S. Tsirkin
@ 2010-05-27 10:59 ` Jes Sorensen
0 siblings, 0 replies; 7+ messages in thread
From: Jes Sorensen @ 2010-05-27 10:59 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: blauwirbel, qemu-devel
On 05/27/10 12:53, Michael S. Tsirkin wrote:
> On Thu, May 27, 2010 at 12:55:49PM +0200, Jes Sorensen wrote:
>> On 05/27/10 12:44, Michael S. Tsirkin wrote:
>>> I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
>>> should just be reverted. We have unsigned long, it should be printed
>>> woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
>>
>> That is an option too. Problem is just that unsigned long is 32 bit on
>> 32 bit systems and Windows (even for 64 bit) so if we need more flags we
>> need to be careful with it.
>>
>> Cheers,
>> Jes
>
> I don't understand, sorry.
> This field is unsigned long long, not unsigned long.
> %ll will print unsigned long long
> for any standard printf, whatever its length.
Ah ok, if the field is long long, then your patch should be just fine. I
hadn't checked that was the case.
Cheers,
Jes
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:55 ` Jes Sorensen
2010-05-27 10:53 ` Michael S. Tsirkin
@ 2010-05-27 10:54 ` Michael S. Tsirkin
2010-05-27 11:04 ` Jes Sorensen
1 sibling, 1 reply; 7+ messages in thread
From: Michael S. Tsirkin @ 2010-05-27 10:54 UTC (permalink / raw)
To: Jes Sorensen; +Cc: blauwirbel, qemu-devel
On Thu, May 27, 2010 at 12:55:49PM +0200, Jes Sorensen wrote:
> On 05/27/10 12:44, Michael S. Tsirkin wrote:
> > On Thu, May 27, 2010 at 12:22:29PM +0200, Jes.Sorensen@redhat.com wrote:
> >> From: Jes Sorensen <Jes.Sorensen@redhat.com>
> >>
> >> Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
> >>
> >> The format statement expects unsigned long on x86_64, but receives
> >> unsigned long long, so gcc exits with an error.
> >>
> >> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> >
> > I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
> > should just be reverted. We have unsigned long, it should be printed
> > woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
>
> That is an option too.
More importantly does this fix the problem for you?
> Problem is just that unsigned long is 32 bit on
> 32 bit systems and Windows (even for 64 bit) so if we need more flags we
> need to be careful with it.
>
> Cheers,
> Jes
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Qemu-devel] Re: [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
2010-05-27 10:54 ` Michael S. Tsirkin
@ 2010-05-27 11:04 ` Jes Sorensen
0 siblings, 0 replies; 7+ messages in thread
From: Jes Sorensen @ 2010-05-27 11:04 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: blauwirbel, qemu-devel
On 05/27/10 12:54, Michael S. Tsirkin wrote:
> On Thu, May 27, 2010 at 12:55:49PM +0200, Jes Sorensen wrote:
>> On 05/27/10 12:44, Michael S. Tsirkin wrote:
>>> On Thu, May 27, 2010 at 12:22:29PM +0200, Jes.Sorensen@redhat.com wrote:
>>>> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>>>>
>>>> Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
>>>>
>>>> The format statement expects unsigned long on x86_64, but receives
>>>> unsigned long long, so gcc exits with an error.
>>>>
>>>> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
>>>
>>> I think this part of 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2
>>> should just be reverted. We have unsigned long, it should be printed
>>> woith %ll. Casting to uint64_t just so we can print with PRIu64 seems silly.
>>
>> That is an option too.
>
> More importantly does this fix the problem for you?
Yes it works fine.
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-05-27 11:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-27 10:22 [Qemu-devel] [PATCH] vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3f5c5679cc7d0165a0a1822e2f60de2 Jes.Sorensen
2010-05-27 10:44 ` [Qemu-devel] " Michael S. Tsirkin
2010-05-27 10:55 ` Jes Sorensen
2010-05-27 10:53 ` Michael S. Tsirkin
2010-05-27 10:59 ` Jes Sorensen
2010-05-27 10:54 ` Michael S. Tsirkin
2010-05-27 11:04 ` Jes Sorensen
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).