提交 c2aa14b4 编写于 作者: E Eric Blake

maint: inline VIR_IS*_DOMAIN macro

Cleanup after a previous patch, commit 6e130ddc.  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: NEric Blake <eblake@redhat.com>
上级 37705c12
...@@ -60,10 +60,6 @@ extern virClassPtr virStoragePoolClass; ...@@ -60,10 +60,6 @@ extern virClassPtr virStoragePoolClass;
} \ } \
} while (0) } 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) \ # define virCheckDomainReturn(obj, retval) \
do { \ do { \
virDomainPtr _dom = (obj); \ virDomainPtr _dom = (obj); \
...@@ -131,7 +127,7 @@ extern virClassPtr virStoragePoolClass; ...@@ -131,7 +127,7 @@ extern virClassPtr virStoragePoolClass;
# define VIR_IS_SNAPSHOT(obj) \ # define VIR_IS_SNAPSHOT(obj) \
(virObjectIsClass((obj), virDomainSnapshotClass)) (virObjectIsClass((obj), virDomainSnapshotClass))
# define VIR_IS_DOMAIN_SNAPSHOT(obj) \ # 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 /* Helper macros to implement VIR_DOMAIN_DEBUG using just C99. This
...@@ -169,7 +165,7 @@ extern virClassPtr virStoragePoolClass; ...@@ -169,7 +165,7 @@ extern virClassPtr virStoragePoolClass;
char _uuidstr[VIR_UUID_STRING_BUFLEN]; \ char _uuidstr[VIR_UUID_STRING_BUFLEN]; \
const char *_domname = NULL; \ const char *_domname = NULL; \
\ \
if (!VIR_IS_DOMAIN(dom)) { \ if (!virObjectIsClass(dom, virDomainClass)) { \
memset(_uuidstr, 0, sizeof(_uuidstr)); \ memset(_uuidstr, 0, sizeof(_uuidstr)); \
} else { \ } else { \
virUUIDFormat((dom)->uuid, _uuidstr); \ virUUIDFormat((dom)->uuid, _uuidstr); \
......
...@@ -203,9 +203,6 @@ xenDomainUsedCpus(virDomainPtr dom, virDomainDefPtr def) ...@@ -203,9 +203,6 @@ xenDomainUsedCpus(virDomainPtr dom, virDomainDefPtr def)
virNodeInfo nodeinfo; virNodeInfo nodeinfo;
xenUnifiedPrivatePtr priv; xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(dom))
return NULL;
priv = dom->conn->privateData; priv = dom->conn->privateData;
if (priv->nbNodeCpus <= 0) if (priv->nbNodeCpus <= 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册