[libvirt] [dbus RFC PATCH 0/6] Remove all enum->string and string->enum code

Katerina Koukiou posted 6 patches 5 years, 11 months ago
Failed in applying to current master (apply log)
There is a newer version of this series
data/org.libvirt.Connect.xml |   6 +-
data/org.libvirt.Domain.xml  |  14 ++--
data/org.libvirt.Network.xml |   6 +-
src/connect.c                |  18 +----
src/domain.c                 | 172 ++++---------------------------------------
src/events.c                 |  40 +---------
src/network.c                |  66 +----------------
src/util.c                   |  27 -------
src/util.h                   |  28 -------
tests/libvirttest.py         |  20 +++++
tests/test_connect.py        |  24 ++++--
tests/test_domain.py         |  36 ++++++---
tests/test_network.py        |  20 +++--
13 files changed, 107 insertions(+), 370 deletions(-)
[libvirt] [dbus RFC PATCH 0/6] Remove all enum->string and string->enum code
Posted by Katerina Koukiou 5 years, 11 months ago
As mentioned in the patches commit message...

Converting ENUMS to str can be user friendly though
it can be problematic between libvirt versions.

In particular when some translated type will introduce a
new constant to the ENUM libvirt-dbus will fail with:

size of array ‘_GStaticAssertCompileTimeAssertion_5’ is negative

Since it's not main use case of livirt-dbus API to be invoked
interactively by user, having all ENUM types passed as
unsigned int is preferable to avoid the previous issue.

Katerina Koukiou (6):
  Abandon usage of all *TypeToString functions in domain.c
  Abandon usage of all *TypeToString functions in connect.c
  Abandon usage of all *TypeToString functions in network.c
  Change DomainEvent argument from string to unsigned int
  Change NetworkEvent argument from string to unsigned int
  Remove virtDBusUtilEnum{From,From}String functions

 data/org.libvirt.Connect.xml |   6 +-
 data/org.libvirt.Domain.xml  |  14 ++--
 data/org.libvirt.Network.xml |   6 +-
 src/connect.c                |  18 +----
 src/domain.c                 | 172 ++++---------------------------------------
 src/events.c                 |  40 +---------
 src/network.c                |  66 +----------------
 src/util.c                   |  27 -------
 src/util.h                   |  28 -------
 tests/libvirttest.py         |  20 +++++
 tests/test_connect.py        |  24 ++++--
 tests/test_domain.py         |  36 ++++++---
 tests/test_network.py        |  20 +++--
 13 files changed, 107 insertions(+), 370 deletions(-)

-- 
2.15.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [dbus RFC PATCH 0/6] Remove all enum->string and string->enum code
Posted by Katerina Koukiou 5 years, 11 months ago
On Thu, 2018-05-03 at 10:45 +0200, Katerina Koukiou wrote:
> As mentioned in the patches commit message...
> 
> Converting ENUMS to str can be user friendly though
> it can be problematic between libvirt versions.
> 
> In particular when some translated type will introduce a
> new constant to the ENUM libvirt-dbus will fail with:
> 
> size of array ‘_GStaticAssertCompileTimeAssertion_5’ is negative
> 
> Since it's not main use case of livirt-dbus API to be invoked
> interactively by user, having all ENUM types passed as
> unsigned int is preferable to avoid the previous issue.
> 
> Katerina Koukiou (6):
>   Abandon usage of all *TypeToString functions in domain.c
>   Abandon usage of all *TypeToString functions in connect.c
>   Abandon usage of all *TypeToString functions in network.c
>   Change DomainEvent argument from string to unsigned int
>   Change NetworkEvent argument from string to unsigned int
>   Remove virtDBusUtilEnum{From,From}String functions
> 
>  data/org.libvirt.Connect.xml |   6 +-
>  data/org.libvirt.Domain.xml  |  14 ++--
>  data/org.libvirt.Network.xml |   6 +-
>  src/connect.c                |  18 +----
>  src/domain.c                 | 172 ++++-----------------------------
> ----------
>  src/events.c                 |  40 +---------
>  src/network.c                |  66 +----------------
>  src/util.c                   |  27 -------
>  src/util.h                   |  28 -------
>  tests/libvirttest.py         |  20 +++++
>  tests/test_connect.py        |  24 ++++--
>  tests/test_domain.py         |  36 ++++++---
>  tests/test_network.py        |  20 +++--
>  13 files changed, 107 insertions(+), 370 deletions(-)

There are two more occurrences of translation of ENUM to String.
virDBusDomainGetState and virtDBusEventsDomainTrayChange.
If there are not objections with this change I 'll repost with these
two fixed.

Katerina

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