From nobody Fri Mar 29 01:24:34 2024 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 1523536909580101.32199179813233; Thu, 12 Apr 2018 05:41:49 -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 11019A8AD; Thu, 12 Apr 2018 12:41:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C51BE832DB; Thu, 12 Apr 2018 12:41:47 +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 3B4501805971; Thu, 12 Apr 2018 12:41:47 +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 w3CCfNFR013418 for ; Thu, 12 Apr 2018 08:41:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 377DE78DDA; Thu, 12 Apr 2018 12:41:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A3147E029 for ; Thu, 12 Apr 2018 12:41:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 39BB9300485F for ; Thu, 12 Apr 2018 12:41:17 +0000 (UTC) Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCeoC5119579 for ; Thu, 12 Apr 2018 08:41:16 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ha5afetkm-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:14 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:12 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:10 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCf9DL30343392 for ; Thu, 12 Apr 2018 12:41:09 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 687EC42045 for ; Thu, 12 Apr 2018 13:32:50 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E0F042041 for ; Thu, 12 Apr 2018 13:32:50 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:50 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:40:56 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0008-0000-0000-000004E9C016 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0009-0000-0000-00001E7DC924 Message-Id: <20180412124104.10547-2-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 12 Apr 2018 12:41:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Thu, 12 Apr 2018 12:41:17 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 1/9] virConnectRegisterCloseCallback: Cleanup 'opaque' if there is no connectRegisterCloseCallback 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.29]); Thu, 12 Apr 2018 12:41:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The commit 'close callback: move it to driver' (88f09b75eb99) moved the responsibility for the close callback to the driver. But if the driver doesn't support the connectRegisterCloseCallback API this function does nothing, even no unsupported error report. This behavior may lead to problems, for example memory leaks, as the caller cannot differentiate whether the close callback was 'really' registered or not. Therefore, call directly @freecb if the connectRegisterCloseCallback API is not supported by the driver used by the connection. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/libvirt-host.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 7ff7407a0874..cb2ace7d9778 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1221,9 +1221,13 @@ virConnectRegisterCloseCallback(virConnectPtr conn, virCheckConnectReturn(conn, -1); virCheckNonNullArgGoto(cb, error); =20 - if (conn->driver->connectRegisterCloseCallback && - conn->driver->connectRegisterCloseCallback(conn, cb, opaque, freec= b) < 0) - goto error; + if (conn->driver->connectRegisterCloseCallback) { + if (conn->driver->connectRegisterCloseCallback(conn, cb, opaque, f= reecb) < 0) + goto error; + } else { + if (freecb) + freecb(opaque); + } =20 return 0; =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523536890281161.41218634199345; Thu, 12 Apr 2018 05:41:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 332C93136323; Thu, 12 Apr 2018 12:41:28 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BBA7F78DD5; Thu, 12 Apr 2018 12:41:27 +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 5EC21180215E; Thu, 12 Apr 2018 12:41:24 +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 w3CCfNF9013413 for ; Thu, 12 Apr 2018 08:41:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 32CB678DD5; Thu, 12 Apr 2018 12:41:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A4E87E02B for ; Thu, 12 Apr 2018 12:41:18 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5CF045D676 for ; Thu, 12 Apr 2018 12:41:16 +0000 (UTC) Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCdiHm089477 for ; Thu, 12 Apr 2018 08:41:15 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha5x3cywr-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:15 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:13 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:11 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfBBB53608450 for ; Thu, 12 Apr 2018 12:41:11 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9D71742045 for ; Thu, 12 Apr 2018 13:32:51 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 734674203F for ; Thu, 12 Apr 2018 13:32:51 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:51 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:40:57 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0040-0000-0000-0000044CBE8D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0041-0000-0000-000020F0F259 Message-Id: <20180412124104.10547-3-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 12 Apr 2018 12:41:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 12 Apr 2018 12:41:16 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 2/9] test: Convert testDriver to virObjectLockable 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 12 Apr 2018 12:41:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test driver state (@testDriver) uses it's own reference counting and locking implementation. Instead of doing that, convert @testDriver into a virObjectLockable and use the provided functionalities. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/test/test_driver.c | 200 ++++++++++++++++++++++-----------------------= ---- 1 file changed, 90 insertions(+), 110 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 856869c9d3a9..1a219316e7c5 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -94,7 +94,7 @@ typedef struct _testAuth testAuth; typedef struct _testAuth *testAuthPtr; =20 struct _testDriver { - virMutex lock; + virObjectLockable parent; =20 virNodeInfo nodeInfo; virInterfaceObjListPtr ifaces; @@ -126,9 +126,22 @@ typedef struct _testDriver testDriver; typedef testDriver *testDriverPtr; =20 static testDriverPtr defaultPrivconn; -static int defaultConnections; static virMutex defaultLock =3D VIR_MUTEX_INITIALIZER; =20 +static virClassPtr testDriverClass; +static void testDriverDispose(void *obj); +static int testDriverOnceInit(void) +{ + if (!(testDriverClass =3D virClassNew(virClassForObjectLockable(), + "testDriver", + sizeof(testDriver), + testDriverDispose))) + return -1; + + return 0; +} +VIR_ONCE_GLOBAL_INIT(testDriver) + #define TEST_MODEL "i686" #define TEST_EMULATOR "/usr/bin/test-hv" =20 @@ -144,10 +157,9 @@ static const virNodeInfo defaultNodeInfo =3D { }; =20 static void -testDriverFree(testDriverPtr driver) +testDriverDispose(void *obj) { - if (!driver) - return; + testDriverPtr driver =3D obj; =20 virObjectUnref(driver->caps); virObjectUnref(driver->xmlopt); @@ -157,23 +169,9 @@ testDriverFree(testDriverPtr driver) virObjectUnref(driver->ifaces); virObjectUnref(driver->pools); virObjectUnref(driver->eventState); - virMutexUnlock(&driver->lock); - virMutexDestroy(&driver->lock); - - VIR_FREE(driver); } =20 =20 -static void testDriverLock(testDriverPtr driver) -{ - virMutexLock(&driver->lock); -} - -static void testDriverUnlock(testDriverPtr driver) -{ - virMutexUnlock(&driver->lock); -} - static void testObjectEventQueue(testDriverPtr driver, virObjectEventPtr event) { @@ -405,14 +403,11 @@ testDriverNew(void) }; testDriverPtr ret; =20 - if (VIR_ALLOC(ret) < 0) + if (testDriverInitialize() < 0) return NULL; =20 - if (virMutexInit(&ret->lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("cannot initialize mutex")); - goto error; - } + if (!(ret =3D virObjectLockableNew(testDriverClass))) + return NULL; =20 if (!(ret->xmlopt =3D virDomainXMLOptionNew(NULL, NULL, &ns, NULL, NUL= L)) || !(ret->eventState =3D virObjectEventStateNew()) || @@ -428,7 +423,7 @@ testDriverNew(void) return ret; =20 error: - testDriverFree(ret); + virObjectUnref(ret); return NULL; } =20 @@ -1262,7 +1257,7 @@ testOpenFromFile(virConnectPtr conn, const char *file) if (!(privconn =3D testDriverNew())) return VIR_DRV_OPEN_ERROR; =20 - testDriverLock(privconn); + virObjectLock(privconn); conn->privateData =3D privconn; =20 if (!(privconn->caps =3D testBuildCapabilities(conn))) @@ -1279,14 +1274,14 @@ testOpenFromFile(virConnectPtr conn, const char *fi= le) =20 xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return VIR_DRV_OPEN_SUCCESS; =20 error: xmlXPathFreeContext(ctxt); xmlFreeDoc(doc); - testDriverFree(privconn); + virObjectUnref(privconn); conn->privateData =3D NULL; return VIR_DRV_OPEN_ERROR; } @@ -1304,8 +1299,8 @@ testOpenDefault(virConnectPtr conn) size_t i; =20 virMutexLock(&defaultLock); - if (defaultConnections++) { - conn->privateData =3D defaultPrivconn; + if (defaultPrivconn) { + conn->privateData =3D virObjectRef(defaultPrivconn); virMutexUnlock(&defaultLock); return VIR_DRV_OPEN_SUCCESS; } @@ -1354,9 +1349,8 @@ testOpenDefault(virConnectPtr conn) return ret; =20 error: - testDriverFree(privconn); + virObjectUnref(privconn); conn->privateData =3D NULL; - defaultConnections--; goto cleanup; } =20 @@ -1369,9 +1363,9 @@ testConnectAuthenticate(virConnectPtr conn, ssize_t i; char *username =3D NULL, *password =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if (privconn->numAuths =3D=3D 0) { - testDriverUnlock(privconn); + virObjectUnlock(privconn); return 0; } =20 @@ -1413,7 +1407,7 @@ testConnectAuthenticate(virConnectPtr conn, =20 ret =3D 0; cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); VIR_FREE(username); VIR_FREE(password); return ret; @@ -1423,24 +1417,11 @@ testConnectAuthenticate(virConnectPtr conn, static void testDriverCloseInternal(testDriverPtr driver) { - bool dflt =3D false; - - if (driver =3D=3D defaultPrivconn) { - dflt =3D true; - virMutexLock(&defaultLock); - if (--defaultConnections) { - virMutexUnlock(&defaultLock); - return; - } - } - - testDriverLock(driver); - testDriverFree(driver); - - if (dflt) { + virMutexLock(&defaultLock); + bool disposed =3D !virObjectUnref(driver); + if (disposed && driver =3D=3D defaultPrivconn) defaultPrivconn =3D NULL; - virMutexUnlock(&defaultLock); - } + virMutexUnlock(&defaultLock); } =20 =20 @@ -1571,9 +1552,9 @@ static int testNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) { testDriverPtr privconn =3D conn->privateData; - testDriverLock(privconn); + virObjectLock(privconn); memcpy(info, &privconn->nodeInfo, sizeof(virNodeInfo)); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return 0; } =20 @@ -1581,9 +1562,9 @@ static char *testConnectGetCapabilities(virConnectPtr= conn) { testDriverPtr privconn =3D conn->privateData; char *xml; - testDriverLock(privconn); + virObjectLock(privconn); xml =3D virCapabilitiesFormatXML(privconn->caps); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return xml; } =20 @@ -1618,9 +1599,9 @@ static int testConnectNumOfDomains(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int count; =20 - testDriverLock(privconn); + virObjectLock(privconn); count =3D virDomainObjListNumOfDomains(privconn->domains, true, NULL, = NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return count; } @@ -1673,7 +1654,7 @@ testDomainCreateXML(virConnectPtr conn, const char *x= ml, if (flags & VIR_DOMAIN_START_VALIDATE) parse_flags |=3D VIR_DOMAIN_DEF_PARSE_VALIDATE_SCHEMA; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((def =3D virDomainDefParseString(xml, privconn->caps, privconn->xm= lopt, NULL, parse_flags)) =3D=3D NULL) goto cleanup; @@ -1708,7 +1689,7 @@ testDomainCreateXML(virConnectPtr conn, const char *x= ml, virObjectUnlock(dom); testObjectEventQueue(privconn, event); virDomainDefFree(def); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -2891,7 +2872,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr c= onn, size_t i; int ret =3D -1; =20 - testDriverLock(privconn); + virObjectLock(privconn); if (startCell >=3D privconn->numCells) { virReportError(VIR_ERR_INVALID_ARG, "%s", _("Range exceeds available cells")); @@ -2906,7 +2887,7 @@ static int testNodeGetCellsFreeMemory(virConnectPtr c= onn, ret =3D i; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -2964,12 +2945,12 @@ testNodeGetFreeMemory(virConnectPtr conn) unsigned int freeMem =3D 0; size_t i; =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 for (i =3D 0; i < privconn->numCells; i++) freeMem +=3D privconn->cells[i].freeMem; =20 - testDriverUnlock(privconn); + virObjectUnlock(privconn); return freeMem; } =20 @@ -3006,7 +2987,7 @@ static int testDomainCreateWithFlags(virDomainPtr dom= ain, unsigned int flags) =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; @@ -3030,7 +3011,7 @@ static int testDomainCreateWithFlags(virDomainPtr dom= ain, unsigned int flags) cleanup: virDomainObjEndAPI(&privdom); testObjectEventQueue(privconn, event); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -3803,9 +3784,9 @@ testInterfaceObjFindByName(testDriverPtr privconn, { virInterfaceObjPtr obj; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virInterfaceObjListFindByName(privconn->ifaces, name); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) virReportError(VIR_ERR_NO_INTERFACE, @@ -3822,9 +3803,9 @@ testConnectNumOfInterfaces(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int ninterfaces; =20 - testDriverLock(privconn); + virObjectLock(privconn); ninterfaces =3D virInterfaceObjListNumOfInterfaces(privconn->ifaces, t= rue); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ninterfaces; } =20 @@ -3837,10 +3818,10 @@ testConnectListInterfaces(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int nnames; =20 - testDriverLock(privconn); + virObjectLock(privconn); nnames =3D virInterfaceObjListGetNames(privconn->ifaces, true, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return nnames; } @@ -3852,9 +3833,9 @@ testConnectNumOfDefinedInterfaces(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int ninterfaces; =20 - testDriverLock(privconn); + virObjectLock(privconn); ninterfaces =3D virInterfaceObjListNumOfInterfaces(privconn->ifaces, f= alse); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ninterfaces; } =20 @@ -3867,10 +3848,10 @@ testConnectListDefinedInterfaces(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int nnames; =20 - testDriverLock(privconn); + virObjectLock(privconn); nnames =3D virInterfaceObjListGetNames(privconn->ifaces, false, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return nnames; } @@ -3905,10 +3886,10 @@ testInterfaceLookupByMACString(virConnectPtr conn, char *ifacenames[] =3D { NULL, NULL }; virInterfacePtr ret =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); ifacect =3D virInterfaceObjListFindByMACString(privconn->ifaces, mac, ifacenames, 2); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (ifacect =3D=3D 0) { virReportError(VIR_ERR_NO_INTERFACE, @@ -3956,7 +3937,7 @@ testInterfaceChangeBegin(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("there is another transaction running.")); @@ -3970,7 +3951,7 @@ testInterfaceChangeBegin(virConnectPtr conn, =20 ret =3D 0; cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -3984,7 +3965,7 @@ testInterfaceChangeCommit(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -3999,7 +3980,7 @@ testInterfaceChangeCommit(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return ret; } @@ -4014,7 +3995,7 @@ testInterfaceChangeRollback(virConnectPtr conn, =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); =20 if (!privconn->transaction_running) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", @@ -4032,7 +4013,7 @@ testInterfaceChangeRollback(virConnectPtr conn, ret =3D 0; =20 cleanup: - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -4072,7 +4053,7 @@ testInterfaceDefineXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((def =3D virInterfaceDefParseString(xmlStr)) =3D=3D NULL) goto cleanup; =20 @@ -4086,7 +4067,7 @@ testInterfaceDefineXML(virConnectPtr conn, cleanup: virInterfaceDefFree(def); virInterfaceObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return ret; } =20 @@ -4190,9 +4171,9 @@ testStoragePoolObjFindByName(testDriverPtr privconn, { virStoragePoolObjPtr obj; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virStoragePoolObjFindByName(privconn->pools, name); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) virReportError(VIR_ERR_NO_STORAGE_POOL, @@ -4250,9 +4231,9 @@ testStoragePoolObjFindByUUID(testDriverPtr privconn, virStoragePoolObjPtr obj; char uuidstr[VIR_UUID_STRING_BUFLEN]; =20 - testDriverLock(privconn); + virObjectLock(privconn); obj =3D virStoragePoolObjFindByUUID(privconn->pools, uuid); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!obj) { virUUIDFormat(uuid, uuidstr); @@ -4318,10 +4299,10 @@ testConnectNumOfStoragePools(virConnectPtr conn) testDriverPtr privconn =3D conn->privateData; int numActive =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); numActive =3D virStoragePoolObjNumOfStoragePools(privconn->pools, conn, true, NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return numActive; } @@ -4335,10 +4316,10 @@ testConnectListStoragePools(virConnectPtr conn, testDriverPtr privconn =3D conn->privateData; int n =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); n =3D virStoragePoolObjGetNames(privconn->pools, conn, true, NULL, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return n; } @@ -4350,10 +4331,10 @@ testConnectNumOfDefinedStoragePools(virConnectPtr c= onn) testDriverPtr privconn =3D conn->privateData; int numInactive =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); numInactive =3D virStoragePoolObjNumOfStoragePools(privconn->pools, co= nn, false, NULL); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return numInactive; } @@ -4367,10 +4348,10 @@ testConnectListDefinedStoragePools(virConnectPtr co= nn, testDriverPtr privconn =3D conn->privateData; int n =3D 0; =20 - testDriverLock(privconn); + virObjectLock(privconn); n =3D virStoragePoolObjGetNames(privconn->pools, conn, false, NULL, names, maxnames); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return n; } @@ -4386,10 +4367,10 @@ testConnectListAllStoragePools(virConnectPtr conn, =20 virCheckFlags(VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_ALL, -1); =20 - testDriverLock(privconn); + virObjectLock(privconn); ret =3D virStoragePoolObjListExport(conn, privconn->pools, pools, NULL, flags); - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 return ret; } @@ -4551,7 +4532,7 @@ testStoragePoolCreateXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (!(newDef =3D virStoragePoolDefParseString(xml))) goto cleanup; =20 @@ -4602,7 +4583,7 @@ testStoragePoolCreateXML(virConnectPtr conn, virStoragePoolDefFree(newDef); testObjectEventQueue(privconn, event); virStoragePoolObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return pool; } =20 @@ -4621,7 +4602,7 @@ testStoragePoolDefineXML(virConnectPtr conn, =20 virCheckFlags(0, NULL); =20 - testDriverLock(privconn); + virObjectLock(privconn); if (!(newDef =3D virStoragePoolDefParseString(xml))) goto cleanup; =20 @@ -4654,7 +4635,7 @@ testStoragePoolDefineXML(virConnectPtr conn, virStoragePoolDefFree(newDef); testObjectEventQueue(privconn, event); virStoragePoolObjEndAPI(&obj); - testDriverUnlock(privconn); + virObjectUnlock(privconn); return pool; } =20 @@ -5055,7 +5036,7 @@ testStorageVolLookupByKey(virConnectPtr conn, .key =3D key, .voldef =3D NULL }; virStorageVolPtr vol =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((obj =3D virStoragePoolObjListSearch(privconn->pools, testStorageVolLookupByKeyCallba= ck, &data)) && data.voldef) { @@ -5065,7 +5046,7 @@ testStorageVolLookupByKey(virConnectPtr conn, NULL, NULL); virStoragePoolObjEndAPI(&obj); } - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!vol) virReportError(VIR_ERR_NO_STORAGE_VOL, @@ -5099,7 +5080,7 @@ testStorageVolLookupByPath(virConnectPtr conn, .path =3D path, .voldef =3D NULL }; virStorageVolPtr vol =3D NULL; =20 - testDriverLock(privconn); + virObjectLock(privconn); if ((obj =3D virStoragePoolObjListSearch(privconn->pools, testStorageVolLookupByPathCallb= ack, &data)) && data.voldef) { @@ -5109,7 +5090,7 @@ testStorageVolLookupByPath(virConnectPtr conn, NULL, NULL); virStoragePoolObjEndAPI(&obj); } - testDriverUnlock(privconn); + virObjectUnlock(privconn); =20 if (!vol) virReportError(VIR_ERR_NO_STORAGE_VOL, @@ -6859,7 +6840,6 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, } =20 =20 - static virHypervisorDriver testHypervisorDriver =3D { .name =3D "Test", .connectOpen =3D testConnectOpen, /* 0.1.1 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523536890956517.1209268739883; Thu, 12 Apr 2018 05:41:30 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 55D09356D3; Thu, 12 Apr 2018 12:41:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AC97D2CFBE; Thu, 12 Apr 2018 12:41:27 +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 96C99180BAD3; Thu, 12 Apr 2018 12:41:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3CCfOcF013436 for ; Thu, 12 Apr 2018 08:41:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 086FF832C3; Thu, 12 Apr 2018 12:41:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F22DE832CC for ; Thu, 12 Apr 2018 12:41:19 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B0043133E65 for ; Thu, 12 Apr 2018 12:41:18 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCf4nj035996 for ; Thu, 12 Apr 2018 08:41:17 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha5gqp6hk-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:16 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:13 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:12 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfCVB50397288 for ; Thu, 12 Apr 2018 12:41:12 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C78BE42045 for ; Thu, 12 Apr 2018 13:32:52 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A79C942041 for ; Thu, 12 Apr 2018 13:32:52 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:52 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:40:58 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0044-0000-0000-00000546799F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0045-0000-0000-00002886B4B4 Message-Id: <20180412124104.10547-4-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 12 Apr 2018 12:41:18 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 12 Apr 2018 12:41:18 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.46 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 3/9] remote: Add the information which program has to be used to daemonClientEventCallback 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 12 Apr 2018 12:41:29 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" As a result, you can later determine at the callback which program has to be used. This makes it easier to refactor the code in the future and is less prone to error. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 108 ++++++++++++++++++++------------= ---- 1 file changed, 59 insertions(+), 49 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 5b764bab48d5..b4c0e01b0832 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -78,6 +78,7 @@ VIR_LOG_INIT("daemon.remote"); =20 struct daemonClientEventCallback { virNetServerClientPtr client; + virNetServerProgramPtr program; int eventID; int callbackID; bool legacy; @@ -127,6 +128,7 @@ remoteEventCallbackFree(void *opaque) daemonClientEventCallbackPtr callback =3D opaque; if (!callback) return; + virObjectUnref(callback->program); virObjectUnref(callback->client); VIR_FREE(callback); } @@ -318,7 +320,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn, data.detail =3D detail; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_domain_event_l= ifecycle_msg, &data); @@ -326,7 +328,7 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn, remote_domain_event_callback_lifecycle_msg msg =3D { callback->cal= lbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_LI= FECYCLE, (xdrproc_t)xdr_remote_domain_event_c= allback_lifecycle_msg, &msg); @@ -355,14 +357,14 @@ remoteRelayDomainEventReboot(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_REBOOT, (xdrproc_t)xdr_remote_domain_event_r= eboot_msg, &data); } else { remote_domain_event_callback_reboot_msg msg =3D { callback->callba= ckID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RE= BOOT, (xdrproc_t)xdr_remote_domain_event_c= allback_reboot_msg, &msg); } @@ -394,14 +396,14 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn, data.offset =3D offset; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_RTC_CHANGE, (xdrproc_t)xdr_remote_domain_event_r= tc_change_msg, &data); } else { remote_domain_event_callback_rtc_change_msg msg =3D { callback->ca= llbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_RT= C_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_rtc_change_msg, &msg); } @@ -432,14 +434,14 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn, data.action =3D action; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_WATCHDOG, (xdrproc_t)xdr_remote_domain_event_w= atchdog_msg, &data); } else { remote_domain_event_callback_watchdog_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_WA= TCHDOG, (xdrproc_t)xdr_remote_domain_event_c= allback_watchdog_msg, &msg); } @@ -476,14 +478,14 @@ remoteRelayDomainEventIOError(virConnectPtr conn, data.action =3D action; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_IO_ERROR, (xdrproc_t)xdr_remote_domain_event_i= o_error_msg, &data); } else { remote_domain_event_callback_io_error_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO= _ERROR, (xdrproc_t)xdr_remote_domain_event_c= allback_io_error_msg, &msg); } @@ -527,14 +529,14 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr con= n, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_IO_ERROR_RE= ASON, (xdrproc_t)xdr_remote_domain_event_i= o_error_reason_msg, &data); } else { remote_domain_event_callback_io_error_reason_msg msg =3D { callbac= k->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_IO= _ERROR_REASON, (xdrproc_t)xdr_remote_domain_event_c= allback_io_error_reason_msg, &msg); } @@ -601,14 +603,14 @@ remoteRelayDomainEventGraphics(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_GRAPHICS, (xdrproc_t)xdr_remote_domain_event_g= raphics_msg, &data); } else { remote_domain_event_callback_graphics_msg msg =3D { callback->call= backID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_GR= APHICS, (xdrproc_t)xdr_remote_domain_event_c= allback_graphics_msg, &msg); } @@ -658,14 +660,14 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB, (xdrproc_t)xdr_remote_domain_event_b= lock_job_msg, &data); } else { remote_domain_event_callback_block_job_msg msg =3D { callback->cal= lbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BL= OCK_JOB, (xdrproc_t)xdr_remote_domain_event_c= allback_block_job_msg, &msg); } @@ -694,14 +696,14 @@ remoteRelayDomainEventControlError(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CONTROL_ERR= OR, (xdrproc_t)xdr_remote_domain_event_c= ontrol_error_msg, &data); } else { remote_domain_event_callback_control_error_msg msg =3D { callback-= >callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_CO= NTROL_ERROR, (xdrproc_t)xdr_remote_domain_event_c= allback_control_error_msg, &msg); } @@ -752,14 +754,14 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_DISK_CHANGE, (xdrproc_t)xdr_remote_domain_event_d= isk_change_msg, &data); } else { remote_domain_event_callback_disk_change_msg msg =3D { callback->c= allbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DI= SK_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_disk_change_msg, &msg); } @@ -800,14 +802,14 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_TRAY_CHANGE, (xdrproc_t)xdr_remote_domain_event_t= ray_change_msg, &data); } else { remote_domain_event_callback_tray_change_msg msg =3D { callback->c= allbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TR= AY_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_tray_change_msg, &msg); } @@ -836,14 +838,14 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMWAKEUP, (xdrproc_t)xdr_remote_domain_event_p= mwakeup_msg, &data); } else { remote_domain_event_callback_pmwakeup_msg msg =3D { callback->call= backID, reason, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= WAKEUP, (xdrproc_t)xdr_remote_domain_event_c= allback_pmwakeup_msg, &msg); } @@ -872,14 +874,14 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND, (xdrproc_t)xdr_remote_domain_event_p= msuspend_msg, &data); } else { remote_domain_event_callback_pmsuspend_msg msg =3D { callback->cal= lbackID, reason, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= SUSPEND, (xdrproc_t)xdr_remote_domain_event_c= allback_pmsuspend_msg, &msg); } @@ -909,14 +911,14 @@ remoteRelayDomainEventBalloonChange(virConnectPtr con= n, data.actual =3D actual; =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BALLOON_CHA= NGE, (xdrproc_t)xdr_remote_domain_event_b= alloon_change_msg, &data); } else { remote_domain_event_callback_balloon_change_msg msg =3D { callback= ->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BA= LLOON_CHANGE, (xdrproc_t)xdr_remote_domain_event_c= allback_balloon_change_msg, &msg); } @@ -946,14 +948,14 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr con= n, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_PMSUSPEND_D= ISK, (xdrproc_t)xdr_remote_domain_event_p= msuspend_disk_msg, &data); } else { remote_domain_event_callback_pmsuspend_disk_msg msg =3D { callback= ->callbackID, reason, da= ta }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PM= SUSPEND_DISK, (xdrproc_t)xdr_remote_domain_event_c= allback_pmsuspend_disk_msg, &msg); } @@ -986,7 +988,7 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 if (callback->legacy) { - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_DEVICE_REMO= VED, (xdrproc_t)xdr_remote_domain_event_d= evice_removed_msg, &data); @@ -994,7 +996,7 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn, remote_domain_event_callback_device_removed_msg msg =3D { callback= ->callbackID, data }; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DE= VICE_REMOVED, (xdrproc_t)xdr_remote_domain_event_c= allback_device_removed_msg, &msg); @@ -1031,7 +1033,7 @@ remoteRelayDomainEventBlockJob2(virConnectPtr conn, data.status =3D status; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2, (xdrproc_t)xdr_remote_domain_event_block= _job_2_msg, &data); =20 @@ -1069,7 +1071,7 @@ remoteRelayDomainEventTunable(virConnectPtr conn, return -1; } =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_TUNABL= E, (xdrproc_t)xdr_remote_domain_event_callb= ack_tunable_msg, &data); @@ -1104,7 +1106,7 @@ remoteRelayDomainEventAgentLifecycle(virConnectPtr co= nn, data.state =3D state; data.reason =3D reason; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_AGENT_= LIFECYCLE, (xdrproc_t)xdr_remote_domain_event_callb= ack_agent_lifecycle_msg, &data); @@ -1138,7 +1140,7 @@ remoteRelayDomainEventDeviceAdded(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE= _ADDED, (xdrproc_t)xdr_remote_domain_event_callb= ack_device_added_msg, &data); @@ -1171,7 +1173,7 @@ remoteRelayDomainEventMigrationIteration(virConnectPt= r conn, =20 data.iteration =3D iteration; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_MIGRAT= ION_ITERATION, (xdrproc_t)xdr_remote_domain_event_callb= ack_migration_iteration_msg, &data); @@ -1211,7 +1213,7 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn, return -1; } =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_JOB_CO= MPLETED, (xdrproc_t)xdr_remote_domain_event_callb= ack_job_completed_msg, &data); @@ -1244,7 +1246,7 @@ remoteRelayDomainEventDeviceRemovalFailed(virConnectP= tr conn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE= _REMOVAL_FAILED, (xdrproc_t)xdr_remote_domain_event_callb= ack_device_removal_failed_msg, &data); @@ -1288,7 +1290,7 @@ remoteRelayDomainEventMetadataChange(virConnectPtr co= nn, make_nonnull_domain(&data.dom, dom); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_METADA= TA_CHANGE, (xdrproc_t)xdr_remote_domain_event_callb= ack_metadata_change_msg, &data); @@ -1331,7 +1333,7 @@ remoteRelayDomainEventBlockThreshold(virConnectPtr co= nn, data.excess =3D excess; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD, (xdrproc_t)xdr_remote_domain_event_block= _threshold_msg, &data); =20 @@ -1396,7 +1398,7 @@ remoteRelayNetworkEventLifecycle(virConnectPtr conn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NETWORK_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_network_event_life= cycle_msg, &data); =20 @@ -1433,7 +1435,7 @@ remoteRelayStoragePoolEventLifecycle(virConnectPtr co= nn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_STORAGE_POOL_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_storage_pool_event= _lifecycle_msg, &data); @@ -1461,7 +1463,7 @@ remoteRelayStoragePoolEventRefresh(virConnectPtr conn, make_nonnull_storage_pool(&data.pool, pool); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_STORAGE_POOL_EVENT_REFRESH, (xdrproc_t)xdr_remote_storage_pool_event= _refresh_msg, &data); @@ -1500,7 +1502,7 @@ remoteRelayNodeDeviceEventLifecycle(virConnectPtr con= n, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NODE_DEVICE_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_node_device_event_= lifecycle_msg, &data); @@ -1528,7 +1530,7 @@ remoteRelayNodeDeviceEventUpdate(virConnectPtr conn, make_nonnull_node_device(&data.dev, dev); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_NODE_DEVICE_EVENT_UPDATE, (xdrproc_t)xdr_remote_node_device_event_= update_msg, &data); @@ -1567,7 +1569,7 @@ remoteRelaySecretEventLifecycle(virConnectPtr conn, data.event =3D event; data.detail =3D detail; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_SECRET_EVENT_LIFECYCLE, (xdrproc_t)xdr_remote_secret_event_lifec= ycle_msg, &data); @@ -1595,7 +1597,7 @@ remoteRelaySecretEventValueChanged(virConnectPtr conn, make_nonnull_secret(&data.secret, secret); data.callbackID =3D callback->callbackID; =20 - remoteDispatchObjectEventSend(callback->client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_SECRET_EVENT_VALUE_CHANGED, (xdrproc_t)xdr_remote_secret_event_value= _changed_msg, &data); @@ -1645,7 +1647,7 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn, data.details =3D details_p; make_nonnull_domain(&data.dom, dom); =20 - remoteDispatchObjectEventSend(callback->client, qemuProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, QEMU_PROC_DOMAIN_MONITOR_EVENT, (xdrproc_t)xdr_qemu_domain_monitor_event= _msg, &data); @@ -3922,6 +3924,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server ATTRIBUTE_UNUSED if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4158,6 +4161,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4234,6 +4238,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server ATTRI if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5757,6 +5762,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5879,6 +5885,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6000,6 +6007,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6121,6 +6129,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6237,6 +6246,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(qemuProgram); callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523536921763374.21178058400073; Thu, 12 Apr 2018 05:42:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57AAE12B6; Thu, 12 Apr 2018 12:42:00 +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 EB10F4D6FA; Thu, 12 Apr 2018 12:41:59 +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 869114CAA0; Thu, 12 Apr 2018 12:41:59 +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 w3CCfvfm013545 for ; Thu, 12 Apr 2018 08:41:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA45E5C8B9; Thu, 12 Apr 2018 12:41:57 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D62057E026 for ; Thu, 12 Apr 2018 12:41:53 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3516D4E90C for ; Thu, 12 Apr 2018 12:41:53 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCf5qP080497 for ; Thu, 12 Apr 2018 08:41:52 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha4ty7s2b-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:39 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:15 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:13 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfD4R11338042 for ; Thu, 12 Apr 2018 12:41:13 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id ED0C64204C for ; Thu, 12 Apr 2018 13:32:53 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D21AC42041 for ; Thu, 12 Apr 2018 13:32:53 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:53 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:40:59 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0020-0000-0000-000004111877 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0021-0000-0000-000042A54737 Message-Id: <20180412124104.10547-5-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 12 Apr 2018 12:41:53 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 12 Apr 2018 12:41:53 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 4/9] remote: Use domainClientEventCallbacks for remoteReplayConnectionClosedEvent 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 12 Apr 2018 12:42:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This allows us to get rid of another usage of the global variable remoteProgram. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index b4c0e01b0832..cf2cd0add7d6 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1661,12 +1661,12 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr con= n, static void remoteRelayConnectionClosedEvent(virConnectPtr conn ATTRIBUTE_UNUSED,= int reason, void *opaque) { - virNetServerClientPtr client =3D opaque; + daemonClientEventCallbackPtr callback =3D opaque; =20 VIR_DEBUG("Relaying connection closed event, reason %d", reason); =20 remote_connect_event_connection_closed_msg msg =3D { reason }; - remoteDispatchObjectEventSend(client, remoteProgram, + remoteDispatchObjectEventSend(callback->client, callback->program, REMOTE_PROC_CONNECT_EVENT_CONNECTION_CLO= SED, (xdrproc_t)xdr_remote_connect_event_conn= ection_closed_msg, &msg); @@ -3836,6 +3836,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server ATTRIBUTE_UNUS virNetMessageErrorPtr rerr) { int rv =3D -1; + daemonClientEventCallbackPtr callback =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 @@ -3846,9 +3847,16 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server ATTRIBUTE_UNUS goto cleanup; } =20 + if (VIR_ALLOC(callback) < 0) + goto cleanup; + callback->client =3D virObjectRef(client); + callback->program =3D virObjectRef(remoteProgram); + /* eventID, callbackID, and legacy are not used */ + callback->eventID =3D -1; + callback->callbackID =3D -1; if (virConnectRegisterCloseCallback(priv->conn, remoteRelayConnectionClosedEvent, - client, NULL) < 0) + callback, remoteEventCallbackFree)= < 0) goto cleanup; =20 priv->closeRegistered =3D true; @@ -3856,8 +3864,10 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server ATTRIBUTE_UNUS =20 cleanup: virMutexUnlock(&priv->lock); - if (rv < 0) + if (rv < 0) { + remoteEventCallbackFree(callback); virNetMessageSaveError(rerr); + } return rv; } =20 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 15235369246201023.9661284702706; Thu, 12 Apr 2018 05:42:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DAB593135B05; Thu, 12 Apr 2018 12:42:02 +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 8AEB64D6FA; Thu, 12 Apr 2018 12:42:02 +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 36A834CAA4; Thu, 12 Apr 2018 12:42:02 +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 w3CCfwZi013552 for ; Thu, 12 Apr 2018 08:41:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 888D34D6FA; Thu, 12 Apr 2018 12:41:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7C9BD78DD6 for ; Thu, 12 Apr 2018 12:41:58 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D08313134D2B for ; Thu, 12 Apr 2018 12:41:57 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCf5qZ080497 for ; Thu, 12 Apr 2018 08:41:57 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha4ty7s2g-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:46 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:16 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:14 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfEj954001732 for ; Thu, 12 Apr 2018 12:41:14 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1CB464203F for ; Thu, 12 Apr 2018 13:32:55 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02E5242045 for ; Thu, 12 Apr 2018 13:32:55 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:54 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:41:00 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0044-0000-0000-0000054679A1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0045-0000-0000-00002886B4B6 Message-Id: <20180412124104.10547-6-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Apr 2018 12:41:57 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Apr 2018 12:41:57 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 5/9] rpc: Introduce virNetServerGetProgramLocked helper function 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Thu, 12 Apr 2018 12:42:03 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch introduces virNetServerGetProgramLocked. It's a function to determine which program has to be used for a given @msg. This function will be reused in the next patch. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/rpc/virnetserver.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 3ce21a8f5345..ef214980b297 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -182,6 +182,29 @@ static void virNetServerHandleJob(void *jobOpaque, voi= d *opaque) VIR_FREE(job); } =20 + +/** + * virNetServerGetProgramLocked: + * @srv: server (must be locked by the caller) + * @msg: message + * + * Searches @srv for the right program for a given message @msg. + * + * Returns a pointer to the server program or NULL if not found. + */ +static virNetServerProgramPtr +virNetServerGetProgramLocked(virNetServerPtr srv, + virNetMessagePtr msg) +{ + size_t i; + for (i =3D 0; i < srv->nprograms; i++) { + if (virNetServerProgramMatches(srv->programs[i], msg)) + return srv->programs[i]; + } + return NULL; +} + + static void virNetServerDispatchNewMessage(virNetServerClientPtr client, virNetMessagePtr msg, void *opaque) @@ -189,18 +212,12 @@ static void virNetServerDispatchNewMessage(virNetServ= erClientPtr client, virNetServerPtr srv =3D opaque; virNetServerProgramPtr prog =3D NULL; unsigned int priority =3D 0; - size_t i; =20 VIR_DEBUG("server=3D%p client=3D%p message=3D%p", srv, client, msg); =20 virObjectLock(srv); - for (i =3D 0; i < srv->nprograms; i++) { - if (virNetServerProgramMatches(srv->programs[i], msg)) { - prog =3D srv->programs[i]; - break; - } - } + prog =3D virNetServerGetProgramLocked(srv, msg); =20 if (srv->workers) { virNetServerJobPtr job; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523781442873523.907429175583; Sun, 15 Apr 2018 01:37:22 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E8873247C1C; Sun, 15 Apr 2018 08:37:21 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5F1A75D6A2; Sun, 15 Apr 2018 08:37:21 +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 158EF1805972; Sun, 15 Apr 2018 08:37: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 w3CCfNCi013414 for ; Thu, 12 Apr 2018 08:41:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 341CD78DD6; Thu, 12 Apr 2018 12:41:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 295017E028 for ; Thu, 12 Apr 2018 12:41:22 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0EB04313066B for ; Thu, 12 Apr 2018 12:41:21 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCdTr4001843 for ; Thu, 12 Apr 2018 08:41:20 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2ha49g9kad-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:20 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:18 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:16 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfFs151642374 for ; Thu, 12 Apr 2018 12:41:15 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E02242041 for ; Thu, 12 Apr 2018 13:32:56 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 281974204B for ; Thu, 12 Apr 2018 13:32:56 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:56 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:41:01 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0040-0000-0000-0000044CBE94 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0041-0000-0000-000020F0F260 Message-Id: <20180412124104.10547-7-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 12 Apr 2018 12:41:21 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Thu, 12 Apr 2018 12:41:21 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 6/9] remote/rpc: Use virNetServerGetProgram() to determine the program 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 15 Apr 2018 08:37:22 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use virNetServerGetProgram() to determine the virNetServerProgram instead of using hard coded global variables. This allows us to remove the global variables @remoteProgram and @qemuProgram as they're now no longer necessary. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- Note: I'm not 100% sure that there is no case where the lock for @client is already held by the thread which is calling virNetServerGetProgram and thus the lock order would be violated (the lock order has to be @server -> @client in the violating case it would be @client -> @server and therefore a deadlock might occur). --- src/libvirt_remote.syms | 1 + src/remote/remote_daemon.c | 4 +- src/remote/remote_daemon.h | 3 - src/remote/remote_daemon_dispatch.c | 116 +++++++++++++++++++++++++++-----= ---- src/rpc/gendispatch.pl | 6 ++ src/rpc/virnetserver.c | 23 +++++++ src/rpc/virnetserver.h | 2 + 7 files changed, 122 insertions(+), 33 deletions(-) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 97e22275b980..c31b16cd5909 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -120,6 +120,7 @@ virNetServerGetCurrentUnauthClients; virNetServerGetMaxClients; virNetServerGetMaxUnauthClients; virNetServerGetName; +virNetServerGetProgram; virNetServerGetThreadPoolParameters; virNetServerHasClients; virNetServerNew; diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index 31c6ce1b6179..f854a1a6981e 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -71,8 +71,6 @@ VIR_LOG_INIT("daemon.libvirtd"); #if WITH_SASL virNetSASLContextPtr saslCtxt =3D NULL; #endif -virNetServerProgramPtr remoteProgram =3D NULL; -virNetServerProgramPtr qemuProgram =3D NULL; =20 volatile bool driversInitialized =3D false; =20 @@ -1049,6 +1047,8 @@ int main(int argc, char **argv) { virNetServerPtr srv =3D NULL; virNetServerPtr srvAdm =3D NULL; virNetServerProgramPtr adminProgram =3D NULL; + virNetServerProgramPtr qemuProgram =3D NULL; + virNetServerProgramPtr remoteProgram =3D NULL; virNetServerProgramPtr lxcProgram =3D NULL; char *remote_config_file =3D NULL; int statuswrite =3D -1; diff --git a/src/remote/remote_daemon.h b/src/remote/remote_daemon.h index 2834da04a9ae..a2eda209683b 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -88,7 +88,4 @@ struct daemonClientPrivate { # if WITH_SASL extern virNetSASLContextPtr saslCtxt; # endif -extern virNetServerProgramPtr remoteProgram; -extern virNetServerProgramPtr qemuProgram; - #endif /* __REMOTE_DAEMON_H__ */ diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index cf2cd0add7d6..94b9cc3377d8 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3830,15 +3830,16 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr s= erver ATTRIBUTE_UNUSED, } =20 static int -remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server ATTRIBUT= E_UNUSED, +remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_= UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr) { int rv =3D -1; daemonClientEventCallbackPtr callback =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virNetServerProgramPtr program; =20 virMutexLock(&priv->lock); =20 @@ -3847,10 +3848,15 @@ remoteDispatchConnectRegisterCloseCallback(virNetSe= rverPtr server ATTRIBUTE_UNUS goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); /* eventID, callbackID, and legacy are not used */ callback->eventID =3D -1; callback->callbackID =3D -1; @@ -3903,9 +3909,9 @@ remoteDispatchConnectUnregisterCloseCallback(virNetSe= rverPtr server ATTRIBUTE_UN } =20 static int -remoteDispatchConnectDomainEventRegister(virNetServerPtr server ATTRIBUTE_= UNUSED, +remoteDispatchConnectDomainEventRegister(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE_UN= USED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr ATTRIB= UTE_UNUSED, remote_connect_domain_event_regis= ter_ret *ret ATTRIBUTE_UNUSED) { @@ -3915,12 +3921,18 @@ remoteDispatchConnectDomainEventRegister(virNetServ= erPtr server ATTRIBUTE_UNUSED daemonClientEventCallbackPtr ref; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virNetServerProgramPtr program; =20 if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 /* If we call register first, we could append a complete callback @@ -3934,7 +3946,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server ATTRIBUTE_UNUSED if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4132,9 +4144,9 @@ remoteDispatchDomainGetState(virNetServerPtr server A= TTRIBUTE_UNUSED, * VIR_DRV_SUPPORTS_FEATURE(VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK), * and must not mix the two styles. */ static int -remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server ATTRIBU= TE_UNUSED, +remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE= _UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, remote_connect_domain_event_re= gister_any_args *args) { @@ -4144,12 +4156,18 @@ remoteDispatchConnectDomainEventRegisterAny(virNetS= erverPtr server ATTRIBUTE_UNU daemonClientEventCallbackPtr ref; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); + virNetServerProgramPtr program; =20 if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 /* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any @@ -4171,7 +4189,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4207,9 +4225,9 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU =20 =20 static int -remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server= ATTRIBUTE_UNUSED, +remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server, virNetServerClientPtr = client, - virNetMessagePtr msg A= TTRIBUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr = rerr ATTRIBUTE_UNUSED, remote_connect_domain_= event_callback_register_any_args *args, remote_connect_domain_= event_callback_register_any_ret *ret) @@ -4221,12 +4239,18 @@ remoteDispatchConnectDomainEventCallbackRegisterAny= (virNetServerPtr server ATTRI struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->dom && @@ -4248,7 +4272,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server ATTRI if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5355,6 +5379,7 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virNe= tServerPtr server ATTRIBUTE virNetServerClientGetPrivateData(client); virStreamPtr st =3D NULL; daemonClientStreamPtr stream =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); @@ -5373,8 +5398,13 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virN= etServerPtr server ATTRIBUTE 0, ¶ms, &nparams) < 0) goto cleanup; =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + if (!(st =3D virStreamNew(priv->conn, VIR_STREAM_NONBLOCK)) || - !(stream =3D daemonCreateClientStream(client, st, remoteProgram, + !(stream =3D daemonCreateClientStream(client, st, program, &msg->header, false))) goto cleanup; =20 @@ -5731,9 +5761,9 @@ static int remoteDispatchDomainCreateWithFiles(virNet= ServerPtr server ATTRIBUTE_ =20 =20 static int -remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server ATTRIB= UTE_UNUSED, +remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUT= E_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr AT= TRIBUTE_UNUSED, remote_connect_network_event_= register_any_args *args, remote_connect_network_event_= register_any_ret *ret) @@ -5745,12 +5775,18 @@ remoteDispatchConnectNetworkEventRegisterAny(virNet= ServerPtr server ATTRIBUTE_UN struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virNetworkPtr net =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->networkConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->net && @@ -5772,7 +5808,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server ATTRIBUTE_UN if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5854,9 +5890,9 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server ATTRIBUTE_ } =20 static int -remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server AT= TRIBUTE_UNUSED, +remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server, virNetServerClientPtr cli= ent, - virNetMessagePtr msg ATTR= IBUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rer= r ATTRIBUTE_UNUSED, remote_connect_storage_po= ol_event_register_any_args *args, remote_connect_storage_po= ol_event_register_any_ret *ret) @@ -5868,12 +5904,18 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vi= rNetServerPtr server ATTRIBUT struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virStoragePoolPtr pool =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->storageConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->pool && @@ -5895,7 +5937,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server ATTRIBUT if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5976,9 +6018,9 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server ATTRIB } =20 static int -remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server ATT= RIBUTE_UNUSED, +remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server, virNetServerClientPtr clie= nt, - virNetMessagePtr msg ATTRI= BUTE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr= ATTRIBUTE_UNUSED, remote_connect_node_device= _event_register_any_args *args, remote_connect_node_device= _event_register_any_ret *ret) @@ -5990,12 +6032,18 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(vir= NetServerPtr server ATTRIBUTE struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virNodeDevicePtr dev =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->nodedevConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->dev && @@ -6017,7 +6065,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server ATTRIBUTE if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6098,9 +6146,9 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server ATTRIBU } =20 static int -remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server ATTRIBU= TE_UNUSED, +remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBUTE= _UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, remote_connect_secret_event_re= gister_any_args *args, remote_connect_secret_event_re= gister_any_ret *ret) @@ -6112,12 +6160,18 @@ remoteDispatchConnectSecretEventRegisterAny(virNetS= erverPtr server ATTRIBUTE_UNU struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virSecretPtr secret =3D NULL; + virNetServerProgramPtr program; =20 if (!priv->secretConn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->secret && @@ -6139,7 +6193,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server ATTRIBUTE_UNU if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(remoteProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6220,9 +6274,9 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server ATTRIBUTE_U } =20 static int -qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server ATTRI= BUTE_UNUSED, +qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg ATTRIBU= TE_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr A= TTRIBUTE_UNUSED, qemu_connect_domain_monitor_= event_register_args *args, qemu_connect_domain_monitor_= event_register_ret *ret) @@ -6235,12 +6289,18 @@ qemuDispatchConnectDomainMonitorEventRegister(virNe= tServerPtr server ATTRIBUTE_U virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; const char *event =3D args->event ? *args->event : NULL; + virNetServerProgramPtr program; =20 if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } + virMutexLock(&priv->lock); =20 if (args->dom && @@ -6256,7 +6316,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server ATTRIBUTE_U if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); - callback->program =3D virObjectRef(qemuProgram); + callback->program =3D virObjectRef(program); callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index b8b83b6b40d3..ad442182d3c8 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1039,6 +1039,7 @@ elsif ($mode eq "server") { if ($call->{streamflag} ne "none") { print " virStreamPtr st =3D NULL;\n"; print " daemonClientStreamPtr stream =3D NULL;\n"; + print " virNetServerProgramPtr remoteProgram;\n"; if ($call->{sparseflag} ne "none") { print " const bool sparse =3D args->flags & $call->{spa= rseflag};\n" } else { @@ -1081,6 +1082,11 @@ elsif ($mode eq "server") { print " if (!(st =3D virStreamNew($conn, VIR_STREAM_NONBLOC= K)))\n"; print " goto cleanup;\n"; print "\n"; + print " if (!(remoteProgram =3D virNetServerGetProgram(serv= er, msg))) {\n"; + print " virReportError(VIR_ERR_INTERNAL_ERROR, \"%s\", = _(\"no matching program found\"));\n"; + print " goto cleanup;\n"; + print " }\n"; + print "\n"; print " if (!(stream =3D daemonCreateClientStream(client, s= t, remoteProgram, &msg->header, sparse)))\n"; print " goto cleanup;\n"; print "\n"; diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index ef214980b297..47ce88392b24 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -205,6 +205,29 @@ virNetServerGetProgramLocked(virNetServerPtr srv, } =20 =20 +/** + * virNetServerGetProgram: + * @srv: server (must NOT be locked by the caller) + * @msg: message + * + * Searches @srv for the right program for a given message @msg. + * + * Returns a pointer to the server program or NULL if not found. + */ +virNetServerProgramPtr +virNetServerGetProgram(virNetServerPtr srv, + virNetMessagePtr msg) +{ + virNetServerProgramPtr ret; + + virObjectLock(srv); + ret =3D virNetServerGetProgramLocked(srv, msg); + virObjectUnlock(srv); + + return ret; +} + + static void virNetServerDispatchNewMessage(virNetServerClientPtr client, virNetMessagePtr msg, void *opaque) diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h index a79c39fdb2e7..1867e46664ba 100644 --- a/src/rpc/virnetserver.h +++ b/src/rpc/virnetserver.h @@ -76,6 +76,8 @@ int virNetServerSetTLSContext(virNetServerPtr srv, virNetTLSContextPtr tls); # endif =20 +virNetServerProgramPtr virNetServerGetProgram(virNetServerPtr srv, + virNetMessagePtr msg); =20 int virNetServerAddClient(virNetServerPtr srv, virNetServerClientPtr client); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523781447037456.43974579990584; Sun, 15 Apr 2018 01:37:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEF55318C75C; Sun, 15 Apr 2018 08:37:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B5BE84E6; Sun, 15 Apr 2018 08:37:25 +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 5AEB3180BAD6; Sun, 15 Apr 2018 08:37:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3CCfjOl013514 for ; Thu, 12 Apr 2018 08:41:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 13CE778BCB; Thu, 12 Apr 2018 12:41:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx19.extmail.prod.ext.phx2.redhat.com [10.5.110.48]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0E23078BD4 for ; Thu, 12 Apr 2018 12:41:40 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B95AA312AC44 for ; Thu, 12 Apr 2018 12:41:38 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCfA7v079076 for ; Thu, 12 Apr 2018 08:41:38 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha6afusv6-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:32 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:18 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:17 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfG9f56754184 for ; Thu, 12 Apr 2018 12:41:16 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 765424204C for ; Thu, 12 Apr 2018 13:32:57 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 529F442049 for ; Thu, 12 Apr 2018 13:32:57 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:57 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:41:02 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0012-0000-0000-000005CA0C78 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0013-0000-0000-00001946429A Message-Id: <20180412124104.10547-8-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 12 Apr 2018 12:41:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Thu, 12 Apr 2018 12:41:38 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.48 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 7/9] rpc: use the return value of virObjectRef directly 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Sun, 15 Apr 2018 08:37:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the return value of virObjectRef directly. This way, it's easier for another reader to identify the reason why the additional reference is required. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/rpc/virnetserver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 47ce88392b24..ec84c1f3d2b5 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -248,7 +248,7 @@ static void virNetServerDispatchNewMessage(virNetServer= ClientPtr client, if (VIR_ALLOC(job) < 0) goto error; =20 - job->client =3D client; + job->client =3D virObjectRef(client); job->msg =3D msg; =20 if (prog) { @@ -256,7 +256,6 @@ static void virNetServerDispatchNewMessage(virNetServer= ClientPtr client, priority =3D virNetServerProgramGetPriority(prog, msg->header.= proc); } =20 - virObjectRef(client); if (virThreadPoolSendJob(srv->workers, priority, job) < 0) { virObjectUnref(client); VIR_FREE(job); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 152353691875969.00012505713698; Thu, 12 Apr 2018 05:41:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 61F073130D72; Thu, 12 Apr 2018 12:41:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DCF5BA8F; Thu, 12 Apr 2018 12:41:57 +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 70382180596E; Thu, 12 Apr 2018 12:41:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3CCfOT7013441 for ; Thu, 12 Apr 2018 08:41:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 704A9832BB; Thu, 12 Apr 2018 12:41:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 65EEB832CC for ; Thu, 12 Apr 2018 12:41:24 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5FDB585540 for ; Thu, 12 Apr 2018 12:41:23 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCdoLf104465 for ; Thu, 12 Apr 2018 08:41:23 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha6764ejd-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:22 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:20 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:18 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfIWZ63635462 for ; Thu, 12 Apr 2018 12:41:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A16AF42045 for ; Thu, 12 Apr 2018 13:32:58 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 815414203F for ; Thu, 12 Apr 2018 13:32:58 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:58 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:41:03 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0040-0000-0000-0000042D83E6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0041-0000-0000-000026319CBD Message-Id: <20180412124104.10547-9-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 12 Apr 2018 12:41:23 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 12 Apr 2018 12:41:23 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 8/9] remote: remove ATTRIBUTE_UNUSED when attribute is actually used 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 12 Apr 2018 12:41:57 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: John Ferlan --- src/remote/remote_daemon_dispatch.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 94b9cc3377d8..041e7c7440bf 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3912,7 +3912,7 @@ static int remoteDispatchConnectDomainEventRegister(virNetServerPtr server, virNetServerClientPtr client, virNetMessagePtr msg, - virNetMessageErrorPtr rerr ATTRIB= UTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_domain_event_regis= ter_ret *ret ATTRIBUTE_UNUSED) { int callbackID; @@ -3984,7 +3984,7 @@ static int remoteDispatchConnectDomainEventDeregister(virNetServerPtr server ATTRIBUT= E_UNUSED, virNetServerClientPtr client, virNetMessagePtr msg ATTRIBUTE_= UNUSED, - virNetMessageErrorPtr rerr ATTR= IBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_domain_event_der= egister_ret *ret ATTRIBUTE_UNUSED) { int callbackID =3D -1; @@ -4147,7 +4147,7 @@ static int remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, virNetMessagePtr msg, - virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_domain_event_re= gister_any_args *args) { int callbackID; @@ -4228,7 +4228,7 @@ static int remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server, virNetServerClientPtr = client, virNetMessagePtr msg, - virNetMessageErrorPtr = rerr ATTRIBUTE_UNUSED, + virNetMessageErrorPtr = rerr, remote_connect_domain_= event_callback_register_any_args *args, remote_connect_domain_= event_callback_register_any_ret *ret) { @@ -4312,7 +4312,7 @@ static int remoteDispatchConnectDomainEventDeregisterAny(virNetServerPtr server ATTRI= BUTE_UNUSED, virNetServerClientPtr client, virNetMessagePtr msg ATTRIBU= TE_UNUSED, - virNetMessageErrorPtr rerr A= TTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_domain_event_= deregister_any_args *args) { int callbackID =3D -1; @@ -4370,7 +4370,7 @@ static int remoteDispatchConnectDomainEventCallbackDeregisterAny(virNetServerPtr serv= er ATTRIBUTE_UNUSED, virNetServerClientPt= r client, virNetMessagePtr msg= ATTRIBUTE_UNUSED, - virNetMessageErrorPt= r rerr ATTRIBUTE_UNUSED, + virNetMessageErrorPt= r rerr, remote_connect_domai= n_event_callback_deregister_any_args *args) { int rv =3D -1; @@ -5764,7 +5764,7 @@ static int remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, virNetMessagePtr msg, - virNetMessageErrorPtr rerr AT= TRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_network_event_= register_any_args *args, remote_connect_network_event_= register_any_ret *ret) { @@ -5848,7 +5848,7 @@ static int remoteDispatchConnectNetworkEventDeregisterAny(virNetServerPtr server ATTR= IBUTE_UNUSED, virNetServerClientPtr clien= t, virNetMessagePtr msg ATTRIB= UTE_UNUSED, - virNetMessageErrorPtr rerr = ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_network_even= t_deregister_any_args *args) { int rv =3D -1; @@ -5893,7 +5893,7 @@ static int remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server, virNetServerClientPtr cli= ent, virNetMessagePtr msg, - virNetMessageErrorPtr rer= r ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rer= r, remote_connect_storage_po= ol_event_register_any_args *args, remote_connect_storage_po= ol_event_register_any_ret *ret) { @@ -5976,7 +5976,7 @@ static int remoteDispatchConnectStoragePoolEventDeregisterAny(virNetServerPtr server = ATTRIBUTE_UNUSED, virNetServerClientPtr clien= t, virNetMessagePtr msg ATTRIB= UTE_UNUSED, - virNetMessageErrorPtr rerr = ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_storage_pool= _event_deregister_any_args *args) { int rv =3D -1; @@ -6021,7 +6021,7 @@ static int remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server, virNetServerClientPtr clie= nt, virNetMessagePtr msg, - virNetMessageErrorPtr rerr= ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_node_device= _event_register_any_args *args, remote_connect_node_device= _event_register_any_ret *ret) { @@ -6104,7 +6104,7 @@ static int remoteDispatchConnectNodeDeviceEventDeregisterAny(virNetServerPtr server A= TTRIBUTE_UNUSED, virNetServerClientPtr cl= ient, virNetMessagePtr msg ATT= RIBUTE_UNUSED, - virNetMessageErrorPtr re= rr ATTRIBUTE_UNUSED, + virNetMessageErrorPtr re= rr, remote_connect_node_devi= ce_event_deregister_any_args *args) { int rv =3D -1; @@ -6149,7 +6149,7 @@ static int remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, virNetMessagePtr msg, - virNetMessageErrorPtr rerr ATT= RIBUTE_UNUSED, + virNetMessageErrorPtr rerr, remote_connect_secret_event_re= gister_any_args *args, remote_connect_secret_event_re= gister_any_ret *ret) { @@ -6232,7 +6232,7 @@ static int remoteDispatchConnectSecretEventDeregisterAny(virNetServerPtr server ATTRI= BUTE_UNUSED, virNetServerClientPtr cl= ient, virNetMessagePtr msg ATT= RIBUTE_UNUSED, - virNetMessageErrorPtr re= rr ATTRIBUTE_UNUSED, + virNetMessageErrorPtr re= rr, remote_connect_secret_ev= ent_deregister_any_args *args) { int rv =3D -1; @@ -6277,7 +6277,7 @@ static int qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server, virNetServerClientPtr client, virNetMessagePtr msg, - virNetMessageErrorPtr rerr A= TTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, qemu_connect_domain_monitor_= event_register_args *args, qemu_connect_domain_monitor_= event_register_ret *ret) { @@ -6357,7 +6357,7 @@ static int qemuDispatchConnectDomainMonitorEventDeregister(virNetServerPtr server ATT= RIBUTE_UNUSED, virNetServerClientPtr clie= nt, virNetMessagePtr msg ATTRI= BUTE_UNUSED, - virNetMessageErrorPtr rerr= ATTRIBUTE_UNUSED, + virNetMessageErrorPtr rerr, qemu_connect_domain_monito= r_event_deregister_args *args) { int rv =3D -1; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 01:24:34 2024 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 1523536909725813.9058777622471; Thu, 12 Apr 2018 05:41:49 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 047D13134C6B; Thu, 12 Apr 2018 12:41:48 +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 B9CBE74942; Thu, 12 Apr 2018 12:41:47 +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 3838C4CA99; Thu, 12 Apr 2018 12:41:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3CCfRAD013468 for ; Thu, 12 Apr 2018 08:41:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5E2EE832C3; Thu, 12 Apr 2018 12:41:27 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5443D832C2 for ; Thu, 12 Apr 2018 12:41:27 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE1823134C4F for ; Thu, 12 Apr 2018 12:41:26 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w3CCfDg2036748 for ; Thu, 12 Apr 2018 08:41:26 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ha5gqp6wq-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Thu, 12 Apr 2018 08:41:25 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 12 Apr 2018 13:41:22 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 12 Apr 2018 13:41:19 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w3CCfJd660358834 for ; Thu, 12 Apr 2018 12:41:19 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD21942045 for ; Thu, 12 Apr 2018 13:32:59 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AC44742049 for ; Thu, 12 Apr 2018 13:32:59 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Thu, 12 Apr 2018 13:32:59 +0100 (BST) From: Marc Hartmayer To: Date: Thu, 12 Apr 2018 14:41:04 +0200 In-Reply-To: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> References: <20180412124104.10547-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18041212-0044-0000-0000-0000054679A7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18041212-0045-0000-0000-00002886B4BB Message-Id: <20180412124104.10547-10-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-04-12_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804120127 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Apr 2018 12:41:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Apr 2018 12:41:26 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.699 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH libvirt v2 9/9] remote: shrink the critical sections 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 12 Apr 2018 12:41:48 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" No lock is required to access 'priv->conn' therefore we can shrink the critical sections. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/remote/remote_daemon_dispatch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 041e7c7440bf..d6699418392e 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -3841,8 +3841,6 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server, virNetServerClientGetPrivateData(client); virNetServerProgramPtr program; =20 - virMutexLock(&priv->lock); - if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; @@ -3853,6 +3851,8 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server, goto cleanup; } =20 + virMutexLock(&priv->lock); + if (VIR_ALLOC(callback) < 0) goto cleanup; callback->client =3D virObjectRef(client); @@ -3887,13 +3887,13 @@ remoteDispatchConnectUnregisterCloseCallback(virNet= ServerPtr server ATTRIBUTE_UN struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); =20 - virMutexLock(&priv->lock); - if (!priv->conn) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("connection not ope= n")); goto cleanup; } =20 + virMutexLock(&priv->lock); + if (virConnectUnregisterCloseCallback(priv->conn, remoteRelayConnectionClosedEvent= ) < 0) goto cleanup; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list