[libvirt] [dbus PATCH 5/9] util: rename function to follow libvirt naming rules

John Ferlan jferlan at redhat.com
Tue Aug 1 13:31:40 UTC 2017



On 07/24/2017 09:38 AM, Pavel Hrdina wrote:
> All libvirt-dbus function should use virtDBus preffix and use only one
> coding style, camelCase.
> 

s/preffix/prefix

In general... Should "bus_path" just be Path - seems redundant to have
"virtDBusBus"... It's not wrong, but mainly curious especially since the
"bus_" prefix got changed to virtDBus.

FWIW: Might also have been easier to convert all those
domain_from_bus_path calls into a helper first...

Since manager.c gets "virtDBusManager", domain.c gets "virtDBusDomain",
and events.c gets "virtDBusEvents" should these be virtDBusUtil to
distinguish them from main.c which also uses "virtDBus"?

> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
>  src/domain.c  | 110 +++++++++++++++++++++++++++++-----------------------------
>  src/events.c  |  20 +++++------
>  src/main.c    |   2 +-
>  src/manager.c |  32 ++++++++---------
>  src/util.c    |  17 ++++-----
>  src/util.h    |  26 +++++++-------
>  6 files changed, 105 insertions(+), 102 deletions(-)
> 
> diff --git a/src/domain.c b/src/domain.c
> index 1bda3b8..4bfb314 100644
> --- a/src/domain.c
> +++ b/src/domain.c

[...]

> @@ -236,13 +236,13 @@ domain_get_xml_desc(sd_bus_message *message,
>                      sd_bus_error *error)
>  {
>      VirtManager *manager = userdata;
> -    _cleanup_(virDomainFreep) virDomainPtr domain = NULL;
> -    _cleanup_(freep) char *description = NULL;
> +    _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain = NULL;
> +    _cleanup_(virtDBusFreep) char *description = NULL;
>      uint32_t flags;
>      int r;
>  
> -    domain = domain_from_bus_path(manager->connection,
> -                                  sd_bus_message_get_path(message));
> +    domain = virtDBusVirDomainFromBusPath(manager->connection,
> +                                       sd_bus_message_get_path(message));

adjust alignment of 2nd argument (occurs a few more times too -
domain_get_stats, domain_shutdown, domain_destroy, domain_reboot,
domain_reset, domain_create, and domain_undefine)

>      if (domain == NULL) {
>          return sd_bus_reply_method_errorf(message,
>                                            SD_BUS_ERROR_UNKNOWN_OBJECT,

[...]




More information about the libvir-list mailing list