[libvirt] [PATCH 2/4] qemu: domain: Add macro to simplify access to vm private data

Peter Krempa pkrempa at redhat.com
Wed Sep 14 06:39:07 UTC 2016


Sometimes adding a separate variable to access vm->privateData is not
necessary. Add a macro that will do the typecasting rather than having
to add a temp variable to force the compiler to typecast it.
---
 src/qemu/qemu_domain.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index a1404d0..e9dfbff 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -234,6 +234,9 @@ struct _qemuDomainObjPrivate {
     size_t masterKeyLen;
 };

+# define QEMU_DOMAIN_PRIVATE(vm)	\
+    ((qemuDomainObjPrivatePtr) (vm)->privateData)
+
 /* Type of domain secret */
 typedef enum {
     VIR_DOMAIN_SECRET_INFO_TYPE_PLAIN = 0,
-- 
2.10.0




More information about the libvir-list mailing list