From nobody Mon Feb 9 16:53:03 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637253238; cv=none; d=zohomail.com; s=zohoarc; b=FmrR0JZqtfsPYAmkkiT5xbKlT3LOMT6BBrVckGZzhMvR2+s6ZmdhcfzWbnwwOXfjp0MbuZYemkAEvM7saSEieJj4krHckszA2snH78teuvAaR68AhIZMO+Jg7xAaoJdHXXPHe476FeyStH35Jj9ttPgqh1hMd4OVbFaORcqwJeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637253238; h=Content-Type:Content-Transfer-Encoding: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=piOAKEkFOe6sJQTbKckl3Kc+iOwNhOlzKSNzdGQZmdI=; b=FPNxupZwYamZ0oPgiiexX1/DsnVEmjy3vIOr4GbtuuzEqcuQXmT47FxYZ4F5s4o7zYNjApDGFbTFBP/JDIRjgMepT80nqk422437AziwK9IqXOGDwWfAffiPXg41TFWctx/LdMmCfElm1NXzmEVyXnWkuQbhK56L3MqmZam4B9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 163725323873697.32945088075826; Thu, 18 Nov 2021 08:33:58 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-qRNmKV40P4aSt1-HUaEdqA-1; Thu, 18 Nov 2021 11:33:55 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 45B8F1922960; Thu, 18 Nov 2021 16:33:42 +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 085DD5F4ED; Thu, 18 Nov 2021 16:33:51 +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 8DAEF4E58E; Thu, 18 Nov 2021 16:33:50 +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 1AIGXm1v028033 for ; Thu, 18 Nov 2021 11:33:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id BFF3E1B5C0; Thu, 18 Nov 2021 16:33:48 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0935C608BA for ; Thu, 18 Nov 2021 16:33:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637253237; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=piOAKEkFOe6sJQTbKckl3Kc+iOwNhOlzKSNzdGQZmdI=; b=K87Ro7G3ki2tNuu7td3J23JjWX09yh4L54l6caa/uHXQsffH4Lt7z2VRwg/a9bjcNO2JNs EPzr7+lZ3OjmffO7jC0kcm/Ede7oOBT+mOgG6Qk+g8X2mBlWanTzKIsMvftt0/qJOb3VUK WHo1eFpPNnlnqMKtH/7E+ougRxi9xQY= X-MC-Unique: qRNmKV40P4aSt1-HUaEdqA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/16] qemu: hotplug: Add wrapper for qemuMonitorAttachCharDev Date: Thu, 18 Nov 2021 17:33:27 +0100 Message-Id: <74b82116ac8c1a6a86e9d15178e3badd92615dde.1637253107.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637253240010100002 Content-Type: text/plain; charset="utf-8" Add a simple wrapper for 'qemuMonitorAttachCharDev' named 'qemuHotplugChardevAttach' which will simplify the moving of the character device property generator out of the monitor code. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_hotplug.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 328b06245f..6f667dfb76 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -193,6 +193,15 @@ qemuDomainDetachExtensionDevice(qemuMonitor *mon, } +static int +qemuHotplugChardevAttach(qemuMonitor *mon, + const char *alias, + virDomainChrSourceDef *def) +{ + return qemuMonitorAttachCharDev(mon, alias, def); +} + + static int qemuHotplugWaitForTrayEject(virDomainObj *vm, virDomainDiskDef *disk) @@ -1459,7 +1468,7 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver, } if (actualType =3D=3D VIR_DOMAIN_NET_TYPE_VHOSTUSER) { - if (qemuMonitorAttachCharDev(priv->mon, charDevAlias, net->data.vh= ostuser) < 0) { + if (qemuHotplugChardevAttach(priv->mon, charDevAlias, net->data.vh= ostuser) < 0) { ignore_value(qemuDomainObjExitMonitor(driver, vm)); virDomainAuditNet(vm, NULL, net, "attach", false); goto cleanup; @@ -1980,9 +1989,7 @@ int qemuDomainAttachRedirdevDevice(virQEMUDriver *dri= ver, qemuDomainObjEnterMonitor(driver, vm); - if (qemuMonitorAttachCharDev(priv->mon, - charAlias, - redirdev->source) < 0) + if (qemuHotplugChardevAttach(priv->mon, charAlias, redirdev->source) <= 0) goto exit_monitor; chardevAdded =3D true; @@ -2242,7 +2249,7 @@ int qemuDomainAttachChrDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); - if (qemuMonitorAttachCharDev(priv->mon, charAlias, chr->source) < 0) + if (qemuHotplugChardevAttach(priv->mon, charAlias, chr->source) < 0) goto exit_monitor; chardevAttached =3D true; @@ -2350,8 +2357,7 @@ qemuDomainAttachRNGDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); if (rng->backend =3D=3D VIR_DOMAIN_RNG_BACKEND_EGD && - qemuMonitorAttachCharDev(priv->mon, charAlias, - rng->source.chardev) < 0) + qemuHotplugChardevAttach(priv->mon, charAlias, rng->source.chardev= ) < 0) goto exit_monitor; chardevAdded =3D true; @@ -3058,8 +3064,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); if (shmem->server.enabled) { - if (qemuMonitorAttachCharDev(priv->mon, charAlias, - &shmem->server.chr) < 0) + if (qemuHotplugChardevAttach(priv->mon, charAlias, &shmem->server.= chr) < 0) goto exit_monitor; } else { if (qemuMonitorAddObject(priv->mon, &props, &memAlias) < 0) @@ -3472,7 +3477,7 @@ qemuDomainAttachFSDevice(virQEMUDriver *driver, qemuDomainObjEnterMonitor(driver, vm); - if (qemuMonitorAttachCharDev(priv->mon, charAlias, chardev) < 0) + if (qemuHotplugChardevAttach(priv->mon, charAlias, chardev) < 0) goto exit_monitor; chardevAdded =3D true; --=20 2.31.1