From nobody Mon May 6 04:30:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525706846797352.1537360504842; Mon, 7 May 2018 08:27:26 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BE42230001DF; Mon, 7 May 2018 15:27:24 +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 170A019940; Mon, 7 May 2018 15:27:24 +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 924BB180BAE5; Mon, 7 May 2018 15:27:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w47FLZjB009419 for ; Mon, 7 May 2018 11:21:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F8DC111CB9E; Mon, 7 May 2018 15:21:35 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9674D111CB8C; Mon, 7 May 2018 15:21:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 7 May 2018 17:21:23 +0200 Message-Id: <3ca84dce0528145802e958767e3ff81f34e24eaf.1525706483.git.pkrempa@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH] qemu: domain: Replace qemuDomainFilePathIsHostCDROM with virFileIsCDROM X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 07 May 2018 15:27:25 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Use the new helper when checking that the VM needs to be tainted as a host-cdrom passthrough. Signed-off-by: Peter Krempa Reviewed-by: Laine Stump --- src/qemu/qemu_domain.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index b13e6d8ca4..ec865e68c8 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -6483,35 +6483,6 @@ qemuDomainDefFormatLive(virQEMUDriverPtr driver, } -/* qemuDomainFilePathIsHostCDROM - * @path: Supplied path. - * - * Determine if the path is a host CD-ROM path. Typically this is - * either /dev/cdrom[n] or /dev/srN, so those are easy checks, but - * it's also possible that @path resolves to /dev/srN, so check for - * those conditions on @path in order to emit the tainted message. - * - * Returns true if the path is a CDROM, false otherwise or on error. - */ -static bool -qemuDomainFilePathIsHostCDROM(const char *path) -{ - bool ret =3D false; - char *linkpath =3D NULL; - - if (virFileResolveLink(path, &linkpath) < 0) - goto cleanup; - - if (STRPREFIX(path, "/dev/cdrom") || STRPREFIX(path, "/dev/sr") || - STRPREFIX(linkpath, "/dev/sr")) - ret =3D true; - - cleanup: - VIR_FREE(linkpath); - return ret; -} - - void qemuDomainObjTaint(virQEMUDriverPtr driver, virDomainObjPtr obj, virDomainTaintFlags taint, @@ -6630,7 +6601,7 @@ void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr dri= ver, if (disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM && virStorageSourceGetActualType(disk->src) =3D=3D VIR_STORAGE_TYPE_B= LOCK && - disk->src->path && qemuDomainFilePathIsHostCDROM(disk->src->path)) + disk->src->path && virFileIsCDROM(disk->src->path)) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH, logCtxt); --=20 2.16.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list