From nobody Mon Feb 9 04:03:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1634037258; cv=none; d=zohomail.com; s=zohoarc; b=bPnxLaFZ61p1ijO6ON0xrOhcFmd1v00G+BzzL0pYVmpodpZ+ZWOC6kvXnx7QqqSwqmqP7fwBEN8LpdpraNJoNt/mnZc7O4p/bzpjL3gnw5bWqV90ZRpPpMQ8qnVRf74WKsqv2VdpsJp0lUpb1FK3kWgkdDWZrqQ1In9r6VNSntQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634037258; 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=wfj6HLHv0FFfkiDJtjMLLrW9oPrcurzXUENsXubz1WA=; b=CNYJxSUbDGGOMMLlSuDzLqLFB+kFvCI8RYPWwwXpHuwLVVDS0M3cpQbvJI6xfe1pRJfeYji8lBg0Va3X3ErwqbBynSBSirppbd4rFOFgvN+RvxOLy0ljOmECpnTE985KD3s8YLE23cVr1JiLpTm4EITb7CxnSjlgCJVGYpcZOVE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634037258610494.72623630366536; Tue, 12 Oct 2021 04:14:18 -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-238-ie9o93f3NnqPyQPzuYtnbA-1; Tue, 12 Oct 2021 07:12:53 -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 663F080158D; Tue, 12 Oct 2021 11:12:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4AC3B5F4F6; Tue, 12 Oct 2021 11:12:48 +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 1E876181A1D0; Tue, 12 Oct 2021 11:12:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19CBCkGL008270 for ; Tue, 12 Oct 2021 07:12:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 653DEADCB; Tue, 12 Oct 2021 11:12:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4344ADCA for ; Tue, 12 Oct 2021 11:12:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634037257; 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=wfj6HLHv0FFfkiDJtjMLLrW9oPrcurzXUENsXubz1WA=; b=PJ7dFPtpZsg6clIjQiMm0bBOo3ISFvkCV4vjzy+i+i/1FXT10Np5tbkGXHUAQYKEd/N0Iv bhGUsgqpuF8089KSEFWWbAYWX/IUbN46xPSkviRSv2Y9uQWVmqE5DeYLHj9QMDIpgyQEvo U2nCiVMv8Y7RCdmMi1F7YgUPy9H4Oxc= X-MC-Unique: ie9o93f3NnqPyQPzuYtnbA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/14] qemuBuildSmartcardCommandLine: Replace qemuBuildSmartcardFindCCIDController Date: Tue, 12 Oct 2021 13:12:12 +0200 Message-Id: <7a2cc76b120dc54acf109f32663fa4615987f097.1634037045.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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: 1634037260387100001 Content-Type: text/plain; charset="utf-8" We have a commonly used helper virDomainControllerAliasFind, which does the same thing and also reports errors internally. Signed-off-by: Peter Krempa --- src/qemu/qemu_command.c | 35 +++-------------------------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d7a6ebde7..e41c7dfaaa 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9048,32 +9048,6 @@ qemuBuildNetCommandLine(virQEMUDriver *driver, } -static const char * -qemuBuildSmartcardFindCCIDController(const virDomainDef *def, - const virDomainSmartcardDef *smartcar= d) -{ - size_t i; - - /* Should never happen. But doesn't hurt to check. */ - if (smartcard->info.type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCID) - return NULL; - - for (i =3D 0; i < def->ncontrollers; i++) { - const virDomainControllerDef *tmp =3D def->controllers[i]; - - if (tmp->type !=3D VIR_DOMAIN_CONTROLLER_TYPE_CCID) - continue; - - if (tmp->idx !=3D smartcard->info.addr.ccid.controller) - continue; - - return tmp->info.alias; - } - - return NULL; -} - - static int qemuBuildSmartcardCommandLine(virLogManager *logManager, virSecurityManager *secManager, @@ -9152,13 +9126,10 @@ qemuBuildSmartcardCommandLine(virLogManager *logMan= ager, return -1; } - if (!(contAlias =3D qemuBuildSmartcardFindCCIDController(def, - smartcard))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find controller for %s"), - smartcard->info.alias); + if (!(contAlias =3D virDomainControllerAliasFind(def, + VIR_DOMAIN_CONTROLLER_T= YPE_CCID, + smartcard->info.addr.cc= id.controller))) return -1; - } virCommandAddArg(cmd, "-device"); virBufferAsprintf(&opt, ",id=3D%s,bus=3D%s.0", smartcard->info.alias, = contAlias); --=20 2.31.1