Signed-off-by: Jincheng Miao <jmiao@xxxxxxxxxx> --- daemon/remote.c | 1 - src/conf/interface_conf.c | 2 -- src/conf/network_conf.c | 2 -- src/conf/node_device_conf.c | 2 -- src/conf/nwfilter_conf.c | 2 -- src/conf/object_event.c | 2 -- src/conf/storage_conf.c | 2 -- src/conf/virchrdev.c | 2 -- src/esx/esx_vi.c | 15 +++------------ src/fdstream.c | 2 -- src/libxl/libxl_driver.c | 2 -- src/locking/lock_daemon.c | 5 ----- src/node_device/node_device_udev.c | 1 - src/nwfilter/nwfilter_learnipaddr.c | 2 -- src/parallels/parallels_driver.c | 5 +---- src/qemu/qemu_agent.c | 2 -- src/qemu/qemu_capabilities.c | 2 -- src/qemu/qemu_driver.c | 1 - src/qemu/qemu_monitor.c | 6 ++---- src/remote/remote_driver.c | 2 -- src/rpc/virnetclient.c | 5 +---- src/test/test_driver.c | 4 ---- src/util/vireventpoll.c | 5 +---- src/util/virlockspace.c | 4 ---- src/util/virobject.c | 2 -- src/xen/xen_driver.c | 2 -- tests/commandtest.c | 4 +--- tests/qemumonitortestutils.c | 2 -- 28 files changed, 9 insertions(+), 79 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index ea16789..d3cf8a8 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -1164,7 +1164,6 @@ void *remoteClientInitHook(virNetServerClientPtr client, if (virMutexInit(&priv->lock) < 0) { VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); return NULL; } diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 103e878..87dc79e 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -1250,8 +1250,6 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, if (VIR_ALLOC(iface) < 0) return NULL; if (virMutexInit(&iface->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(iface); return NULL; } diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index ce4d4d8..574727a 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -388,8 +388,6 @@ virNetworkAssignDef(virNetworkObjListPtr nets, if (VIR_ALLOC(network) < 0) return NULL; if (virMutexInit(&network->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(network); return NULL; } diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index 30aa477..ed4cd2a 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -183,8 +183,6 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs, return NULL; if (virMutexInit(&device->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(device); return NULL; } diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index 52f24e4..b662e02 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -3104,8 +3104,6 @@ virNWFilterObjAssignDef(virNWFilterObjListPtr nwfilters, return NULL; if (virMutexInitRecursive(&nwfilter->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(nwfilter); return NULL; } diff --git a/src/conf/object_event.c b/src/conf/object_event.c index beef3e1..86d0eb8 100644 --- a/src/conf/object_event.c +++ b/src/conf/object_event.c @@ -577,8 +577,6 @@ virObjectEventStateNew(void) goto error; if (virMutexInit(&state->lock) < 0) { - virReportSystemError(errno, "%s", - _("unable to initialize state mutex")); VIR_FREE(state); goto error; } diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 69333f5..1e8edff 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1694,8 +1694,6 @@ virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools, return NULL; if (virMutexInit(&pool->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); VIR_FREE(pool); return NULL; } diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c index 022fe71..a659b62 100644 --- a/src/conf/virchrdev.c +++ b/src/conf/virchrdev.c @@ -272,8 +272,6 @@ virChrdevsPtr virChrdevAlloc(void) return NULL; if (virMutexInit(&devs->lock) < 0) { - virReportSystemError(errno, "%s", - _("Unable to init device stream mutex")); VIR_FREE(devs); return NULL; } diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index c02a293..d8026c2 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -364,11 +364,8 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri) parsedUri->proxy_port); } - if (virMutexInit(&curl->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize CURL mutex")); + if (virMutexInit(&curl->lock) < 0) return -1; - } return 0; } @@ -602,11 +599,8 @@ esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl) CURL_LOCK_DATA_DNS); for (i = 0; i < ARRAY_CARDINALITY(shared->locks); ++i) { - if (virMutexInit(&shared->locks[i]) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize a CURL (share) mutex")); + if (virMutexInit(&shared->locks[i]) < 0) return -1; - } } } @@ -810,11 +804,8 @@ esxVI_Context_Connect(esxVI_Context *ctx, const char *url, if (VIR_ALLOC(ctx->sessionLock) < 0) return -1; - if (virMutexInit(ctx->sessionLock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize session mutex")); + if (virMutexInit(ctx->sessionLock) < 0) return -1; - } if (esxVI_RetrieveServiceContent(ctx, &ctx->service) < 0) { return -1; diff --git a/src/fdstream.c b/src/fdstream.c index fd576ef..31d93f3 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -490,8 +490,6 @@ static int virFDStreamOpenInternal(virStreamPtr st, fdst->length = length; if (virMutexInit(&fdst->lock) < 0) { VIR_FREE(fdst); - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); return -1; } diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 5fbff1c..278fa94 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -291,8 +291,6 @@ libxlStateInitialize(bool privileged, return -1; if (virMutexInit(&libxl_driver->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(libxl_driver); return -1; } diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c index 3379f29..9c68877 100644 --- a/src/locking/lock_daemon.c +++ b/src/locking/lock_daemon.c @@ -140,8 +140,6 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged) return NULL; if (virMutexInit(&lockd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); VIR_FREE(lockd); return NULL; } @@ -183,8 +181,6 @@ virLockDaemonNewPostExecRestart(virJSONValuePtr object, bool privileged) return NULL; if (virMutexInit(&lockd->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); VIR_FREE(lockd); return NULL; } @@ -783,7 +779,6 @@ virLockDaemonClientNew(virNetServerClientPtr client, if (virMutexInit(&priv->lock) < 0) { VIR_FREE(priv); - virReportSystemError(errno, "%s", _("unable to init mutex")); return NULL; } diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 28d2953..0ed1792 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -1754,7 +1754,6 @@ static int nodeStateInitialize(bool privileged, } if (virMutexInit(&driverState->lock) < 0) { - VIR_ERROR(_("Failed to initialize mutex for driverState")); VIR_FREE(priv); VIR_FREE(driverState); ret = -1; diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 4cea9cf..c3ab3a1 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -150,8 +150,6 @@ virNWFilterLockIface(const char *ifname) goto err_exit; if (virMutexInitRecursive(&ifaceLock->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("mutex initialization failed")); VIR_FREE(ifaceLock); goto err_exit; } diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index a503dea..a2af295 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -926,11 +926,8 @@ parallelsOpenDefault(virConnectPtr conn) if (VIR_ALLOC(privconn) < 0) return VIR_DRV_OPEN_ERROR; - if (virMutexInit(&privconn->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); + if (virMutexInit(&privconn->lock) < 0) goto error; - } if (!(privconn->caps = parallelsBuildCapabilities())) goto error; diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 0421733..12db835 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -728,8 +728,6 @@ qemuAgentOpen(virDomainObjPtr vm, mon->fd = -1; if (virCondInit(&mon->notify) < 0) { - virReportSystemError(errno, "%s", - _("cannot initialize monitor condition")); virObjectUnref(mon); return NULL; } diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 07306e5..15d9b92 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3418,8 +3418,6 @@ virQEMUCapsCacheNew(const char *libDir, return NULL; if (virMutexInit(&cache->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); VIR_FREE(cache); return NULL; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 33541d3..b46b2de 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -587,7 +587,6 @@ qemuStateInitialize(bool privileged, return -1; if (virMutexInit(&qemu_driver->lock) < 0) { - VIR_ERROR(_("cannot initialize mutex")); VIR_FREE(qemu_driver); return -1; } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 3d9f87b..00337ec 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -781,11 +781,9 @@ qemuMonitorOpenInternal(virDomainObjPtr vm, mon->fd = -1; mon->logfd = -1; - if (virCondInit(&mon->notify) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize monitor condition")); + if (virCondInit(&mon->notify) < 0) goto cleanup; - } + mon->fd = fd; mon->hasSendFD = hasSendFD; mon->vm = virObjectRef(vm); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 9a1d78f..5dfbb39 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -1100,8 +1100,6 @@ remoteAllocPrivateData(void) return NULL; if (virMutexInit(&priv->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize mutex")); VIR_FREE(priv); return NULL; } diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index a156fe1..7dbb90b 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -1880,11 +1880,8 @@ virNetClientCallNew(virNetMessagePtr msg, if (VIR_ALLOC(call) < 0) goto error; - if (virCondInit(&call->cond) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("cannot initialize condition variable")); + if (virCondInit(&call->cond) < 0) goto error; - } msg->donefds = 0; if (msg->bufferLength) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 42af231..35e7a9c 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -711,8 +711,6 @@ testOpenDefault(virConnectPtr conn) } if (virMutexInit(&privconn->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); defaultConnections--; virMutexUnlock(&defaultLock); return VIR_DRV_OPEN_ERROR; @@ -1408,8 +1406,6 @@ testOpenFromFile(virConnectPtr conn, const char *file) if (VIR_ALLOC(privconn) < 0) return VIR_DRV_OPEN_ERROR; if (virMutexInit(&privconn->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(privconn); return VIR_DRV_OPEN_ERROR; } diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c index 13f40dc..31ddc28 100644 --- a/src/util/vireventpoll.c +++ b/src/util/vireventpoll.c @@ -689,11 +689,8 @@ static void virEventPollHandleWakeup(int watch ATTRIBUTE_UNUSED, int virEventPollInit(void) { - if (virMutexInit(&eventLoop.lock) < 0) { - virReportSystemError(errno, "%s", - _("Unable to initialize mutex")); + if (virMutexInit(&eventLoop.lock) < 0) return -1; - } if (pipe2(eventLoop.wakeupfd, O_CLOEXEC | O_NONBLOCK) < 0) { virReportSystemError(errno, "%s", diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c index 8969ab0..70d40a9 100644 --- a/src/util/virlockspace.c +++ b/src/util/virlockspace.c @@ -249,8 +249,6 @@ virLockSpacePtr virLockSpaceNew(const char *directory) return NULL; if (virMutexInit(&lockspace->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize lockspace mutex")); VIR_FREE(lockspace); return NULL; } @@ -302,8 +300,6 @@ virLockSpacePtr virLockSpaceNewPostExecRestart(virJSONValuePtr object) return NULL; if (virMutexInit(&lockspace->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize lockspace mutex")); VIR_FREE(lockspace); return NULL; } diff --git a/src/util/virobject.c b/src/util/virobject.c index 6cb84b4..d1980ac 100644 --- a/src/util/virobject.c +++ b/src/util/virobject.c @@ -220,8 +220,6 @@ void *virObjectLockableNew(virClassPtr klass) return NULL; if (virMutexInit(&obj->lock) < 0) { - virReportSystemError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to initialize mutex")); virObjectUnref(obj); return NULL; } diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 79df3ee..cbe7f22 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -460,8 +460,6 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int f if (VIR_ALLOC(priv) < 0) return VIR_DRV_OPEN_ERROR; if (virMutexInit(&priv->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); VIR_FREE(priv); return VIR_DRV_OPEN_ERROR; } diff --git a/tests/commandtest.c b/tests/commandtest.c index 7d2161c..c471fdc 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -1121,10 +1121,8 @@ mymain(void) if (VIR_ALLOC(test) < 0) goto cleanup; - if (virMutexInit(&test->lock) < 0) { - printf("Unable to init mutex: %d\n", errno); + if (virMutexInit(&test->lock) < 0) goto cleanup; - } virMutexLock(&test->lock); diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 8155a69..8d7b1f6 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -768,8 +768,6 @@ qemuMonitorCommonTestNew(virDomainXMLOptionPtr xmlopt, goto error; if (virMutexInit(&test->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - "Cannot initialize mutex"); VIR_FREE(test); return NULL; } -- 1.8.3.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list