From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753565; cv=none; d=zoho.com; s=zohoarc; b=d/qFS7NWEDGthHMJ+qJCenqCBuG/YxkcFn1wxY8e41YypRfH0oXP8eDlMXJxl9VPVZJTZoHpwJI84trkbYgYT9JrUN9B9wBJSRXRcQZdBOX7DjZUGud6q12Do2FUCnURza/RRpO7FsbOs6pf8zyA6SulHGcwbvog4tVhFKC0G/k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753565; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=kscVzc1SPicJ5elk2ragQyHcqzvRBHPCWd+RXB0HKlc=; b=O+8PDKZS3xt0BAa5uFEinzjiaolikZKylD9e8ZQxi/BVYaontFrsbNZEIVkeoVSlDnRAsFxexpdc+2JdsKVmwoo/YIrD6yv8b1i9mdPnazgO9TxsGjeogySWwo4eRmkb0A2h+vxIHcm04yyjEU8nYc8ywDfrp8JkG6aOSATKfMg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573753565273219.25567197097564; Thu, 14 Nov 2019 09:46:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-413-XhIbfRltOgCRI7z6YobfOQ-1; Thu, 14 Nov 2019 12:45:15 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5B50E593C6; Thu, 14 Nov 2019 17:45:08 +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 1531B1A7E5; Thu, 14 Nov 2019 17:45:08 +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 A34481832D72; Thu, 14 Nov 2019 17:45:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHiqEm002240 for ; Thu, 14 Nov 2019 12:44:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0860E10AF9DA; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02B7110AF9D4 for ; Thu, 14 Nov 2019 17:44:49 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 673EC805BD0 for ; Thu, 14 Nov 2019 17:44:49 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-69-2WkUmeY5MM2YRKJdzoczaw-1; Thu, 14 Nov 2019 12:44:47 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHXrxY108262 for ; Thu, 14 Nov 2019 12:44:46 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w993eq9ag-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:44:46 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:45 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:42 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHif8T49676352 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:41 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 54339AE051; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22F26AE053; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753563; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kscVzc1SPicJ5elk2ragQyHcqzvRBHPCWd+RXB0HKlc=; b=hzxDRJe+IOMwPL/DBuHx2Ll1giUCeDK9jvyAymStRGe1JeI6PeY6/Cso4LT5xyPJvxEpj8 YoLu2ihETT71YdlD+qba4giCsrgVK9R9I2JMsH3AezMRzrE7p7ZRW4sv+D57bRDFzfB8TD 9JkvfbGiF0fKX1zGywkPnAvQFqMPPPI= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:19 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0028-0000-0000-000003B6EC34 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0029-0000-0000-00002479FAC9 Message-Id: <20191114174425.13583-2-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=740 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: 2WkUmeY5MM2YRKJdzoczaw-1 X-MC-Unique: XhIbfRltOgCRI7z6YobfOQ-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHiqEm002240 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 1/7] 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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: John Ferlan Reviewed-by: Pavel Hrdina --- 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 590e780b641e..673bb7c10c86 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -199,7 +199,7 @@ virNetServerDispatchNewMessage(virNetServerClientPtr cl= ient, if (VIR_ALLOC(job) < 0) goto error; =20 - job->client =3D client; + job->client =3D virObjectRef(client); job->msg =3D msg; =20 if (prog) { @@ -207,7 +207,6 @@ virNetServerDispatchNewMessage(virNetServerClientPtr cl= ient, priority =3D virNetServerProgramGetPriority(prog, msg->header.= proc); } =20 - virObjectRef(client); if (virThreadPoolSendJob(srv->workers, priority, job) < 0) { virObjectUnref(client); VIR_FREE(job); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753756; cv=none; d=zoho.com; s=zohoarc; b=hS+Fj5f+KbmypH7ddPHfDQul1rLiD27rK7i+eZAr2dTq97898/DSrEXyGNsLs6sCekuK4ffhDsFSpycbM6uWYm2cLvSt0fm6EZkMbN9IUfK+yl+P8Z60qcosQASwwNxBlNHEqQA29jplx82vu9ktn7+CCAdtJcMZjBQUgQR7x0A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753756; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GF/xKjlFbjiAQG8flQEMmDR2/tW3dovkGgDtdjEoMBM=; b=QuA8SOnqj1A+jonoh0O9qUwFCxSz+b9HP9DMbX138cMe4AntsauzOfOK+YcyQV+ERcQX0i+7nPBAgnAK0WdxhBXre3Okiu7RggFsETOi/dPygFenA0h+wfqHEPOogbaO4UdLaB9b6+SRsBW5ZlOYBrQu5sQZXAgriSOQG/dSyb4= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573753756460945.7830140329335; Thu, 14 Nov 2019 09:49:16 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-135-hSrBvV1pPS6lMTvOgNNUtA-1; Thu, 14 Nov 2019 12:49:13 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5FC55100E167; Thu, 14 Nov 2019 17:49:07 +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 37A175C3FD; Thu, 14 Nov 2019 17:49:07 +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 E01834BB5C; Thu, 14 Nov 2019 17:49:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHkP0g002532 for ; Thu, 14 Nov 2019 12:46:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3CD0210F1C05; Thu, 14 Nov 2019 17:46:25 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3808A10F1C01 for ; Thu, 14 Nov 2019 17:46:23 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E7F28185A78E for ; Thu, 14 Nov 2019 17:46:22 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-440-fVdtyecnPYqvLqduGCX7jg-1; Thu, 14 Nov 2019 12:46:21 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHYZrV048389 for ; Thu, 14 Nov 2019 12:46:20 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w99ck69xk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:46:18 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:44 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:42 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHif5E49676354 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:41 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 85B9FAE053; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F58EAE056; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753755; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=GF/xKjlFbjiAQG8flQEMmDR2/tW3dovkGgDtdjEoMBM=; b=GUIimd0HHUr+nle5t4d+wJY4EIKuUtTWh7iRG7bVykfxsR/zMxL5NJHHLwNSN2k/6AMSiZ gwkwE4cxqM6GVSeY2c2N/vPyVnexIy2Q4pir2JucZ69uk8yxTxwofuLS89VsJVr1gGvLip W30xjnKjMtHZ/8dT5eXsnMVFdsJ36mU= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:20 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0008-0000-0000-0000032F0E7D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0009-0000-0000-00004A4E1E57 Message-Id: <20191114174425.13583-3-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: fVdtyecnPYqvLqduGCX7jg-1 X-MC-Unique: hSrBvV1pPS6lMTvOgNNUtA-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHkP0g002532 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 2/7] 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: , 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-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 and update the documentation. Signed-off-by: Marc Hartmayer --- src/libvirt-host.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 221a1b7a4353..94383ed449a9 100644 --- a/src/libvirt-host.c +++ b/src/libvirt-host.c @@ -1398,7 +1398,7 @@ virConnectIsAlive(virConnectPtr conn) * @conn: pointer to connection object * @cb: callback to invoke upon close * @opaque: user data to pass to @cb - * @freecb: callback to free @opaque + * @freecb: callback to free @opaque when not used anymore * * Registers a callback to be invoked when the connection * is closed. This callback is invoked when there is any @@ -1412,7 +1412,9 @@ virConnectIsAlive(virConnectPtr conn) * * The @freecb must not invoke any other libvirt public * APIs, since it is not called from a re-entrant safe - * context. + * context. Only if virConnectRegisterCloseCallback is + * successful, @freecb will be called, otherwise the + * caller is responsible to free @opaque. * * Returns 0 on success, -1 on error */ @@ -1428,9 +1430,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.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753680; cv=none; d=zoho.com; s=zohoarc; b=nd3LXxSq5zYZCPK1ZBudnyL7lIpw4eEWndU/9J5R3/v3jaZrnVzejWWPPRKzcZKQVKnLXNu7ZaWnEO5dRHG5AxLar4o81RBR/3jX1Txwt2s0XY+34wbMUXxr9mXgg7dTCAPZVrYnaGRfWsEtVzZD0mHMZAWi1x3R56FKHBwSHxg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753680; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=KWpRi55XDL9a0VALKNfEI1g0Ndlo1Z+TTopmw4Ph3+Q=; b=kwk2qHXeO3FeRMGxtsOOgADBMs8KiZeuYqPdH3fe38+Rndzt4T9docSia4Q5vbc0h6TxZfWWM6nkPGbhdcTkuYjsBIpdttXFKveTG1wF3+5EW42ZbIDaswFxvtXU2F0IZbno5TNZhFFnk+Fi0yffrlctQ0DY7iwkM+5bvNtUTHo= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573753680683921.4382814578267; Thu, 14 Nov 2019 09:48:00 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-324-N00h4R-LMjGKRkJHCeYpmA-1; Thu, 14 Nov 2019 12:47:58 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 08F8A1083E90; Thu, 14 Nov 2019 17:47:53 +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 D20D960BF7; Thu, 14 Nov 2019 17:47:52 +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 8E0D64BB5C; Thu, 14 Nov 2019 17:47:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHloJK002718 for ; Thu, 14 Nov 2019 12:47:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id CA8DA6F9E1; Thu, 14 Nov 2019 17:47:50 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C4E3E728E7 for ; Thu, 14 Nov 2019 17:47:48 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6705A805BD0 for ; Thu, 14 Nov 2019 17:47:48 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-335-L6JAUx8YPCGI-vbFtoFBnQ-1; Thu, 14 Nov 2019 12:47:46 -0500 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHXZbT177111 for ; Thu, 14 Nov 2019 12:47:45 -0500 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w91m7u33f-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:47:43 -0500 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:44 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:42 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHif7i30605484 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:41 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C74FBAE056; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 913A4AE057; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753679; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=KWpRi55XDL9a0VALKNfEI1g0Ndlo1Z+TTopmw4Ph3+Q=; b=ZowRhAZ9Qoq4N3Lhs7nl7XL2qVa+r6GLzTVBjB1S366+QlDwFgp4OFalkok/6vmmA9hESJ QRdwZ8MKDAzGgxr0CGi24Q/pJKDVN0Qavf/+6o0axzPxF6v9t0CgA+dROFjpKGHsVDVlvs DcP+LrnFR6udUQYXhemM5ZpDt5mmxq4= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:21 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0016-0000-0000-000002C3AE9A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0017-0000-0000-0000332551F8 Message-Id: <20191114174425.13583-4-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=4 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: L6JAUx8YPCGI-vbFtoFBnQ-1 X-MC-Unique: N00h4R-LMjGKRkJHCeYpmA-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHloJK002718 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 3/7] remote: Save reference to program in 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: , 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-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As a result, you can later determine during the callback which program was 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: Pavel Hrdina --- 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 f369ffb02a65..7b53c2241c05 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; @@ -149,6 +150,7 @@ remoteEventCallbackFree(void *opaque) daemonClientEventCallbackPtr callback =3D opaque; if (!callback) return; + virObjectUnref(callback->program); virObjectUnref(callback->client); VIR_FREE(callback); } @@ -334,7 +336,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); @@ -342,7 +344,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); @@ -371,14 +373,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); } @@ -410,14 +412,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); } @@ -448,14 +450,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); } @@ -491,14 +493,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); } @@ -536,14 +538,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); } @@ -606,14 +608,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); } @@ -647,14 +649,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); } @@ -683,14 +685,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); } @@ -736,14 +738,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); } @@ -777,14 +779,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); } @@ -813,14 +815,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); } @@ -849,14 +851,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); } @@ -886,14 +888,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); } @@ -923,14 +925,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); } @@ -962,7 +964,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); @@ -970,7 +972,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); @@ -1006,7 +1008,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 @@ -1045,7 +1047,7 @@ remoteRelayDomainEventTunable(virConnectPtr conn, make_nonnull_domain(&data.dom, dom); =20 =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); @@ -1079,7 +1081,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); @@ -1111,7 +1113,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); @@ -1144,7 +1146,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); @@ -1184,7 +1186,7 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn, data.callbackID =3D callback->callbackID; make_nonnull_domain(&data.dom, dom); =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); @@ -1216,7 +1218,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); @@ -1254,7 +1256,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); @@ -1294,7 +1296,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 @@ -1356,7 +1358,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 @@ -1393,7 +1395,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); @@ -1421,7 +1423,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); @@ -1460,7 +1462,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); @@ -1488,7 +1490,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); @@ -1527,7 +1529,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); @@ -1555,7 +1557,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); @@ -1603,7 +1605,7 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn, } 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); @@ -4253,6 +4255,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server G_GNUC_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; @@ -4481,6 +4484,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED 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; @@ -4556,6 +4560,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server G_GNU 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; @@ -6038,6 +6043,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server G_GNUC_UNUSE 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; @@ -6158,6 +6164,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server G_GNUC_U 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; @@ -6277,6 +6284,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server G_GNUC_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; @@ -6396,6 +6404,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED 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; @@ -6510,6 +6519,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server G_GNUC_UNUS 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.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753505; cv=none; d=zoho.com; s=zohoarc; b=bUdSmn+FIUITjJzR2gsuWPl+52iE+g0x+2Lv7r3ZIvAzNShbUADT1/M39GZe4MZnMequV0/luZV7cchX6Y6HPQ87wcJfvCyxlu4q3MYoyutVeWZroNhY0CTRnTqXP+Z+0Yn5hX/4V2oB788UjDds2jsH31zsSQuO0enUEZz8ChU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753505; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=swNYM7fvq53+wCko6nkhva3FcMsSIXVEdwV7Y8drL30=; b=H6bz8P8NOmxyvzZwFSPrAc8+kp0FNJ48AVxBQQG2OC36Oy2dLLiruH3fGt/IuIYFvSZ8jKJmD55qFYvmfsvko2npAs4bAYF1BLT+9Z1doUnI6aVzzOUYebAhL7ev4lAdBLTQPaYaEUgkczYTPStcrrQjAE23KcFsCX0ofQkkn+g= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1573753505089490.11708974696626; Thu, 14 Nov 2019 09:45:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-269-yml3LJw1MKacTPt8ftxw_Q-1; Thu, 14 Nov 2019 12:45:02 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id EB51FDC55; Thu, 14 Nov 2019 17:44:55 +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 8CF01546EB; Thu, 14 Nov 2019 17:44:55 +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 94A994BB5C; Thu, 14 Nov 2019 17:44:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHiqAD002238 for ; Thu, 14 Nov 2019 12:44:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0827110AF9D9; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 02B3B10AF9D2 for ; Thu, 14 Nov 2019 17:44:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AAF7F800296 for ; Thu, 14 Nov 2019 17:44:50 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-acWXqQ-EOReOi7jAITsLeg-1; Thu, 14 Nov 2019 12:44:48 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHYqxr038466 for ; Thu, 14 Nov 2019 12:44:47 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w9a3jc14m-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:44:47 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:45 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:42 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHigur60686546 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 040C2AE04D; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D2303AE058; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:41 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753504; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=swNYM7fvq53+wCko6nkhva3FcMsSIXVEdwV7Y8drL30=; b=NFp1kWP7uc1RrFa4+jdVaM7MKv7UEKJBafkalBd1jSLUdRknkKDW9z3iujCVQhRmyDQ9De BMhzsARZUgwR/8muNqYMo2CdSy2/dWPes+01FzRP57w4t/WSSHiJ9YxF9oRJ4QSWRzWtyl 7rWLfREzUgH23bBg/7bhfg111opJLIw= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:22 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0028-0000-0000-000003B6EC33 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0029-0000-0000-00002479FACB Message-Id: <20191114174425.13583-5-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=837 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: acWXqQ-EOReOi7jAITsLeg-1 X-MC-Unique: yml3LJw1MKacTPt8ftxw_Q-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHiqAD002238 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 4/7] 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: , 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-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This allows us later to get rid of another usage of the global variable `remoteProgram`. Signed-off-by: Marc Hartmayer Reviewed-by: Pavel Hrdina --- src/remote/remote_daemon_dispatch.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 7b53c2241c05..9dc2083d715a 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -1620,12 +1620,12 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr con= n, static void remoteRelayConnectionClosedEvent(virConnectPtr conn G_GNUC_UNUSED, in= t 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); @@ -4170,6 +4170,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server G_GNUC_UNUSED, virNetMessageErrorPtr rerr) { int rv =3D -1; + daemonClientEventCallbackPtr callback =3D NULL; struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); @@ -4179,9 +4180,17 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server G_GNUC_UNUSED, if (!conn) 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(conn, remoteRelayConnectionClosedEvent, - client, NULL) < 0) + callback, remoteEventCallbackFree)= < 0) goto cleanup; =20 priv->closeRegistered =3D true; @@ -4189,8 +4198,10 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr server G_GNUC_UNUSED, =20 cleanup: virMutexUnlock(&priv->lock); - if (rv < 0) + if (rv < 0) { + remoteEventCallbackFree(callback); virNetMessageSaveError(rerr); + } return rv; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753603; cv=none; d=zoho.com; s=zohoarc; b=EVuiiTIrJWSe/I/oXlyOPJnYxpHovqmXZyAi3DWfw80zjx99Vjm6hiYMX6NgB4fl1FZu3haKrWc3nHK0Y5119VfjQOcK3X5wdNkmz3Djgewb2juwkRfrMrBaYePshlu3eByz6y+PKKG/TQcrixAlZQuXzNC/uYiJVdDE30GBHGU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753603; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eKXXsn8/GhnY/a9r3e4FzRSF/2Gtixo+cpKoeNyiMKM=; b=cE324cLS6cXRCYb62O+EZsxdJbvDyiR2kef4h+Mog0m1hxLzaBnQv3DBUcB0EdSM800lXkg6zBzSCXRp9NVDb24U+eCedguM7og2dtzqz4LhyJvWsGWBX0m43QAJsoGgRbK7w0VAkI3gGSpipc3NN51FCz6rwEYs42cpDtSY9wE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1573753603875716.0928625836631; Thu, 14 Nov 2019 09:46:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-15-mAU9F7BNNumrejTp-1nOgw-1; Thu, 14 Nov 2019 12:45:26 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7CEEA189D86A; Thu, 14 Nov 2019 17:45:16 +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 155971036C85; Thu, 14 Nov 2019 17:45:16 +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 9BADE1832D73; Thu, 14 Nov 2019 17:45:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHisvg002270 for ; Thu, 14 Nov 2019 12:44:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 88B092037E64; Thu, 14 Nov 2019 17:44:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 81F8C2037E62 for ; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20B62800FF9 for ; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-409-1lV_8K5ONC6sJiJe8IpUjg-1; Thu, 14 Nov 2019 12:44:49 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHXaQY050026 for ; Thu, 14 Nov 2019 12:44:48 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w9a9xkdw5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:44:47 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:45 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:43 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHigTT60686550 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 36FD2AE04D; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 10653AE051; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753602; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=eKXXsn8/GhnY/a9r3e4FzRSF/2Gtixo+cpKoeNyiMKM=; b=ALLTUkTlRDGJTUxtOxRIg7+j98A08RgUFqkpo2Od4cX6WLcVIwCVBNLMJ1Lt6ivDVcUoh6 MlBb8UrmxiHECfILpfUQKQJWwdOyPxzQsUL5fymzUm3iK872+TXO0zUxR7RTa8Yz0lNXDn NEVbwVGZfvRf/woVsx1cwYzlge5UOIQ= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:23 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0028-0000-0000-000003B6EC35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0029-0000-0000-00002479FACC Message-Id: <20191114174425.13583-6-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=881 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: 1lV_8K5ONC6sJiJe8IpUjg-1 X-MC-Unique: mAU9F7BNNumrejTp-1nOgw-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHisvg002270 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 5/7] 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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: Pavel Hrdina --- src/rpc/virnetserver.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index 673bb7c10c86..41226368058f 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -166,6 +166,26 @@ 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; +} =20 static void virNetServerDispatchNewMessage(virNetServerClientPtr client, @@ -175,18 +195,12 @@ virNetServerDispatchNewMessage(virNetServerClientPtr = 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); /* we can unlock @srv since @prog can only become invalid in case * of disposing @srv, but let's grab a ref first to ensure nothing * disposes of it before we use it. */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753505; cv=none; d=zoho.com; s=zohoarc; b=jsRN1kUtrftBd7XMuuoZ1MzaNg0YUP6Py07yoCDKNAtXcL/yahn+ny1OqkB738yshjUIN/ki13dHn9go0ITL7I1s6c218CsyIMuQWBceVelurcVaFseIrtHQTse2pe6jq/1mzeSeuGj/xsiebrA6whSyumGLqTP+lAQ2y0ru2HI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753505; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TJtgejCDgATnWTI2MeAZv+li5cmvc3dcDjeSSRlXGrk=; b=Ql47YETvWwCc47w7VkE18CvN5Nr/+N6d0loUJK5GQVN0XZCAom9bb1Hb8dYois+B4fuPpG6QY9y1IQUOLUmESFzasqjSCUOaIxN2DDEbL6TUkq81+XyxmaeZ8dnXPilhpF2HvnVULGd+/YcKx1bnlRrK5yPGVbzD79l0D1lfA1A= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573753505347464.9884885474561; Thu, 14 Nov 2019 09:45:05 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-97-bWTf4xNGNya9I1UKfPxitg-1; Thu, 14 Nov 2019 12:45:02 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 23DF61011298; Thu, 14 Nov 2019 17:44:56 +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 C4CB188E6; Thu, 14 Nov 2019 17:44:55 +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 337EC1832D6A; Thu, 14 Nov 2019 17:44:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHiqHp002239 for ; Thu, 14 Nov 2019 12:44:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0B6EF10AF9D2; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0671F10AF9D8 for ; Thu, 14 Nov 2019 17:44:50 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 143C1900A86 for ; Thu, 14 Nov 2019 17:44:50 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-16-cyizOT0RMCOELGrG4HVE8w-1; Thu, 14 Nov 2019 12:44:48 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHZ9Ah029308 for ; Thu, 14 Nov 2019 12:44:47 -0500 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0b-001b2d01.pphosted.com with ESMTP id 2w9985x1xd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:44:47 -0500 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:45 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:43 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHig4R60686552 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6786DAE04D; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 417A4AE053; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753504; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=TJtgejCDgATnWTI2MeAZv+li5cmvc3dcDjeSSRlXGrk=; b=DWJ7dhjuxG4jGx0udC4XAVrsuxQJRER36EHU+qWCwPe+V+zFaYyVn9/BWSgKVrU2NpKRBZ nwcoGnEvbOwekE0wGCmnLcgPdCMUvtKZUtqHoS29BJpbdMAu0/0sS95mb9MfSnbGNnP89N QRknYsuNvleUg7Z+3v+yEqzZV6MSniA= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:24 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0020-0000-0000-000003863845 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0021-0000-0000-000021DC50B1 Message-Id: <20191114174425.13583-7-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=688 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: cyizOT0RMCOELGrG4HVE8w-1 X-MC-Unique: bWTf4xNGNya9I1UKfPxitg-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHiqHp002239 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 6/7] 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" To free the structs and save the error, it is not necessary to hold @priv->= lock, therefore move these parts after the mutex unlock. Signed-off-by: Marc Hartmayer Reviewed-by: Cole Robinson --- 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 9dc2083d715a..6ece51c2889d 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4293,10 +4293,10 @@ remoteDispatchConnectDomainEventRegister(virNetServ= erPtr server G_GNUC_UNUSED, rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -4342,9 +4342,9 @@ remoteDispatchConnectDomainEventDeregister(virNetServ= erPtr server G_GNUC_UNUSED, rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -4522,10 +4522,10 @@ remoteDispatchConnectDomainEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -4598,11 +4598,11 @@ remoteDispatchConnectDomainEventCallbackRegisterAny= (virNetServerPtr server G_GNU rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(dom); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -4657,9 +4657,9 @@ remoteDispatchConnectDomainEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -4702,9 +4702,9 @@ remoteDispatchConnectDomainEventCallbackDeregisterAny= (virNetServerPtr server G_G rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6081,11 +6081,11 @@ remoteDispatchConnectNetworkEventRegisterAny(virNet= ServerPtr server G_GNUC_UNUSE rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(net); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6128,9 +6128,9 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server G_GNUC_UNU rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6202,11 +6202,11 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vi= rNetServerPtr server G_GNUC_U rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(pool); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6248,9 +6248,9 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server G_GNUC rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6322,11 +6322,11 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(vir= NetServerPtr server G_GNUC_UN rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(dev); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6368,9 +6368,9 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server G_GNUC_ rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6442,11 +6442,11 @@ remoteDispatchConnectSecretEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(secret); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6488,9 +6488,9 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6558,11 +6558,11 @@ qemuDispatchConnectDomainMonitorEventRegister(virNe= tServerPtr server G_GNUC_UNUS rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); virObjectUnref(dom); - virMutexUnlock(&priv->lock); return rv; } =20 @@ -6606,9 +6606,9 @@ qemuDispatchConnectDomainMonitorEventDeregister(virNe= tServerPtr server G_GNUC_UN rv =3D 0; =20 cleanup: + virMutexUnlock(&priv->lock); if (rv < 0) virNetMessageSaveError(rerr); - virMutexUnlock(&priv->lock); return rv; } =20 --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 02:47:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=linux.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1573753508; cv=none; d=zoho.com; s=zohoarc; b=Gp7WFx2bsb/M6vBK2mCs4PJanyAxqVbjC8ivqhT8+Hhe6eoOju69OJVgefg3sEsH7oQhTvpzK5WDkhkbvnjgsg9g4aECU/vZSSs1+1W6VoHqAG2CatZCxukrscmumUtvVYj3QVCSvpdrF/BOt2Y4ozJQ9GZxd+B1+u+g9XxkHBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573753508; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VPp9Fs1GHVc6YonRtiEMqzibnoSjpnGM/pE/ntl0lWg=; b=MSI/zaSTzEScGjEkLnfI8QOtOiDe6uGnuB5ELlaL8MGXMbeSlebEiEe7XOJnL3xouBfdTWD/+1B27QZNDzj3QEJlWDwWbHUcjXlCpP6gXWOnt5zHig50BzbngFKXeFqplzL6eZctxEPWfy5U/3TTmeDkAVgCHTRrU7z6EeV0KAc= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1573753508016611.6000150154241; Thu, 14 Nov 2019 09:45:08 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-327-bOWfbukfPm6jcaHwtfkM_g-1; Thu, 14 Nov 2019 12:45:03 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFA2E100F2E1; Thu, 14 Nov 2019 17:44: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 7E17C5F762; Thu, 14 Nov 2019 17:44: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 349D31832D6C; Thu, 14 Nov 2019 17:44:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xAEHisaR002267 for ; Thu, 14 Nov 2019 12:44:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 755BD2157F34; Thu, 14 Nov 2019 17:44:54 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7071E2157F36 for ; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 33C6680CDCF for ; Thu, 14 Nov 2019 17:44:52 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-229-q1Do_EwEP6O0Wxn8tbQb2w-1; Thu, 14 Nov 2019 12:44:50 -0500 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xAEHYpRq038441 for ; Thu, 14 Nov 2019 12:44:49 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w9a3jc153-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 14 Nov 2019 12:44:48 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 14 Nov 2019 17:44:46 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 14 Nov 2019 17:44:43 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xAEHigKu57802834 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 14 Nov 2019 17:44:42 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A9F2EAE053; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 73A29AE051; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) Received: from marcibm.boeblingen.de.ibm.com (unknown [9.152.224.228]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 14 Nov 2019 17:44:42 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573753506; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=VPp9Fs1GHVc6YonRtiEMqzibnoSjpnGM/pE/ntl0lWg=; b=V7emqSK4ihTWLipGQT8Q+fb6YQxQIYV4B0+rgpW2L2+xoRt7WvcCIWx+MFvPdESkxv+uBK q5U0rLxTq+pXDIjSUaGdMoZWYfgG54UQ2QyMnxSc4XIzXXI1njd6KNIYRp1AbWRP3k/J2o cwIOJRVkH/NcPjtqo4Af9auxHjc9SII= From: Marc Hartmayer To: Date: Thu, 14 Nov 2019 18:44:25 +0100 In-Reply-To: <20191114174425.13583-1-mhartmay@linux.ibm.com> References: <20191114174425.13583-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19111417-0008-0000-0000-0000032F0E7E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19111417-0009-0000-0000-00004A4E1E58 Message-Id: <20191114174425.13583-8-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-14_05:, , 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 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1910280000 definitions=main-1911140152 X-MC-Unique: q1Do_EwEP6O0Wxn8tbQb2w-1 X-MC-Unique: bOWfbukfPm6jcaHwtfkM_g-1 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xAEHisaR002267 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v4 7/7] 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: , 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-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) 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 --- src/libvirt_remote.syms | 1 + src/remote/remote_daemon.c | 4 +- src/remote/remote_daemon.h | 2 - src/remote/remote_daemon_dispatch.c | 238 ++++++++++++++++++---------- src/rpc/gendispatch.pl | 6 + src/rpc/virnetserver.c | 22 +++ src/rpc/virnetserver.h | 2 + 7 files changed, 187 insertions(+), 88 deletions(-) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 0493467f4603..a6883f373608 100644 --- a/src/libvirt_remote.syms +++ b/src/libvirt_remote.syms @@ -124,6 +124,7 @@ virNetServerGetCurrentUnauthClients; virNetServerGetMaxClients; virNetServerGetMaxUnauthClients; virNetServerGetName; +virNetServerGetProgram; virNetServerGetThreadPoolParameters; virNetServerHasClients; virNetServerNeedsAuth; diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c index b400b1dd1059..a36b5449d5ae 100644 --- a/src/remote/remote_daemon.c +++ b/src/remote/remote_daemon.c @@ -73,8 +73,6 @@ VIR_LOG_INIT("daemon." DAEMON_NAME); #if WITH_SASL virNetSASLContextPtr saslCtxt =3D NULL; #endif -virNetServerProgramPtr remoteProgram =3D NULL; -virNetServerProgramPtr qemuProgram =3D NULL; =20 volatile bool driversInitialized =3D false; =20 @@ -996,6 +994,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 a2d9af403619..a3d6a220f868 100644 --- a/src/remote/remote_daemon.h +++ b/src/remote/remote_daemon.h @@ -97,5 +97,3 @@ struct daemonClientPrivate { #if WITH_SASL extern virNetSASLContextPtr saslCtxt; #endif -extern virNetServerProgramPtr remoteProgram; -extern virNetServerProgramPtr qemuProgram; diff --git a/src/remote/remote_daemon_dispatch.c b/src/remote/remote_daemon= _dispatch.c index 6ece51c2889d..7ebb97f49f3b 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4164,9 +4164,9 @@ remoteDispatchNodeDeviceGetParent(virNetServerPtr ser= ver G_GNUC_UNUSED, } =20 static int -remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server G_GNUC_U= NUSED, +remoteDispatchConnectRegisterCloseCallback(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_UNU= SED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr) { int rv =3D -1; @@ -4174,30 +4174,37 @@ remoteDispatchConnectRegisterCloseCallback(virNetSe= rverPtr server G_GNUC_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 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; if (virConnectRegisterCloseCallback(conn, remoteRelayConnectionClosedEvent, callback, remoteEventCallbackFree)= < 0) - goto cleanup; + goto cleanup_unlock; =20 priv->closeRegistered =3D true; rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: if (rv < 0) { remoteEventCallbackFree(callback); virNetMessageSaveError(rerr); @@ -4236,9 +4243,9 @@ remoteDispatchConnectUnregisterCloseCallback(virNetSe= rverPtr server G_GNUC_UNUSE } =20 static int -remoteDispatchConnectDomainEventRegister(virNetServerPtr server G_GNUC_UNU= SED, +remoteDispatchConnectDomainEventRegister(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_UNUSE= D, + virNetMessagePtr msg, virNetMessageErrorPtr rerr G_GNUC= _UNUSED, remote_connect_domain_event_regis= ter_ret *ret G_GNUC_UNUSED) { @@ -4249,11 +4256,17 @@ remoteDispatchConnectDomainEventRegister(virNetServ= erPtr server G_GNUC_UNUSED, struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 /* If we call register first, we could append a complete callback * to our array, but on OOM append failure, we'd have to then hope @@ -4264,9 +4277,9 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server G_GNUC_UNUSED, * between 'ref' and 'callback'. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; @@ -4274,7 +4287,7 @@ remoteDispatchConnectDomainEventRegister(virNetServer= Ptr server G_GNUC_UNUSED, if (VIR_APPEND_ELEMENT(priv->domainEventCallbacks, priv->ndomainEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectDomainEventRegisterAny(conn, NULL, @@ -4285,15 +4298,16 @@ remoteDispatchConnectDomainEventRegister(virNetServ= erPtr server G_GNUC_UNUSED, VIR_SHRINK_N(priv->domainEventCallbacks, priv->ndomainEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -4457,9 +4471,9 @@ remoteDispatchDomainGetState(virNetServerPtr server G= _GNUC_UNUSED, * VIR_DRV_SUPPORTS_FEATURE(VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK), * and must not mix the two styles. */ static int -remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server G_GNUC_= UNUSED, +remoteDispatchConnectDomainEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_UN= USED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr G_G= NUC_UNUSED, remote_connect_domain_event_re= gister_any_args *args) { @@ -4470,11 +4484,17 @@ remoteDispatchConnectDomainEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 /* We intentionally do not use VIR_DOMAIN_EVENT_ID_LAST here; any * new domain events added after this point should only use the @@ -4483,7 +4503,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED args->eventID < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"= ), args->eventID); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -4493,9 +4513,9 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; @@ -4503,7 +4523,7 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED if (VIR_APPEND_ELEMENT(priv->domainEventCallbacks, priv->ndomainEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectDomainEventRegisterAny(conn, NULL, @@ -4514,15 +4534,16 @@ remoteDispatchConnectDomainEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED VIR_SHRINK_N(priv->domainEventCallbacks, priv->ndomainEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -4531,9 +4552,9 @@ remoteDispatchConnectDomainEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED =20 =20 static int -remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server= G_GNUC_UNUSED, +remoteDispatchConnectDomainEventCallbackRegisterAny(virNetServerPtr server, virNetServerClientPtr = client, - virNetMessagePtr msg G= _GNUC_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr = rerr G_GNUC_UNUSED, remote_connect_domain_= event_callback_register_any_args *args, remote_connect_domain_= event_callback_register_any_ret *ret) @@ -4546,20 +4567,26 @@ remoteDispatchConnectDomainEventCallbackRegisterAny= (virNetServerPtr server G_GNU virNetServerClientGetPrivateData(client); virDomainPtr dom =3D NULL; virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->dom && !(dom =3D get_nonnull_domain(conn, *args->dom))) - goto cleanup; + goto cleanup_unlock; =20 if (args->eventID >=3D VIR_DOMAIN_EVENT_ID_LAST || args->eventID < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported event ID %d"= ), args->eventID); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -4569,16 +4596,16 @@ remoteDispatchConnectDomainEventCallbackRegisterAny= (virNetServerPtr server G_GNU * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->domainEventCallbacks, priv->ndomainEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectDomainEventRegisterAny(conn, dom, @@ -4589,7 +4616,7 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server G_GNU VIR_SHRINK_N(priv->domainEventCallbacks, priv->ndomainEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -4597,8 +4624,9 @@ remoteDispatchConnectDomainEventCallbackRegisterAny(v= irNetServerPtr server G_GNU =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -5641,7 +5669,7 @@ remoteDispatchDomainMigratePrepare3Params(virNetServe= rPtr server G_GNUC_UNUSED, } =20 static int -remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server G_G= NUC_UNUSED, +remoteDispatchDomainMigratePrepareTunnel3Params(virNetServerPtr server, virNetServerClientPtr clie= nt, virNetMessagePtr msg, virNetMessageErrorPtr rerr, @@ -5656,6 +5684,7 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virNe= tServerPtr server G_GNUC_UN virStreamPtr st =3D NULL; daemonClientStreamPtr stream =3D NULL; virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; =20 if (!conn) goto cleanup; @@ -5672,8 +5701,13 @@ remoteDispatchDomainMigratePrepareTunnel3Params(virN= etServerPtr server G_GNUC_UN 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(conn, VIR_STREAM_NONBLOCK)) || - !(stream =3D daemonCreateClientStream(client, st, remoteProgram, + !(stream =3D daemonCreateClientStream(client, st, program, &msg->header, false))) goto cleanup; =20 @@ -6014,9 +6048,9 @@ static int remoteDispatchDomainCreateWithFiles(virNet= ServerPtr server G_GNUC_UNU =20 =20 static int -remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server G_GNUC= _UNUSED, +remoteDispatchConnectNetworkEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_U= NUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr G_= GNUC_UNUSED, remote_connect_network_event_= register_any_args *args, remote_connect_network_event_= register_any_ret *ret) @@ -6029,20 +6063,26 @@ remoteDispatchConnectNetworkEventRegisterAny(virNet= ServerPtr server G_GNUC_UNUSE struct daemonClientPrivate *priv =3D virNetServerClientGetPrivateData(client); virConnectPtr conn =3D remoteGetNetworkConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->net && !(net =3D get_nonnull_network(conn, *args->net))) - goto cleanup; + goto cleanup_unlock; =20 if (args->eventID >=3D VIR_NETWORK_EVENT_ID_LAST || args->eventID < 0)= { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported network event ID %d"), args->eventID= ); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -6052,16 +6092,16 @@ remoteDispatchConnectNetworkEventRegisterAny(virNet= ServerPtr server G_GNUC_UNUSE * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->networkEventCallbacks, priv->nnetworkEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectNetworkEventRegisterAny(conn, net, @@ -6072,7 +6112,7 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server G_GNUC_UNUSE VIR_SHRINK_N(priv->networkEventCallbacks, priv->nnetworkEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -6080,8 +6120,9 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetSe= rverPtr server G_GNUC_UNUSE =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6135,9 +6176,9 @@ remoteDispatchConnectNetworkEventDeregisterAny(virNet= ServerPtr server G_GNUC_UNU } =20 static int -remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server G_= GNUC_UNUSED, +remoteDispatchConnectStoragePoolEventRegisterAny(virNetServerPtr server, virNetServerClientPtr cli= ent, - virNetMessagePtr msg G_GN= UC_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rer= r G_GNUC_UNUSED, remote_connect_storage_po= ol_event_register_any_args *args, remote_connect_storage_po= ol_event_register_any_ret *ret) @@ -6150,20 +6191,26 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vi= rNetServerPtr server G_GNUC_U virNetServerClientGetPrivateData(client); virStoragePoolPtr pool =3D NULL; virConnectPtr conn =3D remoteGetStorageConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->pool && !(pool =3D get_nonnull_storage_pool(conn, *args->pool))) - goto cleanup; + goto cleanup_unlock; =20 if (args->eventID >=3D VIR_STORAGE_POOL_EVENT_ID_LAST || args->eventID= < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported storage pool event ID %d"), args->ev= entID); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -6173,16 +6220,16 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vi= rNetServerPtr server G_GNUC_U * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->storageEventCallbacks, priv->nstorageEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectStoragePoolEventRegisterAny(conn, pool, @@ -6193,7 +6240,7 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server G_GNUC_U VIR_SHRINK_N(priv->storageEventCallbacks, priv->nstorageEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -6201,8 +6248,9 @@ remoteDispatchConnectStoragePoolEventRegisterAny(virN= etServerPtr server G_GNUC_U =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6255,9 +6303,9 @@ remoteDispatchConnectStoragePoolEventDeregisterAny(vi= rNetServerPtr server G_GNUC } =20 static int -remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server G_G= NUC_UNUSED, +remoteDispatchConnectNodeDeviceEventRegisterAny(virNetServerPtr server, virNetServerClientPtr clie= nt, - virNetMessagePtr msg G_GNU= C_UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr= G_GNUC_UNUSED, remote_connect_node_device= _event_register_any_args *args, remote_connect_node_device= _event_register_any_ret *ret) @@ -6270,20 +6318,26 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(vir= NetServerPtr server G_GNUC_UN virNetServerClientGetPrivateData(client); virNodeDevicePtr dev =3D NULL; virConnectPtr conn =3D remoteGetNodeDevConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->dev && !(dev =3D get_nonnull_node_device(conn, *args->dev))) - goto cleanup; + goto cleanup_unlock; =20 if (args->eventID >=3D VIR_NODE_DEVICE_EVENT_ID_LAST || args->eventID = < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported node device event ID %d"), args->eve= ntID); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -6293,16 +6347,16 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(vir= NetServerPtr server G_GNUC_UN * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->nodeDeviceEventCallbacks, priv->nnodeDeviceEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectNodeDeviceEventRegisterAny(conn, dev, @@ -6313,7 +6367,7 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server G_GNUC_UN VIR_SHRINK_N(priv->nodeDeviceEventCallbacks, priv->nnodeDeviceEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -6321,8 +6375,9 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virNe= tServerPtr server G_GNUC_UN =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6375,9 +6430,9 @@ remoteDispatchConnectNodeDeviceEventDeregisterAny(vir= NetServerPtr server G_GNUC_ } =20 static int -remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server G_GNUC_= UNUSED, +remoteDispatchConnectSecretEventRegisterAny(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_UN= USED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr G_G= NUC_UNUSED, remote_connect_secret_event_re= gister_any_args *args, remote_connect_secret_event_re= gister_any_ret *ret) @@ -6390,20 +6445,26 @@ remoteDispatchConnectSecretEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED virNetServerClientGetPrivateData(client); virSecretPtr secret =3D NULL; virConnectPtr conn =3D remoteGetSecretConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->secret && !(secret =3D get_nonnull_secret(conn, *args->secret))) - goto cleanup; + goto cleanup_unlock; =20 if (args->eventID >=3D VIR_SECRET_EVENT_ID_LAST || args->eventID < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unsupported secret event ID %d"), args->eventID); - goto cleanup; + goto cleanup_unlock; } =20 /* If we call register first, we could append a complete callback @@ -6413,16 +6474,16 @@ remoteDispatchConnectSecretEventRegisterAny(virNetS= erverPtr server G_GNUC_UNUSED * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->secretEventCallbacks, priv->nsecretEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectSecretEventRegisterAny(conn, secret, @@ -6433,7 +6494,7 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED VIR_SHRINK_N(priv->secretEventCallbacks, priv->nsecretEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -6441,8 +6502,9 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSer= verPtr server G_GNUC_UNUSED =20 rv =3D 0; =20 - cleanup: + cleanup_unlock: virMutexUnlock(&priv->lock); + cleanup: remoteEventCallbackFree(callback); if (rv < 0) virNetMessageSaveError(rerr); @@ -6495,9 +6557,9 @@ remoteDispatchConnectSecretEventDeregisterAny(virNetS= erverPtr server G_GNUC_UNUS } =20 static int -qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server G_GNU= C_UNUSED, +qemuDispatchConnectDomainMonitorEventRegister(virNetServerPtr server, virNetServerClientPtr client, - virNetMessagePtr msg G_GNUC_= UNUSED, + virNetMessagePtr msg, virNetMessageErrorPtr rerr G= _GNUC_UNUSED, qemu_connect_domain_monitor_= event_register_args *args, qemu_connect_domain_monitor_= event_register_ret *ret) @@ -6511,15 +6573,21 @@ qemuDispatchConnectDomainMonitorEventRegister(virNe= tServerPtr server G_GNUC_UNUS virDomainPtr dom =3D NULL; const char *event =3D args->event ? *args->event : NULL; virConnectPtr conn =3D remoteGetHypervisorConn(client); + virNetServerProgramPtr program; + + if (!(program =3D virNetServerGetProgram(server, msg))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("no matching progra= m found")); + goto cleanup; + } =20 virMutexLock(&priv->lock); =20 if (!conn) - goto cleanup; + goto cleanup_unlock; =20 if (args->dom && !(dom =3D get_nonnull_domain(conn, *args->dom))) - goto cleanup; + goto cleanup_unlock; =20 /* If we call register first, we could append a complete callback * to our array, but on OOM append failure, we'd have to then hope @@ -6528,16 +6596,16 @@ qemuDispatchConnectDomainMonitorEventRegister(virNe= tServerPtr server G_GNUC_UNUS * our callback; but since VIR_APPEND_ELEMENT clears 'callback' on * success, we use 'ref' to save a copy of the pointer. */ if (VIR_ALLOC(callback) < 0) - goto cleanup; + goto cleanup_unlock; 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; if (VIR_APPEND_ELEMENT(priv->qemuEventCallbacks, priv->nqemuEventCallbacks, callback) < 0) - goto cleanup; + goto cleanup_unlock; =20 if ((callbackID =3D virConnectDomainQemuMonitorEventRegister(conn, dom, @@ -6549,7 +6617,7 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server G_GNUC_UNUS VIR_SHRINK_N(priv->qemuEventCallbacks, priv->nqemuEventCallbacks, 1); callback =3D ref; - goto cleanup; + goto cleanup_unlock; } =20 ref->callbackID =3D callbackID; @@ -6557,6 +6625,8 @@ qemuDispatchConnectDomainMonitorEventRegister(virNetS= erverPtr server G_GNUC_UNUS =20 rv =3D 0; =20 + cleanup_unlock: + virMutexUnlock(&priv->lock); cleanup: virMutexUnlock(&priv->lock); remoteEventCallbackFree(callback); diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 7c868191d19c..2b8795beec16 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1052,6 +1052,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 { @@ -1093,6 +1094,11 @@ elsif ($mode eq "server") { print " if (!(st =3D virStreamNew($conn_var, VIR_STREAM_NON= BLOCK)))\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 41226368058f..787ace916c9d 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -187,6 +187,28 @@ virNetServerGetProgramLocked(virNetServerPtr srv, return NULL; } =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, diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h index 260c99b22d5e..46ecb0e91077 100644 --- a/src/rpc/virnetserver.h +++ b/src/rpc/virnetserver.h @@ -90,6 +90,8 @@ int virNetServerAddProgram(virNetServerPtr srv, int virNetServerSetTLSContext(virNetServerPtr srv, virNetTLSContextPtr tls); =20 +virNetServerProgramPtr virNetServerGetProgram(virNetServerPtr srv, + virNetMessagePtr msg); =20 int virNetServerAddClient(virNetServerPtr srv, virNetServerClientPtr client); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list