提交 7efec259 编写于 作者: J Jim Meyering

xen_hypervisor.c: remove all "domain == NULL" tests, ...

* src/xen/xen_hypervisor.c: Remove all "domain == NULL" tests.
* src/xen/xen_hypervisor.h: Instead, use ATTRIBUTE_NONNULL to
mark each "domain" parameter as "known always to be non-NULL".
上级 b62bf7a7
......@@ -1130,7 +1130,7 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
char *schedulertype = NULL;
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL)) {
if (domain->conn == NULL) {
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return NULL;
......@@ -1214,7 +1214,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
{
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL)) {
if (domain->conn == NULL) {
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return -1;
......@@ -1317,7 +1317,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
xenUnifiedPrivatePtr priv;
char buf[256];
if ((domain == NULL) || (domain->conn == NULL)) {
if (domain->conn == NULL) {
virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
"domain or conn is NULL", 0);
return -1;
......@@ -3064,12 +3064,12 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
*
* Returns the memory size in kilobytes or 0 in case of error.
*/
static unsigned long
static unsigned long ATTRIBUTE_NONNULL (1)
xenHypervisorGetMaxMemory(virDomainPtr domain)
{
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL))
if (domain->conn == NULL)
return 0;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3178,7 +3178,7 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
{
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL))
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3286,7 +3286,7 @@ xenHypervisorPauseDomain(virDomainPtr domain)
int ret;
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL))
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3313,7 +3313,7 @@ xenHypervisorResumeDomain(virDomainPtr domain)
int ret;
xenUnifiedPrivatePtr priv;
if ((domain == NULL) || (domain->conn == NULL))
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3340,7 +3340,7 @@ xenHypervisorDestroyDomain(virDomainPtr domain)
int ret;
xenUnifiedPrivatePtr priv;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3368,7 +3368,7 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
int ret;
xenUnifiedPrivatePtr priv;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3399,7 +3399,7 @@ xenHypervisorSetVcpus(virDomainPtr domain, unsigned int nvcpus)
int ret;
xenUnifiedPrivatePtr priv;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3431,7 +3431,7 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
int ret;
xenUnifiedPrivatePtr priv;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3477,7 +3477,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
virVcpuInfoPtr ipt;
int nbinfo, i;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......@@ -3550,7 +3550,7 @@ xenHypervisorGetVcpuMax(virDomainPtr domain)
int maxcpu;
xenUnifiedPrivatePtr priv;
if (domain == NULL || domain->conn == NULL)
if (domain->conn == NULL)
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
......
/*
* xen_internal.h: internal API for direct access to Xen hypervisor level
*
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005, 2010 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
......@@ -58,48 +58,62 @@ int xenHypervisorListDomains (virConnectPtr conn,
int maxids);
int xenHypervisorGetMaxVcpus (virConnectPtr conn,
const char *type);
int xenHypervisorDestroyDomain (virDomainPtr domain);
int xenHypervisorResumeDomain (virDomainPtr domain);
int xenHypervisorPauseDomain (virDomainPtr domain);
int xenHypervisorDestroyDomain (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
int xenHypervisorResumeDomain (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
int xenHypervisorPauseDomain (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetDomainInfo (virDomainPtr domain,
virDomainInfoPtr info);
virDomainInfoPtr info)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetDomInfo (virConnectPtr conn,
int id,
virDomainInfoPtr info);
int xenHypervisorSetMaxMemory (virDomainPtr domain,
unsigned long memory);
unsigned long memory)
ATTRIBUTE_NONNULL (1);
int xenHypervisorCheckID (virConnectPtr conn,
int id);
int xenHypervisorSetVcpus (virDomainPtr domain,
unsigned int nvcpus);
unsigned int nvcpus)
ATTRIBUTE_NONNULL (1);
int xenHypervisorPinVcpu (virDomainPtr domain,
unsigned int vcpu,
unsigned char *cpumap,
int maplen);
int maplen)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetVcpus (virDomainPtr domain,
virVcpuInfoPtr info,
int maxinfo,
unsigned char *cpumaps,
int maplen);
int xenHypervisorGetVcpuMax (virDomainPtr domain);
int maplen)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetVcpuMax (virDomainPtr domain)
ATTRIBUTE_NONNULL (1);
char * xenHypervisorGetSchedulerType (virDomainPtr domain,
int *nparams);
int *nparams)
ATTRIBUTE_NONNULL (1);
int xenHypervisorGetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params,
int *nparams);
int *nparams)
ATTRIBUTE_NONNULL (1);
int xenHypervisorSetSchedulerParameters(virDomainPtr domain,
virSchedParameterPtr params,
int nparams);
int nparams)
ATTRIBUTE_NONNULL (1);
int xenHypervisorDomainBlockStats (virDomainPtr domain,
const char *path,
struct _virDomainBlockStats *stats);
struct _virDomainBlockStats *stats)
ATTRIBUTE_NONNULL (1);
int xenHypervisorDomainInterfaceStats (virDomainPtr domain,
const char *path,
struct _virDomainInterfaceStats *stats);
struct _virDomainInterfaceStats *stats)
ATTRIBUTE_NONNULL (1);
int xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
unsigned long long *freeMems,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册