[libvirt] [PATCH] openvz: Fix wordsize on 64 bit architectures

The word size there is 64 bit not 8. --- Came across this while browsing the source. O.k. to apply? -- Guido src/openvz/openvz_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index ad4ed74..007f9fe 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 8, + sizeof(int) == 4 ? 32 : 64, NULL, NULL, 0, -- 1.7.10.4

On 17.06.2012 19:18, Guido Günther wrote:
The word size there is 64 bit not 8. --- Came across this while browsing the source. O.k. to apply? -- Guido
src/openvz/openvz_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index ad4ed74..007f9fe 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 8, + sizeof(int) == 4 ? 32 : 64, NULL, NULL, 0,
ACK Michal

On Mon, Jun 18, 2012 at 08:25:32AM +0200, Michal Privoznik wrote:
On 17.06.2012 19:18, Guido Günther wrote:
The word size there is 64 bit not 8. --- Came across this while browsing the source. O.k. to apply? -- Guido
src/openvz/openvz_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index ad4ed74..007f9fe 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 8, + sizeof(int) == 4 ? 32 : 64, NULL, NULL, 0,
ACK Pushed. Thanks. -- Guido

On 06/17/2012 11:18 AM, Guido Günther wrote:
The word size there is 64 bit not 8. --- Came across this while browsing the source. O.k. to apply? -- Guido
src/openvz/openvz_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index ad4ed74..007f9fe 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 8, + sizeof(int) == 4 ? 32 : 64,
Do we ever compile openvz on any platform where sizeof(int) = 4? Shouldn't this really be checking sizeof(long)? -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Mon, Jun 18, 2012 at 03:08:39PM -0600, Eric Blake wrote:
On 06/17/2012 11:18 AM, Guido Günther wrote:
The word size there is 64 bit not 8. --- Came across this while browsing the source. O.k. to apply? -- Guido
src/openvz/openvz_conf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index ad4ed74..007f9fe 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 8, + sizeof(int) == 4 ? 32 : 64,
Do we ever compile openvz on any platform where sizeof(int) = 4? Shouldn't this really be checking sizeof(long)?
Or the actual pointer size? Patch attached. Cheers, -- Guido
-- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 06/19/2012 01:11 AM, Guido Günther wrote:
On Mon, Jun 18, 2012 at 03:08:39PM -0600, Eric Blake wrote:
On 06/17/2012 11:18 AM, Guido Günther wrote:
The word size there is 64 bit not 8.
Do we ever compile openvz on any platform where sizeof(int) = 4? Shouldn't this really be checking sizeof(long)? Or the actual pointer size? Patch attached.
Well, on the new i32 kernel ABI for 64-bit platforms, sizeof(void*)==4 while sizeof(long)==8; on the other hand, for mingw64, sizeof(void*)==8 while sizeof(long)==4. You can't win for all platforms, but for the case of openvz, it seems like we are more likely to be compiled on Linux where sizeof(long) may indeed be the better choice. But I'm okay with your patch to use void*, since the i32 ABI is not popular yet.
+++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 64, + sizeof(void*) == 4 ? 32 : 64,
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 06/19/2012 04:40 PM, Eric Blake wrote:
On 06/19/2012 01:11 AM, Guido Günther wrote:
On Mon, Jun 18, 2012 at 03:08:39PM -0600, Eric Blake wrote:
On 06/17/2012 11:18 AM, Guido Günther wrote:
The word size there is 64 bit not 8.
Do we ever compile openvz on any platform where sizeof(int) = 4? Shouldn't this really be checking sizeof(long)? Or the actual pointer size? Patch attached.
Well, on the new i32 kernel ABI for 64-bit platforms, sizeof(void*)==4 while sizeof(long)==8; on the other hand, for mingw64, sizeof(void*)==8 while sizeof(long)==4. You can't win for all platforms, but for the case of openvz, it seems like we are more likely to be compiled on Linux where sizeof(long) may indeed be the better choice.
But I'm okay with your patch to use void*, since the i32 ABI is not popular yet.
Correction - the x32 ABI; as mentioned here: http://kernelnewbies.org/LinuxChanges#head-ec7868ff102658ddea67d09dcedb4a9cb... has sizeof(long)==4 to match sizeof(void*), so sizeof(void*) is reasonable after all.
+++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 64, + sizeof(void*) == 4 ? 32 : 64,
ACK.
Thus void* really is better than long here. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Tue, Jun 19, 2012 at 04:46:18PM -0600, Eric Blake wrote:
On 06/19/2012 04:40 PM, Eric Blake wrote:
On 06/19/2012 01:11 AM, Guido Günther wrote:
On Mon, Jun 18, 2012 at 03:08:39PM -0600, Eric Blake wrote:
On 06/17/2012 11:18 AM, Guido Günther wrote:
> The word size there is 64 bit not 8.
Do we ever compile openvz on any platform where sizeof(int) = 4? Shouldn't this really be checking sizeof(long)? Or the actual pointer size? Patch attached.
Well, on the new i32 kernel ABI for 64-bit platforms, sizeof(void*)==4 while sizeof(long)==8; on the other hand, for mingw64, sizeof(void*)==8 while sizeof(long)==4. You can't win for all platforms, but for the case of openvz, it seems like we are more likely to be compiled on Linux where sizeof(long) may indeed be the better choice.
But I'm okay with your patch to use void*, since the i32 ABI is not popular yet.
Correction - the x32 ABI; as mentioned here: http://kernelnewbies.org/LinuxChanges#head-ec7868ff102658ddea67d09dcedb4a9cb...
has sizeof(long)==4 to match sizeof(void*), so sizeof(void*) is reasonable after all.
+++ b/src/openvz/openvz_conf.c @@ -195,7 +195,7 @@ virCapsPtr openvzCapsInit(void) if ((guest = virCapabilitiesAddGuest(caps, "exe", utsname.machine, - sizeof(int) == 4 ? 32 : 64, + sizeof(void*) == 4 ? 32 : 64,
ACK.
Thus void* really is better than long here. Pushed. Thanks. -- Guido
participants (3)
-
Eric Blake
-
Guido Günther
-
Michal Privoznik