diff --git a/src/admin/admin_remote.c b/src/admin/admin_remote.c index 83a6be2b97..012488bff3 100644 --- a/src/admin/admin_remote.c +++ b/src/admin/admin_remote.c @@ -165,7 +165,7 @@ remoteAdminConnectOpen(virAdmConnectPtr conn, unsigned int flags) virObjectRef(conn->closeCallback); virNetClientSetCloseCallback(priv->client, remoteAdminClientCloseFunc, conn->closeCallback, - virObjectFreeCallback); + virObjectUnref); if (call(conn, 0, ADMIN_PROC_CONNECT_OPEN, (xdrproc_t)xdr_admin_connect_open_args, (char *)&args, @@ -195,7 +195,7 @@ remoteAdminConnectClose(virAdmConnectPtr conn) } virNetClientSetCloseCallback(priv->client, NULL, conn->closeCallback, - virObjectFreeCallback); + virObjectUnref); virNetClientClose(priv->client); rv = 0; diff --git a/src/bhyve/bhyve_monitor.c b/src/bhyve/bhyve_monitor.c index 6788b83c70..ae602b5c39 100644 --- a/src/bhyve/bhyve_monitor.c +++ b/src/bhyve/bhyve_monitor.c @@ -82,7 +82,7 @@ bhyveMonitorRegister(bhyveMonitor *mon) VIR_EVENT_HANDLE_HANGUP, bhyveMonitorIO, mon, - virObjectFreeCallback); + virObjectUnref); if (mon->watch < 0) { VIR_DEBUG("failed to add event handle for mon %p", mon); virObjectUnref(mon); diff --git a/src/conf/object_event.c b/src/conf/object_event.c index 3c998eda7f..62bbfb33bc 100644 --- a/src/conf/object_event.c +++ b/src/conf/object_event.c @@ -876,7 +876,7 @@ virObjectEventStateRegisterID(virConnectPtr conn, if ((state->timer = virEventAddTimeout(-1, virObjectEventTimer, state, - virObjectFreeCallback)) < 0) { + virObjectUnref)) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("could not initialize domain event timer")); goto cleanup; diff --git a/src/conf/virdomainobjlist.c b/src/conf/virdomainobjlist.c index f16b963eb0..2569454ff8 100644 --- a/src/conf/virdomainobjlist.c +++ b/src/conf/virdomainobjlist.c @@ -73,8 +73,8 @@ virDomainObjList *virDomainObjListNew(void) if (!(doms = virObjectRWLockableNew(virDomainObjListClass))) return NULL; - doms->objs = virHashNew(virObjectFreeHashData); - doms->objsName = virHashNew(virObjectFreeHashData); + doms->objs = virHashNew(virObjectUnref); + doms->objsName = virHashNew(virObjectUnref); return doms; } @@ -217,7 +217,7 @@ virDomainObjListFindByName(virDomainObjList *doms, * tables. Once successfully added into a table, increase the * reference count since upon removal in virHashRemoveEntry * the virObjectUnref will be called since the hash tables were - * configured to call virObjectFreeHashData when the object is + * configured to call virObjectUnref when the object is * removed from the hash table. * * Returns 0 on success with 3 references and locked @@ -453,7 +453,7 @@ virDomainObjListRename(virDomainObjList *doms, /* Increment the refcnt for @new_name. We're about to remove * the @old_name which will cause the refcnt to be decremented - * via the virObjectUnref call made during the virObjectFreeHashData + * via the virObjectUnref call made during the virObjectUnref * as a result of removing something from the object list hash * table as set up during virDomainObjListNew. */ virObjectRef(dom); diff --git a/src/conf/virinterfaceobj.c b/src/conf/virinterfaceobj.c index c2b81b984f..1ec1c9d1b7 100644 --- a/src/conf/virinterfaceobj.c +++ b/src/conf/virinterfaceobj.c @@ -140,7 +140,7 @@ virInterfaceObjListNew(void) if (!(interfaces = virObjectRWLockableNew(virInterfaceObjListClass))) return NULL; - interfaces->objsName = virHashNew(virObjectFreeHashData); + interfaces->objsName = virHashNew(virObjectUnref); return interfaces; } diff --git a/src/conf/virnetworkobj.c b/src/conf/virnetworkobj.c index ddb325cdbd..46b499db58 100644 --- a/src/conf/virnetworkobj.c +++ b/src/conf/virnetworkobj.c @@ -326,7 +326,7 @@ virNetworkObjListNew(void) if (!(nets = virObjectRWLockableNew(virNetworkObjListClass))) return NULL; - nets->objs = virHashNew(virObjectFreeHashData); + nets->objs = virHashNew(virObjectUnref); return nets; } diff --git a/src/conf/virnodedeviceobj.c b/src/conf/virnodedeviceobj.c index 26498fc498..4c22484d11 100644 --- a/src/conf/virnodedeviceobj.c +++ b/src/conf/virnodedeviceobj.c @@ -465,7 +465,7 @@ virNodeDeviceObjListNew(void) if (!(devs = virObjectRWLockableNew(virNodeDeviceObjListClass))) return NULL; - devs->objs = virHashNew(virObjectFreeHashData); + devs->objs = virHashNew(virObjectUnref); return devs; } diff --git a/src/conf/virnwfilterbindingobjlist.c b/src/conf/virnwfilterbindingobjlist.c index 53713d815a..9a46fa06b9 100644 --- a/src/conf/virnwfilterbindingobjlist.c +++ b/src/conf/virnwfilterbindingobjlist.c @@ -66,7 +66,7 @@ virNWFilterBindingObjListNew(void) if (!(bindings = virObjectRWLockableNew(virNWFilterBindingObjListClass))) return NULL; - bindings->objs = virHashNew(virObjectFreeHashData); + bindings->objs = virHashNew(virObjectUnref); return bindings; } @@ -131,7 +131,7 @@ virNWFilterBindingObjListFindByPortDev(virNWFilterBindingObjList *bindings, * tables. Once successfully added into a table, increase the * reference count since upon removal in virHashRemoveEntry * the virObjectUnref will be called since the hash tables were - * configured to call virObjectFreeHashData when the object is + * configured to call virObjectUnref when the object is * removed from the hash table. * * Returns 0 on success with 2 references and locked diff --git a/src/conf/virsecretobj.c b/src/conf/virsecretobj.c index 92985c4b63..4032cd1e9a 100644 --- a/src/conf/virsecretobj.c +++ b/src/conf/virsecretobj.c @@ -118,7 +118,7 @@ virSecretObjListNew(void) if (!(secrets = virObjectRWLockableNew(virSecretObjListClass))) return NULL; - if (!(secrets->objs = virHashNew(virObjectFreeHashData))) { + if (!(secrets->objs = virHashNew(virObjectUnref))) { virObjectUnref(secrets); return NULL; } diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c index 238d4678a2..e1465c8376 100644 --- a/src/conf/virstorageobj.c +++ b/src/conf/virstorageobj.c @@ -151,9 +151,9 @@ virStorageVolObjListNew(void) if (!(vols = virObjectRWLockableNew(virStorageVolObjListClass))) return NULL; - vols->objsKey = virHashNew(virObjectFreeHashData); - vols->objsName = virHashNew(virObjectFreeHashData); - vols->objsPath = virHashNew(virObjectFreeHashData); + vols->objsKey = virHashNew(virObjectUnref); + vols->objsName = virHashNew(virObjectUnref); + vols->objsPath = virHashNew(virObjectUnref); return vols; } @@ -378,8 +378,8 @@ virStoragePoolObjListNew(void) if (!(pools = virObjectRWLockableNew(virStoragePoolObjListClass))) return NULL; - pools->objs = virHashNew(virObjectFreeHashData); - pools->objsName = virHashNew(virObjectFreeHashData); + pools->objs = virHashNew(virObjectUnref); + pools->objsName = virHashNew(virObjectUnref); return pools; } diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 1e757389e6..f4732f1742 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2978,8 +2978,6 @@ virClassForObjectRWLockable; virClassIsDerivedFrom; virClassName; virClassNew; -virObjectFreeCallback; -virObjectFreeHashData; virObjectIsClass; virObjectListFree; virObjectListFreeCount; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 60ed358871..94b2e3118c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1764,7 +1764,7 @@ qemuDomainObjPrivateAlloc(void *opaque) if (!(priv->devs = virChrdevAlloc())) return NULL; - priv->blockjobs = virHashNew(virObjectFreeHashData); + priv->blockjobs = virHashNew(virObjectUnref); /* agent commands block by default, user can choose different behavior */ priv->agentTimeout = VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK; diff --git a/src/remote/remote_daemon_stream.c b/src/remote/remote_daemon_stream.c index 645be6eafd..912f3f9f94 100644 --- a/src/remote/remote_daemon_stream.c +++ b/src/remote/remote_daemon_stream.c @@ -440,7 +440,7 @@ int daemonAddClientStream(virNetServerClient *client, if (virStreamEventAddCallback(stream->st, 0, daemonStreamEvent, client, - virObjectFreeCallback) < 0) + virObjectUnref) < 0) return -1; virObjectRef(client); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 94566069f0..0ca365c4cc 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1096,7 +1096,7 @@ doRemoteOpen(virConnectPtr conn, virObjectRef(priv->closeCallback); virNetClientSetCloseCallback(priv->client, remoteClientCloseFunc, - priv->closeCallback, virObjectFreeCallback); + priv->closeCallback, virObjectUnref); if (!(priv->remoteProgram = virNetClientProgramNew(REMOTE_PROGRAM, REMOTE_PROTOCOL_VERSION, @@ -1301,7 +1301,7 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv) virNetClientSetCloseCallback(priv->client, NULL, - priv->closeCallback, virObjectFreeCallback); + priv->closeCallback, virObjectUnref); virNetClientClose(priv->client); g_clear_pointer(&priv->client, virObjectUnref); @@ -6142,7 +6142,7 @@ remoteDomainMigratePrepareTunnel3(virConnectPtr dconn, st->driver = &remoteStreamDrv; st->privateData = netst; - st->ff = virObjectFreeCallback; + st->ff = virObjectUnref; args.cookie_in.cookie_in_val = (char *)cookiein; args.cookie_in.cookie_in_len = cookieinlen; @@ -7082,7 +7082,7 @@ remoteDomainMigratePrepareTunnel3Params(virConnectPtr dconn, st->driver = &remoteStreamDrv; st->privateData = netst; - st->ff = virObjectFreeCallback; + st->ff = virObjectUnref; if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE_TUNNEL3_PARAMS, (xdrproc_t) xdr_remote_domain_migrate_prepare_tunnel3_params_args, diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index a64ff3e73f..5f2b163ea0 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1837,7 +1837,7 @@ elsif ($mode eq "client") { print "\n"; print " st->driver = &remoteStreamDrv;\n"; print " st->privateData = netst;\n"; - print " st->ff = virObjectFreeCallback;\n"; + print " st->ff = virObjectUnref;\n"; } if ($call->{ProcName} eq "SupportsFeature") { diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c index b7ee6fb169..434cc2c7c9 100644 --- a/src/rpc/virkeepalive.c +++ b/src/rpc/virkeepalive.c @@ -275,7 +275,7 @@ virKeepAliveStart(virKeepAlive *ka, timeout = ka->interval - delay; ka->intervalStart = now - (ka->interval - timeout); ka->timer = virEventAddTimeout(timeout * 1000, virKeepAliveTimer, - ka, virObjectFreeCallback); + ka, virObjectUnref); if (ka->timer < 0) goto cleanup; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 3f79c03a58..1202b0f30c 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -658,7 +658,7 @@ int virNetClientRegisterAsyncIO(virNetClient *client) VIR_EVENT_HANDLE_READABLE, virNetClientIncomingEvent, client, - virObjectFreeCallback) < 0) { + virObjectUnref) < 0) { virObjectUnref(client); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to register async IO callback")); @@ -688,7 +688,7 @@ int virNetClientRegisterKeepAlive(virNetClient *client) if (!(ka = virKeepAliveNew(-1, 0, client, virNetClientKeepAliveSendCB, virNetClientKeepAliveDeadCB, - virObjectFreeCallback))) + virObjectUnref))) return -1; /* keepalive object has a reference to client */ diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c index a03f67e542..e0e3178111 100644 --- a/src/rpc/virnetclientstream.c +++ b/src/rpc/virnetclientstream.c @@ -727,7 +727,7 @@ int virNetClientStreamEventAddCallback(virNetClientStream *st, virEventAddTimeout(-1, virNetClientStreamEventTimer, st, - virObjectFreeCallback)) < 0) { + virObjectUnref)) < 0) { virObjectUnref(st); goto cleanup; } diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c index ac12d2d412..c4f5bbdce5 100644 --- a/src/rpc/virnetdaemon.c +++ b/src/rpc/virnetdaemon.c @@ -142,7 +142,7 @@ virNetDaemonNew(void) if (!(dmn = virObjectLockableNew(virNetDaemonClass))) return NULL; - dmn->servers = virHashNew(virObjectFreeHashData); + dmn->servers = virHashNew(virObjectUnref); #ifndef WIN32 dmn->sigwrite = dmn->sigread = -1; diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index bb70856351..d57ca07167 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -202,7 +202,7 @@ static int virNetServerClientRegisterEvent(virNetServerClient *client) mode, virNetServerClientDispatchEvent, client, - virObjectFreeCallback) < 0) { + virObjectUnref) < 0) { virObjectUnref(client); return -1; } @@ -1521,7 +1521,7 @@ virNetServerClientInitKeepAlive(virNetServerClient *client, if (!(ka = virKeepAliveNew(interval, count, client, virNetServerClientKeepAliveSendCB, virNetServerClientKeepAliveDeadCB, - virObjectFreeCallback))) + virObjectUnref))) return -1; /* keepalive object has a reference to client */ diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c index 214eae1acb..682b2091c1 100644 --- a/src/rpc/virnetserverservice.c +++ b/src/rpc/virnetserverservice.c @@ -152,7 +152,7 @@ virNetServerServiceNewSocket(virNetSocket **socks, virObjectRef(svc); svc->timer = virEventAddTimeout(-1, virNetServerServiceTimerFunc, - svc, virObjectFreeCallback); + svc, virObjectUnref); if (svc->timer < 0) { virObjectUnref(svc); goto error; @@ -169,7 +169,7 @@ virNetServerServiceNewSocket(virNetSocket **socks, 0, virNetServerServiceAccept, svc, - virObjectFreeCallback) < 0) { + virObjectUnref) < 0) { virObjectUnref(svc); goto error; } @@ -361,7 +361,7 @@ virNetServerService *virNetServerServiceNewPostExecRestart(virJSONValue *object) 0, virNetServerServiceAccept, svc, - virObjectFreeCallback) < 0) { + virObjectUnref) < 0) { virObjectUnref(svc); goto error; } diff --git a/src/util/virfilecache.c b/src/util/virfilecache.c index c4bc984020..bad37c9f00 100644 --- a/src/util/virfilecache.c +++ b/src/util/virfilecache.c @@ -239,7 +239,7 @@ virFileCacheNew(const char *dir, if (!(cache = virObjectNew(virFileCacheClass))) return NULL; - cache->table = virHashNew(virObjectFreeHashData); + cache->table = virHashNew(virObjectUnref); cache->dir = g_strdup(dir); diff --git a/src/util/virobject.c b/src/util/virobject.c index d1cd4d32f1..b74d74a545 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -598,36 +598,6 @@ virClassName(virClass *klass) } -/** - * virObjectFreeCallback: - * @opaque: a pointer to a virObject instance - * - * Provides identical functionality to virObjectUnref, - * but with the signature matching the virFreeCallback - * typedef. - */ -void virObjectFreeCallback(void *opaque) -{ - virObjectUnref(opaque); -} - - -/** - * virObjectFreeHashData: - * @opaque: a pointer to a virObject instance - * @name: ignored, name of the hash key being deleted - * - * Provides identical functionality to virObjectUnref, - * but with the signature matching the GDestroyNotify - * typedef used with hash tables. - */ -void -virObjectFreeHashData(void *opaque) -{ - virObjectUnref(opaque); -} - - /** * virObjectListFree: * @list: A pointer to a NULL-terminated list of object pointers to free diff --git a/src/util/virobject.h b/src/util/virobject.h index 4b941ac215..8c06c1b929 100644 --- a/src/util/virobject.h +++ b/src/util/virobject.h @@ -104,12 +104,6 @@ virObjectIsClass(void *obj, virClass *klass) ATTRIBUTE_NONNULL(2); -void -virObjectFreeCallback(void *opaque); - -void -virObjectFreeHashData(void *opaque); - void * virObjectLockableNew(virClass *klass) ATTRIBUTE_NONNULL(1); diff --git a/tests/qemustatusxml2xmltest.c b/tests/qemustatusxml2xmltest.c index cd43820551..db82a1a980 100644 --- a/tests/qemustatusxml2xmltest.c +++ b/tests/qemustatusxml2xmltest.c @@ -78,7 +78,7 @@ mymain(void) int ret = 0; g_autofree char *fakerootdir = NULL; g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); - g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); + g_autoptr(GHashTable) capscache = virHashNew(virObjectUnref); g_autoptr(virConnect) conn = NULL; struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 5b40a0d7f5..b2da42cb1f 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -835,7 +835,7 @@ mymain(void) g_autofree char *fakerootdir = NULL; g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); g_autoptr(GHashTable) qapiSchemaCache = virHashNew((GDestroyNotify) g_hash_table_unref); - g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); + g_autoptr(GHashTable) capscache = virHashNew(virObjectUnref); struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, .qapiSchemaCache = qapiSchemaCache }; diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 58929b68c1..68e5041bfd 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -122,7 +122,7 @@ mymain(void) g_autofree char *fakerootdir = NULL; g_autoptr(virQEMUDriverConfig) cfg = NULL; g_autoptr(GHashTable) capslatest = testQemuGetLatestCaps(); - g_autoptr(GHashTable) capscache = virHashNew(virObjectFreeHashData); + g_autoptr(GHashTable) capscache = virHashNew(virObjectUnref); g_autoptr(virConnect) conn = NULL; struct testQemuConf testConf = { .capslatest = capslatest, .capscache = capscache, diff --git a/tools/virsh-console.c b/tools/virsh-console.c index 13ee811a92..6bfb44a190 100644 --- a/tools/virsh-console.c +++ b/tools/virsh-console.c @@ -451,7 +451,7 @@ virshRunConsole(vshControl *ctl, VIR_EVENT_HANDLE_READABLE, virConsoleEventOnStdin, con, - virObjectFreeCallback)) < 0) { + virObjectUnref)) < 0) { virObjectUnref(con); goto cleanup; } @@ -461,7 +461,7 @@ virshRunConsole(vshControl *ctl, 0, virConsoleEventOnStdout, con, - virObjectFreeCallback)) < 0) { + virObjectUnref)) < 0) { virObjectUnref(con); goto cleanup; } @@ -471,7 +471,7 @@ virshRunConsole(vshControl *ctl, VIR_STREAM_EVENT_READABLE, virConsoleEventOnStream, con, - virObjectFreeCallback) < 0) { + virObjectUnref) < 0) { virObjectUnref(con); goto cleanup; }