mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-09 05:01:28 +00:00
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".
This commit is contained in:
parent
b62bf7a700
commit
7efec25964
@ -1130,7 +1130,7 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
|
|||||||
char *schedulertype = NULL;
|
char *schedulertype = NULL;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL)) {
|
if (domain->conn == NULL) {
|
||||||
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||||
"domain or conn is NULL", 0);
|
"domain or conn is NULL", 0);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1214,7 +1214,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
|||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL)) {
|
if (domain->conn == NULL) {
|
||||||
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||||
"domain or conn is NULL", 0);
|
"domain or conn is NULL", 0);
|
||||||
return -1;
|
return -1;
|
||||||
@ -1317,7 +1317,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
|||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
char buf[256];
|
char buf[256];
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL)) {
|
if (domain->conn == NULL) {
|
||||||
virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
virXenErrorFunc (NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
|
||||||
"domain or conn is NULL", 0);
|
"domain or conn is NULL", 0);
|
||||||
return -1;
|
return -1;
|
||||||
@ -3064,12 +3064,12 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
|
|||||||
*
|
*
|
||||||
* Returns the memory size in kilobytes or 0 in case of error.
|
* Returns the memory size in kilobytes or 0 in case of error.
|
||||||
*/
|
*/
|
||||||
static unsigned long
|
static unsigned long ATTRIBUTE_NONNULL (1)
|
||||||
xenHypervisorGetMaxMemory(virDomainPtr domain)
|
xenHypervisorGetMaxMemory(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL))
|
if (domain->conn == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3178,7 +3178,7 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
|
|||||||
{
|
{
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL))
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3286,7 +3286,7 @@ xenHypervisorPauseDomain(virDomainPtr domain)
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL))
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3313,7 +3313,7 @@ xenHypervisorResumeDomain(virDomainPtr domain)
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if ((domain == NULL) || (domain->conn == NULL))
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3340,7 +3340,7 @@ xenHypervisorDestroyDomain(virDomainPtr domain)
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3368,7 +3368,7 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3399,7 +3399,7 @@ xenHypervisorSetVcpus(virDomainPtr domain, unsigned int nvcpus)
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3431,7 +3431,7 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
|
|||||||
int ret;
|
int ret;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3477,7 +3477,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
|
|||||||
virVcpuInfoPtr ipt;
|
virVcpuInfoPtr ipt;
|
||||||
int nbinfo, i;
|
int nbinfo, i;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
@ -3550,7 +3550,7 @@ xenHypervisorGetVcpuMax(virDomainPtr domain)
|
|||||||
int maxcpu;
|
int maxcpu;
|
||||||
xenUnifiedPrivatePtr priv;
|
xenUnifiedPrivatePtr priv;
|
||||||
|
|
||||||
if (domain == NULL || domain->conn == NULL)
|
if (domain->conn == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* xen_internal.h: internal API for direct access to Xen hypervisor level
|
* 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
|
* See COPYING.LIB for the License of this software
|
||||||
*
|
*
|
||||||
@ -58,48 +58,62 @@ int xenHypervisorListDomains (virConnectPtr conn,
|
|||||||
int maxids);
|
int maxids);
|
||||||
int xenHypervisorGetMaxVcpus (virConnectPtr conn,
|
int xenHypervisorGetMaxVcpus (virConnectPtr conn,
|
||||||
const char *type);
|
const char *type);
|
||||||
int xenHypervisorDestroyDomain (virDomainPtr domain);
|
int xenHypervisorDestroyDomain (virDomainPtr domain)
|
||||||
int xenHypervisorResumeDomain (virDomainPtr domain);
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorPauseDomain (virDomainPtr domain);
|
int xenHypervisorResumeDomain (virDomainPtr domain)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
int xenHypervisorPauseDomain (virDomainPtr domain)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorGetDomainInfo (virDomainPtr domain,
|
int xenHypervisorGetDomainInfo (virDomainPtr domain,
|
||||||
virDomainInfoPtr info);
|
virDomainInfoPtr info)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorGetDomInfo (virConnectPtr conn,
|
int xenHypervisorGetDomInfo (virConnectPtr conn,
|
||||||
int id,
|
int id,
|
||||||
virDomainInfoPtr info);
|
virDomainInfoPtr info);
|
||||||
int xenHypervisorSetMaxMemory (virDomainPtr domain,
|
int xenHypervisorSetMaxMemory (virDomainPtr domain,
|
||||||
unsigned long memory);
|
unsigned long memory)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorCheckID (virConnectPtr conn,
|
int xenHypervisorCheckID (virConnectPtr conn,
|
||||||
int id);
|
int id);
|
||||||
int xenHypervisorSetVcpus (virDomainPtr domain,
|
int xenHypervisorSetVcpus (virDomainPtr domain,
|
||||||
unsigned int nvcpus);
|
unsigned int nvcpus)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorPinVcpu (virDomainPtr domain,
|
int xenHypervisorPinVcpu (virDomainPtr domain,
|
||||||
unsigned int vcpu,
|
unsigned int vcpu,
|
||||||
unsigned char *cpumap,
|
unsigned char *cpumap,
|
||||||
int maplen);
|
int maplen)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorGetVcpus (virDomainPtr domain,
|
int xenHypervisorGetVcpus (virDomainPtr domain,
|
||||||
virVcpuInfoPtr info,
|
virVcpuInfoPtr info,
|
||||||
int maxinfo,
|
int maxinfo,
|
||||||
unsigned char *cpumaps,
|
unsigned char *cpumaps,
|
||||||
int maplen);
|
int maplen)
|
||||||
int xenHypervisorGetVcpuMax (virDomainPtr domain);
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
int xenHypervisorGetVcpuMax (virDomainPtr domain)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
|
||||||
char * xenHypervisorGetSchedulerType (virDomainPtr domain,
|
char * xenHypervisorGetSchedulerType (virDomainPtr domain,
|
||||||
int *nparams);
|
int *nparams)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
|
||||||
int xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
int xenHypervisorGetSchedulerParameters(virDomainPtr domain,
|
||||||
virSchedParameterPtr params,
|
virSchedParameterPtr params,
|
||||||
int *nparams);
|
int *nparams)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
|
||||||
int xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
int xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||||
virSchedParameterPtr params,
|
virSchedParameterPtr params,
|
||||||
int nparams);
|
int nparams)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
|
||||||
int xenHypervisorDomainBlockStats (virDomainPtr domain,
|
int xenHypervisorDomainBlockStats (virDomainPtr domain,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainBlockStats *stats);
|
struct _virDomainBlockStats *stats)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
int xenHypervisorDomainInterfaceStats (virDomainPtr domain,
|
int xenHypervisorDomainInterfaceStats (virDomainPtr domain,
|
||||||
const char *path,
|
const char *path,
|
||||||
struct _virDomainInterfaceStats *stats);
|
struct _virDomainInterfaceStats *stats)
|
||||||
|
ATTRIBUTE_NONNULL (1);
|
||||||
|
|
||||||
int xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
|
int xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn,
|
||||||
unsigned long long *freeMems,
|
unsigned long long *freeMems,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user