[libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE

Ján Tomko posted 2 patches 6 years, 2 months ago
[libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE
Posted by Ján Tomko 6 years, 2 months ago
Use this GLib macro instead of bswap_32 from gnulib.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/qemu/qemu_driver.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c969a3d463..85b0c9cb79 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2803,11 +2803,11 @@ struct _virQEMUSaveData {
 static inline void
 bswap_header(virQEMUSaveHeaderPtr hdr)
 {
-    hdr->version = bswap_32(hdr->version);
-    hdr->data_len = bswap_32(hdr->data_len);
-    hdr->was_running = bswap_32(hdr->was_running);
-    hdr->compressed = bswap_32(hdr->compressed);
-    hdr->cookieOffset = bswap_32(hdr->cookieOffset);
+    hdr->version = GUINT32_SWAP_LE_BE(hdr->version);
+    hdr->data_len = GUINT32_SWAP_LE_BE(hdr->data_len);
+    hdr->was_running = GUINT32_SWAP_LE_BE(hdr->was_running);
+    hdr->compressed = GUINT32_SWAP_LE_BE(hdr->compressed);
+    hdr->cookieOffset = GUINT32_SWAP_LE_BE(hdr->cookieOffset);
 }
 
 
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE
Posted by Daniel P. Berrangé 6 years, 2 months ago
On Wed, Nov 13, 2019 at 10:33:09AM +0100, Ján Tomko wrote:
> Use this GLib macro instead of bswap_32 from gnulib.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/qemu/qemu_driver.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Missing bootstrap.conf change to remove byteswap


> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index c969a3d463..85b0c9cb79 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -2803,11 +2803,11 @@ struct _virQEMUSaveData {
>  static inline void
>  bswap_header(virQEMUSaveHeaderPtr hdr)
>  {
> -    hdr->version = bswap_32(hdr->version);
> -    hdr->data_len = bswap_32(hdr->data_len);
> -    hdr->was_running = bswap_32(hdr->was_running);
> -    hdr->compressed = bswap_32(hdr->compressed);
> -    hdr->cookieOffset = bswap_32(hdr->cookieOffset);
> +    hdr->version = GUINT32_SWAP_LE_BE(hdr->version);
> +    hdr->data_len = GUINT32_SWAP_LE_BE(hdr->data_len);
> +    hdr->was_running = GUINT32_SWAP_LE_BE(hdr->was_running);
> +    hdr->compressed = GUINT32_SWAP_LE_BE(hdr->compressed);
> +    hdr->cookieOffset = GUINT32_SWAP_LE_BE(hdr->cookieOffset);
>  }

Also needs to remove byteswap.h include file


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE
Posted by Peter Krempa 6 years, 2 months ago
On Wed, Nov 13, 2019 at 10:38:06 +0000, Daniel Berrange wrote:
> On Wed, Nov 13, 2019 at 10:33:09AM +0100, Ján Tomko wrote:
> > Use this GLib macro instead of bswap_32 from gnulib.
> > 
> > Signed-off-by: Ján Tomko <jtomko@redhat.com>
> > ---
> >  src/qemu/qemu_driver.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> Missing bootstrap.conf change to remove byteswap

I queued this to my branch for bootstrap.conf changes.

> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index c969a3d463..85b0c9cb79 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -2803,11 +2803,11 @@ struct _virQEMUSaveData {
> >  static inline void
> >  bswap_header(virQEMUSaveHeaderPtr hdr)
> >  {
> > -    hdr->version = bswap_32(hdr->version);
> > -    hdr->data_len = bswap_32(hdr->data_len);
> > -    hdr->was_running = bswap_32(hdr->was_running);
> > -    hdr->compressed = bswap_32(hdr->compressed);
> > -    hdr->cookieOffset = bswap_32(hdr->cookieOffset);
> > +    hdr->version = GUINT32_SWAP_LE_BE(hdr->version);
> > +    hdr->data_len = GUINT32_SWAP_LE_BE(hdr->data_len);
> > +    hdr->was_running = GUINT32_SWAP_LE_BE(hdr->was_running);
> > +    hdr->compressed = GUINT32_SWAP_LE_BE(hdr->compressed);
> > +    hdr->cookieOffset = GUINT32_SWAP_LE_BE(hdr->cookieOffset);
> >  }
> 
> Also needs to remove byteswap.h include file

.. so with the above addressed:

Reviewed-by: Peter Krempa <pkrempa@redhat.com>

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE
Posted by Peter Krempa 6 years, 2 months ago
On Wed, Nov 13, 2019 at 10:38:06 +0000, Daniel Berrange wrote:
> On Wed, Nov 13, 2019 at 10:33:09AM +0100, Ján Tomko wrote:
> > Use this GLib macro instead of bswap_32 from gnulib.
> > 
> > Signed-off-by: Ján Tomko <jtomko@redhat.com>
> > ---
> >  src/qemu/qemu_driver.c | 10 +++++-----
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> Missing bootstrap.conf change to remove byteswap

We had a chat in person and we agreed to try to get rid of as much of
the modules as possible by doing a "kill one gnulib module a day"
initiative at the office.

Since bootstrap changes are very invasive for incremental builds I
pledge that I'll collect them in a branch and push all outstanding ones
once a week to minimize bootstrap churn. I'll specify the branch in my
patches.

Thus bootstrap.conf changes should be kept separate.

> 
> 
> > diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> > index c969a3d463..85b0c9cb79 100644
> > --- a/src/qemu/qemu_driver.c
> > +++ b/src/qemu/qemu_driver.c
> > @@ -2803,11 +2803,11 @@ struct _virQEMUSaveData {
> >  static inline void
> >  bswap_header(virQEMUSaveHeaderPtr hdr)
> >  {
> > -    hdr->version = bswap_32(hdr->version);
> > -    hdr->data_len = bswap_32(hdr->data_len);
> > -    hdr->was_running = bswap_32(hdr->was_running);
> > -    hdr->compressed = bswap_32(hdr->compressed);
> > -    hdr->cookieOffset = bswap_32(hdr->cookieOffset);
> > +    hdr->version = GUINT32_SWAP_LE_BE(hdr->version);
> > +    hdr->data_len = GUINT32_SWAP_LE_BE(hdr->data_len);
> > +    hdr->was_running = GUINT32_SWAP_LE_BE(hdr->was_running);
> > +    hdr->compressed = GUINT32_SWAP_LE_BE(hdr->compressed);
> > +    hdr->cookieOffset = GUINT32_SWAP_LE_BE(hdr->cookieOffset);
> >  }
> 
> Also needs to remove byteswap.h include file

This can be done in this patch though.

> 
> 
> Regards,
> Daniel
> -- 
> |: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
> |: https://libvirt.org         -o-            https://fstop138.berrange.com :|
> |: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
> 
> --
> libvir-list mailing list
> libvir-list@redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 2/2] qemu: use GUINT32_SWAP_LE_BE
Posted by Daniel P. Berrangé 6 years, 2 months ago
On Wed, Nov 13, 2019 at 12:44:57PM +0100, Peter Krempa wrote:
> On Wed, Nov 13, 2019 at 10:38:06 +0000, Daniel Berrange wrote:
> > On Wed, Nov 13, 2019 at 10:33:09AM +0100, Ján Tomko wrote:
> > > Use this GLib macro instead of bswap_32 from gnulib.
> > > 
> > > Signed-off-by: Ján Tomko <jtomko@redhat.com>
> > > ---
> > >  src/qemu/qemu_driver.c | 10 +++++-----
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > Missing bootstrap.conf change to remove byteswap
> 
> We had a chat in person and we agreed to try to get rid of as much of
> the modules as possible by doing a "kill one gnulib module a day"
> initiative at the office.

FYI, most(all?) of the gnulib modules related to sockets/FDs will
need to be killed off in a single group, since they're all intertwined
to deal with the Windows HANDLE vs FD wrapping GNULIB does.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list