[PATCH REPOST] warn about conn, dom and net fields in virterror

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



First discussed in this thread:

http://www.redhat.com/archives/libvir-list/2008-March/thread.html#00367

The attached patch contains a slightly different warning about
the danger of using these fields.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top
Index: include/libvirt/virterror.h
===================================================================
RCS file: /data/cvs/libvirt/include/libvirt/virterror.h,v
retrieving revision 1.35
diff -u -p -r1.35 virterror.h
--- include/libvirt/virterror.h	21 Mar 2008 15:03:37 -0000	1.35
+++ include/libvirt/virterror.h	9 Apr 2008 12:09:44 -0000
@@ -63,6 +63,10 @@ typedef enum {
  * virError:
  *
  * A libvirt Error instance.
+ *
+ * The conn, dom and net fields should be used with extreme care.
+ * Reference counts are not incremented so the underlying objects
+ * may be deleted without notice after the error has been delivered.
  */
 
 typedef struct _virError virError;
@@ -72,14 +76,14 @@ struct _virError {
     int		domain;	/* What part of the library raised this error */
     char       *message;/* human-readable informative error message */
     virErrorLevel level;/* how consequent is the error */
-    virConnectPtr conn;	/* the connection if available */
-    virDomainPtr dom;	/* the domain if available */
+    virConnectPtr conn;	/* connection if available, see note above */
+    virDomainPtr dom;	/* domain if available, see note above */
     char       *str1;	/* extra string information */
     char       *str2;	/* extra string information */
     char       *str3;	/* extra string information */
     int		int1;	/* extra number information */
     int		int2;	/* extra number information */
-    virNetworkPtr net;	/* the network if available */
+    virNetworkPtr net;	/* network if available, see note above */
 };
 
 /**
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]