From nobody Thu May 2 22:04:16 2024 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=1601851055; cv=none; d=zohomail.com; s=zohoarc; b=ip/bNVC7I8S90tLnwlu54bLH/AWLIPoaARLxD2ijZOo4O2BUymZ3W41ue5GA2eneRZHCiNBCsXyFE9WFjWYrq17liR8jYQNZmvMz3MiftrG36SOw/Lc80J2pOTGRFY1cPnzIC1XowQ5Bok303r++puH/K1wM2tMX2GIcerQrmcI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601851055; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=ZP4p85ay8zEwcPqCnouMMItPD6AMF5i8bOSi3Aq+d7M=; b=K2dSlvgYu834Voo8CNM2V5SvKozwryMARt1FNgppCR6ZF3lzeTnmotER/FkYqkynANA+wam4GqMlTCC/5MS5lz1lwjLt5hbqgdjvigFclTEiXuaLJxhINQ+5/NKiT1lAtC2UCnNiEC4uHB0iJalWRGCdczhg2Bh58ICsMQ5iHOY= 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) header.from= 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 1601851055975548.3491795353673; Sun, 4 Oct 2020 15:37:35 -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-195-j1fqqzQlP0OberGMzmExwA-1; Sun, 04 Oct 2020 18:37:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A09D1074660; Sun, 4 Oct 2020 22:37:26 +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 DA3317366D; Sun, 4 Oct 2020 22:37: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 303FC181A870; Sun, 4 Oct 2020 22:37:23 +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 094MZSvh001812 for ; Sun, 4 Oct 2020 18:35:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id EA36E55769; Sun, 4 Oct 2020 22:35:28 +0000 (UTC) Received: from lpt.redhat.com (unknown [10.40.208.16]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A6F02C31E for ; Sun, 4 Oct 2020 22:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601851054; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZP4p85ay8zEwcPqCnouMMItPD6AMF5i8bOSi3Aq+d7M=; b=JoUzlmAXBslcR7WVdEv6e0ObXvlLJFWzWZMBzJ2gPJSxp4xDgTTm+0incfME5bHvwl42xM ovFNxhUTrj51VRGN7eNZ7PoWFy9263e1tF+ch1g4FbGSo3M0MOqa61ZRpHZK6Wo6OQ0KRa fyTe1aFy722xMa8Ws/+HFs9sbUpleBA= X-MC-Unique: j1fqqzQlP0OberGMzmExwA-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH] API: discourage usage of non-ListAll APIs Date: Mon, 5 Oct 2020 00:35:23 +0200 Message-Id: <0cb6de323e4a2e578deb92435c540ef87f610350.1601850918.git.jtomko@redhat.com> 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.13 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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) They require the caller to provide the maximum number of array elements upfront, leading to either incomplete results or violations of the zero-one-infinity rule. Signed-off-by: J=C3=A1n Tomko --- src/libvirt-domain-snapshot.c | 6 ++++-- src/libvirt-domain.c | 8 ++++---- src/libvirt-interface.c | 6 ++++-- src/libvirt-network.c | 6 ++++-- src/libvirt-nodedev.c | 3 ++- src/libvirt-nwfilter.c | 3 +++ src/libvirt-secret.c | 3 +++ src/libvirt-storage.c | 9 ++++++--- 8 files changed, 30 insertions(+), 14 deletions(-) diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c index f856e5b9b8..74d5e16281 100644 --- a/src/libvirt-domain-snapshot.c +++ b/src/libvirt-domain-snapshot.c @@ -378,8 +378,10 @@ virDomainSnapshotNum(virDomainPtr domain, unsigned int= flags) * snapshots were listed if the return is less than @nameslen. Likewise, * you should be prepared for virDomainSnapshotLookupByName() to fail when * converting a name from this call into a snapshot object, if another - * connection deletes the snapshot in the meantime. For more control over - * the results, see virDomainListAllSnapshots(). + * connection deletes the snapshot in the meantime. + * + * The use of this function in new code is discouraged. Instead, use + * virDomainListAllSnapshots(). * * Returns the number of domain snapshots found or -1 in case of error. * The caller is responsible to call free() for each member of the array. diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 415482a526..03eca1196a 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -41,8 +41,8 @@ VIR_LOG_INIT("libvirt.domain"); * * Collect the list of active domains, and store their IDs in array @ids * - * For inactive domains, see virConnectListDefinedDomains(). For more - * control over the results, see virConnectListAllDomains(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllDomains(). * * Returns the number of domains found or -1 in case of error. Note that * this command is inherently racy; a domain can be started between a @@ -6366,8 +6366,8 @@ virConnectNumOfDefinedDomains(virConnectPtr conn) * list the defined but inactive domains, stores the pointers to the names * in @names * - * For active domains, see virConnectListDomains(). For more control over - * the results, see virConnectListAllDomains(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllDomains(). * * Returns the number of names provided in the array or -1 in case of erro= r. * Note that this command is inherently racy; a domain can be defined betw= een diff --git a/src/libvirt-interface.c b/src/libvirt-interface.c index 5eb5980483..271f21b7b5 100644 --- a/src/libvirt-interface.c +++ b/src/libvirt-interface.c @@ -150,7 +150,8 @@ virConnectNumOfInterfaces(virConnectPtr conn) * Collect the list of active physical host interfaces, * and store their names in @names * - * For more control over the results, see virConnectListAllInterfaces(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllInterfaces(). * * Returns the number of interfaces found or -1 in case of error. Note th= at * this command is inherently racy; a interface can be started between a c= all @@ -227,7 +228,8 @@ virConnectNumOfDefinedInterfaces(virConnectPtr conn) * Collect the list of defined (inactive) physical host interfaces, * and store their names in @names. * - * For more control over the results, see virConnectListAllInterfaces(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllInterfaces(). * * Returns the number of names provided in the array or -1 in case of erro= r. * Note that this command is inherently racy; a interface can be defined b= etween diff --git a/src/libvirt-network.c b/src/libvirt-network.c index f691b672c7..e6ea66a234 100644 --- a/src/libvirt-network.c +++ b/src/libvirt-network.c @@ -159,7 +159,8 @@ virConnectNumOfNetworks(virConnectPtr conn) * * Collect the list of active networks, and store their names in @names * - * For more control over the results, see virConnectListAllNetworks(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllNetworks(). * * Returns the number of networks found or -1 in case of error. Note that * this command is inherently racy; a network can be started between a call @@ -235,7 +236,8 @@ virConnectNumOfDefinedNetworks(virConnectPtr conn) * * list the inactive networks, stores the pointers to the names in @names * - * For more control over the results, see virConnectListAllNetworks(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllNetworks(). * * Returns the number of names provided in the array or -1 in case of erro= r. * Note that this command is inherently racy; a network can be defined bet= ween diff --git a/src/libvirt-nodedev.c b/src/libvirt-nodedev.c index 28765b9c30..6b1e03c531 100644 --- a/src/libvirt-nodedev.c +++ b/src/libvirt-nodedev.c @@ -151,7 +151,8 @@ virConnectListAllNodeDevices(virConnectPtr conn, * * Collect the list of node devices, and store their names in @names * - * For more control over the results, see virConnectListAllNodeDevices(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllNodeDevices(). * * If the optional 'cap' argument is non-NULL, then the count * will be restricted to devices with the specified capability diff --git a/src/libvirt-nwfilter.c b/src/libvirt-nwfilter.c index e299385895..11397f2f4c 100644 --- a/src/libvirt-nwfilter.c +++ b/src/libvirt-nwfilter.c @@ -117,6 +117,9 @@ virConnectListAllNWFilters(virConnectPtr conn, * * Collect the list of network filters, and store their names in @names * + * The use of this function in new code is discouraged. Instead, use + * virConnectListALLNWFilters(). + * * Returns the number of network filters found or -1 in case of error */ int diff --git a/src/libvirt-secret.c b/src/libvirt-secret.c index 75d40f53dc..c836a09ce7 100644 --- a/src/libvirt-secret.c +++ b/src/libvirt-secret.c @@ -156,6 +156,9 @@ virConnectListAllSecrets(virConnectPtr conn, * * List UUIDs of defined secrets, store pointers to names in uuids. * + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllSecrets(). + * * Returns the number of UUIDs provided in the array, or -1 on failure. */ int diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c index 2a7cdca234..6b2f612cac 100644 --- a/src/libvirt-storage.c +++ b/src/libvirt-storage.c @@ -179,7 +179,8 @@ virConnectNumOfStoragePools(virConnectPtr conn) * If there are more than maxnames, the remaining names will be silently * ignored. * - * For more control over the results, see virConnectListAllStoragePools(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllStoragePools(). * * Returns the number of pools found or -1 in case of error. Note that * this command is inherently racy; a pool can be started between a call to @@ -259,7 +260,8 @@ virConnectNumOfDefinedStoragePools(virConnectPtr conn) * If there are more than maxnames, the remaining names will be silently * ignored. * - * For more control over the results, see virConnectListAllStoragePools(). + * The use of this function in new code is discouraged. Instead, use + * virConnectListAllStoragePools(). * * Returns the number of names provided in the array or -1 in case of erro= r. * Note that this command is inherently racy; a pool can be defined between @@ -1254,7 +1256,8 @@ virStoragePoolNumOfVolumes(virStoragePoolPtr pool) * Fetch list of storage volume names, limiting to * at most maxnames. * - * To list the volume objects directly, see virStoragePoolListAllVolumes(). + * The use of this function in new code is discouraged. Instead, use + * virStoragePoolListAllVolumes(). * * Returns the number of names fetched, or -1 on error */ --=20 2.26.2