From nobody Tue Feb 10 12:57:27 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=1619535922; cv=none; d=zohomail.com; s=zohoarc; b=Rd+MquHBhhWA+SYMiV/ZDm0ZSJvmsyZqJkvk7EUIjbzqNqBGgcn4zWZAXKEdDCcOCQQUqYyFC21qLRiWt4pCP4YC5/yN/+CBwa/tZxh1P2LSlBeTXEiolNFd37Lfvs5V6g/A0Tws51Suh7leIlc7SdrSwPJPFxkmB2S8fwthsN4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1619535922; 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=RpN5lOtBq3FftIr7wMPOdOqen7vGZj38q1bPCd+pbjs=; b=Xnkb+1NLN8DcL4xKqE/fqaoVL08umEPyjl5Pt2n1OKAT/XfHzCUvp1bsimNEverJ0OL4EuizX0phktz9wJFgv/+v0wZiPwSL5oHgrvBQJCFN+ujBUkv41FPeE9s8zM5uNYxaTYgju0/PaGGpoSifRPkCvMHD8Qr+ge+bNqpAkDI= 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) header.from= 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 1619535922012258.8535194152554; Tue, 27 Apr 2021 08:05:22 -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-218-uCoBkOxUOQmfTeJjX8zZIQ-1; Tue, 27 Apr 2021 11:05:15 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 06938803625; Tue, 27 Apr 2021 15:05:10 +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 D8CAC6064B; Tue, 27 Apr 2021 15:05:09 +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 954D344A62; Tue, 27 Apr 2021 15:05:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13RF4qrX031892 for ; Tue, 27 Apr 2021 11:04:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 35EC960CC6; Tue, 27 Apr 2021 15:04:52 +0000 (UTC) Received: from work.redhat.com (ovpn-113-91.ams2.redhat.com [10.36.113.91]) by smtp.corp.redhat.com (Postfix) with ESMTP id 77C9260C0F; Tue, 27 Apr 2021 15:04:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1619535919; 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=RpN5lOtBq3FftIr7wMPOdOqen7vGZj38q1bPCd+pbjs=; b=BkZdA9H6PP7Sowbso93jq4WG0q/7J+SoZfXjbf0TNsgyt6Stx5aq3gw2BCxa3zl8YvVZHd QVttMlYufE00HCRr4DodmjrfWN0el/jz7xQUb7OSgQD+07waUvM5hZhUrKs+zwSfcjXO2A mjKWRsZqJ2huFDHMXqMYWYw6GIb67qo= X-MC-Unique: uCoBkOxUOQmfTeJjX8zZIQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 05/10] virDomainShmemDef: Change type of model to virDomainShmemModel Date: Tue, 27 Apr 2021 17:04:36 +0200 Message-Id: <20210427150441.206606-6-twiederh@redhat.com> In-Reply-To: <20210427150441.206606-1-twiederh@redhat.com> References: <20210427150441.206606-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.11 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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 4 +++- src/conf/domain_conf.h | 2 +- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_hotplug.c | 4 ++-- src/qemu/qemu_validate.c | 5 +++++ src/security/virt-aa-helper.c | 4 ++++ 6 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c9134c86c5..72d5545068 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -13995,15 +13995,17 @@ virDomainShmemDefParseXML(virDomainXMLOption *xml= opt, =20 tmp =3D virXPathString("string(./model/@type)", ctxt); if (tmp) { + int model; /* If there's none, we will automatically have the first one * (as default). Unfortunately this has to be done for * compatibility reasons. */ - if ((def->model =3D virDomainShmemModelTypeFromString(tmp)) < 0) { + if ((model =3D virDomainShmemModelTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("Unknown shmem model type '%s'"), tmp); goto cleanup; } =20 + def->model =3D model; VIR_FREE(tmp); } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index d9c0cb21d2..8afffd2451 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -1955,7 +1955,7 @@ typedef enum { struct _virDomainShmemDef { char *name; unsigned long long size; - int model; /* enum virDomainShmemModel */ + virDomainShmemModel model; int role; /* enum virDomainShmemRole */ struct { bool enabled; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d7f1c715b6..8fb331eea0 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9214,7 +9214,7 @@ qemuBuildShmemCommandLine(virLogManager *logManager, return -1; } =20 - switch ((virDomainShmemModel)shmem->model) { + switch (shmem->model) { case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM: devstr =3D qemuBuildShmemDevLegacyStr(def, shmem, qemuCaps); break; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 4344edc75b..58afa2fae6 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2978,7 +2978,7 @@ qemuDomainAttachShmemDevice(virQEMUDriver *driver, qemuDomainObjPrivate *priv =3D vm->privateData; virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_SHMEM, { .shmem =3D shm= em } }; =20 - switch ((virDomainShmemModel)shmem->model) { + switch (shmem->model) { case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN: case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL: break; @@ -5583,7 +5583,7 @@ qemuDomainDetachPrepShmem(virDomainObj *vm, =20 *detach =3D shmem =3D vm->def->shmems[idx]; =20 - switch ((virDomainShmemModel)shmem->model) { + switch (shmem->model) { case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_PLAIN: case VIR_DOMAIN_SHMEM_MODEL_IVSHMEM_DOORBELL: break; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 774426bceb..1d6881db5b 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -4936,6 +4936,11 @@ qemuValidateDomainDeviceDefShmem(virDomainShmemDef *= shmem, virDomainShmemModelTypeToString(shmem->model)); return -1; } + break; + + case VIR_DOMAIN_SHMEM_MODEL_LAST: + virReportEnumRangeError(virDomainShmemModel, shmem->model); + return -1; } =20 return 0; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index 2331cc6648..e0d78ae309 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -1209,6 +1209,10 @@ get_files(vahControl * ctl) mem_path =3D g_strdup_printf("/var/lib/libvirt/shmem-%s-so= ck", shmem->name); break; + case VIR_DOMAIN_SHMEM_MODEL_LAST: + virReportEnumRangeError(virDomainShmemModel, + shmem->model); + break; } if (mem_path !=3D NULL) { if (vah_add_file(&buf, mem_path, "rw") !=3D 0) --=20 2.26.3