[libvirt] [PATCH] Remove bogus warning about vir$OBJECTGetConnect functions

Daniel P. Berrange posted 1 patch 6 years, 7 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170804153003.25680-1-berrange@redhat.com
src/libvirt-domain-snapshot.c | 6 ------
src/libvirt-domain.c          | 4 ----
src/libvirt-interface.c       | 4 ----
src/libvirt-network.c         | 4 ----
src/libvirt-secret.c          | 3 ---
src/libvirt-storage.c         | 8 --------
6 files changed, 29 deletions(-)
[libvirt] [PATCH] Remove bogus warning about vir$OBJECTGetConnect functions
Posted by Daniel P. Berrange 6 years, 7 months ago
The API docs for the various vir$OBJECTGetConnect functions
contain a warning

  WARNING: When writing libvirt bindings in other languages, do
  not use this function.  Instead, store the connection and
  the domain object together.

There is no reason why language bindings should not use this
method, and indeed the Perl, Python, and Go bindings all use
these methods.

This warning was originally added back in

  commit 3edb4bc9fb1b451599df58420d61ffd73633cead
  Author: Daniel Veillard <veillard@redhat.com>
  Date:   Tue Jul 24 15:32:55 2007 +0000

    * libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
    * src/libvirt.c python/generator.py: some cleanup and warnings
      from Richard W.M. Jones

IIUC, the rational was that these APIs do not need to be
directly exposed to the non-C language, as the language
can expose the same concept itself by storing the original
virConnectPtr object alongside the virDomainPtr.  There's
no reason to mandate such an approach though - it is valid
for languages to expose this directly if that suits their
needs better.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 src/libvirt-domain-snapshot.c | 6 ------
 src/libvirt-domain.c          | 4 ----
 src/libvirt-interface.c       | 4 ----
 src/libvirt-network.c         | 4 ----
 src/libvirt-secret.c          | 3 ---
 src/libvirt-storage.c         | 8 --------
 6 files changed, 29 deletions(-)

diff --git a/src/libvirt-domain-snapshot.c b/src/libvirt-domain-snapshot.c
index b7c566fec..953a586e5 100644
--- a/src/libvirt-domain-snapshot.c
+++ b/src/libvirt-domain-snapshot.c
@@ -57,9 +57,6 @@ virDomainSnapshotGetName(virDomainSnapshotPtr snapshot)
  * reference counter on the domain is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function.  Instead, store the domain and the snapshot object together.
- *
  * Returns the domain or NULL.
  */
 virDomainPtr
@@ -83,9 +80,6 @@ virDomainSnapshotGetDomain(virDomainSnapshotPtr snapshot)
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function.  Instead, store the connection and the snapshot object together.
- *
  * Returns the connection or NULL.
  */
 virConnectPtr
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 4033ae8e6..87fca29c4 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -115,10 +115,6 @@ virConnectNumOfDomains(virConnectPtr conn)
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function.  Instead, store the connection and
- * the domain object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
diff --git a/src/libvirt-interface.c b/src/libvirt-interface.c
index 3d1a5ff8d..7c8996c58 100644
--- a/src/libvirt-interface.c
+++ b/src/libvirt-interface.c
@@ -35,10 +35,6 @@ VIR_LOG_INIT("libvirt.interface");
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function.  Instead, store the connection and
- * the interface object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
diff --git a/src/libvirt-network.c b/src/libvirt-network.c
index 3136f27ee..5c5a0ee22 100644
--- a/src/libvirt-network.c
+++ b/src/libvirt-network.c
@@ -36,10 +36,6 @@ VIR_LOG_INIT("libvirt.network");
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function.  Instead, store the connection and
- * the network object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
diff --git a/src/libvirt-secret.c b/src/libvirt-secret.c
index 8a99c8c26..d9244c252 100644
--- a/src/libvirt-secret.c
+++ b/src/libvirt-secret.c
@@ -34,9 +34,6 @@ VIR_LOG_INIT("libvirt.secret");
  * Provides the connection pointer associated with a secret.  The reference
  * counter on the connection is not increased by this call.
  *
- * WARNING: When writing libvirt bindings in other languages, do not use this
- * function.  Instead, store the connection and the secret object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
diff --git a/src/libvirt-storage.c b/src/libvirt-storage.c
index 35f9926d5..2cefc3c91 100644
--- a/src/libvirt-storage.c
+++ b/src/libvirt-storage.c
@@ -36,10 +36,6 @@ VIR_LOG_INIT("libvirt.storage");
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function.  Instead, store the connection and
- * the pool object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
@@ -1254,10 +1250,6 @@ virStoragePoolListVolumes(virStoragePoolPtr pool,
  * reference counter on the connection is not increased by this
  * call.
  *
- * WARNING: When writing libvirt bindings in other languages, do
- * not use this function.  Instead, store the connection and
- * the volume object together.
- *
  * Returns the virConnectPtr or NULL in case of failure.
  */
 virConnectPtr
-- 
2.13.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] Remove bogus warning about vir$OBJECTGetConnect functions
Posted by Michal Privoznik 6 years, 7 months ago
On 08/04/2017 05:30 PM, Daniel P. Berrange wrote:
> The API docs for the various vir$OBJECTGetConnect functions
> contain a warning
> 
>   WARNING: When writing libvirt bindings in other languages, do
>   not use this function.  Instead, store the connection and
>   the domain object together.
> 
> There is no reason why language bindings should not use this
> method, and indeed the Perl, Python, and Go bindings all use
> these methods.
> 
> This warning was originally added back in
> 
>   commit 3edb4bc9fb1b451599df58420d61ffd73633cead
>   Author: Daniel Veillard <veillard@redhat.com>
>   Date:   Tue Jul 24 15:32:55 2007 +0000
> 
>     * libvirt.spec.in NEWS docs/* po/*: preparing release 0.3.1
>     * src/libvirt.c python/generator.py: some cleanup and warnings
>       from Richard W.M. Jones
> 
> IIUC, the rational was that these APIs do not need to be
> directly exposed to the non-C language, as the language
> can expose the same concept itself by storing the original
> virConnectPtr object alongside the virDomainPtr.  There's
> no reason to mandate such an approach though - it is valid
> for languages to expose this directly if that suits their
> needs better.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  src/libvirt-domain-snapshot.c | 6 ------
>  src/libvirt-domain.c          | 4 ----
>  src/libvirt-interface.c       | 4 ----
>  src/libvirt-network.c         | 4 ----
>  src/libvirt-secret.c          | 3 ---
>  src/libvirt-storage.c         | 8 --------
>  6 files changed, 29 deletions(-)

ACK

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list