From nobody Thu Apr 25 23:44:34 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=1572629792; cv=none; d=zoho.com; s=zohoarc; b=gr81443gQgXw0+3dfgW7KFKg5QDTs9xkwPsWr6icop5v02Qfp8spQKRwS1c6zdgQjNat1khokw2Rz4DVS9Thx/9UclRvSu7NwHplqlwjt6I0eM/oCyjjBod9u8e1wePJY0IJIdrdQma9yCkjBxvFfig6xwlrS5SyEmCmYYJnh6E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629792; 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=QJndQ5VLPhowfw7r94rVWyE6lc2uedeYiuW9p/iQHdY=; b=FwsFXc++noJB1xLmWlXPlm8nffnQiNjzoW3gJljR28kY3895iszSv/MXpZY/gsNbwyRG71601ffNFwnz0SUkhn6lx4apU65v6HSXeZlmkjeaBWw4SqgIYEeaZWsSH9012FU99PIFSjyh3lr/A5WscvP5baShcXp6aVVHgbw3pgQ= 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 1572629791838401.4545355770499; Fri, 1 Nov 2019 10:36:31 -0700 (PDT) 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-33-A759j0TYMe-HieEFmQNx6A-1; Fri, 01 Nov 2019 13:36:28 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9FB781005500; Fri, 1 Nov 2019 17:36:23 +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 CBC5C60876; Fri, 1 Nov 2019 17:36:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7156C4BB5C; Fri, 1 Nov 2019 17:36:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaGqn028004 for ; Fri, 1 Nov 2019 13:36:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id C66AB63BA9; Fri, 1 Nov 2019 17:36:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C030B5D6B7 for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7DCB63084242 for ; Fri, 1 Nov 2019 17:36:13 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA1GrTB1135287 for ; Fri, 1 Nov 2019 13:36:13 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2w0rd51nke-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:12 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Fri, 1 Nov 2019 17:36:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha7Gd50921604 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 51C7942042; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1B1C842047; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629790; 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=QJndQ5VLPhowfw7r94rVWyE6lc2uedeYiuW9p/iQHdY=; b=Ws0o1uQZN5CkgKuNsq3JN/b6Z4EzKFaO4qJVl6DGdB6OT9Kg3xxunQFz9SPiHp9GBSF/p0 dxY6SXRzWZGEh7+JyX/SZNs9zdMu1+6Ble7zOFT43UF9QP/fWnc/IdPhREnCLdz07eeam2 nmHbh0Re2vMs3AiW1Y0ikP2gaIvt4bw= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:43 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-0016-0000-0000-000002BFE0CE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-0017-0000-0000-000033214A79 Message-Id: <20191101173548.7888-2-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=762 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 01 Nov 2019 17:36:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 01 Nov 2019 17:36:13 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 1/6] 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.79 on 10.5.11.13 X-MC-Unique: A759j0TYMe-HieEFmQNx6A-1 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 042661ffa5ea..54d0e4f31489 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -204,7 +204,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) { @@ -212,7 +212,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 Thu Apr 25 23:44:34 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=1572629791; cv=none; d=zoho.com; s=zohoarc; b=nMZanEb8IN0QuB005p12SivhjVFc6llrN1f/xhjZUoBNrK0w1HizY+qs2NjOHapgzD0fuRFVpwgD+cF+XN9kZCeXDAadgnQ90UREQWF6UjxsPdX2nvVR1NtXiroY0qsq4HNEXAaYdbcU+azWD7DMmMxqOakHXHq5HPvqFjzs+yA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629791; 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=cN+9Zh0cSDn3qprZL/wSf9FBgk/byGGxyAiKmz1b35E=; b=RK0Nwepyg+5NLwZEvyqMXsuYcGIjDBn+6vsu+j6rTz2ZYBgXRv+InIwp4sQLuN/ySE1uG9q33oZQbgo3wEq0b+4v52xhfIJw87DS6O1nQFfyqf637xTUcLaR5K+yf/0VYoRPgcMJOEpy2iZzYjj9f3EW1vYiWVHFu034jU2VXck= 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 1572629791439604.584103380323; Fri, 1 Nov 2019 10:36:31 -0700 (PDT) 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-270-mPn9yhuwM3ig2__PdH1mkA-1; Fri, 01 Nov 2019 13:36:28 -0400 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 9F901107ACC0; Fri, 1 Nov 2019 17:36:23 +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 F16FD5C28E; Fri, 1 Nov 2019 17:36:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 714AD18089C8; Fri, 1 Nov 2019 17:36:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaGo3028005 for ; Fri, 1 Nov 2019 13:36:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id C93825D6B7; Fri, 1 Nov 2019 17:36:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx29.extmail.prod.ext.phx2.redhat.com [10.5.110.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C0F355D6D8 for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2166818C786E for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) 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 xA1HTY55037045 for ; Fri, 1 Nov 2019 13:36:13 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w050yk76k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:13 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 1 Nov 2019 17:36:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha7gR42533040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:07 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C6CF42049; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5FAB742045; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629790; 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=cN+9Zh0cSDn3qprZL/wSf9FBgk/byGGxyAiKmz1b35E=; b=eOqFxBZfOOysE2D7shvfyJLI/kGFtZSbdkVMPI4Ra7H0T/ddU6I4ZPqiG2iPi88liqZ0dO tFMKuMBn5Tx/2KNOLykLHR9rjJ+0ctDsCfZY091k8/XxTp2MhjbMWCCo3Hfg/mi8DjIhBu IOX8hH0q/eK4EPVL3vL9b7nG9OpFZ8U= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:44 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-4275-0000-0000-00000379EF54 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-4276-0000-0000-0000388D31F7 Message-Id: <20191101173548.7888-3-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.70 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 2/6] 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-MC-Unique: mPn9yhuwM3ig2__PdH1mkA-1 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. Signed-off-by: Marc Hartmayer --- src/libvirt-host.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libvirt-host.c b/src/libvirt-host.c index 221a1b7a4353..9c3a19f33b12 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 @@ -1428,9 +1428,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 Thu Apr 25 23:44:34 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=1572629812; cv=none; d=zoho.com; s=zohoarc; b=nC17GFKuftUmd2hdaZkxnGfyBbOkaBWimSi93j5/cC4r+tgxk2xnd3xjsqf3x1BQzYGpPMUgp4xC+zfYeC6E0Pdl+TibXNsEuZtIJYn5RqOBhzC17IcnDmkO49JYbnF1hJPgqJxQ+pPjzUzta/q4RwiEVovNxH3mr4lIu7S39bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629812; 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=hJFWqBjUdjt29ced5gB27SSWA/F+Nj18k28lvcSSoNY=; b=KXj078HAcUvawIDJ5x46icmMJB5FDaCGLczJxDwuSA6qgD4IXnM8dhDKM/Jg0cWjD58jkeFV3uRCqPotYE6KxvAuhAkXb/PyS5Dcss+CFkUftJo+Lk5NZKhLajuhRKthFlKFVzes0f4j1Y/Sv2EIe7NMDPbCk5+gOxCT6xLh+xA= 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 1572629811992439.61863124662295; Fri, 1 Nov 2019 10:36:51 -0700 (PDT) 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-145-owW2CiobNjymOhLWL6wTHw-1; Fri, 01 Nov 2019 13:36:48 -0400 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 B07C785B6F4; Fri, 1 Nov 2019 17:36:43 +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 8C90D63BBA; Fri, 1 Nov 2019 17:36:43 +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 5207818089D0; Fri, 1 Nov 2019 17:36:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaIpG028041 for ; Fri, 1 Nov 2019 13:36:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id 53F335C548; Fri, 1 Nov 2019 17:36:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4DF945C297 for ; Fri, 1 Nov 2019 17:36:15 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 54AF85945E for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA1GrLgg092469 for ; Fri, 1 Nov 2019 13:36:14 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w0r29je0x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:13 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:11 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Fri, 1 Nov 2019 17:36:08 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha7GM43057168 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D525742045; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A6674203F; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:07 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629811; 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=hJFWqBjUdjt29ced5gB27SSWA/F+Nj18k28lvcSSoNY=; b=BoGDFjhNZBwn+zIaM9POvWXHeyqshx2ZfSes1KIhh+4GgN+ztH85sH7BoXnaw67M9upcnq F/o+mGH0KmmA4i+xTRP8HYnSv9sgb75M79X9QbILfc7NZwZkt6mnpOu+/HnL7MRF2eIGWC UCwVz4yIQW2IJo8ZgRQ3DEwKXvvAtPc= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:45 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-0028-0000-0000-000003B1D941 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-0029-0000-0000-0000247427A4 Message-Id: <20191101173548.7888-4-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 3/6] 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.15 X-MC-Unique: owW2CiobNjymOhLWL6wTHw-1 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 be20556128ae..e7f6d4c9f138 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); @@ -4259,6 +4261,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; @@ -4487,6 +4490,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; @@ -4562,6 +4566,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; @@ -6044,6 +6049,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; @@ -6164,6 +6170,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; @@ -6283,6 +6290,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; @@ -6402,6 +6410,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; @@ -6516,6 +6525,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 Thu Apr 25 23:44:34 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=1572629807; cv=none; d=zoho.com; s=zohoarc; b=OrylFqEjpbPgFDhIzZVNME/D/nVZn7hndKGOHh3wOSoeByz82d7VrDtsqUZlyu1nbg8sPqj0SQc3ZPxMHEtr8F/8c4xoDCMJp33oK9eKdtcS5HuEtBq28qzzABocIVO6/FlYljjMmlTi+A5DntTE8JrQ866/AH7woielizlID0w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629807; 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=ECvnMu86lF19HrlShFWdv3R5sKjjH9ijaFe7pAzgPjg=; b=Y3ZF2zQzBC7QBGYQG3A+HZ06uzZBz2eVa4+vT6tiXegvBSaU/3B8GQwuRWmXKwukLC9vYa2U9ubNmqHtJwooJBCGGl4Gj9r7ScL0WfCWtJYIKYMt22/LOdZD/bfzRCd1ml4KN+Elnx92mo39EltDOCKEuJnTf2QWo91Dz+TI4Rg= 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 1572629807137136.82973192484553; Fri, 1 Nov 2019 10:36:47 -0700 (PDT) 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-55-I1CkKP8ZOsmT-QoL7wE6TQ-1; Fri, 01 Nov 2019 13:36:44 -0400 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 EE48D800A1E; Fri, 1 Nov 2019 17:36:39 +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 CA0711001920; Fri, 1 Nov 2019 17:36:39 +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 573F018089CE; Fri, 1 Nov 2019 17:36:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaHJr028019 for ; Fri, 1 Nov 2019 13:36:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 329E260876; Fri, 1 Nov 2019 17:36:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx22.extmail.prod.ext.phx2.redhat.com [10.5.110.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2D51960870 for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DC8B018CB8E2 for ; Fri, 1 Nov 2019 17:36:13 +0000 (UTC) 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 xA1Gqv0d018682 for ; Fri, 1 Nov 2019 13:36:13 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0b-001b2d01.pphosted.com with ESMTP id 2w0pf46h19-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:13 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:11 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) 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) Fri, 1 Nov 2019 17:36:09 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha8ax44433848 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80B1442045; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5387D42041; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629806; 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=ECvnMu86lF19HrlShFWdv3R5sKjjH9ijaFe7pAzgPjg=; b=Gd3440SyprV9tpEB+AgcRIlQQI497mK8ze26S17NRH9m1BuhdFNFfKRMC36p00IMA3NVCG PdQrcrm+r5P8g4MRsx4vFYjz7wywM8uONgNubF8c6gpFQjN4PuY7wqhaAVXMWeZATgl/kR +PKQultIGz3vF5xNBS0HBHx71Fod1iA= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:46 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-0016-0000-0000-000002BFE0CF X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-0017-0000-0000-000033214A7A Message-Id: <20191101173548.7888-5-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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=802 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.63]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.63 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 4/6] 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.84 on 10.5.11.22 X-MC-Unique: I1CkKP8ZOsmT-QoL7wE6TQ-1 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 e7f6d4c9f138..70f1f7d815e8 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); @@ -4176,6 +4176,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); @@ -4185,9 +4186,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; @@ -4195,8 +4204,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 Thu Apr 25 23:44:34 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=1572629817; cv=none; d=zoho.com; s=zohoarc; b=P278620ekV9hltdthLF1g+rXO6kaPxcVL9XpFLocO6H1DQBsWoTb643myGeGeJ95zbvym4dQ6Kl6sZ/NeeqYrBSNbChwo8gHfh7UiqNvqtVC7uKFjxj0qHB/y+qWjbZNh+ZhT2Ys2HoYzmHwYrFES04UhX2DQV8Arr+e5Cg/wXQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629817; 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=tjDz0b32anMgL02113y5/YsDzy3gEVAeC+LMpYYOu8s=; b=ENU5alA3G95o8WKUG+J9T0miYW93FUjmKC4Cb8Ei3H/QnD2lWSLCE5Goud3UUsM55+gO0dE4FRvO3CiUkSCi4ygBLdqWpyKF2t5mS6jZId9IbvIwJM+CJQ9bV6s8pEsqx/JaMDdjhWfkSQsYKjVXu6mXYvd4MekEjU5GhF5bqBE= 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 1572629817551430.4090863443629; Fri, 1 Nov 2019 10:36:57 -0700 (PDT) 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-429-vL16dZCdNh6PUwfA3N9FLA-1; Fri, 01 Nov 2019 13:36:54 -0400 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 8FDA1107ACC2; Fri, 1 Nov 2019 17:36:49 +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 675FB1001920; Fri, 1 Nov 2019 17:36:49 +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 2307C18089D0; Fri, 1 Nov 2019 17:36:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaHV8028031 for ; Fri, 1 Nov 2019 13:36:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id AEFE26012A; Fri, 1 Nov 2019 17:36:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A920160126 for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 311B381F13 for ; Fri, 1 Nov 2019 17:36:14 +0000 (UTC) Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA1GrLbj092681 for ; Fri, 1 Nov 2019 13:36:13 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w0r29je0w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:13 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:11 -0000 Received: from b06avi18878370.portsmouth.uk.ibm.com (9.149.26.194) 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) Fri, 1 Nov 2019 17:36:09 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha8tV32965056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:08 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BAA2642041; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8DC454203F; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629816; 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=tjDz0b32anMgL02113y5/YsDzy3gEVAeC+LMpYYOu8s=; b=B9+mNgesnD5WiLL/CqddMfvLtQ7Xn90L91mUo1DCxkifoKLu7KWhBK9SFrcg+BcMjIdwsF Zcly0vv1upeNGop5OcSQ9sKDvQ5Ri7gowdCKE1Lt9Fb5kcl1fdkixKQZZOFP4OC75Wte42 ztMQDUaR1K9VFe4c2jH597f6n3krEdE= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:47 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-0008-0000-0000-00000329DDE7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-0009-0000-0000-00004A492E44 Message-Id: <20191101173548.7888-6-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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=856 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 01 Nov 2019 17:36:14 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 5/6] 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-MC-Unique: vL16dZCdNh6PUwfA3N9FLA-1 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 54d0e4f31489..154747a1a097 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -171,6 +171,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, @@ -180,18 +200,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 Thu Apr 25 23:44:34 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=1572629825; cv=none; d=zoho.com; s=zohoarc; b=cGVw1tMQ6xkeAqu3/gdaWt0EcO96WZLvZSnlJzZCuEwygVRhsKDPhTYF1EcXf6SJ5BjkojsIIw8EEybVA9hYSXoFtQEtdZc1tFP6AmpVbbeT1s12zhuh4ZEeNlcriBv5RmIf/tOsPy7NEsd+PgH46oqhiexeDQwglzhI59eH7Gk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572629825; 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=JvvfF9hc1yqLdy9/efbFTUX0W3Rl4MjjjINKbZrd5bc=; b=jDKHTPjWEYvNJljCF0rpolLeDFsfl690KeUz5K9uFcBxGvKrA3TOrdxu3tQgiNL/ejoqMwfxqyHGHQAMPts3ymGZb3MBMEURie47NUDEp6Vnn6x2NZtc1tOT2V21KEAZPp69RYitVCfzyfl1kOgw+dGku2RZoGBgnz/yvXRSK5A= 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 1572629825909588.5543644345516; Fri, 1 Nov 2019 10:37:05 -0700 (PDT) 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-145-54OgEYpTML6Be8nw03WySA-1; Fri, 01 Nov 2019 13:36:48 -0400 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 B0A511005513; Fri, 1 Nov 2019 17:36:43 +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 8F6885C28E; Fri, 1 Nov 2019 17:36:43 +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 4DDDF4E566; Fri, 1 Nov 2019 17:36:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA1HaHG3028024 for ; Fri, 1 Nov 2019 13:36:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 424F05D6D8; Fri, 1 Nov 2019 17:36:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx29.extmail.prod.ext.phx2.redhat.com [10.5.110.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CEB45D6B7 for ; Fri, 1 Nov 2019 17:36:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2293118C786C for ; Fri, 1 Nov 2019 17:36:16 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id xA1Grl4p041671 for ; Fri, 1 Nov 2019 13:36:15 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2w0r7whyhq-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 01 Nov 2019 13:36:15 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 1 Nov 2019 17:36:13 -0000 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 1 Nov 2019 17:36:10 -0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xA1Ha9aM52691182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Nov 2019 17:36:09 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0F17B42047; Fri, 1 Nov 2019 17:36:09 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C75B742042; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) Received: from marcibm.ibmuc.com (unknown [9.145.5.215]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 1 Nov 2019 17:36:08 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572629822; 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=JvvfF9hc1yqLdy9/efbFTUX0W3Rl4MjjjINKbZrd5bc=; b=DufEUtR+fNMXoFZ6DFp6Z2V+rSqDJWAMMRJUapDLUKz709Nrw0CrNtzJHy/tHUExwJeRG2 Neb4ZmQyQr3/qKPwZEmKyxVzS52zxumbggRKsB59BhknOiFBu/ktJF6WP4tNPvSCC5nSbM 4XdfyPqfQyw5j+mgrzbIENeYnxBOgjw= From: Marc Hartmayer To: Date: Fri, 1 Nov 2019 18:35:48 +0100 In-Reply-To: <20191101173548.7888-1-mhartmay@linux.ibm.com> References: <20191101173548.7888-1-mhartmay@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 x-cbid: 19110117-4275-0000-0000-00000379EF56 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19110117-4276-0000-0000-0000388D31F8 Message-Id: <20191101173548.7888-7-mhartmay@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-11-01_06:, , 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-1908290000 definitions=main-1911010158 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 01 Nov 2019 17:36:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.70]); Fri, 01 Nov 2019 17:36:16 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.70 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Pavel Hrdina Subject: [libvirt] [PATCH v3 6/6] 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.16 X-MC-Unique: 54OgEYpTML6Be8nw03WySA-1 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 | 118 +++++++++++++++++++++------- src/rpc/gendispatch.pl | 6 ++ src/rpc/virnetserver.c | 22 ++++++ src/rpc/virnetserver.h | 2 + 7 files changed, 122 insertions(+), 33 deletions(-) diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms index 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 7e63e180344d..c8ac224d52e9 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 @@ -1007,6 +1005,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 70f1f7d815e8..8756bd1a222d 100644 --- a/src/remote/remote_daemon_dispatch.c +++ b/src/remote/remote_daemon_dispatch.c @@ -4170,9 +4170,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; @@ -4180,6 +4180,12 @@ remoteDispatchConnectRegisterCloseCallback(virNetSer= verPtr 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 @@ -4190,7 +4196,7 @@ remoteDispatchConnectRegisterCloseCallback(virNetServ= erPtr server G_GNUC_UNUSED, goto cleanup; =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; @@ -4242,9 +4248,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) { @@ -4255,6 +4261,12 @@ remoteDispatchConnectDomainEventRegister(virNetServe= rPtr 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 @@ -4272,7 +4284,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->program =3D virObjectRef(program); callback->eventID =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4463,9 +4475,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) { @@ -4476,6 +4488,12 @@ remoteDispatchConnectDomainEventRegisterAny(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 @@ -4501,7 +4519,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; callback->legacy =3D true; @@ -4537,9 +4555,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) @@ -4552,6 +4570,12 @@ 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 @@ -4577,7 +4601,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -5647,7 +5671,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, @@ -5662,6 +5686,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; @@ -5678,8 +5703,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 @@ -6020,9 +6050,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) @@ -6035,6 +6065,12 @@ remoteDispatchConnectNetworkEventRegisterAny(virNetS= erverPtr 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 @@ -6060,7 +6096,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6141,9 +6177,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) @@ -6156,6 +6192,12 @@ remoteDispatchConnectStoragePoolEventRegisterAny(vir= NetServerPtr 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 @@ -6181,7 +6223,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6261,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) @@ -6276,6 +6318,12 @@ remoteDispatchConnectNodeDeviceEventRegisterAny(virN= etServerPtr 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 @@ -6301,7 +6349,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6381,9 +6429,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) @@ -6396,6 +6444,12 @@ remoteDispatchConnectSecretEventRegisterAny(virNetSe= rverPtr 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 @@ -6421,7 +6475,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->program =3D virObjectRef(program); callback->eventID =3D args->eventID; callback->callbackID =3D -1; ref =3D callback; @@ -6501,9 +6555,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) @@ -6517,6 +6571,12 @@ qemuDispatchConnectDomainMonitorEventRegister(virNet= ServerPtr 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 @@ -6536,7 +6596,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->program =3D virObjectRef(program); callback->eventID =3D -1; callback->callbackID =3D -1; ref =3D callback; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index 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 154747a1a097..80a28123c536 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -192,6 +192,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