[PATCH 13/24] maint: inline VIR_IS*_DOMAIN macro

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

 



Cleanup after the previous patch.  In particular, note that
xenDomainUsedCpus can only be reached from
xenUnifiedDomainGetXMLDesc, which in turn is only reached from
public API that already validated the domain.

* src/xen/xen_driver.c (xenDomainUsedCpus): Drop redundant check.
* src/datatypes.h (VIR_IS_DOMAIN, VIR_IS_CONNECTED_DOMAIN):
Delete, and inline into all callers, since no other file uses it
any more.

Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
---
 src/datatypes.h      | 8 ++------
 src/xen/xen_driver.c | 3 ---
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/src/datatypes.h b/src/datatypes.h
index eda4b9c..ca400ec 100644
--- a/src/datatypes.h
+++ b/src/datatypes.h
@@ -60,10 +60,6 @@ extern virClassPtr virStoragePoolClass;
         }                                                               \
     } while (0)

-# define VIR_IS_DOMAIN(obj) \
-    (virObjectIsClass((obj), virDomainClass))
-# define VIR_IS_CONNECTED_DOMAIN(obj) \
-    (VIR_IS_DOMAIN(obj) && virObjectIsClass((obj)->conn, virConnectClass))
 # define virCheckDomainReturn(obj, retval)                              \
     do {                                                                \
         virDomainPtr _dom = (obj);                                      \
@@ -131,7 +127,7 @@ extern virClassPtr virStoragePoolClass;
 # define VIR_IS_SNAPSHOT(obj) \
     (virObjectIsClass((obj), virDomainSnapshotClass))
 # define VIR_IS_DOMAIN_SNAPSHOT(obj) \
-    (VIR_IS_SNAPSHOT(obj) && VIR_IS_DOMAIN((obj)->domain))
+    (VIR_IS_SNAPSHOT(obj) && virObjectIsClass((obj)->domain, virDomainClass))


 /* Helper macros to implement VIR_DOMAIN_DEBUG using just C99.  This
@@ -169,7 +165,7 @@ extern virClassPtr virStoragePoolClass;
         char _uuidstr[VIR_UUID_STRING_BUFLEN];                          \
         const char *_domname = NULL;                                    \
                                                                         \
-        if (!VIR_IS_DOMAIN(dom)) {                                      \
+        if (!virObjectIsClass(dom, virDomainClass)) {                   \
             memset(_uuidstr, 0, sizeof(_uuidstr));                      \
         } else {                                                        \
             virUUIDFormat((dom)->uuid, _uuidstr);                       \
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 07f1ec0..212603a 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -203,9 +203,6 @@ xenDomainUsedCpus(virDomainPtr dom, virDomainDefPtr def)
     virNodeInfo nodeinfo;
     xenUnifiedPrivatePtr priv;

-    if (!VIR_IS_CONNECTED_DOMAIN(dom))
-        return NULL;
-
     priv = dom->conn->privateData;

     if (priv->nbNodeCpus <= 0)
-- 
1.8.4.2

--
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]