From nobody Mon Feb 9 17:07: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=1628177709; cv=none; d=zohomail.com; s=zohoarc; b=LXtcSKLCkKlqpw1m5fJH/q/OX+A0kxnfTwuEpBv7w/SG12I50aMLJBDBdST5eVzmSAQ4VyC/RKWDhwDTVocnuNgnmCxSYBIj3lLFc4Vrgg4qTkjNNyP7ERqZXgMhKytAD//U8IEKDc3s02Q2EdWCNgsJwaIvovW2pM09FezSY24= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628177709; 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=feboxxXiohDXp3mb1enxJRW2wWNCsNAzNRspSUv2ctQ=; b=jWtQMqxqxbK+jkdmou+6SW939Jl5TF7WAPAcZPifsuOyukEDspcW06sSNSUeIgwCD8L7mqOOnSOSO0hmTlX26qXS4RM+YT+oBIo8DMLaBYFBKhCwmBY8rUWUtzkrUSwHZO10Xc9IiffLzS28FQb2UNCecHqC0aycsWpbgcdnHo0= 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 1628177709822284.46611920294686; Thu, 5 Aug 2021 08:35:09 -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-109-913ZiM0qP3as1doM-mK4qw-1; Thu, 05 Aug 2021 11:35:07 -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 F25D31018F7B; Thu, 5 Aug 2021 15:35:00 +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 D4C2919C87; Thu, 5 Aug 2021 15:35: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 9A2854A707; Thu, 5 Aug 2021 15:35:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 175FYvFP027766 for ; Thu, 5 Aug 2021 11:34:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 232CF18401; Thu, 5 Aug 2021 15:34:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id 791175D6B1 for ; Thu, 5 Aug 2021 15:34:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628177708; 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=feboxxXiohDXp3mb1enxJRW2wWNCsNAzNRspSUv2ctQ=; b=IGlrv4O5xxuu0YjJxWZ7MFB6HKkC1DqwT2OmJzxANBEQG++pAVc7wivN0HtIa2UhNODBv6 +bXZGesPQlzZEsBZqK3SkvhkVKgW8JsM62hXi46FBR19fOVRfNgM9po/0lMCXNdey1vlsu fSaqMZWIejMGNE28RiI9fGNonqDZcMw= X-MC-Unique: 913ZiM0qP3as1doM-mK4qw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/13] qemuNamespacePrepareOneItem: Don't pass count of elements Date: Thu, 5 Aug 2021 17:34:25 +0200 Message-Id: <3f12f0b114831a6f86f4e9e35e2196625e6b3830.1628176883.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 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: 1628177710887100001 Content-Type: text/plain; charset="utf-8" The only caller is passing a NULL terminated string list as 'devMountsPath' thus we don't need to get the count of elements. Signed-off-by: Peter Krempa --- src/qemu/qemu_namespace.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 01a5edc585..06169922b9 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1187,12 +1187,10 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData = *data, virQEMUDriverConfig *cfg, virDomainObj *vm, const char *file, - char * const *devMountsPath, - size_t ndevMountsPath) + GStrv devMountsPath) { long ttl =3D sysconf(_SC_SYMLOOP_MAX); g_autofree char *next =3D g_strdup(file); - size_t i; while (1) { g_auto(qemuNamespaceMknodItem) item =3D { 0 }; @@ -1213,14 +1211,19 @@ qemuNamespacePrepareOneItem(qemuNamespaceMknodData = *data, next =3D g_strdup(item.target); if (STRPREFIX(item.file, QEMU_DEVPREFIX)) { - for (i =3D 0; i < ndevMountsPath; i++) { - if (STREQ(devMountsPath[i], "/dev")) + GStrv n; + bool found =3D false; + + for (n =3D devMountsPath; n && *n; n++) { + if (STREQ(*n, "/dev")) continue; - if (STRPREFIX(item.file, devMountsPath[i])) + if (STRPREFIX(item.file, *n)) { + found =3D true; break; + } } - if (i =3D=3D ndevMountsPath) + if (!found) VIR_APPEND_ELEMENT(data->items, data->nitems, item); } @@ -1269,8 +1272,7 @@ qemuNamespaceMknodPaths(virDomainObj *vm, for (next =3D paths; next; next =3D next->next) { const char *path =3D next->data; - if (qemuNamespacePrepareOneItem(&data, cfg, vm, path, - devMountsPath, ndevMountsPath) < 0) + if (qemuNamespacePrepareOneItem(&data, cfg, vm, path, devMountsPat= h) < 0) goto cleanup; } --=20 2.31.1