Cleanup for a return statement in source files

Return statements with parameter enclosed in parentheses were modified
and parentheses were removed. The whole change was scripted, here is how:

List of files was obtained using this command:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
grep -e '\.[ch]$' -e '\.py$'

Found files were modified with this command:
sed -i -e                                                                 \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'

Then checked for nonsense.

The whole command looks like this:
git grep -l -e '\<return\s*([^()]*\(([^()]*)[^()]*\)*)\s*;' |             \
grep -e '\.[ch]$' -e '\.py$' | xargs sed -i -e                            \
's_^\(.*\<return\)\s*(\(\([^()]*([^()]*)[^()]*\)*\))\s*\(;.*$\)_\1 \2\4_' \
-e 's_^\(.*\<return\)\s*(\([^()]*\))\s*\(;.*$\)_\1 \2\3_'
This commit is contained in:
Martin Kletzander 2012-03-22 12:33:35 +01:00 committed by Eric Blake
parent 70c07e01de
commit 9943276fd2
70 changed files with 812 additions and 812 deletions

View File

@ -59,5 +59,5 @@ int main() {
getDomainInfo(0);
return(0);
return 0;
}

View File

@ -30,9 +30,9 @@ checkDomainState(virDomainPtr dom) {
ret = virDomainGetInfo(dom, &info);
if (ret < 0) {
return(-1);
return -1;
}
return(info.state);
return info.state;
}
/**
@ -130,5 +130,5 @@ int main(int argc, char **argv) {
error:
if (conn != NULL)
virConnectClose(conn);
return(0);
return 0;
}

View File

@ -589,7 +589,7 @@ def print_function_wrapper(module, name, output, export, include):
args[1][0])
else:
c_call = "\n %s(%s);\n" % (name, c_call);
ret_convert = " Py_INCREF(Py_None);\n return(Py_None);\n"
ret_convert = " Py_INCREF(Py_None);\n return Py_None;\n"
elif py_types.has_key(ret[0]):
(f, t, n, c) = py_types[ret[0]]
c_return = " %s c_retval;\n" % (ret[0])
@ -598,13 +598,13 @@ def print_function_wrapper(module, name, output, export, include):
else:
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
ret_convert = ret_convert + " return(py_retval);\n"
ret_convert = ret_convert + " return py_retval;\n"
elif py_return_types.has_key(ret[0]):
(f, t, n, c) = py_return_types[ret[0]]
c_return = " %s c_retval;\n" % (ret[0])
c_call = "\n c_retval = %s(%s);\n" % (name, c_call);
ret_convert = " py_retval = libvirt_%sWrap((%s) c_retval);\n" % (n,c)
ret_convert = ret_convert + " return(py_retval);\n"
ret_convert = ret_convert + " return py_retval;\n"
else:
if skipped_types.has_key(ret[0]):
return 0
@ -663,7 +663,7 @@ def print_function_wrapper(module, name, output, export, include):
if format != "":
output.write("\n if (!PyArg_ParseTuple(args, (char *)\"%s\"%s))\n" %
(format, format_args))
output.write(" return(NULL);\n")
output.write(" return NULL;\n")
if c_convert != "":
output.write(c_convert + "\n")

View File

@ -308,7 +308,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainBlockStats",
&pyobj_domain,&path))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -326,7 +326,7 @@ libvirt_virDomainBlockStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyTuple_SetItem(info, 2, PyLong_FromLongLong(stats.wr_req));
PyTuple_SetItem(info, 3, PyLong_FromLongLong(stats.wr_bytes));
PyTuple_SetItem(info, 4, PyLong_FromLongLong(stats.errs));
return(info);
return info;
}
static PyObject *
@ -534,7 +534,7 @@ libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
if (!PyArg_ParseTuple(args, (char *)"Oz:virDomainInterfaceStats",
&pyobj_domain,&path))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -555,7 +555,7 @@ libvirt_virDomainInterfaceStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
PyTuple_SetItem(info, 5, PyLong_FromLongLong(stats.tx_packets));
PyTuple_SetItem(info, 6, PyLong_FromLongLong(stats.tx_errs));
PyTuple_SetItem(info, 7, PyLong_FromLongLong(stats.tx_drop));
return(info);
return info;
}
static PyObject *
@ -567,7 +567,7 @@ libvirt_virDomainMemoryStats(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *info;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainMemoryStats", &pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
nr_stats = virDomainMemoryStats(domain, stats,
@ -618,7 +618,7 @@ libvirt_virDomainGetSchedulerType(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetScedulerType",
&pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -636,7 +636,7 @@ libvirt_virDomainGetSchedulerType(PyObject *self ATTRIBUTE_UNUSED,
PyTuple_SetItem(info, 0, libvirt_constcharPtrWrap(c_retval));
PyTuple_SetItem(info, 1, PyInt_FromLong((long)nparams));
VIR_FREE(c_retval);
return(info);
return info;
}
static PyObject *
@ -1392,7 +1392,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetVcpus",
&pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1457,7 +1457,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(cpuinfo);
VIR_FREE(cpumap);
return(pyretval);
return pyretval;
cleanup:
VIR_FREE(cpuinfo);
@ -1487,7 +1487,7 @@ libvirt_virDomainPinVcpu(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"OiO:virDomainPinVcpu",
&pyobj_domain, &vcpu, &pycpumap))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1534,7 +1534,7 @@ libvirt_virDomainPinVcpuFlags(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"OiOi:virDomainPinVcpuFlags",
&pyobj_domain, &vcpu, &pycpumap, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1582,7 +1582,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainGetVcpuPinInfo",
&pyobj_domain, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1678,7 +1678,7 @@ libvirt_virConnGetLastError(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
PyObject *pyobj_conn;
if (!PyArg_ParseTuple(args, (char *)"O:virConGetLastError", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1754,7 +1754,7 @@ libvirt_virRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self,
if (!PyArg_ParseTuple
(args, (char *) "OO:xmlRegisterErrorHandler", &pyobj_f,
&pyobj_ctx))
return (NULL);
return NULL;
DEBUG("libvirt_virRegisterErrorHandler(%p, %p) called\n", pyobj_ctx,
pyobj_f);
@ -1780,7 +1780,7 @@ libvirt_virRegisterErrorHandler(ATTRIBUTE_UNUSED PyObject * self,
}
py_retval = libvirt_intWrap(1);
return (py_retval);
return py_retval;
}
static int virConnectCredCallbackWrapper(virConnectCredentialPtr cred,
@ -1874,7 +1874,7 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virConnectAuth auth;
if (!PyArg_ParseTuple(args, (char *)"zOi:virConnectOpenAuth", &name, &pyauth, &flags))
return(NULL);
return NULL;
pycredtype = PyList_GetItem(pyauth, 0);
pycredcb = PyList_GetItem(pyauth, 1);
@ -1899,7 +1899,7 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
LIBVIRT_END_ALLOW_THREADS;
VIR_FREE(auth.credtype);
py_retval = libvirt_virConnectPtrWrap((virConnectPtr) c_retval);
return(py_retval);
return py_retval;
}
@ -1948,7 +1948,7 @@ libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectGetVersion",
&pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1974,7 +1974,7 @@ libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectGetLibVersion",
&pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -1999,7 +1999,7 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListDomains", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2029,7 +2029,7 @@ libvirt_virConnectListDomainsID(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(ids);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -2043,7 +2043,7 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListDefinedDomains", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2073,7 +2073,7 @@ libvirt_virConnectListDefinedDomains(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -2087,7 +2087,7 @@ libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED,
unsigned int flags;
if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainSnapshotListNames", &pyobj_dom, &flags))
return(NULL);
return NULL;
dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2117,7 +2117,7 @@ libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -2131,7 +2131,7 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self ATTRIBUTE_UNUSED,
unsigned int flags;
if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainSnapshotListChildrenNames", &pyobj_snap, &flags))
return(NULL);
return NULL;
snap = (virDomainSnapshotPtr) PyvirDomainSnapshot_Get(pyobj_snap);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2161,7 +2161,7 @@ libvirt_virDomainSnapshotListChildrenNames(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -2174,7 +2174,7 @@ libvirt_virDomainRevertToSnapshot(PyObject *self ATTRIBUTE_UNUSED,
unsigned int flags;
if (!PyArg_ParseTuple(args, (char *)"OOi:virDomainRevertToSnapshot", &pyobj_dom, &pyobj_snap, &flags))
return(NULL);
return NULL;
snap = (virDomainSnapshotPtr) PyvirDomainSnapshot_Get(pyobj_snap);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2195,7 +2195,7 @@ libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virDomainInfo info;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetInfo", &pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2210,7 +2210,7 @@ libvirt_virDomainGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyList_SetItem(py_retval, 3, libvirt_intWrap((int) info.nrVirtCpu));
PyList_SetItem(py_retval, 4,
libvirt_longlongWrap((unsigned long long) info.cpuTime));
return(py_retval);
return py_retval;
}
static PyObject *
@ -2279,7 +2279,7 @@ libvirt_virDomainGetBlockInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
unsigned int flags;
if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetInfo", &pyobj_domain, &path, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2291,7 +2291,7 @@ libvirt_virDomainGetBlockInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyList_SetItem(py_retval, 0, libvirt_ulonglongWrap(info.capacity));
PyList_SetItem(py_retval, 1, libvirt_ulonglongWrap(info.allocation));
PyList_SetItem(py_retval, 2, libvirt_ulonglongWrap(info.physical));
return(py_retval);
return py_retval;
}
static PyObject *
@ -2303,7 +2303,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virNodeInfo info;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetInfo", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2320,7 +2320,7 @@ libvirt_virNodeGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyList_SetItem(py_retval, 5, libvirt_intWrap((int) info.sockets));
PyList_SetItem(py_retval, 6, libvirt_intWrap((int) info.cores));
PyList_SetItem(py_retval, 7, libvirt_intWrap((int) info.threads));
return(py_retval);
return py_retval;
}
static PyObject *
@ -2332,7 +2332,7 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetUUID", &pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
if (domain == NULL)
@ -2345,7 +2345,7 @@ libvirt_virDomainGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return VIR_PY_NONE;
py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2359,7 +2359,7 @@ libvirt_virDomainGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetUUIDString",
&pyobj_dom))
return(NULL);
return NULL;
dom = (virDomainPtr) PyvirDomain_Get(pyobj_dom);
if (dom == NULL)
@ -2372,7 +2372,7 @@ libvirt_virDomainGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString((char *) &uuidstr[0]);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2385,7 +2385,7 @@ libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virDomainLookupByUUID", &pyobj_conn, &uuid, &len))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
@ -2395,7 +2395,7 @@ libvirt_virDomainLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
c_retval = virDomainLookupByUUID(conn, uuid);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_virDomainPtrWrap((virDomainPtr) c_retval);
return(py_retval);
return py_retval;
}
@ -2410,7 +2410,7 @@ libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListNetworks", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2440,7 +2440,7 @@ libvirt_virConnectListNetworks(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -2455,7 +2455,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListDefinedNetworks", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2485,7 +2485,7 @@ libvirt_virConnectListDefinedNetworks(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -2498,7 +2498,7 @@ libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virNetworkGetUUID", &pyobj_domain))
return(NULL);
return NULL;
domain = (virNetworkPtr) PyvirNetwork_Get(pyobj_domain);
if (domain == NULL)
@ -2511,7 +2511,7 @@ libvirt_virNetworkGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return VIR_PY_NONE;
py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2525,7 +2525,7 @@ libvirt_virNetworkGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virNetworkGetUUIDString",
&pyobj_net))
return(NULL);
return NULL;
net = (virNetworkPtr) PyvirNetwork_Get(pyobj_net);
if (net == NULL)
@ -2538,7 +2538,7 @@ libvirt_virNetworkGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString((char *) &uuidstr[0]);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2551,7 +2551,7 @@ libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
int len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virNetworkLookupByUUID", &pyobj_conn, &uuid, &len))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
@ -2561,7 +2561,7 @@ libvirt_virNetworkLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
c_retval = virNetworkLookupByUUID(conn, uuid);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_virNetworkPtrWrap((virNetworkPtr) c_retval);
return(py_retval);
return py_retval;
}
@ -2573,7 +2573,7 @@ libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyObject *pyobj_domain;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetAutostart", &pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@ -2584,7 +2584,7 @@ libvirt_virDomainGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
if (c_retval < 0)
return VIR_PY_INT_FAIL;
py_retval = libvirt_intWrap(autostart);
return(py_retval);
return py_retval;
}
@ -2596,7 +2596,7 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
PyObject *pyobj_network;
if (!PyArg_ParseTuple(args, (char *)"O:virNetworkGetAutostart", &pyobj_network))
return(NULL);
return NULL;
network = (virNetworkPtr) PyvirNetwork_Get(pyobj_network);
@ -2607,7 +2607,7 @@ libvirt_virNetworkGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
if (c_retval < 0)
return VIR_PY_INT_FAIL;
py_retval = libvirt_intWrap(autostart);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2620,7 +2620,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
unsigned long long *freeMems;
if (!PyArg_ParseTuple(args, (char *)"Oii:virNodeGetCellsFreeMemory", &pyobj_conn, &startCell, &maxCells))
return(NULL);
return NULL;
if ((startCell < 0) || (maxCells <= 0) || (startCell + maxCells > 10000))
return VIR_PY_NONE;
@ -2643,7 +2643,7 @@ libvirt_virNodeGetCellsFreeMemory(PyObject *self ATTRIBUTE_UNUSED, PyObject *arg
libvirt_longlongWrap((long long) freeMems[i]));
}
VIR_FREE(freeMems);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2783,7 +2783,7 @@ libvirt_virConnectListStoragePools(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListStoragePools", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2821,7 +2821,7 @@ libvirt_virConnectListStoragePools(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -2836,7 +2836,7 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListDefinedStoragePools", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2874,7 +2874,7 @@ libvirt_virConnectListDefinedStoragePools(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -2889,7 +2889,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolListVolumes", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2927,7 +2927,7 @@ libvirt_virStoragePoolListVolumes(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -2938,7 +2938,7 @@ libvirt_virStoragePoolGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
PyObject *pyobj_pool;
if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolGetAutostart", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
@ -2950,7 +2950,7 @@ libvirt_virStoragePoolGetAutostart(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
return VIR_PY_NONE;
py_retval = libvirt_intWrap(autostart);
return(py_retval);
return py_retval;
}
static PyObject *
@ -2962,7 +2962,7 @@ libvirt_virStoragePoolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virStoragePoolInfo info;
if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolGetInfo", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -2981,7 +2981,7 @@ libvirt_virStoragePoolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
libvirt_longlongWrap((unsigned long long) info.allocation));
PyList_SetItem(py_retval, 3,
libvirt_longlongWrap((unsigned long long) info.available));
return(py_retval);
return py_retval;
}
@ -2994,7 +2994,7 @@ libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virStorageVolInfo info;
if (!PyArg_ParseTuple(args, (char *)"O:virStorageVolGetInfo", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStorageVolPtr) PyvirStorageVol_Get(pyobj_pool);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3010,7 +3010,7 @@ libvirt_virStorageVolGetInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
libvirt_longlongWrap((unsigned long long) info.capacity));
PyList_SetItem(py_retval, 2,
libvirt_longlongWrap((unsigned long long) info.allocation));
return(py_retval);
return py_retval;
}
static PyObject *
@ -3022,7 +3022,7 @@ libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolGetUUID", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
if (pool == NULL)
@ -3036,7 +3036,7 @@ libvirt_virStoragePoolGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3049,7 +3049,7 @@ libvirt_virStoragePoolGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virStoragePoolGetUUIDString", &pyobj_pool))
return(NULL);
return NULL;
pool = (virStoragePoolPtr) PyvirStoragePool_Get(pyobj_pool);
if (pool == NULL)
@ -3062,7 +3062,7 @@ libvirt_virStoragePoolGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString((char *) &uuidstr[0]);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3075,7 +3075,7 @@ libvirt_virStoragePoolLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
int len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virStoragePoolLookupByUUID", &pyobj_conn, &uuid, &len))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
@ -3085,7 +3085,7 @@ libvirt_virStoragePoolLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *ar
c_retval = virStoragePoolLookupByUUID(conn, uuid);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_virStoragePoolPtrWrap((virStoragePoolPtr) c_retval);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3101,7 +3101,7 @@ libvirt_virNodeListDevices(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"Ozi:virNodeListDevices",
&pyobj_conn, &cap, &flags))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3131,7 +3131,7 @@ libvirt_virNodeListDevices(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -3144,7 +3144,7 @@ libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
PyObject *pyobj_dev;
if (!PyArg_ParseTuple(args, (char *)"O:virNodeDeviceListCaps", &pyobj_dev))
return(NULL);
return NULL;
dev = (virNodeDevicePtr) PyvirNodeDevice_Get(pyobj_dev);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3174,7 +3174,7 @@ libvirt_virNodeDeviceListCaps(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
static PyObject *
@ -3186,7 +3186,7 @@ libvirt_virSecretGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virSecretGetUUID", &pyobj_secret))
return(NULL);
return NULL;
secret = (virSecretPtr) PyvirSecret_Get(pyobj_secret);
if (secret == NULL)
@ -3199,7 +3199,7 @@ libvirt_virSecretGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return VIR_PY_NONE;
py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3213,7 +3213,7 @@ libvirt_virSecretGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virSecretGetUUIDString",
&pyobj_dom))
return(NULL);
return NULL;
dom = (virSecretPtr) PyvirSecret_Get(pyobj_dom);
if (dom == NULL)
@ -3226,7 +3226,7 @@ libvirt_virSecretGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString((char *) &uuidstr[0]);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3239,7 +3239,7 @@ libvirt_virSecretLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virSecretLookupByUUID", &pyobj_conn, &uuid, &len))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
@ -3249,7 +3249,7 @@ libvirt_virSecretLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
c_retval = virSecretLookupByUUID(conn, uuid);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_virSecretPtrWrap((virSecretPtr) c_retval);
return(py_retval);
return py_retval;
}
@ -3358,7 +3358,7 @@ libvirt_virNWFilterGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
int c_retval;
if (!PyArg_ParseTuple(args, (char *)"O:virNWFilterGetUUID", &pyobj_nwfilter))
return(NULL);
return NULL;
nwfilter = (virNWFilterPtr) PyvirNWFilter_Get(pyobj_nwfilter);
if (nwfilter == NULL)
@ -3371,7 +3371,7 @@ libvirt_virNWFilterGetUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
return VIR_PY_NONE;
py_retval = PyString_FromStringAndSize((char *) &uuid[0], VIR_UUID_BUFLEN);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3385,7 +3385,7 @@ libvirt_virNWFilterGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virNWFilterGetUUIDString",
&pyobj_nwfilter))
return(NULL);
return NULL;
nwfilter = (virNWFilterPtr) PyvirNWFilter_Get(pyobj_nwfilter);
if (nwfilter == NULL)
@ -3398,7 +3398,7 @@ libvirt_virNWFilterGetUUIDString(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString((char *) &uuidstr[0]);
return(py_retval);
return py_retval;
}
static PyObject *
@ -3411,7 +3411,7 @@ libvirt_virNWFilterLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
int len;
if (!PyArg_ParseTuple(args, (char *)"Oz#:virNWFilterLookupByUUID", &pyobj_conn, &uuid, &len))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if ((uuid == NULL) || (len != VIR_UUID_BUFLEN))
@ -3421,7 +3421,7 @@ libvirt_virNWFilterLookupByUUID(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
c_retval = virNWFilterLookupByUUID(conn, uuid);
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_virNWFilterPtrWrap((virNWFilterPtr) c_retval);
return(py_retval);
return py_retval;
}
@ -3479,7 +3479,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListInterfaces", &pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3517,7 +3517,7 @@ libvirt_virConnectListInterfaces(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -3533,7 +3533,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"O:virConnectListDefinedInterfaces",
&pyobj_conn))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3571,7 +3571,7 @@ libvirt_virConnectListDefinedInterfaces(PyObject *self ATTRIBUTE_UNUSED,
VIR_FREE(names);
}
return(py_retval);
return py_retval;
}
@ -3589,7 +3589,7 @@ libvirt_virConnectBaselineCPU(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"OOi:virConnectBaselineCPU",
&pyobj_conn, &list, &flags))
return(NULL);
return NULL;
conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
if (PyList_Check(list)) {
@ -3636,7 +3636,7 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
virDomainJobInfo info;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetJobInfo", &pyobj_domain))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -3658,7 +3658,7 @@ libvirt_virDomainGetJobInfo(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
PyList_SetItem(py_retval, 10, libvirt_ulonglongWrap(info.fileProcessed));
PyList_SetItem(py_retval, 11, libvirt_ulonglongWrap(info.fileRemaining));
return(py_retval);
return py_retval;
}
static PyObject *
@ -3675,7 +3675,7 @@ libvirt_virDomainGetBlockJobInfo(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainGetBlockJobInfo",
&pyobj_domain, &path, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
LIBVIRT_BEGIN_ALLOW_THREADS;
@ -4073,7 +4073,7 @@ libvirt_virConnectDomainEventRegister(ATTRIBUTE_UNUSED PyObject * self,
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_intWrap(ret);
return (py_retval);
return py_retval;
}
static PyObject *
@ -4090,7 +4090,7 @@ libvirt_virConnectDomainEventDeregister(ATTRIBUTE_UNUSED PyObject * self,
if (!PyArg_ParseTuple
(args, (char *) "OO:virConnectDomainEventDeregister",
&pyobj_conn, &pyobj_conn_inst))
return (NULL);
return NULL;
DEBUG("libvirt_virConnectDomainEventDeregister(%p) called\n", pyobj_conn);
@ -4104,7 +4104,7 @@ libvirt_virConnectDomainEventDeregister(ATTRIBUTE_UNUSED PyObject * self,
Py_DECREF(pyobj_conn_inst);
py_retval = libvirt_intWrap(ret);
return (py_retval);
return py_retval;
}
/*******************************************
@ -5334,7 +5334,7 @@ libvirt_virConnectDomainEventRegisterAny(ATTRIBUTE_UNUSED PyObject * self,
}
py_retval = libvirt_intWrap(ret);
return (py_retval);
return py_retval;
}
static PyObject *
@ -5350,7 +5350,7 @@ libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
if (!PyArg_ParseTuple
(args, (char *) "Oi:virConnectDomainEventDeregister",
&pyobj_conn, &callbackID))
return (NULL);
return NULL;
DEBUG("libvirt_virConnectDomainEventDeregister(%p) called\n", pyobj_conn);
@ -5362,7 +5362,7 @@ libvirt_virConnectDomainEventDeregisterAny(ATTRIBUTE_UNUSED PyObject * self,
LIBVIRT_END_ALLOW_THREADS;
py_retval = libvirt_intWrap(ret);
return (py_retval);
return py_retval;
}
static void
@ -5567,7 +5567,7 @@ libvirt_virDomainMigrateGetMaxSpeed(PyObject *self ATTRIBUTE_UNUSED, PyObject *a
if (!PyArg_ParseTuple(args, (char *)"Oi:virDomainMigrateGetMaxSpeed",
&pyobj_domain, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@ -5578,7 +5578,7 @@ libvirt_virDomainMigrateGetMaxSpeed(PyObject *self ATTRIBUTE_UNUSED, PyObject *a
if (c_retval < 0)
return VIR_PY_INT_FAIL;
py_retval = libvirt_ulongWrap(bandwidth);
return(py_retval);
return py_retval;
}
static PyObject *
@ -5596,7 +5596,7 @@ libvirt_virDomainBlockPeek(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"OzLni:virDomainBlockPeek", &pyobj_domain,
&disk, &offset, &size, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
@ -5631,7 +5631,7 @@ libvirt_virDomainMemoryPeek(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"OLni:virDomainMemoryPeek", &pyobj_domain,
&start, &size, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);

View File

@ -66,7 +66,7 @@ libvirt_qemu_virDomainQemuMonitorCommand(PyObject *self ATTRIBUTE_UNUSED,
if (!PyArg_ParseTuple(args, (char *)"Ozi:virDomainQemuMonitorCommand",
&pyobj_domain, &cmd, &flags))
return(NULL);
return NULL;
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
if (domain == NULL)
@ -79,7 +79,7 @@ libvirt_qemu_virDomainQemuMonitorCommand(PyObject *self ATTRIBUTE_UNUSED,
return VIR_PY_NONE;
py_retval = PyString_FromString(result);
return(py_retval);
return py_retval;
}
/************************************************************************

View File

@ -43,7 +43,7 @@ libvirt_intWrap(int val)
{
PyObject *ret;
ret = PyInt_FromLong((long) val);
return (ret);
return ret;
}
PyObject *
@ -51,7 +51,7 @@ libvirt_longWrap(long val)
{
PyObject *ret;
ret = PyInt_FromLong(val);
return (ret);
return ret;
}
PyObject *
@ -59,7 +59,7 @@ libvirt_ulongWrap(unsigned long val)
{
PyObject *ret;
ret = PyLong_FromLong(val);
return (ret);
return ret;
}
PyObject *
@ -67,7 +67,7 @@ libvirt_longlongWrap(long long val)
{
PyObject *ret;
ret = PyLong_FromUnsignedLongLong((unsigned long long) val);
return (ret);
return ret;
}
PyObject *
@ -75,7 +75,7 @@ libvirt_ulonglongWrap(unsigned long long val)
{
PyObject *ret;
ret = PyLong_FromUnsignedLongLong(val);
return (ret);
return ret;
}
PyObject *
@ -85,11 +85,11 @@ libvirt_charPtrSizeWrap(char *str, Py_ssize_t size)
if (str == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = PyString_FromStringAndSize(str, size);
VIR_FREE(str);
return (ret);
return ret;
}
PyObject *
@ -99,11 +99,11 @@ libvirt_charPtrWrap(char *str)
if (str == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = PyString_FromString(str);
VIR_FREE(str);
return (ret);
return ret;
}
PyObject *
@ -113,10 +113,10 @@ libvirt_constcharPtrWrap(const char *str)
if (str == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = PyString_FromString(str);
return (ret);
return ret;
}
PyObject *
@ -126,11 +126,11 @@ libvirt_virDomainPtrWrap(virDomainPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virDomainPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -140,11 +140,11 @@ libvirt_virNetworkPtrWrap(virNetworkPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virNetworkPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -154,11 +154,11 @@ libvirt_virInterfacePtrWrap(virInterfacePtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virInterfacePtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -168,11 +168,11 @@ libvirt_virStoragePoolPtrWrap(virStoragePoolPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virStoragePoolPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -182,11 +182,11 @@ libvirt_virStorageVolPtrWrap(virStorageVolPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virStorageVolPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -196,11 +196,11 @@ libvirt_virConnectPtrWrap(virConnectPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virConnectPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -210,11 +210,11 @@ libvirt_virNodeDevicePtrWrap(virNodeDevicePtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virNodeDevicePtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -228,7 +228,7 @@ libvirt_virSecretPtrWrap(virSecretPtr node)
}
ret = libvirt_buildPyObject(node, "virSecretPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -242,7 +242,7 @@ libvirt_virNWFilterPtrWrap(virNWFilterPtr node)
}
ret = libvirt_buildPyObject(node, "virNWFilterPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -256,7 +256,7 @@ libvirt_virStreamPtrWrap(virStreamPtr node)
}
ret = libvirt_buildPyObject(node, "virStreamPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -266,11 +266,11 @@ libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virDomainSnapshotPtr", NULL);
return (ret);
return ret;
}
PyObject *
@ -281,11 +281,11 @@ libvirt_virEventHandleCallbackWrap(virEventHandleCallback node)
if (node == NULL) {
Py_INCREF(Py_None);
printf("%s: WARNING - Wrapping None\n", __func__);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virEventHandleCallback", NULL);
return (ret);
return ret;
}
PyObject *
@ -296,11 +296,11 @@ libvirt_virEventTimeoutCallbackWrap(virEventTimeoutCallback node)
if (node == NULL) {
printf("%s: WARNING - Wrapping None\n", __func__);
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virEventTimeoutCallback", NULL);
return (ret);
return ret;
}
PyObject *
@ -310,11 +310,11 @@ libvirt_virFreeCallbackWrap(virFreeCallback node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "virFreeCallback", NULL);
return (ret);
return ret;
}
PyObject *
@ -324,9 +324,9 @@ libvirt_virVoidPtrWrap(void* node)
if (node == NULL) {
Py_INCREF(Py_None);
return (Py_None);
return Py_None;
}
ret = libvirt_buildPyObject(node, "void*", NULL);
return (ret);
return ret;
}

View File

@ -6413,12 +6413,12 @@ virSysinfoParseXML(const xmlNodePtr node,
if (!xmlStrEqual(node->name, BAD_CAST "sysinfo")) {
virDomainReportError(VIR_ERR_XML_ERROR, "%s",
_("XML does not contain expected 'sysinfo' element"));
return(NULL);
return NULL;
}
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
return(NULL);
return NULL;
}
type = virXMLPropString(node, "type");
@ -6462,7 +6462,7 @@ virSysinfoParseXML(const xmlNodePtr node,
cleanup:
VIR_FREE(type);
return(def);
return def;
error:
virSysinfoDefFree(def);
@ -6548,7 +6548,7 @@ virDomainVideoAccelDefParseXML(const xmlNodePtr node) {
}
if ((support3d == NULL) && (support2d == NULL))
return(NULL);
return NULL;
if (VIR_ALLOC(def) < 0) {
virReportOOMError();
@ -10155,16 +10155,16 @@ virDomainCpuNumberParse(const char **str, int maxcpu)
const char *cur = *str;
if (!c_isdigit(*cur))
return (-1);
return -1;
while (c_isdigit(*cur)) {
ret = ret * 10 + (*cur - '0');
if (ret >= maxcpu)
return (-1);
return -1;
cur++;
}
*str = cur;
return (ret);
return ret;
}
/**
@ -10186,7 +10186,7 @@ virDomainCpuSetFormat(char *cpuset, int maxcpu)
int first = 1;
if ((cpuset == NULL) || (maxcpu <= 0) || (maxcpu > 100000))
return (NULL);
return NULL;
cur = 0;
start = -1;
@ -10251,7 +10251,7 @@ virDomainCpuSetParse(const char *str, char sep,
if ((str == NULL) || (cpuset == NULL) || (maxcpu <= 0) ||
(maxcpu > 100000))
return (-1);
return -1;
cur = str;
virSkipSpaces(&cur);
@ -10318,12 +10318,12 @@ virDomainCpuSetParse(const char *str, char sep,
} else
goto parse_error;
}
return (ret);
return ret;
parse_error:
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("topology cpuset syntax error"));
return (-1);
return -1;
}

View File

@ -124,10 +124,10 @@ virInterfaceDefParseName(virInterfaceDefPtr def,
if (tmp == NULL) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("interface has no name"));
return(-1);
return -1;
}
def->name = tmp;
return(0);
return 0;
}
static int
@ -140,11 +140,11 @@ virInterfaceDefParseMtu(virInterfaceDefPtr def,
if ((ret == -2) || ((ret == 0) && (mtu > 100000))) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("interface mtu value is improper"));
return(-1);
return -1;
} else if (ret == 0) {
def->mtu = (unsigned int) mtu;
}
return(0);
return 0;
}
static int
@ -165,10 +165,10 @@ virInterfaceDefParseStartMode(virInterfaceDefPtr def,
virInterfaceReportError(VIR_ERR_XML_ERROR,
_("unknown interface startmode %s"), tmp);
VIR_FREE(tmp);
return(-1);
return -1;
}
VIR_FREE(tmp);
return(0);
return 0;
}
static int
@ -178,7 +178,7 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt) {
tmp = virXPathString("string(./@mode)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_NONE);
return VIR_INTERFACE_BOND_NONE;
if (STREQ(tmp, "balance-rr"))
ret = VIR_INTERFACE_BOND_BALRR;
else if (STREQ(tmp, "active-backup"))
@ -199,7 +199,7 @@ virInterfaceDefParseBondMode(xmlXPathContextPtr ctxt) {
ret = -1;
}
VIR_FREE(tmp);
return(ret);
return ret;
}
static int
@ -209,7 +209,7 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt) {
tmp = virXPathString("string(./miimon/@carrier)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_MII_NONE);
return VIR_INTERFACE_BOND_MII_NONE;
if (STREQ(tmp, "ioctl"))
ret = VIR_INTERFACE_BOND_MII_IOCTL;
else if (STREQ(tmp, "netif"))
@ -220,7 +220,7 @@ virInterfaceDefParseBondMiiCarrier(xmlXPathContextPtr ctxt) {
ret = -1;
}
VIR_FREE(tmp);
return(ret);
return ret;
}
static int
@ -230,7 +230,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt) {
tmp = virXPathString("string(./arpmon/@validate)", ctxt);
if (tmp == NULL)
return(VIR_INTERFACE_BOND_ARP_NONE);
return VIR_INTERFACE_BOND_ARP_NONE;
if (STREQ(tmp, "active"))
ret = VIR_INTERFACE_BOND_ARP_ACTIVE;
else if (STREQ(tmp, "backup"))
@ -243,7 +243,7 @@ virInterfaceDefParseBondArpValid(xmlXPathContextPtr ctxt) {
ret = -1;
}
VIR_FREE(tmp);
return(ret);
return ret;
}
static int
@ -273,7 +273,7 @@ virInterfaceDefParseDhcp(virInterfaceProtocolDefPtr def,
def->peerdns = -1;
ctxt->node = save;
return(ret);
return ret;
}
static int
@ -292,11 +292,11 @@ virInterfaceDefParseIp(virInterfaceIpDefPtr def,
else if (ret == -2) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("Invalid ip address prefix value"));
return(-1);
return -1;
}
}
return(0);
return 0;
}
static int
@ -314,7 +314,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
if (dhcp != NULL) {
ret = virInterfaceDefParseDhcp(def, dhcp, ctxt);
if (ret != 0)
return(ret);
return ret;
}
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
@ -351,7 +351,7 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
error:
VIR_FREE(ipNodes);
return(ret);
return ret;
}
static int
@ -373,7 +373,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
if (dhcp != NULL) {
ret = virInterfaceDefParseDhcp(def, dhcp, ctxt);
if (ret != 0)
return(ret);
return ret;
}
nIpNodes = virXPathNodeSet("./ip", ctxt, &ipNodes);
@ -410,7 +410,7 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
error:
VIR_FREE(ipNodes);
return(ret);
return ret;
}
static int
@ -482,7 +482,7 @@ virInterfaceDefParseIfAdressing(virInterfaceDefPtr def,
error:
VIR_FREE(protoNodes);
ctxt->node = save;
return(ret);
return ret;
}
@ -524,7 +524,7 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
error:
VIR_FREE(interfaces);
ctxt->node = bridge;
return(ret);
return ret;
}
static int
@ -570,7 +570,7 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
error:
VIR_FREE(interfaces);
ctxt->node = bond;
return(ret);
return ret;
}
static int
@ -650,7 +650,7 @@ virInterfaceDefParseBond(virInterfaceDefPtr def,
}
}
error:
return(ret);
return ret;
}
static int
@ -660,7 +660,7 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
if (def->data.vlan.tag == NULL) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses the tag attribute"));
return(-1);
return -1;
}
def->data.vlan.devname =
@ -668,9 +668,9 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
if (def->data.vlan.devname == NULL) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses name attribute"));
return(-1);
return -1;
}
return(0);
return 0;
}
static virInterfaceDefPtr
@ -685,14 +685,14 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) {
if (tmp == NULL) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
"%s", _("interface misses the type attribute"));
return(NULL);
return NULL;
}
type = virInterfaceTypeFromString(tmp);
if (type == -1) {
virInterfaceReportError(VIR_ERR_XML_ERROR,
_("unknown interface type %s"), tmp);
VIR_FREE(tmp);
return(NULL);
return NULL;
}
VIR_FREE(tmp);
@ -906,7 +906,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
}
virBufferAsprintf(buf, "%*s </bridge>\n", level*2, "");
return(ret);
return ret;
}
static int
@ -948,7 +948,7 @@ virInterfaceBondDefFormat(virBufferPtr buf,
if (def->data.bond.target == NULL) {
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("bond arp monitoring has no target"));
return(-1);
return -1;
}
virBufferAsprintf(buf, "%*s <arpmon interval='%d' target='%s'",
level*2, "",
@ -967,7 +967,7 @@ virInterfaceBondDefFormat(virBufferPtr buf,
}
virBufferAsprintf(buf, "%*s </bond>\n", level*2, "");
return(ret);
return ret;
}
static int
@ -976,7 +976,7 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
if (def->data.vlan.tag == NULL) {
virInterfaceReportError(VIR_ERR_INTERNAL_ERROR,
"%s", _("vlan misses the tag name"));
return(-1);
return -1;
}
virBufferAsprintf(buf, "%*s <vlan tag='%s'",
@ -988,7 +988,7 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
virBufferAsprintf(buf, "%*s </vlan>\n", level*2, "");
} else
virBufferAddLit(buf, "/>\n");
return(0);
return 0;
}
static int
@ -1035,7 +1035,7 @@ virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def,
virBufferAsprintf(buf, "%*s </protocol>\n", level*2, "");
}
return(0);
return 0;
}
static int
@ -1061,7 +1061,7 @@ virInterfaceStartmodeDefFormat(virBufferPtr buf,
return -1;
}
virBufferAsprintf(buf, "%*s <start mode='%s'/>\n", level*2, "", mode);
return(0);
return 0;
}
static int

View File

@ -908,7 +908,7 @@ virNWFilterVarAccessEqual(const virNWFilterVarAccessPtr a,
a->u.index.intIterId == b->u.index.intIterId);
break;
case VIR_NWFILTER_VAR_ACCESS_ITERATOR:
return (a->u.iterId == b->u.iterId);
return a->u.iterId == b->u.iterId;
break;
case VIR_NWFILTER_VAR_ACCESS_LAST:
break;

View File

@ -392,7 +392,7 @@ x86DataIsEmpty(union cpuData *data)
{
struct data_iterator iter = DATA_ITERATOR_INIT(data);
return (x86DataCpuidNext(&iter) == NULL);
return x86DataCpuidNext(&iter) == NULL;
}

View File

@ -70,14 +70,14 @@ virGetConnect(void) {
ret->interfacePrivateData = NULL;
ret->refs = 1;
return(ret);
return ret;
failed:
if (ret != NULL) {
virMutexDestroy(&ret->lock);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
/**
@ -148,10 +148,10 @@ virUnrefConnect(virConnectPtr conn) {
if (refs == 0) {
virReleaseConnect(conn);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&conn->lock);
return (refs);
return refs;
}
/**
@ -207,14 +207,14 @@ virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
/**
@ -279,11 +279,11 @@ virUnrefDomain(virDomainPtr domain) {
if (refs == 0) {
virReleaseDomain(domain);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&domain->conn->lock);
return (refs);
return refs;
}
/**
@ -338,14 +338,14 @@ virGetNetwork(virConnectPtr conn, const char *name, const unsigned char *uuid) {
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
/**
@ -410,11 +410,11 @@ virUnrefNetwork(virNetworkPtr network) {
if (refs == 0) {
virReleaseNetwork(network);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&network->conn->lock);
return (refs);
return refs;
}
@ -475,7 +475,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
@ -483,7 +483,7 @@ virGetInterface(virConnectPtr conn, const char *name, const char *mac) {
VIR_FREE(ret->mac);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
/**
@ -546,11 +546,11 @@ virUnrefInterface(virInterfacePtr iface) {
if (refs == 0) {
virReleaseInterface(iface);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&iface->conn->lock);
return (refs);
return refs;
}
@ -607,14 +607,14 @@ virGetStoragePool(virConnectPtr conn, const char *name,
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
@ -680,11 +680,11 @@ virUnrefStoragePool(virStoragePoolPtr pool) {
if (refs == 0) {
virReleaseStoragePool(pool);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&pool->conn->lock);
return (refs);
return refs;
}
@ -750,7 +750,7 @@ virGetStorageVol(virConnectPtr conn, const char *pool, const char *name,
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
@ -759,7 +759,7 @@ error:
VIR_FREE(ret->pool);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
@ -824,11 +824,11 @@ virUnrefStorageVol(virStorageVolPtr vol) {
if (refs == 0) {
virReleaseStorageVol(vol);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&vol->conn->lock);
return (refs);
return refs;
}
@ -876,14 +876,14 @@ virGetNodeDevice(virConnectPtr conn, const char *name)
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
@ -942,11 +942,11 @@ virUnrefNodeDevice(virNodeDevicePtr dev) {
if (refs == 0) {
virReleaseNodeDevice(dev);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&dev->conn->lock);
return (refs);
return refs;
}
@ -1092,12 +1092,12 @@ virStreamPtr virGetStream(virConnectPtr conn) {
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
virMutexUnlock(&conn->lock);
VIR_FREE(ret);
return(NULL);
return NULL;
}
static void
@ -1129,11 +1129,11 @@ int virUnrefStream(virStreamPtr st) {
if (refs == 0) {
virReleaseStream(st);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&st->conn->lock);
return (refs);
return refs;
}
@ -1189,14 +1189,14 @@ virGetNWFilter(virConnectPtr conn, const char *name, const unsigned char *uuid)
conn->refs++;
ret->refs++;
virMutexUnlock(&conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
@ -1265,11 +1265,11 @@ virUnrefNWFilter(virNWFilterPtr nwfilter)
if (refs == 0) {
virReleaseNWFilter(nwfilter);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&nwfilter->conn->lock);
return (refs);
return refs;
}
@ -1305,14 +1305,14 @@ virGetDomainSnapshot(virDomainPtr domain, const char *name)
domain->refs++;
ret->refs++;
virMutexUnlock(&domain->conn->lock);
return(ret);
return ret;
error:
if (ret != NULL) {
VIR_FREE(ret->name);
VIR_FREE(ret);
}
return(NULL);
return NULL;
}
@ -1355,9 +1355,9 @@ virUnrefDomainSnapshot(virDomainSnapshotPtr snapshot)
if (refs == 0) {
virReleaseDomainSnapshot(snapshot);
/* Already unlocked mutex */
return (0);
return 0;
}
virMutexUnlock(&snapshot->domain->conn->lock);
return (refs);
return refs;
}

View File

@ -73,7 +73,7 @@ static int netcf_to_vir_err(int netcf_errcode)
* allocation failed return VIR ERR NO MEMORY
* though it should not be used now.
*/
return(2);
return 2;
case NETCF_EXMLPARSER:
/* XML parser choked */
return VIR_ERR_XML_ERROR;

View File

@ -2699,7 +2699,7 @@ lxcReload(void) {
static int lxcShutdown(void)
{
if (lxc_driver == NULL)
return(-1);
return -1;
lxcDriverLock(lxc_driver);
virDomainObjListDeinit(&lxc_driver->domains);
@ -2732,7 +2732,7 @@ lxcActive(void) {
int active;
if (lxc_driver == NULL)
return(0);
return 0;
lxcDriverLock(lxc_driver);
active = virDomainObjListNumOfDomains(&lxc_driver->domains, 1);

View File

@ -3097,7 +3097,7 @@ ebiptablesInstCommand(virBufferPtr buf,
*/
static int
ebiptablesCanApplyBasicRules(void) {
return (ebtables_cmd_path != NULL);
return ebtables_cmd_path != NULL;
}
/**
@ -3445,7 +3445,7 @@ ebiptablesRuleOrderSort(const void *a, const void *b)
}
normal:
/* priorities are limited to range [-1000, 1000] */
return (insta->priority - instb->priority);
return insta->priority - instb->priority;
}
static int

View File

@ -3482,7 +3482,7 @@ static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
if ((def->bios_vendor == NULL) && (def->bios_version == NULL) &&
(def->bios_date == NULL) && (def->bios_release == NULL))
return(NULL);
return NULL;
virBufferAddLit(&buf, "type=0");
@ -3508,7 +3508,7 @@ static char *qemuBuildSmbiosBiosStr(virSysinfoDefPtr def)
error:
virBufferFreeAndReset(&buf);
return(NULL);
return NULL;
}
static char *qemuBuildSmbiosSystemStr(virSysinfoDefPtr def, bool skip_uuid)
@ -3555,7 +3555,7 @@ static char *qemuBuildSmbiosSystemStr(virSysinfoDefPtr def, bool skip_uuid)
error:
virBufferFreeAndReset(&buf);
return(NULL);
return NULL;
}
static char *

View File

@ -2800,10 +2800,10 @@ qemuDomainManagedSavePath(struct qemud_driver *driver, virDomainObjPtr vm) {
if (virAsprintf(&ret, "%s/%s.save", driver->saveDir, vm->def->name) < 0) {
virReportOOMError();
return(NULL);
return NULL;
}
return(ret);
return ret;
}
static int

View File

@ -87,7 +87,7 @@ qemuProcessRemoveDomainStatus(struct qemud_driver *driver,
if (virAsprintf(&file, "%s/%s.xml", driver->stateDir, vm->def->name) < 0) {
virReportOOMError();
return(-1);
return -1;
}
if (unlink(file) < 0 && errno != ENOENT && errno != ENOTDIR)

View File

@ -184,7 +184,7 @@ remoteFindDaemonPath(void)
const char *customDaemon = getenv("LIBVIRTD_PATH");
if (customDaemon)
return(customDaemon);
return customDaemon;
for (i = 0; serverPaths[i]; i++) {
if (virFileIsExecutable(serverPaths[i])) {

View File

@ -105,7 +105,7 @@ SELinuxGenNewContext(const char *oldcontext, const char *mcs)
context_free(con);
err:
freecon(scontext);
return (newcontext);
return newcontext;
}
static int

View File

@ -641,7 +641,7 @@ static char *testBuildFilename(const char *relativeTo,
char *offset;
int baseLen;
if (!filename || filename[0] == '\0')
return (NULL);
return NULL;
if (filename[0] == '/')
return strdup(filename);
@ -1078,7 +1078,7 @@ static int testOpenFromFile(virConnectPtr conn,
xmlFreeDoc(xml);
testDriverUnlock(privconn);
return (0);
return 0;
error:
xmlXPathFreeContext(ctxt);
@ -1176,7 +1176,7 @@ static int testGetVersion(virConnectPtr conn ATTRIBUTE_UNUSED,
unsigned long *hvVer)
{
*hvVer = 2;
return (0);
return 0;
}
static int testIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED)
@ -1207,7 +1207,7 @@ static int testNodeGetInfo(virConnectPtr conn,
testDriverLock(privconn);
memcpy(info, &privconn->nodeInfo, sizeof(virNodeInfo));
testDriverUnlock(privconn);
return (0);
return 0;
}
static char *testGetCapabilities (virConnectPtr conn)

View File

@ -162,12 +162,12 @@ virConfNew(void)
if (VIR_ALLOC(ret) < 0) {
virReportOOMError();
return(NULL);
return NULL;
}
ret->filename = NULL;
ret->flags = 0;
return(ret);
return ret;
}
/**
@ -187,7 +187,7 @@ virConfCreate(const char *filename, unsigned int flags)
ret->filename = filename;
ret->flags = flags;
}
return(ret);
return ret;
}
/**
@ -208,13 +208,13 @@ virConfAddEntry(virConfPtr conf, char *name, virConfValuePtr value, char *comm)
virConfEntryPtr ret, prev;
if (conf == NULL)
return(NULL);
return NULL;
if ((comm == NULL) && (name == NULL))
return(NULL);
return NULL;
if (VIR_ALLOC(ret) < 0) {
virReportOOMError();
return(NULL);
return NULL;
}
ret->name = name;
@ -229,7 +229,7 @@ virConfAddEntry(virConfPtr conf, char *name, virConfValuePtr value, char *comm)
prev = prev->next;
prev->next = ret;
}
return(ret);
return ret;
}
/************************************************************************
@ -251,10 +251,10 @@ static int
virConfSaveValue(virBufferPtr buf, virConfValuePtr val)
{
if (val == NULL)
return(-1);
return -1;
switch (val->type) {
case VIR_CONF_NONE:
return(-1);
return -1;
case VIR_CONF_LONG:
virBufferAsprintf(buf, "%ld", val->l);
break;
@ -287,9 +287,9 @@ virConfSaveValue(virBufferPtr buf, virConfValuePtr val)
break;
}
default:
return(-1);
return -1;
}
return(0);
return 0;
}
/**
@ -317,7 +317,7 @@ virConfSaveEntry(virBufferPtr buf, virConfEntryPtr cur)
virBufferAdd(buf, cur->comment, -1);
}
virBufferAddLit(buf, "\n");
return(0);
return 0;
}
/************************************************************************
@ -349,7 +349,7 @@ virConfParseLong(virConfParserCtxtPtr ctxt, long *val)
}
if ((ctxt->cur >= ctxt->end) || (!c_isdigit(CUR))) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("unterminated number"));
return(-1);
return -1;
}
while ((ctxt->cur < ctxt->end) && (c_isdigit(CUR))) {
l = l * 10 + (CUR - '0');
@ -358,7 +358,7 @@ virConfParseLong(virConfParserCtxtPtr ctxt, long *val)
if (neg)
l = -l;
*val = l;
return(0);
return 0;
}
/**
@ -382,7 +382,7 @@ virConfParseString(virConfParserCtxtPtr ctxt)
NEXT;
if (CUR != '\'') {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("unterminated string"));
return(NULL);
return NULL;
}
ret = strndup(base, ctxt->cur - base);
if (ret == NULL) {
@ -406,7 +406,7 @@ virConfParseString(virConfParserCtxtPtr ctxt)
if (!STRPREFIX(ctxt->cur, "\"\"\"")) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("unterminated string"));
return(NULL);
return NULL;
}
ret = strndup(base, ctxt->cur - base);
if (ret == NULL) {
@ -421,7 +421,7 @@ virConfParseString(virConfParserCtxtPtr ctxt)
NEXT;
if (CUR != '"') {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("unterminated string"));
return(NULL);
return NULL;
}
ret = strndup(base, ctxt->cur - base);
if (ret == NULL) {
@ -430,7 +430,7 @@ virConfParseString(virConfParserCtxtPtr ctxt)
}
NEXT;
}
return(ret);
return ret;
}
/**
@ -452,25 +452,25 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
SKIP_BLANKS;
if (ctxt->cur >= ctxt->end) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("expecting a value"));
return(NULL);
return NULL;
}
if ((CUR == '"') || (CUR == '\'')) {
type = VIR_CONF_STRING;
str = virConfParseString(ctxt);
if (str == NULL)
return(NULL);
return NULL;
} else if (CUR == '[') {
if (ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
_("lists not allowed in VMX format"));
return(NULL);
return NULL;
}
type = VIR_CONF_LIST;
NEXT;
SKIP_BLANKS_AND_EOL;
if ((ctxt->cur < ctxt->end) && (CUR != ']')) {
if ((lst = virConfParseValue(ctxt)) == NULL)
return(NULL);
return NULL;
SKIP_BLANKS_AND_EOL;
}
while ((ctxt->cur < ctxt->end) && (CUR != ']')) {
@ -485,7 +485,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
_("expecting a separator in list"));
virConfFreeList(lst);
return(NULL);
return NULL;
}
NEXT;
SKIP_BLANKS_AND_EOL;
@ -495,7 +495,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
tmp = virConfParseValue(ctxt);
if (tmp == NULL) {
virConfFreeList(lst);
return(NULL);
return NULL;
}
prev = lst;
while (prev->next != NULL) prev = prev->next;
@ -508,33 +508,33 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
_("list is not closed with ]"));
virConfFreeList(lst);
return(NULL);
return NULL;
}
} else if (c_isdigit(CUR) || (CUR == '-') || (CUR == '+')) {
if (ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
_("numbers not allowed in VMX format"));
return(NULL);
return NULL;
}
if (virConfParseLong(ctxt, &l) < 0) {
return(NULL);
return NULL;
}
type = VIR_CONF_LONG;
} else {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("expecting a value"));
return(NULL);
return NULL;
}
if (VIR_ALLOC(ret) < 0) {
virReportOOMError();
virConfFreeList(lst);
VIR_FREE(str);
return(NULL);
return NULL;
}
ret->type = type;
ret->l = l;
ret->str = str;
ret->list = lst;
return(ret);
return ret;
}
/**
@ -557,7 +557,7 @@ virConfParseName(virConfParserCtxtPtr ctxt)
if (!c_isalpha(CUR) &&
!((ctxt->conf->flags & VIR_CONF_FLAG_VMX_FORMAT) && (CUR == '.'))) {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("expecting a name"));
return(NULL);
return NULL;
}
while ((ctxt->cur < ctxt->end) &&
(c_isalnum(CUR) || (CUR == '_') ||
@ -567,9 +567,9 @@ virConfParseName(virConfParserCtxtPtr ctxt)
ret = strndup(base, ctxt->cur - base);
if (ret == NULL) {
virReportOOMError();
return(NULL);
return NULL;
}
return(ret);
return ret;
}
/**
@ -587,17 +587,17 @@ virConfParseComment(virConfParserCtxtPtr ctxt)
char *comm;
if (CUR != '#')
return(-1);
return -1;
NEXT;
base = ctxt->cur;
while ((ctxt->cur < ctxt->end) && (!IS_EOL(CUR))) NEXT;
comm = strndup(base, ctxt->cur - base);
if (comm == NULL) {
virReportOOMError();
return(-1);
return -1;
}
virConfAddEntry(ctxt->conf, NULL, NULL, comm);
return(0);
return 0;
}
/**
@ -613,7 +613,7 @@ virConfParseSeparator(virConfParserCtxtPtr ctxt)
{
SKIP_BLANKS;
if (ctxt->cur >= ctxt->end)
return(0);
return 0;
if (IS_EOL(CUR)) {
SKIP_BLANKS_AND_EOL;
} else if (CUR == ';') {
@ -621,9 +621,9 @@ virConfParseSeparator(virConfParserCtxtPtr ctxt)
SKIP_BLANKS_AND_EOL;
} else {
virConfError(ctxt, VIR_ERR_CONF_SYNTAX, _("expecting a separator"));
return(-1);
return -1;
}
return(0);
return 0;
}
/**
@ -709,7 +709,7 @@ virConfParse(const char *filename, const char *content, int len,
ctxt.conf = virConfCreate(filename, flags);
if (ctxt.conf == NULL)
return(NULL);
return NULL;
while (ctxt.cur < ctxt.end) {
if (virConfParseStatement(&ctxt) < 0)
@ -718,11 +718,11 @@ virConfParse(const char *filename, const char *content, int len,
goto error;
}
return(ctxt.conf);
return ctxt.conf;
error:
virConfFree(ctxt.conf);
return(NULL);
return NULL;
}
/************************************************************************
@ -753,7 +753,7 @@ virConfReadFile(const char *filename, unsigned int flags)
if (filename == NULL) {
virConfError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
if ((len = virFileReadAll(filename, MAX_CONFIG_FILE_SIZE, &content)) < 0) {
@ -784,12 +784,12 @@ virConfReadMem(const char *memory, int len, unsigned int flags)
{
if ((memory == NULL) || (len < 0)) {
virConfError(NULL, VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
if (len == 0)
len = strlen(memory);
return(virConfParse("memory conf", memory, len, flags));
return virConfParse("memory conf", memory, len, flags);
}
/**
@ -818,7 +818,7 @@ virConfFree(virConfPtr conf)
tmp = next;
}
VIR_FREE(conf);
return(0);
return 0;
}
/**
@ -845,10 +845,10 @@ virConfGetValue(virConfPtr conf, const char *setting)
((conf->flags & VIR_CONF_FLAG_VMX_FORMAT &&
STRCASEEQ(cur->name, setting)) ||
STREQ(cur->name, setting)))
return(cur->value);
return cur->value;
cur = cur->next;
}
return(NULL);
return NULL;
}
/**
@ -887,14 +887,14 @@ virConfSetValue (virConfPtr conf,
if (VIR_ALLOC(cur) < 0) {
virReportOOMError();
virConfFreeValue(value);
return (-1);
return -1;
}
cur->comment = NULL;
if (!(cur->name = strdup(setting))) {
virReportOOMError();
virConfFreeValue(value);
VIR_FREE(cur);
return (-1);
return -1;
}
cur->value = value;
if (prev) {
@ -908,7 +908,7 @@ virConfSetValue (virConfPtr conf,
virConfFreeValue(cur->value);
cur->value = value;
}
return (0);
return 0;
}
@ -932,7 +932,7 @@ virConfWriteFile(const char *filename, virConfPtr conf)
unsigned int use;
if (conf == NULL)
return(-1);
return -1;
cur = conf->entries;
while (cur != NULL) {
@ -988,7 +988,7 @@ virConfWriteMem(char *memory, int *len, virConfPtr conf)
unsigned int use;
if ((memory == NULL) || (len == NULL) || (*len <= 0) || (conf == NULL))
return(-1);
return -1;
cur = conf->entries;
while (cur != NULL) {

View File

@ -142,14 +142,14 @@ virHookInitialize(void) {
for (i = 0;i < VIR_HOOK_DRIVER_LAST;i++) {
res = virHookCheck(i, virHookDriverTypeToString(i));
if (res < 0)
return(-1);
return -1;
if (res == 1) {
virHooksFound |= (1 << i);
ret++;
}
}
return(ret);
return ret;
}
/**
@ -165,13 +165,13 @@ int
virHookPresent(int driver) {
if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
(driver >= VIR_HOOK_DRIVER_LAST))
return(0);
return 0;
if (virHooksFound == -1)
return(0);
return 0;
if ((virHooksFound & (1 << driver)) == 0)
return(0);
return(1);
return 0;
return 1;
}
/**
@ -215,7 +215,7 @@ virHookCall(int driver,
if ((driver < VIR_HOOK_DRIVER_DAEMON) ||
(driver >= VIR_HOOK_DRIVER_LAST))
return(1);
return 1;
/*
* We cache the availability of the script to minimize impact at
@ -228,7 +228,7 @@ virHookCall(int driver,
virHookInitialize();
if ((virHooksFound & (1 << driver)) == 0)
return(1);
return 1;
drvstr = virHookDriverTypeToString(driver);
@ -248,7 +248,7 @@ virHookCall(int driver,
virHookReportError(VIR_ERR_INTERNAL_ERROR,
_("Hook for %s, failed to find operation #%d"),
drvstr, op);
return(1);
return 1;
}
subopstr = virHookSubopTypeToString(sub_op);
if (subopstr == NULL)
@ -261,7 +261,7 @@ virHookCall(int driver,
virHookReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to build path for %s hook"),
drvstr);
return(-1);
return -1;
}
cmd = virCommandNewArgList(path, id, opstr, subopstr, extra, NULL);

View File

@ -42,7 +42,7 @@ sexpr_new(void)
if (VIR_ALLOC(ret) < 0) {
virReportOOMError();
return (NULL);
return NULL;
}
ret->kind = SEXPR_NIL;
return ret;
@ -187,12 +187,12 @@ struct sexpr *
sexpr_append(struct sexpr *lst, const struct sexpr *value)
{
if (lst == NULL)
return (NULL);
return NULL;
if (value == NULL)
return (lst);
return lst;
if (append(lst, value) < 0)
return (NULL);
return (lst);
return NULL;
return lst;
}
/**
@ -256,7 +256,7 @@ trim(const char *string)
{
while (IS_SPACE(*string))
string++;
return (string);
return string;
}
/**
@ -351,7 +351,7 @@ _string2sexpr(const char *buffer, size_t * end)
error:
sexpr_free(ret);
return (NULL);
return NULL;
}
/**

View File

@ -605,7 +605,7 @@ int virFileIsLink(const char *linkpath)
if (lstat(linkpath, &st) < 0)
return -errno;
return (S_ISLNK(st.st_mode) != 0);
return S_ISLNK(st.st_mode) != 0;
}
@ -1813,19 +1813,19 @@ virParseNumber(const char **str)
const char *cur = *str;
if ((*cur < '0') || (*cur > '9'))
return (-1);
return -1;
while (c_isdigit(*cur)) {
unsigned int c = *cur - '0';
if ((ret > INT_MAX / 10) ||
((ret == INT_MAX / 10) && (c > INT_MAX % 10)))
return (-1);
return -1;
ret = ret * 10 + c;
cur++;
}
*str = cur;
return (ret);
return ret;
}

View File

@ -102,7 +102,7 @@ virUUIDGenerate(unsigned char *uuid)
int err;
if (uuid == NULL)
return(-1);
return -1;
if ((err = virUUIDGenerateRandomBytes(uuid, VIR_UUID_BUFLEN))) {
char ebuf[1024];
@ -112,7 +112,7 @@ virUUIDGenerate(unsigned char *uuid)
err = virUUIDGeneratePseudoRandomBytes(uuid, VIR_UUID_BUFLEN);
}
return(err);
return err;
}
/**
@ -222,7 +222,7 @@ virUUIDIsValid(unsigned char *uuid)
if (uuid[i] == c)
ctr++;
return (ctr != VIR_UUID_BUFLEN);
return ctr != VIR_UUID_BUFLEN;
}
static int

View File

@ -98,7 +98,7 @@ static size_t
virHashComputeKey(virHashTablePtr table, const void *name)
{
uint32_t value = table->keyCode(name, table->seed);
return (value % table->size);
return value % table->size;
}
/**
@ -189,21 +189,21 @@ virHashGrow(virHashTablePtr table, size_t size)
#endif
if (table == NULL)
return (-1);
return -1;
if (size < 8)
return (-1);
return -1;
if (size > 8 * 2048)
return (-1);
return -1;
oldsize = table->size;
oldtable = table->table;
if (oldtable == NULL)
return (-1);
return -1;
if (VIR_ALLOC_N(table->table, size) < 0) {
virReportOOMError();
table->table = oldtable;
return (-1);
return -1;
}
table->size = size;
@ -230,7 +230,7 @@ virHashGrow(virHashTablePtr table, size_t size)
size, nbElem);
#endif
return (0);
return 0;
}
/**
@ -276,7 +276,7 @@ virHashAddOrUpdateEntry(virHashTablePtr table, const void *name,
char *new_name;
if ((table == NULL) || (name == NULL))
return (-1);
return -1;
if (table->iterating)
virHashIterationError(-1);
@ -416,8 +416,8 @@ ssize_t
virHashSize(virHashTablePtr table)
{
if (table == NULL)
return (-1);
return (table->nbElems);
return -1;
return table->nbElems;
}
/**
@ -456,7 +456,7 @@ virHashRemoveEntry(virHashTablePtr table, const void *name)
virHashEntryPtr *nextptr;
if (table == NULL || name == NULL)
return (-1);
return -1;
nextptr = table->table + virHashComputeKey(table, name);
for (entry = *nextptr; entry; entry = entry->next) {
@ -498,7 +498,7 @@ virHashForEach(virHashTablePtr table, virHashIterator iter, void *data)
size_t i, count = 0;
if (table == NULL || iter == NULL)
return (-1);
return -1;
if (table->iterating)
virHashIterationError(-1);
@ -520,7 +520,7 @@ virHashForEach(virHashTablePtr table, virHashIterator iter, void *data)
}
table->iterating = false;
return (count);
return count;
}
/**
@ -544,7 +544,7 @@ virHashRemoveSet(virHashTablePtr table,
size_t i, count = 0;
if (table == NULL || iter == NULL)
return (-1);
return -1;
if (table->iterating)
virHashIterationError(-1);
@ -593,7 +593,7 @@ void *virHashSearch(virHashTablePtr table,
size_t i;
if (table == NULL || iter == NULL)
return (NULL);
return NULL;
if (table->iterating)
virHashIterationError(NULL);

View File

@ -58,7 +58,7 @@ virMacAddrCompare(const char *p, const char *q)
/* On machines where 'char' and 'int' are types of the same size, the
difference of two 'unsigned char' values - including the sign bit -
doesn't fit in an 'int'. */
return (c > d ? 1 : c < d ? -1 : 0);
return c > d ? 1 : c < d ? -1 : 0;
}
/**

View File

@ -312,7 +312,7 @@ virNetlinkEventServiceStop(void)
bool
virNetlinkEventServiceIsRunning(void)
{
return (server != NULL);
return server != NULL;
}
/**

View File

@ -48,7 +48,7 @@ static int virSocketAddrGetIPv4Addr(virSocketAddrPtr addr, virSocketAddrIPv4Ptr
int i;
if ((addr == NULL) || (tab == NULL) || (addr->data.stor.ss_family != AF_INET))
return(-1);
return -1;
val = ntohl(addr->data.inet4.sin_addr.s_addr);
@ -57,21 +57,21 @@ static int virSocketAddrGetIPv4Addr(virSocketAddrPtr addr, virSocketAddrIPv4Ptr
val >>= 8;
}
return(0);
return 0;
}
static int virSocketAddrGetIPv6Addr(virSocketAddrPtr addr, virSocketAddrIPv6Ptr tab) {
int i;
if ((addr == NULL) || (tab == NULL) || (addr->data.stor.ss_family != AF_INET6))
return(-1);
return -1;
for (i = 0;i < 8;i++) {
(*tab)[i] = ((addr->data.inet6.sin6_addr.s6_addr[2 * i] << 8) |
addr->data.inet6.sin6_addr.s6_addr[2 * i + 1]);
}
return(0);
return 0;
}
/**
@ -120,7 +120,7 @@ int virSocketAddrParse(virSocketAddrPtr addr, const char *val, int family) {
}
freeaddrinfo(res);
return(len);
return len;
}
/*
@ -444,13 +444,13 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
int i;
if ((addr1 == NULL) || (addr2 == NULL) || (netmask == NULL))
return(-1);
return -1;
if ((addr1->data.stor.ss_family != addr2->data.stor.ss_family) ||
(addr1->data.stor.ss_family != netmask->data.stor.ss_family))
return(-1);
return -1;
if (virSocketAddrIsNetmask(netmask) != 0)
return(-1);
return -1;
if (addr1->data.stor.ss_family == AF_INET) {
virSocketAddrIPv4 t1, t2, tm;
@ -458,11 +458,11 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
if ((virSocketAddrGetIPv4Addr(addr1, &t1) < 0) ||
(virSocketAddrGetIPv4Addr(addr2, &t2) < 0) ||
(virSocketAddrGetIPv4Addr(netmask, &tm) < 0))
return(-1);
return -1;
for (i = 0;i < 4;i++) {
if ((t1[i] & tm[i]) != (t2[i] & tm[i]))
return(0);
return 0;
}
} else if (addr1->data.stor.ss_family == AF_INET6) {
@ -471,17 +471,17 @@ int virSocketAddrCheckNetmask(virSocketAddrPtr addr1, virSocketAddrPtr addr2,
if ((virSocketAddrGetIPv6Addr(addr1, &t1) < 0) ||
(virSocketAddrGetIPv6Addr(addr2, &t2) < 0) ||
(virSocketAddrGetIPv6Addr(netmask, &tm) < 0))
return(-1);
return -1;
for (i = 0;i < 8;i++) {
if ((t1[i] & tm[i]) != (t2[i] & tm[i]))
return(0);
return 0;
}
} else {
return(-1);
return -1;
}
return(1);
return 1;
}
/**
@ -500,44 +500,44 @@ int virSocketAddrGetRange(virSocketAddrPtr start, virSocketAddrPtr end) {
int ret = 0, i;
if ((start == NULL) || (end == NULL))
return(-1);
return -1;
if (start->data.stor.ss_family != end->data.stor.ss_family)
return(-1);
return -1;
if (start->data.stor.ss_family == AF_INET) {
virSocketAddrIPv4 t1, t2;
if ((virSocketAddrGetIPv4Addr(start, &t1) < 0) ||
(virSocketAddrGetIPv4Addr(end, &t2) < 0))
return(-1);
return -1;
for (i = 0;i < 2;i++) {
if (t1[i] != t2[i])
return(-1);
return -1;
}
ret = (t2[2] - t1[2]) * 256 + (t2[3] - t1[3]);
if (ret < 0)
return(-1);
return -1;
ret++;
} else if (start->data.stor.ss_family == AF_INET6) {
virSocketAddrIPv6 t1, t2;
if ((virSocketAddrGetIPv6Addr(start, &t1) < 0) ||
(virSocketAddrGetIPv6Addr(end, &t2) < 0))
return(-1);
return -1;
for (i = 0;i < 7;i++) {
if (t1[i] != t2[i])
return(-1);
return -1;
}
ret = t2[7] - t1[7];
if (ret < 0)
return(-1);
return -1;
ret++;
} else {
return(-1);
return -1;
}
return(ret);
return ret;
}

View File

@ -31,13 +31,13 @@ virErrorLogPriorityFunc virErrorLogPriorityFilter = NULL;
static virLogPriority virErrorLevelPriority(virErrorLevel level) {
switch (level) {
case VIR_ERR_NONE:
return(VIR_LOG_INFO);
return VIR_LOG_INFO;
case VIR_ERR_WARNING:
return(VIR_LOG_WARN);
return VIR_LOG_WARN;
case VIR_ERR_ERROR:
return(VIR_LOG_ERROR);
return VIR_LOG_ERROR;
}
return(VIR_LOG_ERROR);
return VIR_LOG_ERROR;
}
static const char *virErrorDomainName(virErrorDomain domain) {
@ -185,7 +185,7 @@ static const char *virErrorDomainName(virErrorDomain domain) {
dom = "Auth ";
break;
}
return(dom);
return dom;
}
@ -769,7 +769,7 @@ virErrorMsg(virErrorNumber error, const char *info)
switch (error) {
case VIR_ERR_OK:
return (NULL);
return NULL;
case VIR_ERR_INTERNAL_ERROR:
if (info != NULL)
errmsg = _("internal error %s");
@ -1251,7 +1251,7 @@ virErrorMsg(virErrorNumber error, const char *info)
errmsg = _("numerical overflow: %s");
break;
}
return (errmsg);
return errmsg;
}
/**

View File

@ -68,7 +68,7 @@ virXPathString(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathString()"));
return (NULL);
return NULL;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -76,14 +76,14 @@ virXPathString(const char *xpath,
if ((obj == NULL) || (obj->type != XPATH_STRING) ||
(obj->stringval == NULL) || (obj->stringval[0] == 0)) {
xmlXPathFreeObject(obj);
return (NULL);
return NULL;
}
ret = strdup((char *) obj->stringval);
xmlXPathFreeObject(obj);
if (ret == NULL) {
virReportOOMError();
}
return (ret);
return ret;
}
/**
@ -138,7 +138,7 @@ virXPathNumber(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNumber()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -146,12 +146,12 @@ virXPathNumber(const char *xpath,
if ((obj == NULL) || (obj->type != XPATH_NUMBER) ||
(isnan(obj->floatval))) {
xmlXPathFreeObject(obj);
return (-1);
return -1;
}
*value = obj->floatval;
xmlXPathFreeObject(obj);
return (0);
return 0;
}
static int
@ -167,7 +167,7 @@ virXPathLongBase(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathLong()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -194,7 +194,7 @@ virXPathLongBase(const char *xpath,
}
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
/**
@ -280,7 +280,7 @@ virXPathULongBase(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathULong()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -307,7 +307,7 @@ virXPathULongBase(const char *xpath,
}
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
/**
@ -404,7 +404,7 @@ virXPathULongLong(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathULong()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -431,7 +431,7 @@ virXPathULongLong(const char *xpath,
}
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
/**
@ -458,7 +458,7 @@ virXPathLongLong(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL) || (value == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathLongLong()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -485,7 +485,7 @@ virXPathLongLong(const char *xpath,
}
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
char *
@ -515,7 +515,7 @@ virXPathBoolean(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathBoolean()"));
return (-1);
return -1;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -523,12 +523,12 @@ virXPathBoolean(const char *xpath,
if ((obj == NULL) || (obj->type != XPATH_BOOLEAN) ||
(obj->boolval < 0) || (obj->boolval > 1)) {
xmlXPathFreeObject(obj);
return (-1);
return -1;
}
ret = obj->boolval;
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
/**
@ -552,7 +552,7 @@ virXPathNode(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNode()"));
return (NULL);
return NULL;
}
relnode = ctxt->node;
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
@ -561,12 +561,12 @@ virXPathNode(const char *xpath,
(obj->nodesetval == NULL) || (obj->nodesetval->nodeNr <= 0) ||
(obj->nodesetval->nodeTab == NULL)) {
xmlXPathFreeObject(obj);
return (NULL);
return NULL;
}
ret = obj->nodesetval->nodeTab[0];
xmlXPathFreeObject(obj);
return (ret);
return ret;
}
/**
@ -592,7 +592,7 @@ virXPathNodeSet(const char *xpath,
if ((ctxt == NULL) || (xpath == NULL)) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
"%s", _("Invalid parameter to virXPathNodeSet()"));
return (-1);
return -1;
}
if (list != NULL)
@ -602,18 +602,18 @@ virXPathNodeSet(const char *xpath,
obj = xmlXPathEval(BAD_CAST xpath, ctxt);
ctxt->node = relnode;
if (obj == NULL)
return(0);
return 0;
if (obj->type != XPATH_NODESET) {
virXMLError(VIR_ERR_INTERNAL_ERROR,
_("Incorrect xpath '%s'"), xpath);
xmlXPathFreeObject(obj);
return (-1);
return -1;
}
if ((obj->nodesetval == NULL) || (obj->nodesetval->nodeNr < 0)) {
xmlXPathFreeObject(obj);
return (0);
return 0;
}
ret = obj->nodesetval->nodeNr;
@ -627,7 +627,7 @@ virXPathNodeSet(const char *xpath,
}
}
xmlXPathFreeObject(obj);
return (ret);
return ret;
}

View File

@ -135,17 +135,17 @@ xenDomainUsedCpus(virDomainPtr dom)
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(dom))
return (NULL);
return NULL;
priv = dom->conn->privateData;
if (priv->nbNodeCpus <= 0)
return(NULL);
return NULL;
nb_vcpu = xenUnifiedDomainGetMaxVcpus(dom);
if (nb_vcpu <= 0)
return(NULL);
return NULL;
if (xenUnifiedNodeGetInfo(dom->conn, &nodeinfo) < 0)
return(NULL);
return NULL;
if (VIR_ALLOC_N(cpulist, priv->nbNodeCpus) < 0) {
virReportOOMError();
@ -184,7 +184,7 @@ done:
VIR_FREE(cpulist);
VIR_FREE(cpumap);
VIR_FREE(cpuinfo);
return(res);
return res;
}
#ifdef WITH_LIBVIRTD
@ -1247,7 +1247,7 @@ xenUnifiedDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
xenUnifiedUnlock(priv);
res = xenDaemonDomainGetXMLDesc(dom, flags, cpus);
VIR_FREE(cpus);
return(res);
return res;
}
}
@ -1679,10 +1679,10 @@ xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams)
if (priv->opened[i] && drivers[i]->xenDomainGetSchedulerType) {
schedulertype = drivers[i]->xenDomainGetSchedulerType (dom, nparams);
if (schedulertype != NULL)
return(schedulertype);
return schedulertype;
}
}
return(NULL);
return NULL;
}
static int
@ -1700,10 +1700,10 @@ xenUnifiedDomainGetSchedulerParametersFlags(virDomainPtr dom,
if (priv->opened[i] && drivers[i]->xenDomainGetSchedulerParameters) {
ret = drivers[i]->xenDomainGetSchedulerParameters(dom, params, nparams);
if (ret == 0)
return(0);
return 0;
}
}
return(-1);
return -1;
}
static int
@ -1735,7 +1735,7 @@ xenUnifiedDomainSetSchedulerParametersFlags(virDomainPtr dom,
}
}
return(-1);
return -1;
}
static int
@ -1823,12 +1823,12 @@ xenUnifiedNodeGetFreeMemory (virConnectPtr conn)
ret = xenHypervisorNodeGetCellsFreeMemory (conn, &freeMem,
-1, 1);
if (ret != 1)
return (0);
return(freeMem);
return 0;
return freeMem;
}
xenUnifiedError(VIR_ERR_NO_SUPPORT, __FUNCTION__);
return(0);
return 0;
}
@ -1853,7 +1853,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn,
callback, opaque, freefunc);
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
@ -1905,7 +1905,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn,
ret = -1;
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
static int

View File

@ -526,9 +526,9 @@ static int
lock_pages(void *addr, size_t len)
{
#ifdef __linux__
return (mlock(addr, len));
return mlock(addr, len);
#elif defined(__sun)
return (0);
return 0;
#endif
}
@ -536,9 +536,9 @@ static int
unlock_pages(void *addr, size_t len)
{
#ifdef __linux__
return (munlock(addr, len));
return munlock(addr, len);
#elif defined(__sun)
return (0);
return 0;
#endif
}
@ -902,7 +902,7 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
@ -917,9 +917,9 @@ xenHypervisorDoV0Op(int handle, xen_op_v0 * op)
}
if (ret < 0)
return (-1);
return -1;
return (0);
return 0;
}
/**
* xenHypervisorDoV1Op:
@ -944,7 +944,7 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
@ -959,9 +959,9 @@ xenHypervisorDoV1Op(int handle, xen_op_v1* op)
}
if (ret < 0)
return (-1);
return -1;
return (0);
return 0;
}
/**
@ -987,7 +987,7 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
@ -1002,9 +1002,9 @@ xenHypervisorDoV2Sys(int handle, xen_op_v2_sys* op)
}
if (ret < 0)
return (-1);
return -1;
return (0);
return 0;
}
/**
@ -1030,7 +1030,7 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
if (lock_pages(op, sizeof(dom0_op_t)) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
ret = ioctl(handle, xen_ioctl_hypercall_cmd, (unsigned long) &hc);
@ -1045,9 +1045,9 @@ xenHypervisorDoV2Dom(int handle, xen_op_v2_dom* op)
}
if (ret < 0)
return (-1);
return -1;
return (0);
return 0;
}
/**
@ -1070,7 +1070,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
if (lock_pages(XEN_GETDOMAININFOLIST_DATA(dominfos),
XEN_GETDOMAININFO_SIZE * maxids) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
if (hv_versions.hypervisor > 1) {
xen_op_v2_sys op;
@ -1127,7 +1127,7 @@ virXen_getdomaininfolist(int handle, int first_domain, int maxids,
virXenError(VIR_ERR_XEN_CALL, " release");
ret = -1;
}
return(ret);
return ret;
}
static int
@ -1197,7 +1197,7 @@ xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
op.cmd = XEN_V2_OP_GETSCHEDULERID;
ret = xenHypervisorDoV2Sys(priv->handle, &op);
if (ret < 0)
return(NULL);
return NULL;
switch (op.u.getschedulerid.sched_id){
case XEN_SCHEDULER_SEDF:
@ -1291,7 +1291,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
/* TODO: Implement for Xen/SEDF */
TODO
return(-1);
return -1;
case XEN_SCHEDULER_CREDIT:
memset(&op_dom, 0, sizeof(op_dom));
op_dom.cmd = XEN_V2_OP_SCHEDULER;
@ -1300,7 +1300,7 @@ xenHypervisorGetSchedulerParameters(virDomainPtr domain,
op_dom.u.getschedinfo.cmd = XEN_DOMCTL_SCHEDOP_getinfo;
ret = xenHypervisorDoV2Dom(priv->handle, &op_dom);
if (ret < 0)
return(-1);
return -1;
if (virTypedParameterAssign(&params[0],
VIR_DOMAIN_SCHEDULER_WEIGHT,
@ -1403,7 +1403,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
case XEN_SCHEDULER_SEDF:
/* TODO: Implement for Xen/SEDF */
TODO
return(-1);
return -1;
case XEN_SCHEDULER_CREDIT: {
memset(&op_dom, 0, sizeof(op_dom));
op_dom.cmd = XEN_V2_OP_SCHEDULER;
@ -1426,7 +1426,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
virXenError(VIR_ERR_INVALID_ARG,
_("Credit scheduler weight parameter (%d) "
"is out of range (1-65535)"), val);
return(-1);
return -1;
}
op_dom.u.getschedinfo.u.credit.weight = val;
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP)) {
@ -1435,7 +1435,7 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
virXenError(VIR_ERR_INVALID_ARG,
_("Credit scheduler cap parameter (%d) is "
"out of range (0-65534)"), val);
return(-1);
return -1;
}
op_dom.u.getschedinfo.u.credit.cap = val;
}
@ -1553,7 +1553,7 @@ virXen_pausedomain(int handle, int id)
op.u.domain.domain = (domid_t) id;
ret = xenHypervisorDoV0Op(handle, &op);
}
return(ret);
return ret;
}
/**
@ -1592,7 +1592,7 @@ virXen_unpausedomain(int handle, int id)
op.u.domain.domain = (domid_t) id;
ret = xenHypervisorDoV0Op(handle, &op);
}
return(ret);
return ret;
}
/**
@ -1631,7 +1631,7 @@ virXen_destroydomain(int handle, int id)
op.u.domain.domain = (domid_t) id;
ret = xenHypervisorDoV0Op(handle, &op);
}
return(ret);
return ret;
}
/**
@ -1677,7 +1677,7 @@ virXen_setmaxmem(int handle, int id, unsigned long memory)
op.u.setmaxmem.maxmem = memory;
ret = xenHypervisorDoV0Op(handle, &op);
}
return(ret);
return ret;
}
/**
@ -1720,7 +1720,7 @@ virXen_setmaxvcpus(int handle, int id, unsigned int vcpus)
op.u.setmaxvcpu.maxvcpu = vcpus;
ret = xenHypervisorDoV0Op(handle, &op);
}
return(ret);
return ret;
}
/**
@ -1749,7 +1749,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
if (lock_pages(cpumap, maplen) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
memset(&op, 0, sizeof(op));
op.cmd = XEN_V2_OP_SETVCPUMAP;
@ -1760,7 +1760,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
if (maplen < 8) {
if (VIR_ALLOC_N(new, sizeof(uint64_t)) < 0) {
virReportOOMError();
return (-1);
return -1;
}
memcpy(new, cpumap, maplen);
bitmap = new;
@ -1792,7 +1792,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
int j;
if ((maplen > (int)sizeof(cpumap_t)) || (sizeof(cpumap_t) & 7))
return (-1);
return -1;
memset(pm, 0, sizeof(cpumap_t));
for (j = 0; j < maplen; j++)
@ -1818,7 +1818,7 @@ virXen_setvcpumap(int handle, int id, unsigned int vcpu,
ret = xenHypervisorDoV0Op(handle, &op);
}
}
return(ret);
return ret;
}
@ -1853,7 +1853,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
ret = xenHypervisorDoV2Dom(handle, &op);
if (ret < 0)
return(-1);
return -1;
ipt->number = vcpu;
if (hv_versions.dom_interface < 5) {
if (op.u.getvcpuinfo.online) {
@ -1881,7 +1881,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
if ((cpumap != NULL) && (maplen > 0)) {
if (lock_pages(cpumap, maplen) < 0) {
virXenError(VIR_ERR_XEN_CALL, " locking");
return (-1);
return -1;
}
memset(cpumap, 0, maplen);
memset(&op, 0, sizeof(op));
@ -1918,7 +1918,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
op.u.getvcpuinfo.vcpu = vcpu;
ret = xenHypervisorDoV1Op(handle, &op);
if (ret < 0)
return(-1);
return -1;
ipt->number = vcpu;
if (op.u.getvcpuinfo.online) {
if (op.u.getvcpuinfo.running) ipt->state = VIR_VCPU_RUNNING;
@ -1942,7 +1942,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
op.u.getvcpuinfo.vcpu = vcpu;
ret = xenHypervisorDoV0Op(handle, &op);
if (ret < 0)
return(-1);
return -1;
ipt->number = vcpu;
if (op.u.getvcpuinfo.online) {
if (op.u.getvcpuinfo.running) ipt->state = VIR_VCPU_RUNNING;
@ -1959,7 +1959,7 @@ virXen_getvcpusinfo(int handle, int id, unsigned int vcpu, virVcpuInfoPtr ipt,
}
}
}
return(ret);
return ret;
}
/**
@ -1983,8 +1983,8 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
if (initialized) {
if (hv_versions.hypervisor == -1)
return (-1);
return(0);
return -1;
return 0;
}
initialized = 1;
in_init = 1;
@ -2034,7 +2034,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
if (ret < 0) {
hv_versions.hypervisor = -1;
return(-1);
return -1;
}
fd = ret;
@ -2083,7 +2083,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
(unsigned long) IOCTL_PRIVCMD_HYPERCALL);
VIR_FORCE_CLOSE(fd);
in_init = 0;
return(-1);
return -1;
detect_v2:
/*
@ -2095,7 +2095,7 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
if (VIR_ALLOC(ipt) < 0) {
virReportOOMError();
return(-1);
return -1;
}
/* Currently consider RHEL5.0 Fedora7, xen-3.1, and xen-unstable */
hv_versions.sys_interface = 2; /* XEN_SYSCTL_INTERFACE_VERSION */
@ -2189,13 +2189,13 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
VIR_FORCE_CLOSE(fd);
in_init = 0;
VIR_FREE(ipt);
return(-1);
return -1;
done:
VIR_FORCE_CLOSE(fd);
in_init = 0;
VIR_FREE(ipt);
return(0);
return 0;
}
/**
@ -2227,12 +2227,12 @@ xenHypervisorOpen(virConnectPtr conn,
ret = open(XEN_HYPERVISOR_SOCKET, O_RDWR);
if (ret < 0) {
virXenError(VIR_ERR_NO_XEN, "%s", XEN_HYPERVISOR_SOCKET);
return (-1);
return -1;
}
priv->handle = ret;
return(0);
return 0;
}
/**
@ -2250,7 +2250,7 @@ xenHypervisorClose(virConnectPtr conn)
xenUnifiedPrivatePtr priv;
if (conn == NULL)
return (-1);
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -2259,9 +2259,9 @@ xenHypervisorClose(virConnectPtr conn)
ret = VIR_CLOSE(priv->handle);
if (ret < 0)
return (-1);
return -1;
return (0);
return 0;
}
@ -2283,9 +2283,9 @@ xenHypervisorGetVersion(virConnectPtr conn, unsigned long *hvVer)
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0 || hvVer == NULL)
return (-1);
return -1;
*hvVer = (hv_versions.hv >> 16) * 1000000 + (hv_versions.hv & 0xFFFF) * 1000;
return(0);
return 0;
}
struct guest_arch {
@ -2821,12 +2821,12 @@ xenHypervisorNumOfDomains(virConnectPtr conn)
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0)
return (-1);
return -1;
retry:
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virReportOOMError();
return(-1);
return -1;
}
XEN_GETDOMAININFOLIST_CLEAR(dominfos, maxids);
@ -2836,7 +2836,7 @@ xenHypervisorNumOfDomains(virConnectPtr conn)
XEN_GETDOMAININFOLIST_FREE(dominfos);
if (ret < 0)
return (-1);
return -1;
nbids = ret;
/* Can't possibly have more than 65,000 concurrent guests
@ -2853,8 +2853,8 @@ xenHypervisorNumOfDomains(virConnectPtr conn)
nbids = -1;
}
if ((nbids < 0) || (nbids > maxids))
return(-1);
return(nbids);
return -1;
return nbids;
}
/**
@ -2880,14 +2880,14 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0 ||
(ids == NULL) || (maxids < 0))
return (-1);
return -1;
if (maxids == 0)
return(0);
return 0;
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virReportOOMError();
return(-1);
return -1;
}
XEN_GETDOMAININFOLIST_CLEAR(dominfos, maxids);
@ -2897,13 +2897,13 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
if (ret < 0) {
XEN_GETDOMAININFOLIST_FREE(dominfos);
return (-1);
return -1;
}
nbids = ret;
if ((nbids < 0) || (nbids > maxids)) {
XEN_GETDOMAININFOLIST_FREE(dominfos);
return(-1);
return -1;
}
for (i = 0;i < nbids;i++) {
@ -2911,7 +2911,7 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
}
XEN_GETDOMAININFOLIST_FREE(dominfos);
return (nbids);
return nbids;
}
@ -2926,7 +2926,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
if (priv->handle < 0) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domain shut off or invalid"));
return (NULL);
return NULL;
}
/* HV's earlier than 3.1.0 don't include the HVM flags in guests status*/
@ -2934,7 +2934,7 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
hv_versions.dom_interface < 4) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("unsupported in dom interface < 4"));
return (NULL);
return NULL;
}
XEN_GETDOMAININFO_CLEAR(dominfo);
@ -2942,13 +2942,13 @@ xenHypervisorDomainGetOSType (virDomainPtr dom)
if (virXen_getdomaininfo(priv->handle, dom->id, &dominfo) < 0) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get domain details"));
return (NULL);
return NULL;
}
if (XEN_GETDOMAININFO_DOMAIN(dominfo) != dom->id) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get domain details"));
return (NULL);
return NULL;
}
if (XEN_GETDOMAININFO_FLAGS(dominfo) & DOMFLAGS_HVM)
@ -2995,21 +2995,21 @@ xenHypervisorLookupDomainByID(virConnectPtr conn,
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0)
return (NULL);
return NULL;
XEN_GETDOMAININFO_CLEAR(dominfo);
if (virXen_getdomaininfo(priv->handle, id, &dominfo) < 0)
return (NULL);
return NULL;
if (XEN_GETDOMAININFO_DOMAIN(dominfo) != id)
return (NULL);
return NULL;
xenUnifiedLock(priv);
name = xenStoreDomainGetName(conn, id);
xenUnifiedUnlock(priv);
if (!name)
return (NULL);
return NULL;
ret = virGetDomain(conn, name, XEN_GETDOMAININFO_UUID(dominfo));
if (ret)
@ -3031,12 +3031,12 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn,
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0)
return (NULL);
return NULL;
retry:
if (!(XEN_GETDOMAININFOLIST_ALLOC(dominfos, maxids))) {
virReportOOMError();
return(NULL);
return NULL;
}
XEN_GETDOMAININFOLIST_CLEAR(dominfos, maxids);
@ -3045,7 +3045,7 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn,
if (nids < 0) {
XEN_GETDOMAININFOLIST_FREE(dominfos);
return (NULL);
return NULL;
}
/* Can't possibly have more than 65,000 concurrent guests
@ -3059,7 +3059,7 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn,
maxids *= 2;
goto retry;
}
return (NULL);
return NULL;
}
id = -1;
@ -3072,13 +3072,13 @@ xenHypervisorLookupDomainByUUID(virConnectPtr conn,
XEN_GETDOMAININFOLIST_FREE(dominfos);
if (id == -1)
return (NULL);
return NULL;
xenUnifiedLock(priv);
name = xenStoreDomainGetName(conn, id);
xenUnifiedUnlock(priv);
if (!name)
return (NULL);
return NULL;
ret = virGetDomain(conn, name, uuid);
if (ret)
@ -3102,7 +3102,7 @@ xenHypervisorGetMaxVcpus(virConnectPtr conn,
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0)
return (-1);
return -1;
return MAX_VIRT_CPUS;
}
@ -3142,9 +3142,9 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
ret = virXen_getdomaininfo(priv->handle, id, &dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != id))
return (0);
return 0;
return((unsigned long) XEN_GETDOMAININFO_MAX_PAGES(dominfo) * kb_per_pages);
return (unsigned long) XEN_GETDOMAININFO_MAX_PAGES(dominfo) * kb_per_pages;
}
/**
@ -3167,9 +3167,9 @@ xenHypervisorGetMaxMemory(virDomainPtr domain)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0)
return (0);
return 0;
return(xenHypervisorGetDomMaxMemory(domain->conn, domain->id));
return xenHypervisorGetDomMaxMemory(domain->conn, domain->id);
}
/**
@ -3201,7 +3201,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->handle < 0 || info == NULL)
return (-1);
return -1;
memset(info, 0, sizeof(virDomainInfo));
XEN_GETDOMAININFO_CLEAR(dominfo);
@ -3209,7 +3209,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
ret = virXen_getdomaininfo(priv->handle, id, &dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != id))
return (-1);
return -1;
domain_flags = XEN_GETDOMAININFO_FLAGS(dominfo);
domain_flags &= ~DOMFLAGS_HVM; /* Mask out HVM flags */
@ -3253,7 +3253,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
if(info->maxMem != UINT_MAX)
info->maxMem *= kb_per_pages;
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
return (0);
return 0;
}
/**
@ -3276,9 +3276,9 @@ xenHypervisorGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || info == NULL ||
(domain->id < 0))
return (-1);
return -1;
return(xenHypervisorGetDomInfo(domain->conn, domain->id, info));
return xenHypervisorGetDomInfo(domain->conn, domain->id, info);
}
@ -3355,7 +3355,7 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
if (priv->nbNodeCells < 0) {
virXenError(VIR_ERR_XEN_CALL, "%s",
_("cannot determine actual number of cells"));
return(-1);
return -1;
}
if ((maxCells < 1) || (startCell >= priv->nbNodeCells)) {
@ -3389,14 +3389,14 @@ xenHypervisorNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *free
op_sys.u.availheap.node = i;
ret = xenHypervisorDoV2Sys(priv->handle, &op_sys);
if (ret < 0) {
return(-1);
return -1;
}
if (hv_versions.sys_interface >= 5)
freeMems[j] = op_sys.u.availheap5.avail_bytes;
else
freeMems[j] = op_sys.u.availheap.avail_bytes;
}
return (j);
return j;
}
@ -3419,12 +3419,12 @@ xenHypervisorPauseDomain(virDomainPtr domain)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0)
return (-1);
return -1;
ret = virXen_pausedomain(priv->handle, domain->id);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -3446,12 +3446,12 @@ xenHypervisorResumeDomain(virDomainPtr domain)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0)
return (-1);
return -1;
ret = virXen_unpausedomain(priv->handle, domain->id);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -3480,12 +3480,12 @@ xenHypervisorDestroyDomainFlags(virDomainPtr domain,
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0)
return (-1);
return -1;
ret = virXen_destroydomain(priv->handle, domain->id);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -3508,12 +3508,12 @@ xenHypervisorSetMaxMemory(virDomainPtr domain, unsigned long memory)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0)
return (-1);
return -1;
ret = virXen_setmaxmem(priv->handle, domain->id, memory);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
@ -3538,12 +3538,12 @@ xenHypervisorSetVcpus(virDomainPtr domain, unsigned int nvcpus)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || domain->id < 0 || nvcpus < 1)
return (-1);
return -1;
ret = virXen_setmaxvcpus(priv->handle, domain->id, nvcpus);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -3571,13 +3571,13 @@ xenHypervisorPinVcpu(virDomainPtr domain, unsigned int vcpu,
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0 || (domain->id < 0) ||
(cpumap == NULL) || (maplen < 1))
return (-1);
return -1;
ret = virXen_setvcpumap(priv->handle, domain->id, vcpu,
cpumap, maplen);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -3618,7 +3618,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
(sizeof(cpumap_t) & 7)) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("domain shut off or invalid"));
return (-1);
return -1;
}
if ((cpumaps != NULL) && (maplen < 1)) {
virXenError(VIR_ERR_INVALID_ARG, "%s",
@ -3633,7 +3633,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id)) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get domain details"));
return (-1);
return -1;
}
nbinfo = XEN_GETDOMAININFO_CPUCOUNT(dominfo) + 1;
if (nbinfo > maxinfo) nbinfo = maxinfo;
@ -3650,7 +3650,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if (ret < 0) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get VCPUs info"));
return(-1);
return -1;
}
} else {
ret = virXen_getvcpusinfo(priv->handle, domain->id, i,
@ -3658,7 +3658,7 @@ xenHypervisorGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if (ret < 0) {
virXenError(VIR_ERR_INTERNAL_ERROR, "%s",
_("cannot get VCPUs info"));
return(-1);
return -1;
}
}
}
@ -3686,7 +3686,7 @@ xenHypervisorGetVcpuMax(virDomainPtr domain)
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->handle < 0)
return (-1);
return -1;
/* inactive domain */
if (domain->id < 0) {
@ -3697,7 +3697,7 @@ xenHypervisorGetVcpuMax(virDomainPtr domain)
&dominfo);
if ((ret < 0) || (XEN_GETDOMAININFO_DOMAIN(dominfo) != domain->id))
return (-1);
return -1;
maxcpu = XEN_GETDOMAININFO_MAXCPUID(dominfo) + 1;
}

View File

@ -162,7 +162,7 @@ wr_sync(int fd, void *buffer, size_t size, int do_read)
virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to write to Xen Daemon"));
return (-1);
return -1;
}
offset += len;
@ -234,7 +234,7 @@ sreads(int fd, char *buffer, size_t n_buffer)
size_t offset;
if (n_buffer < 1)
return (-1);
return -1;
for (offset = 0; offset < (n_buffer - 1); offset++) {
ssize_t ret;
@ -620,7 +620,7 @@ xenDaemonOpen_unix(virConnectPtr conn, const char *path)
xenUnifiedPrivatePtr priv;
if ((conn == NULL) || (path == NULL))
return (-1);
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
memset(&priv->addr, 0, sizeof(priv->addr));
@ -638,7 +638,7 @@ xenDaemonOpen_unix(virConnectPtr conn, const char *path)
if (virStrcpyStatic(addr->sun_path, path) == NULL)
return -1;
return (0);
return 0;
}
@ -663,7 +663,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
int ret;
if ((conn == NULL) || (host == NULL) || (port == NULL))
return (-1);
return -1;
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -869,7 +869,7 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,
error:
sexpr_free(root);
return (ret);
return ret;
}
@ -920,13 +920,13 @@ xenDaemonDomainLookupByID(virConnectPtr xend,
}
sexpr_free(root);
return (0);
return 0;
error:
sexpr_free(root);
if (domname)
VIR_FREE(*domname);
return (-1);
return -1;
}
@ -938,14 +938,14 @@ xend_detect_config_version(virConnectPtr conn) {
if (!VIR_IS_CONNECT(conn)) {
virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) conn->privateData;
root = sexpr_get(conn, "/xend/node/");
if (root == NULL)
return (-1);
return -1;
value = sexpr_node(root, "node/xend_config_format");
@ -957,7 +957,7 @@ xend_detect_config_version(virConnectPtr conn) {
priv->xendConfigVersion = XEND_CONFIG_VERSION_3_0_2;
}
sexpr_free(root);
return (0);
return 0;
}
@ -1015,7 +1015,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
int vcpus;
if ((root == NULL) || (info == NULL))
return (-1);
return -1;
info->state = sexpr_to_xend_domain_state(domain, root);
info->memory = sexpr_u64(root, "domain/memory") << 10;
@ -1027,7 +1027,7 @@ sexpr_to_xend_domain_info(virDomainPtr domain, const struct sexpr *root,
if (!info->nrVirtCpu || vcpus < info->nrVirtCpu)
info->nrVirtCpu = vcpus;
return (0);
return 0;
}
/**
@ -1047,7 +1047,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr info)
if ((root == NULL) || (info == NULL))
return (-1);
return -1;
machine = sexpr_node(root, "node/machine");
if (machine == NULL) {
@ -1074,7 +1074,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr info)
int nr_cpus = sexpr_int(root, "node/nr_cpus");
int procs = info->nodes * info->cores * info->threads;
if (procs == 0) /* Sanity check in case of Xen bugs in futures..*/
return (-1);
return -1;
info->sockets = nr_cpus / procs;
}
@ -1091,7 +1091,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr info)
info->sockets = info->cpus / (info->cores * info->threads);
}
return (0);
return 0;
}
@ -1170,7 +1170,7 @@ sexpr_to_xend_topology(const struct sexpr *root,
}
VIR_FREE(cpuNums);
VIR_FREE(cpuset);
return (0);
return 0;
parse_error:
virXendError(VIR_ERR_XEN_CALL, "%s", _("topology syntax error"));
@ -1178,13 +1178,13 @@ sexpr_to_xend_topology(const struct sexpr *root,
VIR_FREE(cpuNums);
VIR_FREE(cpuset);
return (-1);
return -1;
memory_error:
VIR_FREE(cpuNums);
VIR_FREE(cpuset);
virReportOOMError();
return (-1);
return -1;
}
@ -1207,7 +1207,7 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
xenUnifiedPrivatePtr priv;
if ((conn == NULL) || (root == NULL))
return(NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -1232,14 +1232,14 @@ sexpr_to_domain(virConnectPtr conn, const struct sexpr *root)
else
ret->id = -1; /* An inactive domain */
return (ret);
return ret;
error:
virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to parse Xend domain information"));
if (ret != NULL)
virUnrefDomain(ret);
return(NULL);
return NULL;
}
@ -1357,13 +1357,13 @@ xenDaemonDomainSuspend(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "pause", NULL);
@ -1383,13 +1383,13 @@ xenDaemonDomainResume(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "unpause", NULL);
@ -1410,13 +1410,13 @@ xenDaemonDomainShutdown(virDomainPtr domain)
{
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "shutdown", "reason", "poweroff", NULL);
@ -1440,13 +1440,13 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "shutdown", "reason", "reboot", NULL);
@ -1477,13 +1477,13 @@ xenDaemonDomainDestroyFlags(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "destroy", NULL);
@ -1507,18 +1507,18 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(NULL);
return NULL;
/* can we ask for a subset ? worth it ? */
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL)
return(NULL);
return NULL;
if (sexpr_lookup(root, "domain/image/hvm")) {
type = strdup("hvm");
@ -1531,7 +1531,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
sexpr_free(root);
return(type);
return type;
}
/**
@ -1553,18 +1553,18 @@ xenDaemonDomainSave(virDomainPtr domain, const char *filename)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
/* We can't save the state of Domain-0, that would mean stopping it too */
if (domain->id == 0) {
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name, "op", "save", "file", filename, NULL);
@ -1591,13 +1591,13 @@ xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(filename == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id < 0) {
virXendError(VIR_ERR_OPERATION_INVALID,
_("Domain %s isn't running."), domain->name);
return(-1);
return -1;
}
return xend_op(domain->conn, domain->name,
@ -1624,7 +1624,7 @@ xenDaemonDomainRestore(virConnectPtr conn, const char *filename)
if ((conn == NULL) || (filename == NULL)) {
/* this should be caught at the interface but ... */
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
return xend_op(conn, "", "op", "restore", "file", filename, NULL);
}
@ -1686,13 +1686,13 @@ xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
snprintf(buf, sizeof(buf), "%lu", VIR_DIV_UP(memory, 1024));
return xend_op(domain->conn, domain->name, "op", "maxmem_set", "memory",
@ -1723,13 +1723,13 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
snprintf(buf, sizeof(buf), "%lu", VIR_DIV_UP(memory, 1024));
return xend_op(domain->conn, domain->name, "op", "mem_target_set",
@ -1755,7 +1755,7 @@ xenDaemonDomainFetch(virConnectPtr conn,
else
root = sexpr_get(conn, "/xend/domain/%d?detail=1", domid);
if (root == NULL)
return (NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -1777,7 +1777,7 @@ xenDaemonDomainFetch(virConnectPtr conn,
cleanup:
sexpr_free(root);
return (def);
return def;
}
@ -1804,20 +1804,20 @@ xenDaemonDomainGetXMLDesc(virDomainPtr domain, unsigned int flags,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4) {
/* fall-through to the next driver to handle */
return(NULL);
return NULL;
}
if (!(def = xenDaemonDomainFetch(domain->conn,
domain->id,
domain->name,
cpus)))
return(NULL);
return NULL;
xml = virDomainDefFormat(def, flags);
@ -1847,21 +1847,21 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL) ||
(info == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id < 0 && priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL)
return (-1);
return -1;
ret = sexpr_to_xend_domain_info(domain, root, info);
sexpr_free(root);
return (ret);
return ret;
}
@ -1922,7 +1922,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname)
if ((conn == NULL) || (domname == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
root = sexpr_get(conn, "/xend/domain/%s?detail=1", domname);
@ -1933,7 +1933,7 @@ xenDaemonLookupByName(virConnectPtr conn, const char *domname)
error:
sexpr_free(root);
return(ret);
return ret;
}
@ -1953,20 +1953,20 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
if (!VIR_IS_CONNECT(conn)) {
virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
if (info == NULL) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
root = sexpr_get(conn, "/xend/node/");
if (root == NULL)
return (-1);
return -1;
ret = sexpr_to_xend_node_info(root, info);
sexpr_free(root);
return (ret);
return ret;
}
/**
@ -1986,22 +1986,22 @@ xenDaemonNodeGetTopology(virConnectPtr conn,
if (!VIR_IS_CONNECT(conn)) {
virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
if (caps == NULL) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
root = sexpr_get(conn, "/xend/node/");
if (root == NULL) {
return (-1);
return -1;
}
ret = sexpr_to_xend_topology(root, caps);
sexpr_free(root);
return (ret);
return ret;
}
/**
@ -2024,22 +2024,22 @@ xenDaemonGetVersion(virConnectPtr conn, unsigned long *hvVer)
if (!VIR_IS_CONNECT(conn)) {
virXendError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
if (hvVer == NULL) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
root = sexpr_get(conn, "/xend/node/");
if (root == NULL)
return(-1);
return -1;
major = sexpr_int(root, "node/xen_major");
minor = sexpr_int(root, "node/xen_minor");
sexpr_free(root);
version = major * 1000000 + minor * 1000;
*hvVer = version;
return(0);
return 0;
}
@ -2064,7 +2064,7 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
long id;
if (maxids == 0)
return(0);
return 0;
if ((ids == NULL) || (maxids < 0))
goto error;
@ -2087,7 +2087,7 @@ xenDaemonListDomains(virConnectPtr conn, int *ids, int maxids)
error:
sexpr_free(root);
return(ret);
return ret;
}
/**
@ -2120,7 +2120,7 @@ xenDaemonNumOfDomains(virConnectPtr conn)
error:
sexpr_free(root);
return(ret);
return ret;
}
@ -2148,11 +2148,11 @@ xenDaemonLookupByID(virConnectPtr conn, int id) {
ret->id = id;
VIR_FREE(name);
return (ret);
return ret;
error:
VIR_FREE(name);
return (NULL);
return NULL;
}
/**
@ -2181,7 +2181,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (vcpus < 1)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@ -2263,7 +2263,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (cpumap == NULL) || (maplen < 1) || (maplen > (int)sizeof(cpumap_t))) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@ -2300,7 +2300,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
if (virDomainVcpuPinAdd(def, cpumap, maplen, vcpu) < 0) {
virXendError(VIR_ERR_INTERNAL_ERROR,
"%s", _("failed to add vcpupin xml entry"));
return (-1);
return -1;
}
}
@ -2399,16 +2399,16 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
|| (info == NULL) || (maxinfo < 1)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
if (cpumaps != NULL && maplen < 1) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
root = sexpr_get(domain->conn, "/xend/domain/%s?op=vcpuinfo", domain->name);
if (root == NULL)
return (-1);
return -1;
if (cpumaps != NULL)
memset(cpumaps, 0, maxinfo * maplen);
@ -2456,7 +2456,7 @@ xenDaemonDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo,
}
}
sexpr_free(root);
return(nbinfo);
return nbinfo;
}
/**
@ -2484,7 +2484,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
tmp = names;
if (names == NULL) {
return (NULL);
return NULL;
}
while (*tmp != NULL) {
id = xenDaemonDomainLookupByName_ids(conn, *tmp, &ident[0]);
@ -2511,7 +2511,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
virUUIDFormat(uuid, uuidstr);
root = sexpr_get(conn, "/xend/domain/%s?detail=1", uuidstr);
if (root == NULL)
return (NULL);
return NULL;
domname = (char*)sexpr_node(root, "domain/name");
if (sexpr_node(root, "domain/domid")) /* only active domains have domid */
id = sexpr_int(root, "domain/domid");
@ -2529,7 +2529,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
}
if (name == NULL)
return (NULL);
return NULL;
ret = virGetDomain(conn, name, uuid);
if (ret == NULL) goto cleanup;
@ -2538,7 +2538,7 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
cleanup:
VIR_FREE(name);
return (ret);
return ret;
}
/**
@ -2570,11 +2570,11 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
if (!(def = virDomainDefParseString(priv->caps, xmlDesc,
1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE)))
return (NULL);
return NULL;
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
virDomainDefFree(def);
return (NULL);
return NULL;
}
ret = xenDaemonDomainCreateXML(conn, sexpr);
@ -2595,7 +2595,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
goto error;
virDomainDefFree(def);
return (dom);
return dom;
error:
/* Make sure we don't leave a still-born domain around */
@ -2604,7 +2604,7 @@ xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
virUnrefDomain(dom);
}
virDomainDefFree(def);
return (NULL);
return NULL;
}
/**
@ -2916,7 +2916,7 @@ xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
@ -3009,7 +3009,7 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
/* xm_internal.c (the support for defined domains from /etc/xen
@ -3017,13 +3017,13 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
*/
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) {
virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonGetAutostart failed to find this domain"));
return (-1);
return -1;
}
*autostart = 0;
@ -3049,7 +3049,7 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
return (-1);
return -1;
}
/* xm_internal.c (the support for defined domains from /etc/xen
@ -3057,13 +3057,13 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
*/
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL) {
virXendError(VIR_ERR_XEN_CALL,
"%s", _("xenDaemonSetAutostart failed to find this domain"));
return (-1);
return -1;
}
autonode = sexpr_lookup(root, "domain/on_xend_start");
@ -3317,14 +3317,14 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(NULL);
return NULL;
if (!(def = virDomainDefParseString(priv->caps, xmlDesc,
1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE))) {
virXendError(VIR_ERR_XML_ERROR,
"%s", _("failed to parse domain description"));
return (NULL);
return NULL;
}
if (!(sexpr = xenFormatSxpr(conn, def, priv->xendConfigVersion))) {
@ -3346,11 +3346,11 @@ virDomainPtr xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc) {
goto error;
}
virDomainDefFree(def);
return (dom);
return dom;
error:
virDomainDefFree(def);
return (NULL);
return NULL;
}
int xenDaemonDomainCreate(virDomainPtr domain)
{
@ -3360,13 +3360,13 @@ int xenDaemonDomainCreate(virDomainPtr domain)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
ret = xend_op(domain->conn, domain->name, "op", "start", NULL);
@ -3387,13 +3387,13 @@ int xenDaemonDomainUndefine(virDomainPtr domain)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
return xend_op(domain->conn, domain->name, "op", "delete", NULL);
}
@ -3418,7 +3418,7 @@ xenDaemonNumOfDefinedDomains(virConnectPtr conn)
* config files used by old Xen) will handle this.
*/
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
root = sexpr_get(conn, "/xend/domain?state=halted");
if (root == NULL)
@ -3435,7 +3435,7 @@ xenDaemonNumOfDefinedDomains(virConnectPtr conn)
error:
sexpr_free(root);
return(ret);
return ret;
}
static int
@ -3446,12 +3446,12 @@ xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_0_4)
return(-1);
return -1;
if ((names == NULL) || (maxnames < 0))
goto error;
if (maxnames == 0)
return(0);
return 0;
root = sexpr_get(conn, "/xend/domain?state=halted");
if (root == NULL)
@ -3475,7 +3475,7 @@ xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
cleanup:
sexpr_free(root);
return(ret);
return ret;
error:
for (i = 0; i < ret; ++i)
@ -3579,7 +3579,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
/* Support only xendConfigVersion >=4 */
@ -3587,13 +3587,13 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) {
virXendError(VIR_ERR_OPERATION_INVALID,
"%s", _("unsupported in xendConfigVersion < 4"));
return (-1);
return -1;
}
/* look up the information by domain name */
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL)
return (-1);
return -1;
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
@ -3661,7 +3661,7 @@ xenDaemonGetSchedulerParameters(virDomainPtr domain,
error:
sexpr_free(root);
VIR_FREE(sched_type);
return (ret);
return ret;
}
/**
@ -3687,7 +3687,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
virXendError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
/* Support only xendConfigVersion >=4 and active domains */
@ -3695,13 +3695,13 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
if (priv->xendConfigVersion < XEND_CONFIG_VERSION_3_1_0) {
virXendError(VIR_ERR_OPERATION_INVALID,
"%s", _("unsupported in xendConfigVersion < 4"));
return (-1);
return -1;
}
/* look up the information by domain name */
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1", domain->name);
if (root == NULL)
return (-1);
return -1;
/* get the scheduler type */
sched_type = xenDaemonGetSchedulerType(domain, &sched_nparam);
@ -3771,7 +3771,7 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
error:
sexpr_free(root);
VIR_FREE(sched_type);
return (ret);
return ret;
}
/**

View File

@ -140,9 +140,9 @@ static int xenXMConfigReaper(const void *payload, const void *key ATTRIBUTE_UNUS
if (nameowner && STREQ(nameowner, key)) {
virHashRemoveEntry(args->priv->nameConfigMap, olddomname);
}
return (1);
return 1;
}
return (0);
return 0;
}
@ -324,12 +324,12 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
if (now == ((time_t)-1)) {
virReportSystemError(errno,
"%s", _("cannot get time of day"));
return (-1);
return -1;
}
/* Rate limit re-scans */
if ((now - priv->lastRefresh) < XM_REFRESH_INTERVAL)
return (0);
return 0;
priv->lastRefresh = now;
@ -338,7 +338,7 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
virReportSystemError(errno,
_("cannot read directory %s"),
priv->configDir);
return (-1);
return -1;
}
while ((ent = readdir(dh))) {
@ -404,7 +404,7 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
closedir(dh);
return (ret);
return ret;
}
@ -427,19 +427,19 @@ xenXMOpen (virConnectPtr conn,
priv->configCache = virHashCreate(50, xenXMConfigFree);
if (!priv->configCache)
return (-1);
return -1;
priv->nameConfigMap = virHashCreate(50, NULL);
if (!priv->nameConfigMap) {
virHashFree(priv->configCache);
priv->configCache = NULL;
return (-1);
return -1;
}
/* Force the cache to be reloaded next time that
* xenXMConfigCacheRefresh is called.
*/
priv->lastRefresh = 0;
return (0);
return 0;
}
/*
@ -452,7 +452,7 @@ int xenXMClose(virConnectPtr conn) {
virHashFree(priv->nameConfigMap);
virHashFree(priv->configCache);
return (0);
return 0;
}
/*
@ -487,11 +487,11 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) {
xenXMConfCachePtr entry;
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id != -1)
return (-1);
return -1;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -510,7 +510,7 @@ int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) {
info->cpuTime = 0;
xenUnifiedUnlock(priv);
return (0);
return 0;
error:
xenUnifiedUnlock(priv);
@ -533,10 +533,10 @@ char *xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
if (domain->id != -1)
return (NULL);
return NULL;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -566,14 +566,14 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) {
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
if (domain->conn->flags & VIR_CONNECT_RO)
return (-1);
return -1;
if (domain->id != -1)
return (-1);
return -1;
if (memory < 1024 * MIN_XEN_GUEST_SIZE)
return (-1);
return -1;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -611,12 +611,12 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) {
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
if (domain->conn->flags & VIR_CONNECT_RO)
return (-1);
return -1;
if (domain->id != -1)
return (-1);
return -1;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -654,10 +654,10 @@ unsigned long long xenXMDomainGetMaxMemory(virDomainPtr domain) {
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (0);
return 0;
}
if (domain->id != -1)
return (0);
return 0;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -910,7 +910,7 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
VIR_FREE(mapsave);
VIR_FREE(cpuset);
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
/*
@ -924,11 +924,11 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
if (!VIR_IS_CONNECT(conn)) {
xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
return NULL;
}
if (domname == NULL) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
return NULL;
}
priv = conn->privateData;
@ -952,7 +952,7 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
cleanup:
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
@ -964,9 +964,9 @@ static int xenXMDomainSearchForUUID(const void *payload, const void *name ATTRIB
const xenXMConfCachePtr entry = (const xenXMConfCachePtr)payload;
if (!memcmp(entry->def->uuid, wantuuid, VIR_UUID_BUFLEN))
return (1);
return 1;
return (0);
return 0;
}
/*
@ -980,11 +980,11 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
if (!VIR_IS_CONNECT(conn)) {
xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
return NULL;
}
if (uuid == NULL) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
return NULL;
}
priv = conn->privateData;
@ -1005,7 +1005,7 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
cleanup:
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
@ -1022,7 +1022,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (domain->id != -1)
return (-1);
return -1;
xenUnifiedLock(priv);
@ -1052,7 +1052,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
goto error;
xenUnifiedUnlock(priv);
return (0);
return 0;
error:
if (domain->id != -1) {
@ -1060,7 +1060,7 @@ int xenXMDomainCreate(virDomainPtr domain) {
domain->id = -1;
}
xenUnifiedUnlock(priv);
return (-1);
return -1;
}
/*
@ -1079,27 +1079,27 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
if (!VIR_IS_CONNECT(conn)) {
xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (NULL);
return NULL;
}
if (xml == NULL) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (NULL);
return NULL;
}
if (conn->flags & VIR_CONNECT_RO)
return (NULL);
return NULL;
xenUnifiedLock(priv);
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0) {
xenUnifiedUnlock(priv);
return (NULL);
return NULL;
}
if (!(def = virDomainDefParseString(priv->caps, xml,
1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE))) {
xenUnifiedUnlock(priv);
return (NULL);
return NULL;
}
if (!(conf = xenFormatXM(conn, def, priv->xendConfigVersion)))
@ -1196,7 +1196,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
ret = virGetDomain(conn, def->name, def->uuid);
xenUnifiedUnlock(priv);
VIR_FREE(filename);
return (ret);
return ret;
error:
VIR_FREE(filename);
@ -1206,7 +1206,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
virConfFree(conf);
virDomainDefFree(def);
xenUnifiedUnlock(priv);
return (NULL);
return NULL;
}
/*
@ -1220,13 +1220,13 @@ int xenXMDomainUndefine(virDomainPtr domain) {
if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
xenXMError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return (-1);
return -1;
}
if (domain->id != -1)
return (-1);
return -1;
if (domain->conn->flags & VIR_CONNECT_RO)
return (-1);
return -1;
priv = domain->conn->privateData;
xenUnifiedLock(priv);
@ -1296,7 +1296,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
if (!VIR_IS_CONNECT(conn)) {
xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
priv = conn->privateData;
@ -1341,7 +1341,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
if (!VIR_IS_CONNECT(conn)) {
xenXMError(VIR_ERR_INVALID_CONN, __FUNCTION__);
return (-1);
return -1;
}
priv = conn->privateData;
@ -1566,7 +1566,7 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
cleanup:
virDomainDeviceDefFree(dev);
xenUnifiedUnlock(priv);
return (ret);
return ret;
}
int

View File

@ -81,7 +81,7 @@ virConnectDoStoreList(virConnectPtr conn, const char *path,
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL || path == NULL || nb == NULL)
return (NULL);
return NULL;
return xs_directory (priv->xshandle, 0, path, nb);
}
@ -108,7 +108,7 @@ virDomainDoStoreQuery(virConnectPtr conn, int domid, const char *path)
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
snprintf(s, 255, "/local/domain/%d/%s", domid, path);
s[255] = 0;
@ -135,13 +135,13 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path,
int ret = -1;
if (!VIR_IS_CONNECTED_DOMAIN(domain))
return (-1);
return -1;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xshandle == NULL)
return (-1);
return -1;
if (domain->conn->flags & VIR_CONNECT_RO)
return (-1);
return -1;
snprintf(s, 255, "/local/domain/%d/%s", domain->id, path);
s[255] = 0;
@ -149,7 +149,7 @@ virDomainDoStoreWrite(virDomainPtr domain, const char *path,
if (xs_write(priv->xshandle, 0, &s[0], value, strlen(value)))
ret = 0;
return (ret);
return ret;
}
/**
@ -169,18 +169,18 @@ virDomainGetVM(virDomainPtr domain)
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(domain))
return (NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
snprintf(query, 199, "/local/domain/%d/vm", virDomainGetID(domain));
query[199] = 0;
vm = xs_read(priv->xshandle, 0, &query[0], &len);
return (vm);
return vm;
}
/**
@ -203,18 +203,18 @@ virDomainGetVMInfo(virDomainPtr domain, const char *vm, const char *name)
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(domain))
return (NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
snprintf(s, 255, "%s/%s", vm, name);
s[255] = 0;
ret = xs_read(priv->xshandle, 0, &s[0], &len);
return (ret);
return ret;
}
@ -257,7 +257,7 @@ xenStoreOpen(virConnectPtr conn,
virXenStoreError(VIR_ERR_NO_XEN,
"%s", _("failed to connect to Xen Store"));
}
return (-1);
return -1;
}
/* Init activeDomainList */
@ -318,7 +318,7 @@ xenStoreClose(virConnectPtr conn)
if (conn == NULL) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -339,7 +339,7 @@ xenStoreClose(virConnectPtr conn)
priv->activeDomainList = NULL;
if (priv->xshandle == NULL)
return(-1);
return -1;
if (priv->xsWatch != -1)
virEventRemoveHandle(priv->xsWatch);
@ -347,7 +347,7 @@ xenStoreClose(virConnectPtr conn)
xs_daemon_close(priv->xshandle);
priv->xshandle = NULL;
return (0);
return 0;
}
/**
@ -368,19 +368,19 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(domain))
return (-1);
return -1;
if ((domain == NULL) || (domain->conn == NULL) || (info == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
if (priv->xshandle == NULL)
return(-1);
return -1;
if (domain->id == -1)
return(-1);
return -1;
tmp = virDomainDoStoreQuery(domain->conn, domain->id, "running");
if (tmp != NULL) {
@ -416,7 +416,7 @@ xenStoreGetDomainInfo(virDomainPtr domain, virDomainInfoPtr info)
info->nrVirtCpu = nb_vcpus;
VIR_FREE(tmp2);
}
return (0);
return 0;
}
/**
@ -473,18 +473,18 @@ xenStoreDomainSetMemory(virDomainPtr domain, unsigned long memory)
if ((domain == NULL) || (domain->conn == NULL) ||
(memory < 1024 * MIN_XEN_GUEST_SIZE)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id == -1)
return(-1);
return -1;
if ((domain->id == 0) && (memory < (2 * MIN_XEN_GUEST_SIZE * 1024)))
return(-1);
return -1;
snprintf(value, 19, "%lu", memory);
value[19] = 0;
ret = virDomainDoStoreWrite(domain, "memory/target", &value[0]);
if (ret < 0)
return (-1);
return (0);
return -1;
return 0;
}
/**
@ -503,7 +503,7 @@ xenStoreDomainGetMaxMemory(virDomainPtr domain)
xenUnifiedPrivatePtr priv;
if (!VIR_IS_CONNECTED_DOMAIN(domain))
return (ret);
return ret;
if (domain->id == -1)
return 0;
@ -515,7 +515,7 @@ xenStoreDomainGetMaxMemory(virDomainPtr domain)
VIR_FREE(tmp);
}
xenUnifiedUnlock(priv);
return(ret);
return ret;
}
/**
@ -543,7 +543,7 @@ xenStoreNumOfDomains(virConnectPtr conn)
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
idlist = xs_directory(priv->xshandle, 0, "/local/domain", &num);
@ -562,7 +562,7 @@ out:
VIR_FREE (idlist);
ret = realnum;
}
return(ret);
return ret;
}
/**
@ -625,7 +625,7 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids)
if ((conn == NULL) || (ids == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
priv = (xenUnifiedPrivatePtr) conn->privateData;
@ -634,7 +634,7 @@ xenStoreListDomains(virConnectPtr conn, int *ids, int maxids)
ret = xenStoreDoListDomains(conn, priv, ids, maxids);
xenUnifiedUnlock(priv);
return(ret);
return ret;
}
/**
@ -660,12 +660,12 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
if ((conn == NULL) || (name == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return(NULL);
return NULL;
idlist = xs_directory(priv->xshandle, 0, "/local/domain", &num);
if (idlist == NULL)
@ -703,7 +703,7 @@ done:
VIR_FREE(xenddomain);
VIR_FREE(idlist);
return(ret);
return ret;
}
/**
@ -724,10 +724,10 @@ xenStoreDomainShutdown(virDomainPtr domain)
if ((domain == NULL) || (domain->conn == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id == -1 || domain->id == 0)
return(-1);
return -1;
/*
* this is very hackish, the domU kernel probes for a special
* node in the xenstore and launch the shutdown command if found.
@ -760,10 +760,10 @@ xenStoreDomainReboot(virDomainPtr domain, unsigned int flags)
if ((domain == NULL) || (domain->conn == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(-1);
return -1;
}
if (domain->id == -1 || domain->id == 0)
return(-1);
return -1;
/*
* this is very hackish, the domU kernel probes for a special
* node in the xenstore and launch the shutdown command if found.
@ -790,7 +790,7 @@ xenStoreDomainGetOSType(virDomainPtr domain) {
if ((domain == NULL) || (domain->conn == NULL)) {
virXenStoreError(VIR_ERR_INVALID_ARG, __FUNCTION__);
return(NULL);
return NULL;
}
vm = virDomainGetVM(domain);
@ -802,7 +802,7 @@ xenStoreDomainGetOSType(virDomainPtr domain) {
VIR_FREE(vm);
}
return (str);
return str;
}
/**
@ -830,7 +830,7 @@ int xenStoreDomainGetVNCPort(virConnectPtr conn, int domid) {
ret = -1;
VIR_FREE(tmp);
}
return(ret);
return ret;
}
/**
@ -895,18 +895,18 @@ xenStoreDomainGetNetworkID(virConnectPtr conn, int id, const char *mac) {
xenUnifiedPrivatePtr priv;
if (id < 0)
return(NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
if (mac == NULL)
return (NULL);
return NULL;
snprintf(dir, sizeof(dir), "/local/domain/0/backend/vif/%d", id);
list = xs_directory(priv->xshandle, 0, dir, &num);
if (list == NULL)
return(NULL);
return NULL;
for (i = 0; i < num; i++) {
snprintf(path, sizeof(path), "%s/%s/%s", dir, list[i], "mac");
if ((val = xs_read(priv->xshandle, 0, path, &len)) == NULL)
@ -927,7 +927,7 @@ xenStoreDomainGetNetworkID(virConnectPtr conn, int id, const char *mac) {
}
VIR_FREE(list);
return(ret);
return ret;
}
/*
@ -953,16 +953,16 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
xenUnifiedPrivatePtr priv;
if (id < 0)
return(NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
if (dev == NULL)
return (NULL);
return NULL;
devlen = strlen(dev);
if (devlen <= 0)
return (NULL);
return NULL;
snprintf(dir, sizeof(dir), "/local/domain/0/backend/vbd/%d", id);
list = xs_directory(priv->xshandle, 0, dir, &num);
@ -982,7 +982,7 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
VIR_FREE (val);
VIR_FREE (list);
return (ret);
return ret;
}
}
VIR_FREE (list);
@ -1005,12 +1005,12 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
VIR_FREE (val);
VIR_FREE (list);
return (ret);
return ret;
}
}
VIR_FREE (list);
}
return (NULL);
return NULL;
}
/*
@ -1037,18 +1037,18 @@ xenStoreDomainGetPCIID(virConnectPtr conn, int id, const char *bdf)
xenUnifiedPrivatePtr priv;
if (id < 0)
return(NULL);
return NULL;
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return (NULL);
return NULL;
if (bdf == NULL)
return (NULL);
return NULL;
snprintf(dir, sizeof(dir), "/local/domain/0/backend/pci/%d", id);
list = xs_directory(priv->xshandle, 0, dir, &num);
if (list == NULL)
return(NULL);
return NULL;
for (i = 0; i < num; i++) {
snprintf(path, sizeof(path), "%s/%s/%s", dir, list[i], "dev-0");
if ((val = xs_read(priv->xshandle, 0, path, &len)) == NULL)
@ -1065,7 +1065,7 @@ xenStoreDomainGetPCIID(virConnectPtr conn, int id, const char *bdf)
}
VIR_FREE(list);
return(ret);
return ret;
}
/*
@ -1080,7 +1080,7 @@ char *xenStoreDomainGetName(virConnectPtr conn,
priv = (xenUnifiedPrivatePtr) conn->privateData;
if (priv->xshandle == NULL)
return(NULL);
return NULL;
snprintf(prop, 199, "/local/domain/%d/name", id);
prop[199] = 0;

View File

@ -972,7 +972,7 @@ xenapiDomainGetMaxMemory (virDomainPtr dom)
vm = vms->contents[0];
xen_vm_get_memory_static_max(session, &mem_static_max, vm);
xen_vm_set_free(vms);
return (mem_static_max / 1024);
return mem_static_max / 1024;
} else {
if (vms) xen_vm_set_free(vms);
xenapiSessionErrorHandler(dom->conn, VIR_ERR_NO_DOMAIN, NULL);

View File

@ -95,7 +95,7 @@ xenParseSxprOS(const struct sexpr *node,
if (def->os.loader == NULL) {
XENXS_ERROR(VIR_ERR_INTERNAL_ERROR,
"%s", _("domain information incomplete, missing HVM loader"));
return(-1);
return -1;
}
} else {
if (sexpr_node_copy(node, "domain/image/hvm/kernel", &def->os.kernel) < 0)

View File

@ -1951,5 +1951,5 @@ cleanup:
VIR_FREE(cpus);
if (conf)
virConfFree(conf);
return (NULL);
return NULL;
}

View File

@ -803,7 +803,7 @@ mymain(void)
int fd;
if (chdir("/tmp") < 0)
return(EXIT_FAILURE);
return EXIT_FAILURE;
setpgid(0, 0);
setsid();
@ -868,7 +868,7 @@ mymain(void)
DO_TEST(test18);
DO_TEST(test19);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -632,7 +632,7 @@ mymain(void)
models, "Penryn", -1);
VIR_FREE(map);
return (ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -88,7 +88,7 @@ mymain(void)
int ret = 0;
if ((driver.caps = testQemuCapsInit()) == NULL)
return (EXIT_FAILURE);
return EXIT_FAILURE;
# define DO_TEST(name, uuid, internal) \
do { \
@ -113,7 +113,7 @@ mymain(void)
virCapabilitiesFree(driver.caps);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -92,7 +92,7 @@ mymain(void)
DO_TEST("ipv6-static-multi");
DO_TEST("ipv6-static");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -157,7 +157,7 @@ mymain(void)
DO_TEST("nat-network-dns-srv-record-minimal");
DO_TEST("nat-network-dns-hosts");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -106,7 +106,7 @@ mymain(void)
DO_TEST("bandwidth-network");
DO_TEST_FULL("passthrough-pf", VIR_NETWORK_XML_INACTIVE);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -85,7 +85,7 @@ mymain(void)
DO_TEST("usb_device_1d6b_1_0000_00_1d_0_if0");
DO_TEST("usb_device_1d6b_1_0000_00_1d_0");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -141,7 +141,7 @@ mymain(void)
if (virtTestRun(nodeData[i], 1, linuxTestNodeInfo, nodeData[i]) != 0)
ret = -1;
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -157,7 +157,7 @@ mymain(void)
DO_TEST("iter-test2", false);
DO_TEST("iter-test3", false);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -242,7 +242,7 @@ mymain(void)
VIR_FREE(driver.stateDir);
virCapabilitiesFree(driver.caps);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -760,7 +760,7 @@ mymain(void)
virCapabilitiesFree(driver.caps);
VIR_FREE(map);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -100,7 +100,7 @@ mymain(void)
int ret = 0;
if ((driver.caps = testQemuCapsInit()) == NULL)
return (EXIT_FAILURE);
return EXIT_FAILURE;
# define DO_TEST_FULL(name, is_different, inactive) \
do { \
@ -227,7 +227,7 @@ mymain(void)
virCapabilitiesFree(driver.caps);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -280,7 +280,7 @@ mymain(void)
virCapabilitiesFree(driver.caps);
VIR_FREE(map);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -113,7 +113,7 @@ mymain(void)
int ret = 0;
if (!(caps = testXenCapsInit()))
return(EXIT_FAILURE);
return EXIT_FAILURE;
#define DO_TEST(in, out, version) \
do { \
@ -186,7 +186,7 @@ mymain(void)
virCapabilitiesFree(caps);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -252,7 +252,7 @@ mymain(void)
DO_TEST_NETMASK("2000::1:1", "9000::1:1",
"ffff:ffff:ffff:ffff:ffff:ffff:ffff:0", false);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -213,7 +213,7 @@ mymain(void)
DO_TEST("/dev/xvda1", 51713);
DO_TEST("/dev/xvda15", 51727);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -94,7 +94,7 @@ mymain(void)
DO_TEST("pool-iscsi-multiiqn");
DO_TEST("pool-iscsi-vendor-product");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -113,7 +113,7 @@ mymain(void)
DO_TEST("pool-logical", "vol-logical");
DO_TEST("pool-logical", "vol-logical-backing");
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -134,7 +134,7 @@ mymain(void)
virAuthConfigFree(config);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -150,7 +150,7 @@ mymain(void)
DO_TEST("VSprintf infinite loop", testBufInfiniteLoop, 0);
DO_TEST("Auto-indentation", testBufAutoIndent, 0);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 Red Hat, Inc.
* Copyright (C) 2011, 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -117,7 +117,7 @@ mymain(void)
if (virtTestRun("Test parse", 1, testParse, NULL) < 0)
ret = -1;
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -506,7 +506,7 @@ mymain(void)
if (virtTestRun("Message Payload Stream Encode", 1, testMessagePayloadStreamEncode, NULL) < 0)
ret = -1;
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -460,7 +460,7 @@ mymain(void)
#ifdef HAVE_IFADDRS_H
if (checkProtocols(&hasIPv4, &hasIPv6, &freePort) < 0) {
fprintf(stderr, "Cannot identify IPv4/6 availability\n");
return (EXIT_FAILURE);
return EXIT_FAILURE;
}
if (hasIPv4) {
@ -602,7 +602,7 @@ mymain(void)
#endif
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -1245,7 +1245,7 @@ mymain(void)
asn1_delete_structure(&pkix_asn1);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -395,7 +395,7 @@ mymain(void)
# undef DO_TEST
VIR_FREE(custom_uri);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -118,7 +118,7 @@ mymain(void)
TEST_FIELDS(2147483648000ull, 2038, 1, 19, 3, 14, 8);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -211,7 +211,7 @@ mymain(void)
TEST_PARAMS("foo=one%20two", "", params5);
TEST_PARAMS("=bogus&foo=one", "foo=one", params6);
return (ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -210,7 +210,7 @@ mymain(void)
ret = -1;
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -192,7 +192,7 @@ mymain(void)
int ret = 0;
if (!(caps = testXenCapsInit()))
return(EXIT_FAILURE);
return EXIT_FAILURE;
#define DO_TEST(name, version) \
do { \
@ -247,7 +247,7 @@ mymain(void)
virCapabilitiesFree(caps);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -100,7 +100,7 @@ mymain(void)
} while (0)
if (!(caps = testXenCapsInit()))
return(EXIT_FAILURE);
return EXIT_FAILURE;
DO_TEST("pv", "pv", "pvtest", 1);
DO_TEST("fv", "fv", "fvtest", 1);
@ -170,7 +170,7 @@ mymain(void)
virCapabilitiesFree(caps);
return(ret==0 ? EXIT_SUCCESS : EXIT_FAILURE);
return ret==0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
VIRT_TEST_MAIN(mymain)

View File

@ -471,7 +471,7 @@ _vshStrdup(vshControl *ctl, const char *s, const char *filename, int line)
char *x;
if (s == NULL)
return(NULL);
return NULL;
if ((x = strdup(s)))
return x;
vshError(ctl, _("%s: %d: failed to allocate %lu bytes"),
@ -518,13 +518,13 @@ prettyCapacity(unsigned long long val,
return (((double)val / 1024.0l));
} else if (val < (1024.0l * 1024.0l * 1024.0l)) {
*unit = "MB";
return ((double)val / (1024.0l * 1024.0l));
return (double)val / (1024.0l * 1024.0l);
} else if (val < (1024.0l * 1024.0l * 1024.0l * 1024.0l)) {
*unit = "GB";
return ((double)val / (1024.0l * 1024.0l * 1024.0l));
return (double)val / (1024.0l * 1024.0l * 1024.0l);
} else {
*unit = "TB";
return ((double)val / (1024.0l * 1024.0l * 1024.0l * 1024.0l));
return (double)val / (1024.0l * 1024.0l * 1024.0l * 1024.0l);
}
}