From nobody Fri May 16 00:49:29 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500903567239995.0244933760531; Mon, 24 Jul 2017 06:39:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57879C04D292; Mon, 24 Jul 2017 13:39:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A0A26DA80; Mon, 24 Jul 2017 13:39:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CABE714B27; Mon, 24 Jul 2017 13:39:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6ODdBUh001779 for ; Mon, 24 Jul 2017 09:39:11 -0400 Received: by smtp.corp.redhat.com (Postfix) id E904D67CF1; Mon, 24 Jul 2017 13:39:11 +0000 (UTC) Received: from antique-work.brq.redhat.com (unknown [10.43.2.41]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E85769325 for ; Mon, 24 Jul 2017 13:39:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 57879C04D292 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 57879C04D292 From: Pavel Hrdina To: libvir-list@redhat.com Date: Mon, 24 Jul 2017 15:38:58 +0200 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [dbus PATCH 5/9] util: rename function to follow libvirt naming rules X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 24 Jul 2017 13:39:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" All libvirt-dbus function should use virtDBus preffix and use only one coding style, camelCase. Signed-off-by: Pavel Hrdina --- 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 @@ -11,10 +11,10 @@ domain_get_name(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; const char *name =3D ""; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "s", ""); =20 @@ -35,10 +35,10 @@ domain_get_uuid(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; char uuid[VIR_UUID_STRING_BUFLEN] =3D ""; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "s", ""); =20 @@ -57,9 +57,9 @@ domain_get_id(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "u", 0); =20 @@ -76,9 +76,9 @@ domain_get_vcpus(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "u", 0); =20 @@ -95,10 +95,10 @@ domain_get_os_type(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; - _cleanup_(freep) char *os_type =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusFreep) char *os_type =3D NULL; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "s", ""); =20 @@ -119,10 +119,10 @@ domain_get_active(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int active; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "b", 0); =20 @@ -143,10 +143,10 @@ domain_get_persistent(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int persistent; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "b", 0); =20 @@ -167,11 +167,11 @@ domain_get_state(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int state =3D 0; const char *string; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "s", ""); =20 @@ -218,10 +218,10 @@ domain_get_autostart(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int autostart =3D 0; =20 - domain =3D domain_from_bus_path(manager->connection, path); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, path); if (domain =3D=3D NULL) return sd_bus_message_append(reply, "b", 0); =20 @@ -236,13 +236,13 @@ domain_get_xml_desc(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; - _cleanup_(freep) char *description =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusFreep) char *description =3D NULL; uint32_t flags; int r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -256,7 +256,7 @@ domain_get_xml_desc(sd_bus_message *message, =20 description =3D virDomainGetXMLDesc(domain, flags); if (!description) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, "s", description); } @@ -274,7 +274,7 @@ domain_get_stats(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; virDomainPtr domains[2]; _cleanup_(virDomainStatsRecordListFreep) virDomainStatsRecordPtr *reco= rds =3D NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply =3D NULL; @@ -285,8 +285,8 @@ domain_get_stats(sd_bus_message *message, if (r < 0) return r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -298,13 +298,13 @@ domain_get_stats(sd_bus_message *message, domains[1] =3D NULL; =20 if (virDomainListGetStats(domains, stats, &records, flags) !=3D 1) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 r =3D sd_bus_message_new_method_return(message, &reply); if (r < 0) return r; =20 - r =3D bus_message_append_typed_parameters(reply, records[0]->params, r= ecords[0]->nparams); + r =3D virtDBusMessageAppendTypedParameters(reply, records[0]->params, = records[0]->nparams); if (r < 0) return r; =20 @@ -317,11 +317,11 @@ domain_shutdown(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -331,7 +331,7 @@ domain_shutdown(sd_bus_message *message, =20 r =3D virDomainShutdown(domain); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -342,11 +342,11 @@ domain_destroy(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -356,7 +356,7 @@ domain_destroy(sd_bus_message *message, =20 r =3D virDomainDestroy(domain); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -367,7 +367,7 @@ domain_reboot(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; uint32_t flags; int r; =20 @@ -375,8 +375,8 @@ domain_reboot(sd_bus_message *message, if (r < 0) return r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -386,7 +386,7 @@ domain_reboot(sd_bus_message *message, =20 r =3D virDomainReboot(domain, flags); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -397,7 +397,7 @@ domain_reset(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; uint32_t flags; int r; =20 @@ -405,8 +405,8 @@ domain_reset(sd_bus_message *message, if (r < 0) return r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -416,7 +416,7 @@ domain_reset(sd_bus_message *message, =20 r =3D virDomainReset(domain, flags); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -427,11 +427,11 @@ domain_create(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -441,7 +441,7 @@ domain_create(sd_bus_message *message, =20 r =3D virDomainCreate(domain); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -452,11 +452,11 @@ domain_undefine(sd_bus_message *message, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int r; =20 - domain =3D domain_from_bus_path(manager->connection, - sd_bus_message_get_path(message)); + domain =3D virtDBusVirDomainFromBusPath(manager->connection, + sd_bus_message_get_path(message)); if (domain =3D=3D NULL) { return sd_bus_reply_method_errorf(message, SD_BUS_ERROR_UNKNOWN_OBJECT, @@ -466,7 +466,7 @@ domain_undefine(sd_bus_message *message, =20 r =3D virDomainUndefine(domain); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 return sd_bus_reply_method_return(message, ""); } @@ -510,8 +510,8 @@ lookup_domain(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(freep) char *name =3D NULL; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusFreep) char *name =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; int r; =20 r =3D sd_bus_path_decode(path, "/org/libvirt/domain", &name); diff --git a/src/events.c b/src/events.c index 4572e39..74f3d6f 100644 --- a/src/events.c +++ b/src/events.c @@ -16,7 +16,7 @@ handle_domain_lifecycle_event(virConnectPtr connection, _cleanup_(sd_bus_message_unrefp) sd_bus_message *message =3D NULL; const char *signal =3D NULL; const char *name; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; int r; =20 switch (event) { @@ -60,7 +60,7 @@ handle_domain_lifecycle_event(virConnectPtr connection, return r; =20 name =3D virDomainGetName(domain); - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 r =3D sd_bus_message_append(message, "so", name ? : "", path); if (r < 0) @@ -77,10 +77,10 @@ handle_domain_device_added_event(virConnectPtr connecti= on, { VirtManager *manager =3D opaque; _cleanup_(sd_bus_message_unrefp) sd_bus_message *message =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; int r; =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 r =3D sd_bus_message_new_signal(manager->bus, &message, @@ -105,10 +105,10 @@ handle_domain_device_removed_event(virConnectPtr conn= ection, { VirtManager *manager =3D opaque; _cleanup_(sd_bus_message_unrefp) sd_bus_message *message =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; int r; =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 r =3D sd_bus_message_new_signal(manager->bus, &message, @@ -134,11 +134,11 @@ handle_domain_disk_change_event(virConnectPtr connect= ion, { VirtManager *manager =3D opaque; _cleanup_(sd_bus_message_unrefp) sd_bus_message *message =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; const char *reasonstr; int r; =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 r =3D sd_bus_message_new_signal(manager->bus, &message, @@ -178,11 +178,11 @@ handle_domain_tray_change_event(virConnectPtr connect= ion, { VirtManager *manager =3D opaque; _cleanup_(sd_bus_message_unrefp) sd_bus_message *message =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; const char *reasonstr; int r; =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 r =3D sd_bus_message_new_signal(manager->bus, &message, diff --git a/src/main.c b/src/main.c index a0cff38..a1d9cd1 100644 --- a/src/main.c +++ b/src/main.c @@ -100,7 +100,7 @@ main(int argc, char *argv[]) =20 _cleanup_(virt_manager_freep) VirtManager *manager =3D NULL; _cleanup_(sd_bus_unrefp) sd_bus *bus =3D NULL; - _cleanup_(closep) int signal_fd =3D -1; + _cleanup_(virtDBusClosep) int signal_fd =3D -1; _cleanup_(virEventRemoveHandlep) int bus_watch =3D -1; _cleanup_(virEventRemoveHandlep) int signal_watch =3D -1; sigset_t mask; diff --git a/src/manager.c b/src/manager.c index 32f38bb..8b25354 100644 --- a/src/manager.c +++ b/src/manager.c @@ -14,18 +14,18 @@ enumerate_domains(sd_bus *bus, sd_bus_error *error) { VirtManager *manager =3D userdata; - _cleanup_(virDomainListFreep) virDomainPtr *domains =3D NULL; - _cleanup_(strv_freep) char **paths =3D NULL; + _cleanup_(virtDBusVirDomainListFreep) virDomainPtr *domains =3D NULL; + _cleanup_(virtDBusStrvFreep) char **paths =3D NULL; int n_domains; =20 n_domains =3D virConnectListAllDomains(manager->connection, &domains, = 0); if (n_domains < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 paths =3D calloc(n_domains + 1, sizeof(char *)); =20 for (int i =3D 0; i < n_domains; i +=3D 1) - paths[i] =3D bus_path_for_domain(domains[i]); + paths[i] =3D virtDBusBusPathForVirDomain(domains[i]); =20 *nodes =3D paths; paths =3D NULL; @@ -40,7 +40,7 @@ virt_manager_list_domains(sd_bus_message *message, { VirtManager *manager =3D userdata; _cleanup_(sd_bus_message_unrefp) sd_bus_message *reply =3D NULL; - _cleanup_(virDomainListFreep) virDomainPtr *domains =3D NULL; + _cleanup_(virtDBusVirDomainListFreep) virDomainPtr *domains =3D NULL; uint32_t flags; int r; =20 @@ -50,7 +50,7 @@ virt_manager_list_domains(sd_bus_message *message, =20 r =3D virConnectListAllDomains(manager->connection, &domains, flags); if (r < 0) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 r =3D sd_bus_message_new_method_return(message, &reply); if (r < 0) @@ -61,9 +61,9 @@ virt_manager_list_domains(sd_bus_message *message, return r; =20 for (int i =3D 0; domains[i] !=3D NULL; i +=3D 1) { - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; =20 - path =3D bus_path_for_domain(domains[i]); + path =3D virtDBusBusPathForVirDomain(domains[i]); =20 r =3D sd_bus_message_append(reply, "o", path); if (r < 0) @@ -85,8 +85,8 @@ virt_manager_create_xml(sd_bus_message *message, VirtManager *manager =3D userdata; const char *xml; uint32_t flags; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; int r; =20 r =3D sd_bus_message_read(message, "su", &xml, &flags); @@ -95,9 +95,9 @@ virt_manager_create_xml(sd_bus_message *message, =20 domain =3D virDomainCreateXML(manager->connection, xml, flags); if (!domain) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 return sd_bus_reply_method_return(message, "o", path); } @@ -109,8 +109,8 @@ virt_manager_define_xml(sd_bus_message *message, { VirtManager *manager =3D userdata; const char *xml; - _cleanup_(virDomainFreep) virDomainPtr domain =3D NULL; - _cleanup_(freep) char *path =3D NULL; + _cleanup_(virtDBusVirDomainFreep) virDomainPtr domain =3D NULL; + _cleanup_(virtDBusFreep) char *path =3D NULL; int r; =20 r =3D sd_bus_message_read(message, "s", &xml); @@ -119,9 +119,9 @@ virt_manager_define_xml(sd_bus_message *message, =20 domain =3D virDomainDefineXML(manager->connection, xml); if (!domain) - return bus_error_set_last_virt_error(error); + return virtDBusSetLastVirtError(error); =20 - path =3D bus_path_for_domain(domain); + path =3D virtDBusBusPathForVirDomain(domain); =20 return sd_bus_reply_method_return(message, "o", path); } diff --git a/src/util.c b/src/util.c index 99cd6b5..21a9453 100644 --- a/src/util.c +++ b/src/util.c @@ -3,9 +3,9 @@ #include =20 int -bus_message_append_typed_parameters(sd_bus_message *message, - virTypedParameterPtr parameters, - int n_parameters) +virtDBusMessageAppendTypedParameters(sd_bus_message *message, + virTypedParameterPtr parameters, + int n_parameters) { int r; =20 @@ -57,7 +57,8 @@ bus_message_append_typed_parameters(sd_bus_message *messa= ge, return sd_bus_message_close_container(message); } =20 -int bus_error_set_last_virt_error(sd_bus_error *error) +int +virtDBusSetLastVirtError(sd_bus_error *error) { virErrorPtr vir_error; =20 @@ -69,7 +70,7 @@ int bus_error_set_last_virt_error(sd_bus_error *error) } =20 char * -bus_path_for_domain(virDomainPtr domain) +virtDBusBusPathForVirDomain(virDomainPtr domain) { char *path =3D NULL; char uuid[VIR_UUID_STRING_BUFLEN] =3D ""; @@ -81,10 +82,10 @@ bus_path_for_domain(virDomainPtr domain) } =20 virDomainPtr -domain_from_bus_path(virConnectPtr connection, - const char *path) +virtDBusVirDomainFromBusPath(virConnectPtr connection, + const char *path) { - _cleanup_(freep) char *name =3D NULL; + _cleanup_(virtDBusFreep) char *name =3D NULL; int r; =20 r =3D sd_bus_path_decode(path, "/org/libvirt/domain", &name); diff --git a/src/util.h b/src/util.h index bc39f44..9ac7932 100644 --- a/src/util.h +++ b/src/util.h @@ -7,34 +7,36 @@ =20 #define _cleanup_(_x) __attribute__((__cleanup__(_x))) =20 -int bus_message_append_typed_parameters(sd_bus_message *message, - virTypedParameterPtr parameters, - int n_parameters); +int +virtDBusMessageAppendTypedParameters(sd_bus_message *message, + virTypedParameterPtr parameters, + int n_parameters); =20 -int bus_error_set_last_virt_error(sd_bus_error *error); +int +virtDBusSetLastVirtError(sd_bus_error *error); =20 char * -bus_path_for_domain(virDomainPtr domain); +virtDBusBusPathForVirDomain(virDomainPtr domain); =20 virDomainPtr -domain_from_bus_path(virConnectPtr connection, - const char *path); +virtDBusVirDomainFromBusPath(virConnectPtr connection, + const char *path); =20 static inline void -freep(void *p) +virtDBusFreep(void *p) { free(*(void **)p); } =20 static inline void -closep(int *fdp) +virtDBusClosep(int *fdp) { if (*fdp >=3D 0) close(*fdp); } =20 static inline void -strv_freep(void *p) +virtDBusStrvFreep(void *p) { char **strv =3D *(char ***)p; =20 @@ -48,14 +50,14 @@ strv_freep(void *p) } =20 static inline void -virDomainFreep(virDomainPtr *domainp) +virtDBusVirDomainFreep(virDomainPtr *domainp) { if (*domainp) virDomainFree(*domainp); } =20 static inline void -virDomainListFreep(virDomainPtr **domainsp) +virtDBusVirDomainListFreep(virDomainPtr **domainsp) { virDomainPtr *domains =3D *domainsp; =20 --=20 2.13.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list