]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
API: discourage usage of non-ListAll APIs
authorJán Tomko <jtomko@redhat.com>
Sun, 4 Oct 2020 22:20:27 +0000 (00:20 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 24 Aug 2021 14:26:55 +0000 (16:26 +0200)
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án Tomko <jtomko@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/libvirt-domain-snapshot.c
src/libvirt-domain.c
src/libvirt-interface.c
src/libvirt-network.c
src/libvirt-nodedev.c
src/libvirt-nwfilter.c
src/libvirt-secret.c
src/libvirt-storage.c

index 15bf4d86346b2a2d8ec391f118d5c1fa0a0ff1dd..4a79e95704e5000cfb4e9fe486497d37aeb2e9dc 100644 (file)
@@ -381,8 +381,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 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.
@@ -582,8 +584,10 @@ virDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot, 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 virDomainSnapshotListAllChildren().
+ * connection deletes the snapshot in the meantime.
+ *
+ * The use of this function is discouraged. Instead, use
+ * virDomainSnapshotListAllChildren().
  *
  * 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.
index 3c4204e56345803e51a33fbc692f434c365cccfd..a8a386e839564f65d9491a16bda7d2aaf4959fc7 100644 (file)
@@ -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 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
@@ -6526,8 +6526,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 is discouraged. Instead, use
+ * virConnectListAllDomains().
  *
  * Returns the number of names provided in the array or -1 in case of error.
  * Note that this command is inherently racy; a domain can be defined between
index 2af86291d385d33e2c5381ed4ff553a342ee819f..e4e8178ba95262bb82e794816e45e9eb5942db91 100644 (file)
@@ -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 is discouraged. Instead, use
+ * virConnectListAllInterfaces().
  *
  * Returns the number of interfaces found or -1 in case of error.  Note that
  * this command is inherently racy; a interface can be started between a call
@@ -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 is discouraged. Instead, use
+ * virConnectListAllInterfaces().
  *
  * Returns the number of names provided in the array or -1 in case of error.
  * Note that this command is inherently racy; a interface can be defined between
index c9d0e9d25bba5c55673a50a1de4d4935af8f3a5a..5829996301a2f5e6c0611c80dec44a9434a6d7d2 100644 (file)
@@ -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 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 is discouraged. Instead, use
+ * virConnectListAllNetworks().
  *
  * Returns the number of names provided in the array or -1 in case of error.
  * Note that this command is inherently racy; a network can be defined between
index e416c125346466b86076b29e891af8f528ed3434..ce0f30e9580c3bbfa121ce7c6a5f2396ccfd2a25 100644 (file)
@@ -128,7 +128,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 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
index 7b857d14222cf9dc9aa269f417ed0b3815dd62b5..8d0927029654ceb745ca0884539f2a9acc8a6993 100644 (file)
@@ -117,6 +117,9 @@ virConnectListAllNWFilters(virConnectPtr conn,
  *
  * Collect the list of network filters, and store their names in @names
  *
+ * The use of this function is discouraged. Instead, use
+ * virConnectListAllNWFilters().
+ *
  * Returns the number of network filters found or -1 in case of error
  */
 int
index d3626ed561041f59e9e6f1b97e83a3099f08569a..d2a3a4bd9d4382b3b14973fadb8a716d2e6c05f2 100644 (file)
@@ -156,6 +156,9 @@ virConnectListAllSecrets(virConnectPtr conn,
  *
  * List UUIDs of defined secrets, store pointers to names in uuids.
  *
+ * The use of this function is discouraged. Instead, use
+ * virConnectListAllSecrets().
+ *
  * Returns the number of UUIDs provided in the array, or -1 on failure.
  */
 int
index 2a7cdca234113a7ff606cac22e1da6016c60bf1f..4badb13f049b5fb7a607984255e90fef5f586fa5 100644 (file)
@@ -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 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 is discouraged. Instead, use
+ * virConnectListAllStoragePools().
  *
  * Returns the number of names provided in the array or -1 in case of error.
  * 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 is discouraged. Instead, use
+ * virStoragePoolListAllVolumes().
  *
  * Returns the number of names fetched, or -1 on error
  */