From nobody Mon Feb 9 04:46:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1595410872; cv=none; d=zohomail.com; s=zohoarc; b=XJDwGDoCE1RMe4upQ01N92DRGbEoTyxZnbJTZzhnMK8qW+dd5et7BBeR2i2g+GWFHeH6PJY3cPXDUX2T37bzjwVibxEkNU5LlKl5QzghLCrLV8x6EhrI0hYlk/PPlGqeTFf9aWA9k5bYnhFZ1FCAl7G4/Is24snqituNJhpRxQ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595410872; 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=5UST0wBPLG5Y/PuXK5OBHxIRE1h5dPdwldVE8eVl09k=; b=K7tNKd+VdPtUyAdIThfuNcn0qJ5bcPJUPmgjyzMForHWYVDGZLo5dyj3uu/+J3sWuGsekRVD6pjBR86TIJETORU5pIc8JkI8bBHckF6OsGHmYF5TwkyjiiP5LwmBiYGu/RrdZ/fEdwy3rEEdHJT/i5tOADsLwpIAoFMkH4rpOqk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1595410872253649.187769771467; Wed, 22 Jul 2020 02:41:12 -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-482-4b2q7Bs7OI6p3AjIo73dtA-1; Wed, 22 Jul 2020 05:41:08 -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 C1F4091272; Wed, 22 Jul 2020 09:41:00 +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 A244F78540; Wed, 22 Jul 2020 09:41:00 +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 6F00D1800C9A; Wed, 22 Jul 2020 09:41:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06M9euMJ000952 for ; Wed, 22 Jul 2020 05:40:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4D9242B4DD; Wed, 22 Jul 2020 09:40:56 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.120]) by smtp.corp.redhat.com (Postfix) with ESMTP id C11FE1A8F7 for ; Wed, 22 Jul 2020 09:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595410871; 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=5UST0wBPLG5Y/PuXK5OBHxIRE1h5dPdwldVE8eVl09k=; b=BaGLbN9FNUoWnlDh9kfaliV4sQqfojTKEocP0yd+1xHwbPdY+3JLDILHVHgrgts0XTc/N1 +p4VqamaZF6m4uNl9i5RinYO4831+GnxPv/xiv9n5CFVkmnxQfElaR0S6/74Huf08u3v5x 0p7GWwg3QJoFQ/Ii1whZdBslChdT4y8= X-MC-Unique: 4b2q7Bs7OI6p3AjIo73dtA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH v1 13/34] qemuDomainNamespaceMknodPaths: Turn @paths into string list Date: Wed, 22 Jul 2020 11:40:07 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.11 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" Every caller does the same - counts the number of items in a string list they have, only to pass the number to qemuDomainNamespaceMknodPaths(). This is needless - the function can accept the string list and count the items itself. Signed-off-by: Michal Privoznik Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain_namespace.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_domain_namespace.c b/src/qemu/qemu_domain_namesp= ace.c index b9f8c32770..1803943fbc 100644 --- a/src/qemu/qemu_domain_namespace.c +++ b/src/qemu/qemu_domain_namespace.c @@ -1434,18 +1434,19 @@ qemuDomainNamespacePrepareOne(qemuDomainMknodDataPt= r data, =20 static int qemuDomainNamespaceMknodPaths(virDomainObjPtr vm, - const char **paths, - size_t npaths) + const char **paths) { qemuDomainObjPrivatePtr priv =3D vm->privateData; virQEMUDriverPtr driver =3D priv->driver; g_autoptr(virQEMUDriverConfig) cfg =3D NULL; char **devMountsPath =3D NULL; size_t ndevMountsPath =3D 0; + size_t npaths =3D 0; qemuDomainMknodData data =3D { 0 }; size_t i; int ret =3D -1; =20 + npaths =3D virStringListLength(paths); if (npaths =3D=3D 0) return 0; =20 @@ -1566,9 +1567,9 @@ static int qemuDomainNamespaceMknodPath(virDomainObjPtr vm, const char *path) { - const char *paths[] =3D { path }; + const char *paths[] =3D { path, NULL }; =20 - return qemuDomainNamespaceMknodPaths(vm, paths, 1); + return qemuDomainNamespaceMknodPaths(vm, paths); } =20 =20 @@ -1624,7 +1625,6 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm, { virStorageSourcePtr next; VIR_AUTOSTRINGLIST paths =3D NULL; - size_t npaths =3D 0; bool hasNVMe =3D false; =20 if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) @@ -1674,8 +1674,7 @@ qemuDomainNamespaceSetupDisk(virDomainObjPtr vm, virStringListAdd(&paths, QEMU_DEV_VFIO) < 0) return -1; =20 - npaths =3D virStringListLength((const char **) paths); - if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths, npaths) <= 0) + if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths) < 0) return -1; =20 return 0; @@ -1713,7 +1712,6 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm, { g_autofree char *path =3D NULL; VIR_AUTOSTRINGLIST paths =3D NULL; - size_t npaths =3D 0; =20 if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT)) return 0; @@ -1729,8 +1727,7 @@ qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm, virStringListAdd(&paths, QEMU_DEV_VFIO) < 0) return -1; =20 - npaths =3D virStringListLength((const char **) paths); - if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths, npaths) <= 0) + if (qemuDomainNamespaceMknodPaths(vm, (const char **) paths) < 0) return -1; =20 return 0; --=20 2.26.2