mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
Remove spurious whitespace between function name & open brackets
The libvirt coding standard is to use 'function(...args...)' instead of 'function (...args...)'. A non-trivial number of places did not follow this rule and are fixed in this patch. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
0211fd6e04
commit
1c04f99970
@ -45,7 +45,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
const char *filename)
|
||||
{
|
||||
char **list;
|
||||
virConfValuePtr p = virConfGetValue (conf, key);
|
||||
virConfValuePtr p = virConfGetValue(conf, key);
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
@ -57,7 +57,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
key);
|
||||
return -1;
|
||||
}
|
||||
list[0] = strdup (p->str);
|
||||
list[0] = strdup(p->str);
|
||||
list[1] = NULL;
|
||||
if (list[0] == NULL) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
@ -88,7 +88,7 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
VIR_FREE(list);
|
||||
return -1;
|
||||
}
|
||||
list[i] = strdup (pp->str);
|
||||
list[i] = strdup(pp->str);
|
||||
if (list[i] == NULL) {
|
||||
int j;
|
||||
for (j = 0 ; j < i ; j++)
|
||||
@ -119,15 +119,15 @@ remoteConfigGetStringList(virConfPtr conf, const char *key, char ***list_arg,
|
||||
|
||||
/* A helper function used by each of the following macros. */
|
||||
static int
|
||||
checkType (virConfValuePtr p, const char *filename,
|
||||
const char *key, virConfType required_type)
|
||||
checkType(virConfValuePtr p, const char *filename,
|
||||
const char *key, virConfType required_type)
|
||||
{
|
||||
if (p->type != required_type) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
_("remoteReadConfigFile: %s: %s: invalid type:"
|
||||
" got %s; expected %s"), filename, key,
|
||||
virConfTypeName (p->type),
|
||||
virConfTypeName (required_type));
|
||||
virConfTypeName(p->type),
|
||||
virConfTypeName(required_type));
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
@ -139,12 +139,12 @@ checkType (virConfValuePtr p, const char *filename,
|
||||
failure), give a diagnostic and "goto" the cleanup-and-fail label. */
|
||||
#define GET_CONF_STR(conf, filename, var_name) \
|
||||
do { \
|
||||
virConfValuePtr p = virConfGetValue (conf, #var_name); \
|
||||
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||
if (p) { \
|
||||
if (checkType (p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
||||
if (checkType(p, filename, #var_name, VIR_CONF_STRING) < 0) \
|
||||
goto error; \
|
||||
VIR_FREE(data->var_name); \
|
||||
if (!(data->var_name = strdup (p->str))) { \
|
||||
if (!(data->var_name = strdup(p->str))) { \
|
||||
virReportOOMError(); \
|
||||
goto error; \
|
||||
} \
|
||||
@ -154,9 +154,9 @@ checkType (virConfValuePtr p, const char *filename,
|
||||
/* Like GET_CONF_STR, but for integral values. */
|
||||
#define GET_CONF_INT(conf, filename, var_name) \
|
||||
do { \
|
||||
virConfValuePtr p = virConfGetValue (conf, #var_name); \
|
||||
virConfValuePtr p = virConfGetValue(conf, #var_name); \
|
||||
if (p) { \
|
||||
if (checkType (p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||
if (checkType(p, filename, #var_name, VIR_CONF_LONG) < 0) \
|
||||
goto error; \
|
||||
data->var_name = p->l; \
|
||||
} \
|
||||
@ -166,11 +166,11 @@ checkType (virConfValuePtr p, const char *filename,
|
||||
static int remoteConfigGetAuth(virConfPtr conf, const char *key, int *auth, const char *filename) {
|
||||
virConfValuePtr p;
|
||||
|
||||
p = virConfGetValue (conf, key);
|
||||
p = virConfGetValue(conf, key);
|
||||
if (!p)
|
||||
return 0;
|
||||
|
||||
if (checkType (p, filename, key, VIR_CONF_STRING) < 0)
|
||||
if (checkType(p, filename, key, VIR_CONF_STRING) < 0)
|
||||
return -1;
|
||||
|
||||
if (!p->str)
|
||||
@ -366,11 +366,11 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
const char *filename,
|
||||
virConfPtr conf)
|
||||
{
|
||||
GET_CONF_INT (conf, filename, listen_tcp);
|
||||
GET_CONF_INT (conf, filename, listen_tls);
|
||||
GET_CONF_STR (conf, filename, tls_port);
|
||||
GET_CONF_STR (conf, filename, tcp_port);
|
||||
GET_CONF_STR (conf, filename, listen_addr);
|
||||
GET_CONF_INT(conf, filename, listen_tcp);
|
||||
GET_CONF_INT(conf, filename, listen_tls);
|
||||
GET_CONF_STR(conf, filename, tls_port);
|
||||
GET_CONF_STR(conf, filename, tcp_port);
|
||||
GET_CONF_STR(conf, filename, listen_addr);
|
||||
|
||||
if (remoteConfigGetAuth(conf, "auth_unix_rw", &data->auth_unix_rw, filename) < 0)
|
||||
goto error;
|
||||
@ -393,22 +393,22 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
|
||||
goto error;
|
||||
|
||||
GET_CONF_STR (conf, filename, unix_sock_group);
|
||||
GET_CONF_STR (conf, filename, unix_sock_ro_perms);
|
||||
GET_CONF_STR (conf, filename, unix_sock_rw_perms);
|
||||
GET_CONF_STR(conf, filename, unix_sock_group);
|
||||
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
|
||||
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
|
||||
|
||||
GET_CONF_STR (conf, filename, unix_sock_dir);
|
||||
GET_CONF_STR(conf, filename, unix_sock_dir);
|
||||
|
||||
GET_CONF_INT (conf, filename, mdns_adv);
|
||||
GET_CONF_STR (conf, filename, mdns_name);
|
||||
GET_CONF_INT(conf, filename, mdns_adv);
|
||||
GET_CONF_STR(conf, filename, mdns_name);
|
||||
|
||||
GET_CONF_INT (conf, filename, tls_no_sanity_certificate);
|
||||
GET_CONF_INT (conf, filename, tls_no_verify_certificate);
|
||||
GET_CONF_INT(conf, filename, tls_no_sanity_certificate);
|
||||
GET_CONF_INT(conf, filename, tls_no_verify_certificate);
|
||||
|
||||
GET_CONF_STR (conf, filename, key_file);
|
||||
GET_CONF_STR (conf, filename, cert_file);
|
||||
GET_CONF_STR (conf, filename, ca_file);
|
||||
GET_CONF_STR (conf, filename, crl_file);
|
||||
GET_CONF_STR(conf, filename, key_file);
|
||||
GET_CONF_STR(conf, filename, cert_file);
|
||||
GET_CONF_STR(conf, filename, ca_file);
|
||||
GET_CONF_STR(conf, filename, crl_file);
|
||||
|
||||
if (remoteConfigGetStringList(conf, "tls_allowed_dn_list",
|
||||
&data->tls_allowed_dn_list, filename) < 0)
|
||||
@ -420,28 +420,28 @@ daemonConfigLoadOptions(struct daemonConfig *data,
|
||||
goto error;
|
||||
|
||||
|
||||
GET_CONF_INT (conf, filename, min_workers);
|
||||
GET_CONF_INT (conf, filename, max_workers);
|
||||
GET_CONF_INT (conf, filename, max_clients);
|
||||
GET_CONF_INT(conf, filename, min_workers);
|
||||
GET_CONF_INT(conf, filename, max_workers);
|
||||
GET_CONF_INT(conf, filename, max_clients);
|
||||
|
||||
GET_CONF_INT (conf, filename, prio_workers);
|
||||
GET_CONF_INT(conf, filename, prio_workers);
|
||||
|
||||
GET_CONF_INT (conf, filename, max_requests);
|
||||
GET_CONF_INT (conf, filename, max_client_requests);
|
||||
GET_CONF_INT(conf, filename, max_requests);
|
||||
GET_CONF_INT(conf, filename, max_client_requests);
|
||||
|
||||
GET_CONF_INT (conf, filename, audit_level);
|
||||
GET_CONF_INT (conf, filename, audit_logging);
|
||||
GET_CONF_INT(conf, filename, audit_level);
|
||||
GET_CONF_INT(conf, filename, audit_logging);
|
||||
|
||||
GET_CONF_STR (conf, filename, host_uuid);
|
||||
GET_CONF_STR(conf, filename, host_uuid);
|
||||
|
||||
GET_CONF_INT (conf, filename, log_level);
|
||||
GET_CONF_STR (conf, filename, log_filters);
|
||||
GET_CONF_STR (conf, filename, log_outputs);
|
||||
GET_CONF_INT (conf, filename, log_buffer_size);
|
||||
GET_CONF_INT(conf, filename, log_level);
|
||||
GET_CONF_STR(conf, filename, log_filters);
|
||||
GET_CONF_STR(conf, filename, log_outputs);
|
||||
GET_CONF_INT(conf, filename, log_buffer_size);
|
||||
|
||||
GET_CONF_INT (conf, filename, keepalive_interval);
|
||||
GET_CONF_INT (conf, filename, keepalive_count);
|
||||
GET_CONF_INT (conf, filename, keepalive_required);
|
||||
GET_CONF_INT(conf, filename, keepalive_interval);
|
||||
GET_CONF_INT(conf, filename, keepalive_count);
|
||||
GET_CONF_INT(conf, filename, keepalive_required);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -713,23 +713,23 @@ error:
|
||||
static void
|
||||
daemonVersion(const char *argv0)
|
||||
{
|
||||
printf ("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
printf("%s (%s) %s\n", argv0, PACKAGE_NAME, PACKAGE_VERSION);
|
||||
}
|
||||
|
||||
#ifdef __sun
|
||||
static int
|
||||
daemonSetupPrivs(void)
|
||||
{
|
||||
chown ("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
|
||||
chown("/var/run/libvirt", SYSTEM_UID, SYSTEM_UID);
|
||||
|
||||
if (__init_daemon_priv (PU_RESETGROUPS | PU_CLEARLIMITSET,
|
||||
SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
|
||||
if (__init_daemon_priv(PU_RESETGROUPS | PU_CLEARLIMITSET,
|
||||
SYSTEM_UID, SYSTEM_UID, PRIV_XVM_CONTROL, NULL)) {
|
||||
VIR_ERROR(_("additional privileges are required"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (priv_set (PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
|
||||
PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
|
||||
if (priv_set(PRIV_OFF, PRIV_ALLSETS, PRIV_FILE_LINK_ANY, PRIV_PROC_INFO,
|
||||
PRIV_PROC_SESSION, PRIV_PROC_EXEC, PRIV_PROC_FORK, NULL)) {
|
||||
VIR_ERROR(_("failed to set reduced privileges"));
|
||||
return -1;
|
||||
}
|
||||
@ -884,42 +884,43 @@ static int migrateProfile(void)
|
||||
static void
|
||||
daemonUsage(const char *argv0, bool privileged)
|
||||
{
|
||||
fprintf (stderr,
|
||||
_("\n\
|
||||
Usage:\n\
|
||||
%s [options]\n\
|
||||
\n\
|
||||
Options:\n\
|
||||
-v | --verbose Verbose messages.\n\
|
||||
-d | --daemon Run as a daemon & write PID file.\n\
|
||||
-l | --listen Listen for TCP/IP connections.\n\
|
||||
-t | --timeout <secs> Exit after timeout period.\n\
|
||||
-f | --config <file> Configuration file.\n\
|
||||
| --version Display version information.\n\
|
||||
-p | --pid-file <file> Change name of PID file.\n\
|
||||
\n\
|
||||
libvirt management daemon:\n"), argv0);
|
||||
fprintf(stderr,
|
||||
_("\n"
|
||||
"Usage:\n"
|
||||
" %s [options]\n"
|
||||
"\n"
|
||||
"Options:\n"
|
||||
" -v | --verbose Verbose messages.\n"
|
||||
" -d | --daemon Run as a daemon & write PID file.\n"
|
||||
" -l | --listen Listen for TCP/IP connections.\n"
|
||||
" -t | --timeout <secs> Exit after timeout period.\n"
|
||||
" -f | --config <file> Configuration file.\n"
|
||||
" | --version Display version information.\n"
|
||||
" -p | --pid-file <file> Change name of PID file.\n"
|
||||
"\n"
|
||||
"libvirt management daemon:\n"),
|
||||
argv0);
|
||||
|
||||
if (privileged) {
|
||||
fprintf(stderr,
|
||||
_("\n\
|
||||
Default paths:\n\
|
||||
\n\
|
||||
Configuration file (unless overridden by -f):\n\
|
||||
%s/libvirt/libvirtd.conf\n\
|
||||
\n\
|
||||
Sockets:\n\
|
||||
%s/run/libvirt/libvirt-sock\n\
|
||||
%s/run/libvirt/libvirt-sock-ro\n\
|
||||
\n\
|
||||
TLS:\n\
|
||||
CA certificate: %s/pki/CA/caert.pem\n\
|
||||
Server certificate: %s/pki/libvirt/servercert.pem\n\
|
||||
Server private key: %s/pki/libvirt/private/serverkey.pem\n\
|
||||
\n\
|
||||
PID file (unless overridden by -p):\n\
|
||||
%s/run/libvirtd.pid\n\
|
||||
\n"),
|
||||
_("\n"
|
||||
" Default paths:\n"
|
||||
"\n"
|
||||
" Configuration file (unless overridden by -f):\n"
|
||||
" %s/libvirt/libvirtd.conf\n"
|
||||
"\n"
|
||||
" Sockets:\n"
|
||||
" %s/run/libvirt/libvirt-sock\n"
|
||||
" %s/run/libvirt/libvirt-sock-ro\n"
|
||||
"\n"
|
||||
" TLS:\n"
|
||||
" CA certificate: %s/pki/CA/caert.pem\n"
|
||||
" Server certificate: %s/pki/libvirt/servercert.pem\n"
|
||||
" Server private key: %s/pki/libvirt/private/serverkey.pem\n"
|
||||
"\n"
|
||||
" PID file (unless overridden by -p):\n"
|
||||
" %s/run/libvirtd.pid\n"
|
||||
"\n"),
|
||||
SYSCONFDIR,
|
||||
LOCALSTATEDIR,
|
||||
LOCALSTATEDIR,
|
||||
@ -928,24 +929,24 @@ libvirt management daemon:\n"), argv0);
|
||||
SYSCONFDIR,
|
||||
LOCALSTATEDIR);
|
||||
} else {
|
||||
fprintf(stderr,
|
||||
"%s", _("\n\
|
||||
Default paths:\n\
|
||||
\n\
|
||||
Configuration file (unless overridden by -f):\n\
|
||||
$XDG_CONFIG_HOME/libvirt/libvirtd.conf\n\
|
||||
\n\
|
||||
Sockets:\n\
|
||||
$XDG_RUNTIME_DIR/libvirt/libvirt-sock\n\
|
||||
\n\
|
||||
TLS:\n\
|
||||
CA certificate: $HOME/.pki/libvirt/cacert.pem\n\
|
||||
Server certificate: $HOME/.pki/libvirt/servercert.pem\n\
|
||||
Server private key: $HOME/.pki/libvirt/serverkey.pem\n\
|
||||
\n\
|
||||
PID file:\n\
|
||||
$XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n\
|
||||
\n"));
|
||||
fprintf(stderr, "%s",
|
||||
_("\n"
|
||||
" Default paths:\n"
|
||||
"\n"
|
||||
" Configuration file (unless overridden by -f):\n"
|
||||
" $XDG_CONFIG_HOME/libvirt/libvirtd.conf\n"
|
||||
"\n"
|
||||
" Sockets:\n"
|
||||
" $XDG_RUNTIME_DIR/libvirt/libvirt-sock\n"
|
||||
"\n"
|
||||
" TLS:\n"
|
||||
" CA certificate: $HOME/.pki/libvirt/cacert.pem\n"
|
||||
" Server certificate: $HOME/.pki/libvirt/servercert.pem\n"
|
||||
" Server private key: $HOME/.pki/libvirt/serverkey.pem\n"
|
||||
"\n"
|
||||
" PID file:\n"
|
||||
" $XDG_RUNTIME_DIR/libvirt/libvirtd.pid\n"
|
||||
"\n"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -985,8 +986,8 @@ int main(int argc, char **argv) {
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
|
||||
if (setlocale (LC_ALL, "") == NULL ||
|
||||
bindtextdomain (PACKAGE, LOCALEDIR) == NULL ||
|
||||
if (setlocale(LC_ALL, "") == NULL ||
|
||||
bindtextdomain(PACKAGE, LOCALEDIR) == NULL ||
|
||||
textdomain(PACKAGE) == NULL ||
|
||||
virInitialize() < 0) {
|
||||
fprintf(stderr, _("%s: initialization failed\n"), argv[0]);
|
||||
@ -1081,7 +1082,7 @@ int main(int argc, char **argv) {
|
||||
default:
|
||||
VIR_ERROR(_("%s: internal error: unknown flag: %c"),
|
||||
argv[0], c);
|
||||
exit (EXIT_FAILURE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ setPyVirTypedParameter(PyObject *info,
|
||||
ignore_value(virStrcpyStatic(temp->field, keystr));
|
||||
temp->type = params[i].type;
|
||||
|
||||
switch(params[i].type) {
|
||||
switch (params[i].type) {
|
||||
case VIR_TYPED_PARAM_INT:
|
||||
if (libvirt_intUnwrap(value, &temp->value.i) < 0)
|
||||
goto cleanup;
|
||||
@ -1940,21 +1940,21 @@ libvirt_virConnectOpenAuth(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
************************************************************************/
|
||||
|
||||
static PyObject *
|
||||
libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
libvirt_virGetVersion(PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
{
|
||||
char *type = NULL;
|
||||
unsigned long libVer, typeVer = 0;
|
||||
int c_retval;
|
||||
|
||||
if (!PyArg_ParseTuple (args, (char *) "|s", &type))
|
||||
if (!PyArg_ParseTuple(args, (char *) "|s", &type))
|
||||
return NULL;
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
|
||||
if (type == NULL)
|
||||
c_retval = virGetVersion (&libVer, NULL, NULL);
|
||||
c_retval = virGetVersion(&libVer, NULL, NULL);
|
||||
else
|
||||
c_retval = virGetVersion (&libVer, type, &typeVer);
|
||||
c_retval = virGetVersion(&libVer, type, &typeVer);
|
||||
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
|
||||
@ -1962,14 +1962,14 @@ libvirt_virGetVersion (PyObject *self ATTRIBUTE_UNUSED, PyObject *args)
|
||||
return VIR_PY_NONE;
|
||||
|
||||
if (type == NULL)
|
||||
return PyInt_FromLong (libVer);
|
||||
return PyInt_FromLong(libVer);
|
||||
else
|
||||
return Py_BuildValue ((char *) "kk", libVer, typeVer);
|
||||
return Py_BuildValue((char *) "kk", libVer, typeVer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args)
|
||||
libvirt_virConnectGetVersion(PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args)
|
||||
{
|
||||
unsigned long hvVersion;
|
||||
int c_retval;
|
||||
@ -1990,12 +1990,12 @@ libvirt_virConnectGetVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||
if (c_retval == -1)
|
||||
return VIR_PY_INT_FAIL;
|
||||
|
||||
return PyInt_FromLong (hvVersion);
|
||||
return PyInt_FromLong(hvVersion);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args)
|
||||
libvirt_virConnectGetLibVersion(PyObject *self ATTRIBUTE_UNUSED,
|
||||
PyObject *args)
|
||||
{
|
||||
unsigned long libVer;
|
||||
int c_retval;
|
||||
@ -2016,7 +2016,7 @@ libvirt_virConnectGetLibVersion (PyObject *self ATTRIBUTE_UNUSED,
|
||||
if (c_retval == -1)
|
||||
return VIR_PY_INT_FAIL;
|
||||
|
||||
return PyInt_FromLong (libVer);
|
||||
return PyInt_FromLong(libVer);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
@ -4404,7 +4404,7 @@ static PyObject *libvirt_dict = NULL;
|
||||
static PyObject *libvirt_dom_class = NULL;
|
||||
|
||||
static PyObject *
|
||||
getLibvirtModuleObject (void) {
|
||||
getLibvirtModuleObject(void) {
|
||||
if (libvirt_module)
|
||||
return libvirt_module;
|
||||
|
||||
@ -4421,7 +4421,7 @@ getLibvirtModuleObject (void) {
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
getLibvirtDictObject (void) {
|
||||
getLibvirtDictObject(void) {
|
||||
if (libvirt_dict)
|
||||
return libvirt_dict;
|
||||
|
||||
@ -4438,7 +4438,7 @@ getLibvirtDictObject (void) {
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
getLibvirtDomainClassObject (void) {
|
||||
getLibvirtDomainClassObject(void) {
|
||||
if (libvirt_dom_class)
|
||||
return libvirt_dom_class;
|
||||
|
||||
@ -4975,7 +4975,7 @@ libvirt_virEventInvokeHandleCallback(PyObject *self ATTRIBUTE_UNUSED,
|
||||
|
||||
if (cb) {
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
cb (watch, fd, event, opaque);
|
||||
cb(watch, fd, event, opaque);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
}
|
||||
|
||||
@ -5002,7 +5002,7 @@ libvirt_virEventInvokeTimeoutCallback(PyObject *self ATTRIBUTE_UNUSED,
|
||||
opaque = (void *) PyvirVoidPtr_Get(py_opaque);
|
||||
if (cb) {
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
cb (timer, opaque);
|
||||
cb(timer, opaque);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
}
|
||||
|
||||
|
@ -1565,7 +1565,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
|
||||
|
||||
no_memory:
|
||||
if (ret) {
|
||||
for ( ; i >= 0; --i) {
|
||||
for (; i >= 0; --i) {
|
||||
if (ret[i]) {
|
||||
virBitmapFree(ret[i]->cpumask);
|
||||
VIR_FREE(ret[i]);
|
||||
@ -1596,7 +1596,7 @@ virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
|
||||
if (!def || !nvcpupin)
|
||||
return;
|
||||
|
||||
for(i = 0; i < nvcpupin; i++) {
|
||||
for (i = 0; i < nvcpupin; i++) {
|
||||
virDomainVcpuPinDefFree(def[i]);
|
||||
}
|
||||
|
||||
@ -3305,7 +3305,7 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
|
||||
|
||||
/* Checking missing model information */
|
||||
if (def->nseclabels > 1) {
|
||||
for(; n; n--) {
|
||||
for (; n; n--) {
|
||||
if (def->seclabels[n - 1]->model == NULL) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("missing security model "
|
||||
@ -4898,14 +4898,14 @@ virDomainNetDefParseXML(virCapsPtr caps,
|
||||
} else if (!script &&
|
||||
xmlStrEqual(cur->name, BAD_CAST "script")) {
|
||||
script = virXMLPropString(cur, "path");
|
||||
} else if (xmlStrEqual (cur->name, BAD_CAST "model")) {
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "model")) {
|
||||
model = virXMLPropString(cur, "type");
|
||||
} else if (xmlStrEqual (cur->name, BAD_CAST "driver")) {
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "driver")) {
|
||||
backend = virXMLPropString(cur, "name");
|
||||
txmode = virXMLPropString(cur, "txmode");
|
||||
ioeventfd = virXMLPropString(cur, "ioeventfd");
|
||||
event_idx = virXMLPropString(cur, "event_idx");
|
||||
} else if (xmlStrEqual (cur->name, BAD_CAST "filterref")) {
|
||||
} else if (xmlStrEqual(cur->name, BAD_CAST "filterref")) {
|
||||
if (filter) {
|
||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||
_("Invalid specification of multiple <filterref>s "
|
||||
@ -6929,29 +6929,29 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
|
||||
char *action = NULL;
|
||||
virDomainWatchdogDefPtr def;
|
||||
|
||||
if (VIR_ALLOC (def) < 0) {
|
||||
if (VIR_ALLOC(def) < 0) {
|
||||
virReportOOMError();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
model = virXMLPropString (node, "model");
|
||||
model = virXMLPropString(node, "model");
|
||||
if (model == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("watchdog must contain model name"));
|
||||
goto error;
|
||||
}
|
||||
def->model = virDomainWatchdogModelTypeFromString (model);
|
||||
def->model = virDomainWatchdogModelTypeFromString(model);
|
||||
if (def->model < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown watchdog model '%s'"), model);
|
||||
goto error;
|
||||
}
|
||||
|
||||
action = virXMLPropString (node, "action");
|
||||
action = virXMLPropString(node, "action");
|
||||
if (action == NULL)
|
||||
def->action = VIR_DOMAIN_WATCHDOG_ACTION_RESET;
|
||||
else {
|
||||
def->action = virDomainWatchdogActionTypeFromString (action);
|
||||
def->action = virDomainWatchdogActionTypeFromString(action);
|
||||
if (def->action < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown watchdog action '%s'"), action);
|
||||
@ -6963,13 +6963,13 @@ virDomainWatchdogDefParseXML(const xmlNodePtr node,
|
||||
goto error;
|
||||
|
||||
cleanup:
|
||||
VIR_FREE (action);
|
||||
VIR_FREE (model);
|
||||
VIR_FREE(action);
|
||||
VIR_FREE(model);
|
||||
|
||||
return def;
|
||||
|
||||
error:
|
||||
virDomainWatchdogDefFree (def);
|
||||
virDomainWatchdogDefFree(def);
|
||||
def = NULL;
|
||||
goto cleanup;
|
||||
}
|
||||
@ -12952,8 +12952,8 @@ virDomainWatchdogDefFormat(virBufferPtr buf,
|
||||
virDomainWatchdogDefPtr def,
|
||||
unsigned int flags)
|
||||
{
|
||||
const char *model = virDomainWatchdogModelTypeToString (def->model);
|
||||
const char *action = virDomainWatchdogActionTypeToString (def->action);
|
||||
const char *model = virDomainWatchdogModelTypeToString(def->model);
|
||||
const char *action = virDomainWatchdogActionTypeToString(def->action);
|
||||
|
||||
if (!model) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -15371,7 +15371,7 @@ virDomainDeviceDefCopy(virCapsPtr caps,
|
||||
char *xmlStr = NULL;
|
||||
int rc = -1;
|
||||
|
||||
switch(src->type) {
|
||||
switch (src->type) {
|
||||
case VIR_DOMAIN_DEVICE_DISK:
|
||||
rc = virDomainDiskDefFormat(&buf, src->data.disk, flags);
|
||||
break;
|
||||
|
@ -355,7 +355,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
|
||||
int ret = 0;
|
||||
|
||||
/* Check incoming */
|
||||
if ( !cbList ) {
|
||||
if (!cbList) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
|
||||
VIR_ENUM_IMPL(virInterface,
|
||||
VIR_INTERFACE_TYPE_LAST,
|
||||
"ethernet", "bridge", "bond", "vlan" )
|
||||
"ethernet", "bridge", "bond", "vlan")
|
||||
|
||||
static virInterfaceDefPtr
|
||||
virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType);
|
||||
|
@ -1376,7 +1376,7 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
|
||||
|
||||
forwardDev = virXPathString("string(./@dev)", ctxt);
|
||||
forwardManaged = virXPathString("string(./@managed)", ctxt);
|
||||
if(forwardManaged != NULL) {
|
||||
if (forwardManaged != NULL) {
|
||||
if (STRCASEEQ(forwardManaged, "yes"))
|
||||
def->managed = 1;
|
||||
}
|
||||
@ -3124,8 +3124,8 @@ void virNetworkObjUnlock(virNetworkObjPtr obj)
|
||||
|
||||
#define MATCH(FLAG) (flags & (FLAG))
|
||||
static bool
|
||||
virNetworkMatch (virNetworkObjPtr netobj,
|
||||
unsigned int flags)
|
||||
virNetworkMatch(virNetworkObjPtr netobj,
|
||||
unsigned int flags)
|
||||
{
|
||||
/* filter by active state */
|
||||
if (MATCH(VIR_CONNECT_LIST_NETWORKS_FILTERS_ACTIVE) &&
|
||||
|
@ -135,7 +135,7 @@ static const struct int_map chain_priorities[] = {
|
||||
INTMAP_ENTRY(NWFILTER_VLAN_FILTER_PRI, "vlan"),
|
||||
INTMAP_ENTRY(NWFILTER_IPV4_FILTER_PRI, "ipv4"),
|
||||
INTMAP_ENTRY(NWFILTER_IPV6_FILTER_PRI, "ipv6"),
|
||||
INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp" ),
|
||||
INTMAP_ENTRY(NWFILTER_ARP_FILTER_PRI , "arp"),
|
||||
INTMAP_ENTRY(NWFILTER_RARP_FILTER_PRI, "rarp"),
|
||||
INTMAP_ENTRY_LAST,
|
||||
};
|
||||
@ -259,8 +259,8 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
|
||||
bool found = false;
|
||||
|
||||
while (intmap[i].val && !found) {
|
||||
if ( (casecmp && STRCASEEQ(intmap[i].val, str)) ||
|
||||
STREQ (intmap[i].val, str) ) {
|
||||
if ((casecmp && STRCASEEQ(intmap[i].val, str)) ||
|
||||
STREQ(intmap[i].val, str)) {
|
||||
*result = intmap[i].attr;
|
||||
found = true;
|
||||
}
|
||||
@ -938,7 +938,7 @@ tcpFlagsValidator(enum attrDatatype datatype ATTRIBUTE_UNUSED, union data *val,
|
||||
*sep = '\0';
|
||||
|
||||
if (parseStringItems(tcpFlags, s_mask , &mask , ',') == 0 &&
|
||||
parseStringItems(tcpFlags, s_flags, &flags, ',') == 0 ) {
|
||||
parseStringItems(tcpFlags, s_flags, &flags, ',') == 0) {
|
||||
item->u.tcpFlags.mask = mask & 0x3f;
|
||||
item->u.tcpFlags.flags = flags & 0x3f;
|
||||
rc = true;
|
||||
|
@ -492,7 +492,7 @@ PowerPCDecode(virCPUDefPtr cpu,
|
||||
if (ret < 0) {
|
||||
VIR_FREE(cpuCandidate);
|
||||
goto out;
|
||||
}else if(ret == 1) {
|
||||
} else if (ret == 1) {
|
||||
cpuCandidate->model = cpu_model;
|
||||
cpuCandidate->vendor = cpu_vendor;
|
||||
virCPUDefFree(cpuModel);
|
||||
@ -530,7 +530,7 @@ out:
|
||||
static uint32_t ppc_mfpvr(void)
|
||||
{
|
||||
uint32_t pvr;
|
||||
asm ("mfpvr %0"
|
||||
asm("mfpvr %0"
|
||||
: "=r"(pvr));
|
||||
return pvr;
|
||||
}
|
||||
|
@ -548,16 +548,16 @@ x86VendorLoad(xmlXPathContextPtr ctxt,
|
||||
}
|
||||
|
||||
vendor->cpuid.function = 0;
|
||||
vendor->cpuid.ebx = (string[0] ) |
|
||||
(string[1] << 8) |
|
||||
(string[2] << 16) |
|
||||
(string[3] << 24);
|
||||
vendor->cpuid.edx = (string[4] ) |
|
||||
(string[5] << 8) |
|
||||
(string[6] << 16) |
|
||||
(string[7] << 24);
|
||||
vendor->cpuid.ecx = (string[8] ) |
|
||||
(string[9] << 8) |
|
||||
vendor->cpuid.ebx = (string[0]) |
|
||||
(string[1] << 8) |
|
||||
(string[2] << 16) |
|
||||
(string[3] << 24);
|
||||
vendor->cpuid.edx = (string[4]) |
|
||||
(string[5] << 8) |
|
||||
(string[6] << 16) |
|
||||
(string[7] << 24);
|
||||
vendor->cpuid.ecx = (string[8]) |
|
||||
(string[9] << 8) |
|
||||
(string[10] << 16) |
|
||||
(string[11] << 24);
|
||||
|
||||
|
@ -3769,7 +3769,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
||||
}
|
||||
|
||||
spec->cpuAllocation->reservation->value = params[i].value.l;
|
||||
} else if(STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_LIMIT)) {
|
||||
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_LIMIT)) {
|
||||
if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
|
||||
goto cleanup;
|
||||
}
|
||||
@ -3783,7 +3783,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
|
||||
}
|
||||
|
||||
spec->cpuAllocation->limit->value = params[i].value.l;
|
||||
} else if(STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_SHARES)) {
|
||||
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_SHARES)) {
|
||||
if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 ||
|
||||
esxVI_Int_Alloc(&sharesInfo->shares) < 0) {
|
||||
goto cleanup;
|
||||
|
@ -2440,7 +2440,7 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
|
||||
}
|
||||
|
||||
if ((!inverse && powerState_ == powerState) ||
|
||||
( inverse && powerState_ != powerState)) {
|
||||
(inverse && powerState_ != powerState)) {
|
||||
count++;
|
||||
}
|
||||
} else {
|
||||
|
@ -242,7 +242,7 @@
|
||||
esxVI_##_type##_Serialize(esxVI_##_type *item, \
|
||||
const char *element, virBufferPtr output) \
|
||||
{ \
|
||||
if (element == NULL || output == NULL ) { \
|
||||
if (element == NULL || output == NULL) { \
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", \
|
||||
_("Invalid argument")); \
|
||||
return -1; \
|
||||
|
@ -165,7 +165,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
||||
ws_xml_destroy_doc(response);
|
||||
response = NULL;
|
||||
|
||||
while (enumContext != NULL && *enumContext != '\0' ) {
|
||||
while (enumContext != NULL && *enumContext != '\0') {
|
||||
response = wsmc_action_pull(priv->client, resourceUri, options,
|
||||
filter, enumContext);
|
||||
|
||||
|
@ -152,7 +152,7 @@ netcf_error:
|
||||
{
|
||||
ncf_close(driverState->netcf);
|
||||
}
|
||||
virMutexDestroy (&driverState->lock);
|
||||
virMutexDestroy(&driverState->lock);
|
||||
mutex_error:
|
||||
VIR_FREE(driverState);
|
||||
alloc_error:
|
||||
|
746
src/libvirt.c
746
src/libvirt.c
File diff suppressed because it is too large
Load Diff
@ -372,7 +372,7 @@ libxlMakeDomCreateInfo(virDomainDefPtr def, libxl_domain_create_info *c_info)
|
||||
}
|
||||
|
||||
virUUIDFormat(def->uuid, uuidstr);
|
||||
if (libxl_uuid_from_string(&c_info->uuid, uuidstr) ) {
|
||||
if (libxl_uuid_from_string(&c_info->uuid, uuidstr)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("libxenlight failed to parse UUID '%s'"), uuidstr);
|
||||
goto error;
|
||||
@ -920,7 +920,7 @@ libxlMakeCapabilities(libxl_ctx *ctx)
|
||||
const libxl_version_info *ver_info;
|
||||
struct utsname utsname;
|
||||
|
||||
regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||
regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||
|
||||
if (libxl_get_physinfo(ctx, &phy_info) != 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
|
@ -659,7 +659,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
|
||||
|
||||
memset(&d_config, 0, sizeof(d_config));
|
||||
|
||||
if (libxlBuildDomainConfig(driver, vm->def, &d_config) < 0 )
|
||||
if (libxlBuildDomainConfig(driver, vm->def, &d_config) < 0)
|
||||
return -1;
|
||||
|
||||
if (libxlFreeMem(priv, &d_config) < 0) {
|
||||
@ -3562,7 +3562,7 @@ libxlDomainGetSchedulerType(virDomainPtr dom, int *nparams)
|
||||
|
||||
if (nparams)
|
||||
*nparams = 0;
|
||||
switch(sched_id) {
|
||||
switch (sched_id) {
|
||||
case XEN_SCHEDULER_SEDF:
|
||||
ret = strdup("sedf");
|
||||
break;
|
||||
|
@ -164,8 +164,8 @@ static int virLockManagerSanlockLoadConfig(const char *configFile)
|
||||
VIR_FREE(tmp);
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "group");
|
||||
CHECK_TYPE ("group", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "group");
|
||||
CHECK_TYPE("group", VIR_CONF_STRING);
|
||||
if (p) {
|
||||
if (!(tmp = strdup(p->str))) {
|
||||
virReportOOMError();
|
||||
|
@ -184,7 +184,7 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
||||
goto no_memory;
|
||||
|
||||
/* Avoid error from non-existant or unreadable file. */
|
||||
if (access (filename, R_OK) == -1)
|
||||
if (access(filename, R_OK) == -1)
|
||||
goto done;
|
||||
conf = virConfReadFile(filename, 0);
|
||||
if (!conf)
|
||||
@ -199,11 +199,11 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
||||
}
|
||||
|
||||
p = virConfGetValue(conf, "log_with_libvirtd");
|
||||
CHECK_TYPE ("log_with_libvirtd", VIR_CONF_LONG);
|
||||
CHECK_TYPE("log_with_libvirtd", VIR_CONF_LONG);
|
||||
if (p) driver->log_libvirtd = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "security_driver");
|
||||
CHECK_TYPE ("security_driver", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "security_driver");
|
||||
CHECK_TYPE("security_driver", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
if (!(driver->securityDriverName = strdup(p->str))) {
|
||||
virReportOOMError();
|
||||
@ -212,12 +212,12 @@ int lxcLoadDriverConfig(virLXCDriverPtr driver)
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "security_default_confined");
|
||||
CHECK_TYPE ("security_default_confined", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "security_default_confined");
|
||||
CHECK_TYPE("security_default_confined", VIR_CONF_LONG);
|
||||
if (p) driver->securityDefaultConfined = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "security_require_confined");
|
||||
CHECK_TYPE ("security_require_confined", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "security_require_confined");
|
||||
CHECK_TYPE("security_require_confined", VIR_CONF_LONG);
|
||||
if (p) driver->securityRequireConfined = p->l;
|
||||
|
||||
|
||||
|
@ -240,7 +240,7 @@ static int lxcContainerSetStdio(int control, int ttyfd, int handshakefd)
|
||||
|
||||
/* Just in case someone forget to set FD_CLOEXEC, explicitly
|
||||
* close all FDs before executing the container */
|
||||
open_max = sysconf (_SC_OPEN_MAX);
|
||||
open_max = sysconf(_SC_OPEN_MAX);
|
||||
for (i = 0; i < open_max; i++)
|
||||
if (i != ttyfd && i != control && i != handshakefd) {
|
||||
int tmpfd = i;
|
||||
@ -1456,7 +1456,7 @@ static int lxcContainerMountCGroups(struct lxcContainerCGroup *mounts,
|
||||
}
|
||||
|
||||
if (virAsprintf(&opts,
|
||||
"mode=755,size=65536%s",(sec_mount_options ? sec_mount_options : "")) < 0 ) {
|
||||
"mode=755,size=65536%s",(sec_mount_options ? sec_mount_options : "")) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
@ -1721,7 +1721,7 @@ static int lxcContainerDropCapabilities(bool keepReboot ATTRIBUTE_UNUSED)
|
||||
CAP_AUDIT_CONTROL, /* No messing with auditing status */
|
||||
CAP_MAC_ADMIN, /* No messing with LSM config */
|
||||
keepReboot ? -1 : CAP_SYS_BOOT, /* No use of reboot */
|
||||
-1 /* sentinal */)) < 0) {
|
||||
-1)) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to remove capabilities: %d"), ret);
|
||||
return -1;
|
||||
@ -1758,7 +1758,7 @@ static int lxcContainerDropCapabilities(bool keepReboot ATTRIBUTE_UNUSED)
|
||||
*
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int lxcContainerChild( void *data )
|
||||
static int lxcContainerChild(void *data)
|
||||
{
|
||||
lxc_child_argv_t *argv = data;
|
||||
virDomainDefPtr vmDef = argv->config;
|
||||
|
@ -878,7 +878,7 @@ lxcDomainGetMemoryParameters(virDomainPtr dom,
|
||||
virTypedParameterPtr param = ¶ms[i];
|
||||
val = 0;
|
||||
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0: /* fill memory hard limit here */
|
||||
rc = virCgroupGetMemoryHardLimit(cgroup, &val);
|
||||
if (rc != 0) {
|
||||
|
@ -350,7 +350,7 @@ networkStartup(int privileged) {
|
||||
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
||||
goto out_of_memory;
|
||||
|
||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
||||
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||
goto out_of_memory;
|
||||
} else {
|
||||
char *userdir = virGetUserCacheDirectory();
|
||||
@ -2037,7 +2037,7 @@ networkCheckRouteCollision(virNetworkObjPtr network)
|
||||
|
||||
VIR_DEBUG("%s output:\n%s", PROC_NET_ROUTE, buf);
|
||||
|
||||
if (!STRPREFIX (buf, "Iface"))
|
||||
if (!STRPREFIX(buf, "Iface"))
|
||||
goto out;
|
||||
|
||||
/* First line is just headings, skip it */
|
||||
@ -3366,7 +3366,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef) {
|
||||
(netdef->forwardType == VIR_NETWORK_FORWARD_VEPA) ||
|
||||
(netdef->forwardType == VIR_NETWORK_FORWARD_PASSTHROUGH)) {
|
||||
netdef->forwardIfs[ii].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
|
||||
if(vfname[ii]) {
|
||||
if (vfname[ii]) {
|
||||
netdef->forwardIfs[ii].device.dev = strdup(vfname[ii]);
|
||||
if (!netdef->forwardIfs[ii].device.dev) {
|
||||
virReportOOMError();
|
||||
|
@ -1005,7 +1005,7 @@ static int udevProcessStorage(struct udev_device *device,
|
||||
const char* devnode;
|
||||
|
||||
devnode = udev_device_get_devnode(device);
|
||||
if(!devnode) {
|
||||
if (!devnode) {
|
||||
VIR_DEBUG("No devnode for '%s'", udev_device_get_devpath(device));
|
||||
goto out;
|
||||
}
|
||||
|
@ -839,7 +839,7 @@ int nodeGetInfo(virConnectPtr conn ATTRIBUTE_UNUSED, virNodeInfoPtr nodeinfo) {
|
||||
goto cleanup;
|
||||
|
||||
/* Convert to KB. */
|
||||
nodeinfo->memory = physmem_total () / 1024;
|
||||
nodeinfo->memory = physmem_total() / 1024;
|
||||
|
||||
cleanup:
|
||||
VIR_FORCE_FCLOSE(cpuinfo);
|
||||
@ -1161,7 +1161,7 @@ nodeGetMemoryParameters(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
for (i = 0; i < *nparams && i < NODE_MEMORY_PARAMETERS_NUM; i++) {
|
||||
virTypedParameterPtr param = ¶ms[i];
|
||||
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (nodeGetMemoryParameterValue("pages_to_scan",
|
||||
&pages_to_scan) < 0)
|
||||
|
@ -1640,7 +1640,7 @@ virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
|
||||
}
|
||||
|
||||
/* check that all tools are available for applying the filters (late) */
|
||||
if ( !techdriver->canApplyBasicRules()) {
|
||||
if (!techdriver->canApplyBasicRules()) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("IP parameter must be provided since "
|
||||
"snooping the IP address does not work "
|
||||
|
@ -216,7 +216,7 @@ nwfilterDriverStartup(int privileged)
|
||||
}
|
||||
|
||||
if (privileged) {
|
||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
||||
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||
goto out_of_memory;
|
||||
} else {
|
||||
base = virGetUserConfigDirectory();
|
||||
|
@ -898,7 +898,7 @@ iptablesRenameTmpRootChain(virBufferPtr buf,
|
||||
};
|
||||
|
||||
PRINT_IPT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
||||
PRINT_IPT_ROOT_CHAIN( chain, chainPrefix, ifname);
|
||||
PRINT_IPT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||
|
||||
virBufferAsprintf(buf,
|
||||
"$IPT -E %s %s" CMD_SEPARATOR,
|
||||
@ -2141,14 +2141,14 @@ ebtablesCreateRuleInstance(char chainPrefix,
|
||||
INST_ITEM(stpHdrFilter, dataFlags, "--stp-flags")
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataRootPri, dataRootPriHi,
|
||||
"--stp-root-pri");
|
||||
INST_ITEM_MASK( stpHdrFilter, dataRootAddr, dataRootAddrMask,
|
||||
INST_ITEM_MASK(stpHdrFilter, dataRootAddr, dataRootAddrMask,
|
||||
"--stp-root-addr");
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataRootCost, dataRootCostHi,
|
||||
"--stp-root-cost");
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataSndrPrio, dataSndrPrioHi,
|
||||
"--stp-sender-prio");
|
||||
INST_ITEM_MASK( stpHdrFilter, dataSndrAddr, dataSndrAddrMask,
|
||||
"--stp-sender-addr");
|
||||
INST_ITEM_MASK(stpHdrFilter, dataSndrAddr, dataSndrAddrMask,
|
||||
"--stp-sender-addr");
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataPort, dataPortHi, "--stp-port");
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataAge, dataAgeHi, "--stp-msg-age");
|
||||
INST_ITEM_RANGE(stpHdrFilter, dataMaxAge, dataMaxAgeHi,
|
||||
@ -3093,10 +3093,10 @@ ebtablesRenameTmpSubChain(virBufferPtr buf,
|
||||
|
||||
if (protocol) {
|
||||
PRINT_CHAIN(tmpchain, tmpChainPrefix, ifname, protocol);
|
||||
PRINT_CHAIN( chain, chainPrefix, ifname, protocol);
|
||||
PRINT_CHAIN(chain, chainPrefix, ifname, protocol);
|
||||
} else {
|
||||
PRINT_ROOT_CHAIN(tmpchain, tmpChainPrefix, ifname);
|
||||
PRINT_ROOT_CHAIN( chain, chainPrefix, ifname);
|
||||
PRINT_ROOT_CHAIN(chain, chainPrefix, ifname);
|
||||
}
|
||||
|
||||
virBufferAsprintf(buf,
|
||||
@ -3571,7 +3571,7 @@ iptablesCheckBridgeNFCallEnabled(bool isIPv6)
|
||||
time_t now = time(NULL);
|
||||
|
||||
if (isIPv6 &&
|
||||
(now - lastReportIPv6) > BRIDGE_NF_CALL_ALERT_INTERVAL ) {
|
||||
(now - lastReportIPv6) > BRIDGE_NF_CALL_ALERT_INTERVAL) {
|
||||
pathname = PROC_BRIDGE_NF_CALL_IP6TABLES;
|
||||
} else if (now - lastReport > BRIDGE_NF_CALL_ALERT_INTERVAL) {
|
||||
pathname = PROC_BRIDGE_NF_CALL_IPTABLES;
|
||||
@ -3686,7 +3686,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
||||
|
||||
/* scan the rules to see which chains need to be created */
|
||||
for (i = 0; i < nruleInstances; i++) {
|
||||
sa_assert (inst);
|
||||
sa_assert(inst);
|
||||
if (inst[i]->ruleType == RT_EBTABLES) {
|
||||
const char *name = inst[i]->neededProtocolChain;
|
||||
if (inst[i]->chainprefix == CHAINPREFIX_HOST_IN_TEMP) {
|
||||
@ -3743,7 +3743,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
||||
commands for creating and connecting ebtables chains */
|
||||
j = 0;
|
||||
for (i = 0; i < nruleInstances; i++) {
|
||||
sa_assert (inst);
|
||||
sa_assert(inst);
|
||||
switch (inst[i]->ruleType) {
|
||||
case RT_EBTABLES:
|
||||
while (j < nEbtChains &&
|
||||
@ -3801,7 +3801,7 @@ ebiptablesApplyNewRules(const char *ifname,
|
||||
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
||||
|
||||
for (i = 0; i < nruleInstances; i++) {
|
||||
sa_assert (inst);
|
||||
sa_assert(inst);
|
||||
if (inst[i]->ruleType == RT_IPTABLES)
|
||||
iptablesInstCommand(&buf,
|
||||
inst[i]->commandTemplate,
|
||||
@ -4079,7 +4079,7 @@ ebiptablesAllTeardown(const char *ifname)
|
||||
NWFILTER_SET_IPTABLES_SHELLVAR(&buf);
|
||||
|
||||
iptablesUnlinkRootChains(&buf, ifname);
|
||||
iptablesClearVirtInPost (&buf, ifname);
|
||||
iptablesClearVirtInPost(&buf, ifname);
|
||||
iptablesRemoveRootChains(&buf, ifname);
|
||||
}
|
||||
|
||||
@ -4087,7 +4087,7 @@ ebiptablesAllTeardown(const char *ifname)
|
||||
NWFILTER_SET_IP6TABLES_SHELLVAR(&buf);
|
||||
|
||||
iptablesUnlinkRootChains(&buf, ifname);
|
||||
iptablesClearVirtInPost (&buf, ifname);
|
||||
iptablesClearVirtInPost(&buf, ifname);
|
||||
iptablesRemoveRootChains(&buf, ifname);
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,7 @@ printString(void *payload ATTRIBUTE_UNUSED, const void *name, void *data)
|
||||
{
|
||||
struct printString *ps = data;
|
||||
|
||||
if ((STREQ((char *)name, NWFILTER_STD_VAR_IP ) && !ps->reportIP ) ||
|
||||
if ((STREQ((char *)name, NWFILTER_STD_VAR_IP) && !ps->reportIP) ||
|
||||
(STREQ((char *)name, NWFILTER_STD_VAR_MAC) && !ps->reportMAC))
|
||||
return;
|
||||
|
||||
@ -1182,13 +1182,13 @@ virNWFilterDomainFWUpdateCB(void *payload,
|
||||
break;
|
||||
|
||||
case STEP_TEAR_NEW:
|
||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||
if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||
cb->err = virNWFilterRollbackUpdateFilter(net);
|
||||
}
|
||||
break;
|
||||
|
||||
case STEP_TEAR_OLD:
|
||||
if ( !virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||
if (!virHashLookup(cb->skipInterfaces, net->ifname)) {
|
||||
cb->err = virNWFilterTearOldFilter(net);
|
||||
}
|
||||
break;
|
||||
|
@ -504,8 +504,8 @@ learnIPAddressThread(void *arg)
|
||||
/* skip mcast addresses (224.0.0.0 - 239.255.255.255),
|
||||
* class E (240.0.0.0 - 255.255.255.255, includes eth.
|
||||
* bcast) and zero address in DHCP Requests */
|
||||
if ( (ntohl(vmaddr) & 0xe0000000) == 0xe0000000 ||
|
||||
vmaddr == 0) {
|
||||
if ((ntohl(vmaddr) & 0xe0000000) == 0xe0000000 ||
|
||||
vmaddr == 0) {
|
||||
vmaddr = 0;
|
||||
continue;
|
||||
}
|
||||
@ -672,7 +672,7 @@ virNWFilterLearnIPAddress(virNWFilterTechDriverPtr techdriver,
|
||||
if (howDetect == 0)
|
||||
return -1;
|
||||
|
||||
if ( !techdriver->canApplyBasicRules()) {
|
||||
if (!techdriver->canApplyBasicRules()) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("IP parameter must be provided since "
|
||||
"snooping the IP address does not work "
|
||||
|
@ -285,7 +285,7 @@ openvzReadNetworkConf(virDomainDefPtr def,
|
||||
|
||||
/*parse string*/
|
||||
do {
|
||||
char *next = strchrnul (p, ',');
|
||||
char *next = strchrnul(p, ',');
|
||||
if (STRPREFIX(p, "ifname=")) {
|
||||
/* skip in libvirt */
|
||||
} else if (STRPREFIX(p, "host_ifname=")) {
|
||||
@ -456,7 +456,7 @@ openvzReadFSConf(virDomainDefPtr def,
|
||||
} else {
|
||||
/* Ensure that we can multiply by 1024 without overflowing. */
|
||||
if (barrier > ULLONG_MAX / 1024 ||
|
||||
limit > ULLONG_MAX / 1024 ) {
|
||||
limit > ULLONG_MAX / 1024) {
|
||||
virReportSystemError(VIR_ERR_OVERFLOW, "%s",
|
||||
_("Unable to parse quota"));
|
||||
goto error;
|
||||
@ -985,7 +985,7 @@ openvz_readline(int fd, char *ptr, int maxlen)
|
||||
char c;
|
||||
|
||||
for (n = 1; n < maxlen; n++) {
|
||||
if ( (rc = read(fd, &c, 1)) == 1) {
|
||||
if ((rc = read(fd, &c, 1)) == 1) {
|
||||
*ptr++ = c;
|
||||
if (c == '\n')
|
||||
break;
|
||||
|
@ -1403,7 +1403,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
} else {
|
||||
/* If scheme isn't 'openvz', then its for another driver */
|
||||
if (conn->uri->scheme == NULL ||
|
||||
STRNEQ (conn->uri->scheme, "openvz"))
|
||||
STRNEQ(conn->uri->scheme, "openvz"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
/* If server name is given, its for remote driver */
|
||||
@ -1412,7 +1412,7 @@ static virDrvOpenStatus openvzOpen(virConnectPtr conn,
|
||||
|
||||
/* If path isn't /system, then they typoed, so tell them correct path */
|
||||
if (conn->uri->path == NULL ||
|
||||
STRNEQ (conn->uri->path, "/system")) {
|
||||
STRNEQ(conn->uri->path, "/system")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected OpenVZ URI path '%s', try openvz:///system"),
|
||||
conn->uri->path);
|
||||
@ -1601,7 +1601,7 @@ out:
|
||||
VIR_FORCE_CLOSE(outfd);
|
||||
virCommandFree(cmd);
|
||||
if (rc < 0) {
|
||||
for ( ; got >= 0 ; got--)
|
||||
for (; got >= 0 ; got--)
|
||||
VIR_FREE(names[got]);
|
||||
}
|
||||
return rc;
|
||||
@ -1636,8 +1636,8 @@ Version: 2.2
|
||||
break;
|
||||
}
|
||||
|
||||
if (sscanf (line, "%d %llu %llu %llu",
|
||||
&readvps, &usertime, &nicetime, &systime) == 4
|
||||
if (sscanf(line, "%d %llu %llu %llu",
|
||||
&readvps, &usertime, &nicetime, &systime) == 4
|
||||
&& readvps == vpsid) { /*found vpsid*/
|
||||
/* convert jiffies to nanoseconds */
|
||||
*cpuTime = (1000ull * 1000ull * 1000ull
|
||||
@ -1942,9 +1942,9 @@ cleanup:
|
||||
}
|
||||
|
||||
static int
|
||||
openvzDomainInterfaceStats (virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
openvzDomainInterfaceStats(virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
{
|
||||
struct openvz_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -1972,7 +1972,7 @@ openvzDomainInterfaceStats (virDomainPtr dom,
|
||||
/* Check the path is one of the domain's network interfaces. */
|
||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||
if (vm->def->nets[i]->ifname &&
|
||||
STREQ (vm->def->nets[i]->ifname, path)) {
|
||||
STREQ(vm->def->nets[i]->ifname, path)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
|
@ -1089,7 +1089,7 @@ parallelsDomainGetAutostart(virDomainPtr domain, int *autostart)
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef int (*parallelsChangeStateFunc) (virDomainObjPtr privdom);
|
||||
typedef int (*parallelsChangeStateFunc)(virDomainObjPtr privdom);
|
||||
#define PARALLELS_UUID(x) (((parallelsDomObjPtr)(x->privateData))->uuid)
|
||||
|
||||
static int
|
||||
@ -1283,7 +1283,7 @@ parallelsApplySerialParams(virDomainChrDefPtr *oldserials, int nold,
|
||||
!STREQ_NULLABLE(oldserial->source.data.file.path,
|
||||
newserial->source.data.file.path))
|
||||
goto error;
|
||||
if(newserial->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
||||
if (newserial->source.type == VIR_DOMAIN_CHR_TYPE_UNIX &&
|
||||
(!STREQ_NULLABLE(oldserial->source.data.nix.path,
|
||||
newserial->source.data.nix.path) ||
|
||||
oldserial->source.data.nix.listen == newserial->source.data.nix.listen)) {
|
||||
|
@ -825,7 +825,7 @@ virCapsPtr qemuCapsInit(qemuCapsCachePtr cache)
|
||||
};
|
||||
|
||||
/* Really, this never fails - look at the man-page. */
|
||||
uname (&utsname);
|
||||
uname(&utsname);
|
||||
|
||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||
1, 1)) == NULL)
|
||||
@ -1558,7 +1558,7 @@ cleanup:
|
||||
|
||||
|
||||
static void
|
||||
uname_normalize (struct utsname *ut)
|
||||
uname_normalize(struct utsname *ut)
|
||||
{
|
||||
uname(ut);
|
||||
|
||||
|
@ -302,7 +302,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
||||
if (vm->def->blkio.weight != 0) {
|
||||
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_BLKIO)) {
|
||||
rc = virCgroupSetBlkioWeight(cgroup, vm->def->blkio.weight);
|
||||
if(rc != 0) {
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set io weight for domain %s"),
|
||||
vm->def->name);
|
||||
@ -391,7 +391,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
|
||||
if (vm->def->cputune.shares != 0) {
|
||||
if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||
rc = virCgroupSetCpuShares(cgroup, vm->def->cputune.shares);
|
||||
if(rc != 0) {
|
||||
if (rc != 0) {
|
||||
virReportSystemError(-rc,
|
||||
_("Unable to set io cpu shares for domain %s"),
|
||||
vm->def->name);
|
||||
|
@ -122,7 +122,7 @@ VIR_ENUM_IMPL(qemuDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST,
|
||||
|
||||
|
||||
static void
|
||||
uname_normalize (struct utsname *ut)
|
||||
uname_normalize(struct utsname *ut)
|
||||
{
|
||||
uname(ut);
|
||||
|
||||
@ -1837,7 +1837,7 @@ qemuBuildIoEventFdStr(virBufferPtr buf,
|
||||
static int
|
||||
qemuSafeSerialParamValue(const char *value)
|
||||
{
|
||||
if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen (value)) {
|
||||
if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen(value)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("driver serial '%s' contains unsafe characters"),
|
||||
value);
|
||||
@ -2686,9 +2686,9 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
|
||||
fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_DEFAULT) {
|
||||
if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_MAPPED) {
|
||||
virBufferAddLit(&opt, ",security_model=mapped");
|
||||
} else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
|
||||
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) {
|
||||
virBufferAddLit(&opt, ",security_model=passthrough");
|
||||
} else if(fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
|
||||
} else if (fs->accessmode == VIR_DOMAIN_FS_ACCESSMODE_SQUASH) {
|
||||
virBufferAddLit(&opt, ",security_model=none");
|
||||
}
|
||||
} else {
|
||||
@ -3631,7 +3631,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
bool telnet;
|
||||
|
||||
switch(dev->type) {
|
||||
switch (dev->type) {
|
||||
case VIR_DOMAIN_CHR_TYPE_NULL:
|
||||
virBufferAsprintf(&buf, "null,id=char%s", alias);
|
||||
break;
|
||||
@ -5728,7 +5728,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
char *addr;
|
||||
int port;
|
||||
|
||||
switch(channel->targetType) {
|
||||
switch (channel->targetType) {
|
||||
case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
|
||||
if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
|
||||
!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||
@ -5796,7 +5796,7 @@ qemuBuildCommandLine(virConnectPtr conn,
|
||||
virDomainChrDefPtr console = def->consoles[i];
|
||||
char *devstr;
|
||||
|
||||
switch(console->targetType) {
|
||||
switch (console->targetType) {
|
||||
case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
|
||||
if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
|
||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
@ -8408,7 +8408,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
||||
if (!(def->os.machine = strndup(val, params - val)))
|
||||
goto no_memory;
|
||||
|
||||
while(params++) {
|
||||
while (params++) {
|
||||
/* prepared for more "-machine" parameters */
|
||||
char *tmp = params;
|
||||
params = strchr(params, ',');
|
||||
@ -8581,7 +8581,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
||||
}
|
||||
} else if (STREQ(arg, "-watchdog")) {
|
||||
WANT_VALUE();
|
||||
int model = virDomainWatchdogModelTypeFromString (val);
|
||||
int model = virDomainWatchdogModelTypeFromString(val);
|
||||
|
||||
if (model != -1) {
|
||||
virDomainWatchdogDefPtr wd;
|
||||
@ -8593,7 +8593,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
|
||||
}
|
||||
} else if (STREQ(arg, "-watchdog-action") && def->watchdog) {
|
||||
WANT_VALUE();
|
||||
int action = virDomainWatchdogActionTypeFromString (val);
|
||||
int action = virDomainWatchdogActionTypeFromString(val);
|
||||
|
||||
if (action != -1)
|
||||
def->watchdog->action = action;
|
||||
|
@ -134,12 +134,12 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
/* Just check the file is readable before opening it, otherwise
|
||||
* libvirt emits an error.
|
||||
*/
|
||||
if (access (filename, R_OK) == -1) {
|
||||
if (access(filename, R_OK) == -1) {
|
||||
VIR_INFO("Could not read qemu config file %s", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
conf = virConfReadFile (filename, 0);
|
||||
conf = virConfReadFile(filename, 0);
|
||||
if (!conf) {
|
||||
return -1;
|
||||
}
|
||||
@ -153,20 +153,20 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
return -1; \
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "vnc_auto_unix_socket");
|
||||
CHECK_TYPE ("vnc_auto_unix_socket", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "vnc_auto_unix_socket");
|
||||
CHECK_TYPE("vnc_auto_unix_socket", VIR_CONF_LONG);
|
||||
if (p) driver->vncAutoUnixSocket = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "vnc_tls");
|
||||
CHECK_TYPE ("vnc_tls", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "vnc_tls");
|
||||
CHECK_TYPE("vnc_tls", VIR_CONF_LONG);
|
||||
if (p) driver->vncTLS = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "vnc_tls_x509_verify");
|
||||
CHECK_TYPE ("vnc_tls_x509_verify", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "vnc_tls_x509_verify");
|
||||
CHECK_TYPE("vnc_tls_x509_verify", VIR_CONF_LONG);
|
||||
if (p) driver->vncTLSx509verify = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "vnc_tls_x509_cert_dir");
|
||||
CHECK_TYPE ("vnc_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "vnc_tls_x509_cert_dir");
|
||||
CHECK_TYPE("vnc_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->vncTLSx509certdir);
|
||||
if (!(driver->vncTLSx509certdir = strdup(p->str))) {
|
||||
@ -176,8 +176,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "vnc_listen");
|
||||
CHECK_TYPE ("vnc_listen", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "vnc_listen");
|
||||
CHECK_TYPE("vnc_listen", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->vncListen);
|
||||
if (!(driver->vncListen = strdup(p->str))) {
|
||||
@ -187,8 +187,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "vnc_password");
|
||||
CHECK_TYPE ("vnc_password", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "vnc_password");
|
||||
CHECK_TYPE("vnc_password", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->vncPassword);
|
||||
if (!(driver->vncPassword = strdup(p->str))) {
|
||||
@ -198,7 +198,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "security_driver");
|
||||
p = virConfGetValue(conf, "security_driver");
|
||||
if (p && p->type == VIR_CONF_LIST) {
|
||||
size_t len;
|
||||
virConfValuePtr pp;
|
||||
@ -228,7 +228,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
driver->securityDriverNames[len] = NULL;
|
||||
} else {
|
||||
CHECK_TYPE ("security_driver", VIR_CONF_STRING);
|
||||
CHECK_TYPE("security_driver", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
if (VIR_ALLOC_N(driver->securityDriverNames, 2) < 0 ||
|
||||
!(driver->securityDriverNames[0] = strdup(p->str))) {
|
||||
@ -240,21 +240,21 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "security_default_confined");
|
||||
CHECK_TYPE ("security_default_confined", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "security_default_confined");
|
||||
CHECK_TYPE("security_default_confined", VIR_CONF_LONG);
|
||||
if (p) driver->securityDefaultConfined = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "security_require_confined");
|
||||
CHECK_TYPE ("security_require_confined", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "security_require_confined");
|
||||
CHECK_TYPE("security_require_confined", VIR_CONF_LONG);
|
||||
if (p) driver->securityRequireConfined = p->l;
|
||||
|
||||
|
||||
p = virConfGetValue (conf, "vnc_sasl");
|
||||
CHECK_TYPE ("vnc_sasl", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "vnc_sasl");
|
||||
CHECK_TYPE("vnc_sasl", VIR_CONF_LONG);
|
||||
if (p) driver->vncSASL = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "vnc_sasl_dir");
|
||||
CHECK_TYPE ("vnc_sasl_dir", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "vnc_sasl_dir");
|
||||
CHECK_TYPE("vnc_sasl_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->vncSASLdir);
|
||||
if (!(driver->vncSASLdir = strdup(p->str))) {
|
||||
@ -264,12 +264,12 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "spice_tls");
|
||||
CHECK_TYPE ("spice_tls", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "spice_tls");
|
||||
CHECK_TYPE("spice_tls", VIR_CONF_LONG);
|
||||
if (p) driver->spiceTLS = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "spice_tls_x509_cert_dir");
|
||||
CHECK_TYPE ("spice_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "spice_tls_x509_cert_dir");
|
||||
CHECK_TYPE("spice_tls_x509_cert_dir", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->spiceTLSx509certdir);
|
||||
if (!(driver->spiceTLSx509certdir = strdup(p->str))) {
|
||||
@ -279,8 +279,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "spice_listen");
|
||||
CHECK_TYPE ("spice_listen", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "spice_listen");
|
||||
CHECK_TYPE("spice_listen", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->spiceListen);
|
||||
if (!(driver->spiceListen = strdup(p->str))) {
|
||||
@ -290,8 +290,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "spice_password");
|
||||
CHECK_TYPE ("spice_password", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "spice_password");
|
||||
CHECK_TYPE("spice_password", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->spicePassword);
|
||||
if (!(driver->spicePassword = strdup(p->str))) {
|
||||
@ -301,8 +301,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "remote_display_port_min");
|
||||
CHECK_TYPE ("remote_display_port_min", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "remote_display_port_min");
|
||||
CHECK_TYPE("remote_display_port_min", VIR_CONF_LONG);
|
||||
if (p) {
|
||||
if (p->l < QEMU_REMOTE_PORT_MIN) {
|
||||
/* if the port is too low, we can't get the display name
|
||||
@ -317,8 +317,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
driver->remotePortMin = p->l;
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "remote_display_port_max");
|
||||
CHECK_TYPE ("remote_display_port_max", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "remote_display_port_max");
|
||||
CHECK_TYPE("remote_display_port_max", VIR_CONF_LONG);
|
||||
if (p) {
|
||||
if (p->l > QEMU_REMOTE_PORT_MAX ||
|
||||
p->l < driver->remotePortMin) {
|
||||
@ -342,8 +342,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
return -1;
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "user");
|
||||
CHECK_TYPE ("user", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "user");
|
||||
CHECK_TYPE("user", VIR_CONF_STRING);
|
||||
if (!(user = strdup(p && p->str ? p->str : QEMU_USER))) {
|
||||
virReportOOMError();
|
||||
virConfFree(conf);
|
||||
@ -357,8 +357,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
VIR_FREE(user);
|
||||
|
||||
|
||||
p = virConfGetValue (conf, "group");
|
||||
CHECK_TYPE ("group", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "group");
|
||||
CHECK_TYPE("group", VIR_CONF_STRING);
|
||||
if (!(group = strdup(p && p->str ? p->str : QEMU_GROUP))) {
|
||||
virReportOOMError();
|
||||
virConfFree(conf);
|
||||
@ -372,13 +372,13 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
VIR_FREE(group);
|
||||
|
||||
|
||||
p = virConfGetValue (conf, "dynamic_ownership");
|
||||
CHECK_TYPE ("dynamic_ownership", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "dynamic_ownership");
|
||||
CHECK_TYPE("dynamic_ownership", VIR_CONF_LONG);
|
||||
if (p) driver->dynamicOwnership = p->l;
|
||||
|
||||
|
||||
p = virConfGetValue (conf, "cgroup_controllers");
|
||||
CHECK_TYPE ("cgroup_controllers", VIR_CONF_LIST);
|
||||
p = virConfGetValue(conf, "cgroup_controllers");
|
||||
CHECK_TYPE("cgroup_controllers", VIR_CONF_LIST);
|
||||
if (p) {
|
||||
virConfValuePtr pp;
|
||||
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
|
||||
@ -412,8 +412,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "cgroup_device_acl");
|
||||
CHECK_TYPE ("cgroup_device_acl", VIR_CONF_LIST);
|
||||
p = virConfGetValue(conf, "cgroup_device_acl");
|
||||
CHECK_TYPE("cgroup_device_acl", VIR_CONF_LIST);
|
||||
if (p) {
|
||||
int len = 0;
|
||||
virConfValuePtr pp;
|
||||
@ -430,7 +430,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
virConfFree(conf);
|
||||
return -1;
|
||||
}
|
||||
driver->cgroupDeviceACL[i] = strdup (pp->str);
|
||||
driver->cgroupDeviceACL[i] = strdup(pp->str);
|
||||
if (driver->cgroupDeviceACL[i] == NULL) {
|
||||
virReportOOMError();
|
||||
virConfFree(conf);
|
||||
@ -441,8 +441,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
driver->cgroupDeviceACL[i] = NULL;
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "save_image_format");
|
||||
CHECK_TYPE ("save_image_format", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "save_image_format");
|
||||
CHECK_TYPE("save_image_format", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->saveImageFormat);
|
||||
if (!(driver->saveImageFormat = strdup(p->str))) {
|
||||
@ -452,8 +452,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "dump_image_format");
|
||||
CHECK_TYPE ("dump_image_format", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "dump_image_format");
|
||||
CHECK_TYPE("dump_image_format", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->dumpImageFormat);
|
||||
if (!(driver->dumpImageFormat = strdup(p->str))) {
|
||||
@ -463,8 +463,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "auto_dump_path");
|
||||
CHECK_TYPE ("auto_dump_path", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "auto_dump_path");
|
||||
CHECK_TYPE("auto_dump_path", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->autoDumpPath);
|
||||
if (!(driver->autoDumpPath = strdup(p->str))) {
|
||||
@ -474,16 +474,16 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "auto_dump_bypass_cache");
|
||||
CHECK_TYPE ("auto_dump_bypass_cache", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "auto_dump_bypass_cache");
|
||||
CHECK_TYPE("auto_dump_bypass_cache", VIR_CONF_LONG);
|
||||
if (p) driver->autoDumpBypassCache = true;
|
||||
|
||||
p = virConfGetValue (conf, "auto_start_bypass_cache");
|
||||
CHECK_TYPE ("auto_start_bypass_cache", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "auto_start_bypass_cache");
|
||||
CHECK_TYPE("auto_start_bypass_cache", VIR_CONF_LONG);
|
||||
if (p) driver->autoStartBypassCache = true;
|
||||
|
||||
p = virConfGetValue (conf, "hugetlbfs_mount");
|
||||
CHECK_TYPE ("hugetlbfs_mount", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "hugetlbfs_mount");
|
||||
CHECK_TYPE("hugetlbfs_mount", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->hugetlbfs_mount);
|
||||
if (!(driver->hugetlbfs_mount = strdup(p->str))) {
|
||||
@ -493,8 +493,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "mac_filter");
|
||||
CHECK_TYPE ("mac_filter", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "mac_filter");
|
||||
CHECK_TYPE("mac_filter", VIR_CONF_LONG);
|
||||
if (p && p->l) {
|
||||
driver->macFilter = p->l;
|
||||
if (!(driver->ebtables = ebtablesContextNew("qemu"))) {
|
||||
@ -515,24 +515,24 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "relaxed_acs_check");
|
||||
CHECK_TYPE ("relaxed_acs_check", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "relaxed_acs_check");
|
||||
CHECK_TYPE("relaxed_acs_check", VIR_CONF_LONG);
|
||||
if (p) driver->relaxedACS = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "vnc_allow_host_audio");
|
||||
CHECK_TYPE ("vnc_allow_host_audio", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "vnc_allow_host_audio");
|
||||
CHECK_TYPE("vnc_allow_host_audio", VIR_CONF_LONG);
|
||||
if (p) driver->vncAllowHostAudio = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "clear_emulator_capabilities");
|
||||
CHECK_TYPE ("clear_emulator_capabilities", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "clear_emulator_capabilities");
|
||||
CHECK_TYPE("clear_emulator_capabilities", VIR_CONF_LONG);
|
||||
if (p) driver->clearEmulatorCapabilities = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "allow_disk_format_probing");
|
||||
CHECK_TYPE ("allow_disk_format_probing", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "allow_disk_format_probing");
|
||||
CHECK_TYPE("allow_disk_format_probing", VIR_CONF_LONG);
|
||||
if (p) driver->allowDiskFormatProbing = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "set_process_name");
|
||||
CHECK_TYPE ("set_process_name", VIR_CONF_LONG);
|
||||
p = virConfGetValue(conf, "set_process_name");
|
||||
CHECK_TYPE("set_process_name", VIR_CONF_LONG);
|
||||
if (p) driver->setProcessName = p->l;
|
||||
|
||||
p = virConfGetValue(conf, "max_processes");
|
||||
@ -543,8 +543,8 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
CHECK_TYPE("max_files", VIR_CONF_LONG);
|
||||
if (p) driver->maxFiles = p->l;
|
||||
|
||||
p = virConfGetValue (conf, "lock_manager");
|
||||
CHECK_TYPE ("lock_manager", VIR_CONF_STRING);
|
||||
p = virConfGetValue(conf, "lock_manager");
|
||||
CHECK_TYPE("lock_manager", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
char *lockConf;
|
||||
virLockManagerPluginUnref(driver->lockManager);
|
||||
@ -575,7 +575,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
CHECK_TYPE("seccomp_sandbox", VIR_CONF_LONG);
|
||||
if (p) driver->seccompSandbox = p->l;
|
||||
|
||||
virConfFree (conf);
|
||||
virConfFree(conf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -635,7 +635,7 @@ qemudStartup(int privileged) {
|
||||
"%s/log/libvirt/qemu", LOCALSTATEDIR) == -1)
|
||||
goto out_of_memory;
|
||||
|
||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
||||
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||
goto out_of_memory;
|
||||
|
||||
if (virAsprintf(&qemu_driver->stateDir,
|
||||
@ -1085,15 +1085,15 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (qemu_driver->privileged) {
|
||||
if (STRNEQ (conn->uri->path, "/system") &&
|
||||
STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/system") &&
|
||||
STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected QEMU URI path '%s', try qemu:///system"),
|
||||
conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected QEMU URI path '%s', try qemu:///session"),
|
||||
conn->uri->path);
|
||||
@ -1121,7 +1121,7 @@ static int qemudClose(virConnectPtr conn) {
|
||||
|
||||
/* Which features are supported by this driver? */
|
||||
static int
|
||||
qemudSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
qemudSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case VIR_DRV_FEATURE_MIGRATION_V2:
|
||||
@ -8704,9 +8704,9 @@ cleanup:
|
||||
|
||||
#ifdef __linux__
|
||||
static int
|
||||
qemudDomainInterfaceStats (virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
qemudDomainInterfaceStats(virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -8734,7 +8734,7 @@ qemudDomainInterfaceStats (virDomainPtr dom,
|
||||
/* Check the path is one of the domain's network interfaces. */
|
||||
for (i = 0 ; i < vm->def->nnets ; i++) {
|
||||
if (vm->def->nets[i]->ifname &&
|
||||
STREQ (vm->def->nets[i]->ifname, path)) {
|
||||
STREQ(vm->def->nets[i]->ifname, path)) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
@ -8753,9 +8753,9 @@ cleanup:
|
||||
}
|
||||
#else
|
||||
static int
|
||||
qemudDomainInterfaceStats (virDomainPtr dom,
|
||||
const char *path ATTRIBUTE_UNUSED,
|
||||
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
|
||||
qemudDomainInterfaceStats(virDomainPtr dom,
|
||||
const char *path ATTRIBUTE_UNUSED,
|
||||
struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("interface stats not implemented on this platform"));
|
||||
@ -8991,7 +8991,7 @@ qemuDomainGetInterfaceParameters(virDomainPtr dom,
|
||||
}
|
||||
|
||||
for (i = 0; i < *nparams && i < QEMU_NB_BANDWIDTH_PARAM; i++) {
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0: /* inbound.average */
|
||||
if (virTypedParameterAssign(¶ms[i],
|
||||
VIR_DOMAIN_BANDWIDTH_IN_AVERAGE,
|
||||
@ -9060,10 +9060,10 @@ cleanup:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudDomainMemoryStats (virDomainPtr dom,
|
||||
struct _virDomainMemoryStat *stats,
|
||||
unsigned int nr_stats,
|
||||
unsigned int flags)
|
||||
qemudDomainMemoryStats(virDomainPtr dom,
|
||||
struct _virDomainMemoryStat *stats,
|
||||
unsigned int nr_stats,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -9119,11 +9119,11 @@ cleanup:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudDomainBlockPeek (virDomainPtr dom,
|
||||
const char *path,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer,
|
||||
unsigned int flags)
|
||||
qemudDomainBlockPeek(virDomainPtr dom,
|
||||
const char *path,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -9187,10 +9187,10 @@ cleanup:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudDomainMemoryPeek (virDomainPtr dom,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer,
|
||||
unsigned int flags)
|
||||
qemudDomainMemoryPeek(virDomainPtr dom,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer,
|
||||
unsigned int flags)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -9570,16 +9570,16 @@ cleanup:
|
||||
*
|
||||
* This starts an empty VM listening on a TCP port.
|
||||
*/
|
||||
static int ATTRIBUTE_NONNULL (5)
|
||||
qemudDomainMigratePrepare2 (virConnectPtr dconn,
|
||||
char **cookie ATTRIBUTE_UNUSED,
|
||||
int *cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri_in,
|
||||
char **uri_out,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource ATTRIBUTE_UNUSED,
|
||||
const char *dom_xml)
|
||||
static int ATTRIBUTE_NONNULL(5)
|
||||
qemudDomainMigratePrepare2(virConnectPtr dconn,
|
||||
char **cookie ATTRIBUTE_UNUSED,
|
||||
int *cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri_in,
|
||||
char **uri_out,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource ATTRIBUTE_UNUSED,
|
||||
const char *dom_xml)
|
||||
{
|
||||
struct qemud_driver *driver = dconn->privateData;
|
||||
int ret = -1;
|
||||
@ -9629,13 +9629,13 @@ cleanup:
|
||||
|
||||
/* Perform is the second step, and it runs on the source host. */
|
||||
static int
|
||||
qemudDomainMigratePerform (virDomainPtr dom,
|
||||
const char *cookie,
|
||||
int cookielen,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource)
|
||||
qemudDomainMigratePerform(virDomainPtr dom,
|
||||
const char *cookie,
|
||||
int cookielen,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long resource)
|
||||
{
|
||||
struct qemud_driver *driver = dom->conn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -9685,13 +9685,13 @@ cleanup:
|
||||
|
||||
/* Finish is the third and final step, and it runs on the destination host. */
|
||||
static virDomainPtr
|
||||
qemudDomainMigrateFinish2 (virConnectPtr dconn,
|
||||
const char *dname,
|
||||
const char *cookie ATTRIBUTE_UNUSED,
|
||||
int cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri ATTRIBUTE_UNUSED,
|
||||
unsigned long flags,
|
||||
int retcode)
|
||||
qemudDomainMigrateFinish2(virConnectPtr dconn,
|
||||
const char *dname,
|
||||
const char *cookie ATTRIBUTE_UNUSED,
|
||||
int cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri ATTRIBUTE_UNUSED,
|
||||
unsigned long flags,
|
||||
int retcode)
|
||||
{
|
||||
struct qemud_driver *driver = dconn->privateData;
|
||||
virDomainObjPtr vm;
|
||||
@ -10043,11 +10043,11 @@ cleanup:
|
||||
|
||||
|
||||
static int
|
||||
qemudNodeDeviceGetPciInfo (virNodeDevicePtr dev,
|
||||
unsigned *domain,
|
||||
unsigned *bus,
|
||||
unsigned *slot,
|
||||
unsigned *function)
|
||||
qemudNodeDeviceGetPciInfo(virNodeDevicePtr dev,
|
||||
unsigned *domain,
|
||||
unsigned *bus,
|
||||
unsigned *slot,
|
||||
unsigned *function)
|
||||
{
|
||||
virNodeDeviceDefPtr def = NULL;
|
||||
virNodeDevCapsDefPtr cap;
|
||||
@ -10089,7 +10089,7 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudNodeDeviceDettach (virNodeDevicePtr dev)
|
||||
qemudNodeDeviceDettach(virNodeDevicePtr dev)
|
||||
{
|
||||
struct qemud_driver *driver = dev->conn->privateData;
|
||||
pciDevice *pci;
|
||||
@ -10120,7 +10120,7 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudNodeDeviceReAttach (virNodeDevicePtr dev)
|
||||
qemudNodeDeviceReAttach(virNodeDevicePtr dev)
|
||||
{
|
||||
struct qemud_driver *driver = dev->conn->privateData;
|
||||
pciDevice *pci;
|
||||
@ -10164,7 +10164,7 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
qemudNodeDeviceReset (virNodeDevicePtr dev)
|
||||
qemudNodeDeviceReset(virNodeDevicePtr dev)
|
||||
{
|
||||
struct qemud_driver *driver = dev->conn->privateData;
|
||||
pciDevice *pci;
|
||||
@ -13580,7 +13580,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom,
|
||||
for (i = 0; i < QEMU_NB_BLOCK_IO_TUNE_PARAM && i < *nparams; i++) {
|
||||
virTypedParameterPtr param = ¶ms[i];
|
||||
|
||||
switch(i) {
|
||||
switch (i) {
|
||||
case 0:
|
||||
if (virTypedParameterAssign(param,
|
||||
VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC,
|
||||
|
@ -268,7 +268,7 @@ qemuDomainHostdevNetConfigVirtPortProfile(const char *linkdev, int vf,
|
||||
if (!virtPort)
|
||||
return ret;
|
||||
|
||||
switch(virtPort->virtPortType) {
|
||||
switch (virtPort->virtPortType) {
|
||||
case VIR_NETDEV_VPORT_PROFILE_NONE:
|
||||
case VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH:
|
||||
case VIR_NETDEV_VPORT_PROFILE_8021QBG:
|
||||
|
@ -491,7 +491,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
|
||||
/* Tell clang that "cont" is non-NULL.
|
||||
This is because disk->info.addr.driver.controller is unsigned,
|
||||
and hence the above loop must iterate at least once. */
|
||||
sa_assert (cont);
|
||||
sa_assert(cont);
|
||||
|
||||
if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -715,7 +715,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
|
||||
*/
|
||||
if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
|
||||
driver->privileged ||
|
||||
(!qemuCapsGet (priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
||||
(!qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
|
||||
if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
|
||||
priv->caps)) < 0)
|
||||
goto cleanup;
|
||||
@ -1097,7 +1097,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
|
||||
usbDevice *usb;
|
||||
qemuCgroupData data;
|
||||
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
|
||||
if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) != 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Unable to find cgroup for %s"),
|
||||
vm->def->name);
|
||||
@ -2415,7 +2415,7 @@ int qemuDomainDetachHostDevice(struct qemud_driver *driver,
|
||||
idx = virDomainHostdevFind(vm->def, hostdev, &detach);
|
||||
|
||||
if (idx < 0) {
|
||||
switch(subsys->type) {
|
||||
switch (subsys->type) {
|
||||
case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
|
||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("host pci device %.4x:%.2x:%.2x.%.1x not found"),
|
||||
|
@ -1794,7 +1794,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
||||
* URI when passing it to the qemu monitor, so bad
|
||||
* characters in hostname part don't matter.
|
||||
*/
|
||||
if (!STRPREFIX (uri_in, "tcp:")) {
|
||||
if (!STRPREFIX(uri_in, "tcp:")) {
|
||||
virReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
_("only tcp URIs are supported for KVM/QEMU"
|
||||
" migrations"));
|
||||
@ -1802,7 +1802,7 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
||||
}
|
||||
|
||||
/* Get the port number. */
|
||||
p = strrchr (uri_in, ':');
|
||||
p = strrchr(uri_in, ':');
|
||||
if (p == strchr(uri_in, ':')) {
|
||||
/* Generate a port */
|
||||
this_port = QEMUD_MIGRATION_FIRST_PORT + port++;
|
||||
@ -1817,8 +1817,8 @@ qemuMigrationPrepareDirect(struct qemud_driver *driver,
|
||||
|
||||
} else {
|
||||
p++; /* definitely has a ':' in it, see above */
|
||||
this_port = virParseNumber (&p);
|
||||
if (this_port == -1 || p-uri_in != strlen (uri_in)) {
|
||||
this_port = virParseNumber(&p);
|
||||
if (this_port == -1 || p-uri_in != strlen(uri_in)) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("URI ended with incorrect ':port'"));
|
||||
goto cleanup;
|
||||
@ -3338,7 +3338,7 @@ qemuMigrationFinish(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
dom = virGetDomain (dconn, vm->def->name, vm->def->uuid);
|
||||
dom = virGetDomain(dconn, vm->def->name, vm->def->uuid);
|
||||
|
||||
event = virDomainEventNewFromObj(vm,
|
||||
VIR_DOMAIN_EVENT_RESUMED,
|
||||
|
@ -132,7 +132,7 @@ char *qemuMonitorEscapeArg(const char *in)
|
||||
*/
|
||||
|
||||
for (i = 0; in[i] != '\0'; i++) {
|
||||
switch(in[i]) {
|
||||
switch (in[i]) {
|
||||
case '\r':
|
||||
case '\n':
|
||||
case '"':
|
||||
@ -149,7 +149,7 @@ char *qemuMonitorEscapeArg(const char *in)
|
||||
return NULL;
|
||||
|
||||
for (i = j = 0; in[i] != '\0'; i++) {
|
||||
switch(in[i]) {
|
||||
switch (in[i]) {
|
||||
case '\r':
|
||||
out[j++] = '\\';
|
||||
out[j++] = 'r';
|
||||
@ -187,7 +187,7 @@ char *qemuMonitorUnescapeArg(const char *in)
|
||||
next = in[i];
|
||||
if (in[i] == '\\') {
|
||||
++i;
|
||||
switch(in[i]) {
|
||||
switch (in[i]) {
|
||||
case 'r':
|
||||
next = '\r';
|
||||
break;
|
||||
|
@ -609,10 +609,10 @@ static int parseMemoryStat(char **text, unsigned int tag,
|
||||
char *dummy;
|
||||
unsigned long long value;
|
||||
|
||||
if (STRPREFIX (*text, search)) {
|
||||
if (STRPREFIX(*text, search)) {
|
||||
*text += strlen(search);
|
||||
if (virStrToLong_ull (*text, &dummy, 10, &value)) {
|
||||
VIR_DEBUG ("error reading %s: %s", search, *text);
|
||||
if (virStrToLong_ull(*text, &dummy, 10, &value)) {
|
||||
VIR_DEBUG("error reading %s: %s", search, *text);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -675,7 +675,7 @@ static int qemuMonitorParseBalloonInfo(char *text,
|
||||
*/
|
||||
if (*p == ',')
|
||||
p++;
|
||||
p = strchr (p, ',');
|
||||
p = strchr(p, ',');
|
||||
if (!p) break;
|
||||
}
|
||||
return nr_stats_found;
|
||||
@ -877,7 +877,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *p, *eol;
|
||||
int devnamelen = strlen(dev_name);
|
||||
|
||||
if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
|
||||
if (qemuMonitorHMPCommand(mon, "info blockstats", &info) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* If the command isn't supported then qemu prints the supported
|
||||
@ -919,58 +919,58 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
|
||||
p += strlen(QEMU_DRIVE_HOST_PREFIX);
|
||||
|
||||
if (STREQLEN (p, dev_name, devnamelen)
|
||||
if (STREQLEN(p, dev_name, devnamelen)
|
||||
&& p[devnamelen] == ':' && p[devnamelen+1] == ' ') {
|
||||
|
||||
eol = strchr (p, '\n');
|
||||
eol = strchr(p, '\n');
|
||||
if (!eol)
|
||||
eol = p + strlen (p);
|
||||
eol = p + strlen(p);
|
||||
|
||||
p += devnamelen+2; /* Skip to first label. */
|
||||
|
||||
while (*p) {
|
||||
if (STRPREFIX (p, "rd_bytes=")) {
|
||||
if (STRPREFIX(p, "rd_bytes=")) {
|
||||
p += strlen("rd_bytes=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, rd_bytes) == -1)
|
||||
VIR_DEBUG ("error reading rd_bytes: %s", p);
|
||||
} else if (STRPREFIX (p, "wr_bytes=")) {
|
||||
if (virStrToLong_ll(p, &dummy, 10, rd_bytes) == -1)
|
||||
VIR_DEBUG("error reading rd_bytes: %s", p);
|
||||
} else if (STRPREFIX(p, "wr_bytes=")) {
|
||||
p += strlen("wr_bytes=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, wr_bytes) == -1)
|
||||
VIR_DEBUG ("error reading wr_bytes: %s", p);
|
||||
} else if (STRPREFIX (p, "rd_operations=")) {
|
||||
if (virStrToLong_ll(p, &dummy, 10, wr_bytes) == -1)
|
||||
VIR_DEBUG("error reading wr_bytes: %s", p);
|
||||
} else if (STRPREFIX(p, "rd_operations=")) {
|
||||
p += strlen("rd_operations=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, rd_req) == -1)
|
||||
VIR_DEBUG ("error reading rd_req: %s", p);
|
||||
} else if (STRPREFIX (p, "wr_operations=")) {
|
||||
if (virStrToLong_ll(p, &dummy, 10, rd_req) == -1)
|
||||
VIR_DEBUG("error reading rd_req: %s", p);
|
||||
} else if (STRPREFIX(p, "wr_operations=")) {
|
||||
p += strlen("wr_operations=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, wr_req) == -1)
|
||||
VIR_DEBUG ("error reading wr_req: %s", p);
|
||||
if (virStrToLong_ll(p, &dummy, 10, wr_req) == -1)
|
||||
VIR_DEBUG("error reading wr_req: %s", p);
|
||||
} else if (rd_total_times &&
|
||||
STRPREFIX (p, "rd_total_time_ns=")) {
|
||||
STRPREFIX(p, "rd_total_time_ns=")) {
|
||||
p += strlen("rd_total_time_ns=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, rd_total_times) == -1)
|
||||
VIR_DEBUG ("error reading rd_total_times: %s", p);
|
||||
if (virStrToLong_ll(p, &dummy, 10, rd_total_times) == -1)
|
||||
VIR_DEBUG("error reading rd_total_times: %s", p);
|
||||
} else if (wr_total_times &&
|
||||
STRPREFIX (p, "wr_total_time_ns=")) {
|
||||
STRPREFIX(p, "wr_total_time_ns=")) {
|
||||
p += strlen("wr_total_time_ns=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, wr_total_times) == -1)
|
||||
VIR_DEBUG ("error reading wr_total_times: %s", p);
|
||||
if (virStrToLong_ll(p, &dummy, 10, wr_total_times) == -1)
|
||||
VIR_DEBUG("error reading wr_total_times: %s", p);
|
||||
} else if (flush_req &&
|
||||
STRPREFIX (p, "flush_operations=")) {
|
||||
STRPREFIX(p, "flush_operations=")) {
|
||||
p += strlen("flush_operations=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, flush_req) == -1)
|
||||
VIR_DEBUG ("error reading flush_req: %s", p);
|
||||
if (virStrToLong_ll(p, &dummy, 10, flush_req) == -1)
|
||||
VIR_DEBUG("error reading flush_req: %s", p);
|
||||
} else if (flush_total_times &&
|
||||
STRPREFIX (p, "flush_total_time_ns=")) {
|
||||
STRPREFIX(p, "flush_total_time_ns=")) {
|
||||
p += strlen("flush_total_time_ns=");
|
||||
if (virStrToLong_ll (p, &dummy, 10, flush_total_times) == -1)
|
||||
VIR_DEBUG ("error reading flush_total_times: %s", p);
|
||||
if (virStrToLong_ll(p, &dummy, 10, flush_total_times) == -1)
|
||||
VIR_DEBUG("error reading flush_total_times: %s", p);
|
||||
} else {
|
||||
VIR_DEBUG ("unknown block stat near %s", p);
|
||||
VIR_DEBUG("unknown block stat near %s", p);
|
||||
}
|
||||
|
||||
/* Skip to next label. */
|
||||
p = strchr (p, ' ');
|
||||
p = strchr(p, ' ');
|
||||
if (!p || p >= eol) break;
|
||||
p++;
|
||||
}
|
||||
@ -979,14 +979,14 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
/* Skip to next line. */
|
||||
p = strchr (p, '\n');
|
||||
p = strchr(p, '\n');
|
||||
if (!p) break;
|
||||
p++;
|
||||
}
|
||||
|
||||
/* If we reach here then the device was not found. */
|
||||
virReportError (VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), dev_name);
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), dev_name);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(info);
|
||||
@ -1001,7 +1001,7 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
int num = 0;
|
||||
const char *p, *eol;
|
||||
|
||||
if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0)
|
||||
if (qemuMonitorHMPCommand(mon, "info blockstats", &info) < 0)
|
||||
goto cleanup;
|
||||
|
||||
/* If the command isn't supported then qemu prints the supported
|
||||
@ -1023,9 +1023,9 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
*/
|
||||
p = info;
|
||||
|
||||
eol = strchr (p, '\n');
|
||||
eol = strchr(p, '\n');
|
||||
if (!eol)
|
||||
eol = p + strlen (p);
|
||||
eol = p + strlen(p);
|
||||
|
||||
/* Skip the device name and following ":", and spaces (e.g.
|
||||
* "floppy0: ")
|
||||
@ -1033,17 +1033,17 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
p = strchr(p, ' ');
|
||||
|
||||
while (p && p < eol) {
|
||||
if (STRPREFIX (p, " rd_bytes=") ||
|
||||
STRPREFIX (p, " wr_bytes=") ||
|
||||
STRPREFIX (p, " rd_operations=") ||
|
||||
STRPREFIX (p, " wr_operations=") ||
|
||||
STRPREFIX (p, " rd_total_time_ns=") ||
|
||||
STRPREFIX (p, " wr_total_time_ns=") ||
|
||||
STRPREFIX (p, " flush_operations=") ||
|
||||
STRPREFIX (p, " flush_total_time_ns=")) {
|
||||
if (STRPREFIX(p, " rd_bytes=") ||
|
||||
STRPREFIX(p, " wr_bytes=") ||
|
||||
STRPREFIX(p, " rd_operations=") ||
|
||||
STRPREFIX(p, " wr_operations=") ||
|
||||
STRPREFIX(p, " rd_total_time_ns=") ||
|
||||
STRPREFIX(p, " wr_total_time_ns=") ||
|
||||
STRPREFIX(p, " flush_operations=") ||
|
||||
STRPREFIX(p, " flush_total_time_ns=")) {
|
||||
num++;
|
||||
} else {
|
||||
VIR_DEBUG ("unknown block stat near %s", p);
|
||||
VIR_DEBUG("unknown block stat near %s", p);
|
||||
}
|
||||
|
||||
/* Skip to next label. */
|
||||
@ -3232,7 +3232,7 @@ qemuMonitorTextParseBlockIoThrottle(const char *result,
|
||||
}
|
||||
|
||||
/* Skip to next label. */
|
||||
p = strchr (p, ' ');
|
||||
p = strchr(p, ' ');
|
||||
if (!p || p >= eol)
|
||||
break;
|
||||
p++;
|
||||
@ -3242,7 +3242,7 @@ qemuMonitorTextParseBlockIoThrottle(const char *result,
|
||||
}
|
||||
|
||||
/* Skip to next line. */
|
||||
p = strchr (p, '\n');
|
||||
p = strchr(p, '\n');
|
||||
if (!p)
|
||||
break;
|
||||
p++;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -754,14 +754,14 @@ int virNetClientSetTLSSession(virNetClientPtr client,
|
||||
struct pollfd fds[1];
|
||||
sigset_t oldmask, blockedsigs;
|
||||
|
||||
sigemptyset (&blockedsigs);
|
||||
sigemptyset(&blockedsigs);
|
||||
#ifdef SIGWINCH
|
||||
sigaddset (&blockedsigs, SIGWINCH);
|
||||
sigaddset(&blockedsigs, SIGWINCH);
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
sigaddset (&blockedsigs, SIGCHLD);
|
||||
sigaddset(&blockedsigs, SIGCHLD);
|
||||
#endif
|
||||
sigaddset (&blockedsigs, SIGPIPE);
|
||||
sigaddset(&blockedsigs, SIGPIPE);
|
||||
|
||||
virNetClientLock(client);
|
||||
|
||||
@ -1510,14 +1510,14 @@ static int virNetClientIOEventLoop(virNetClientPtr client,
|
||||
* after the call (RHBZ#567931). Same for SIGCHLD and SIGPIPE
|
||||
* at the suggestion of Paolo Bonzini and Daniel Berrange.
|
||||
*/
|
||||
sigemptyset (&blockedsigs);
|
||||
sigemptyset(&blockedsigs);
|
||||
#ifdef SIGWINCH
|
||||
sigaddset (&blockedsigs, SIGWINCH);
|
||||
sigaddset(&blockedsigs, SIGWINCH);
|
||||
#endif
|
||||
#ifdef SIGCHLD
|
||||
sigaddset (&blockedsigs, SIGCHLD);
|
||||
sigaddset(&blockedsigs, SIGCHLD);
|
||||
#endif
|
||||
sigaddset (&blockedsigs, SIGPIPE);
|
||||
sigaddset(&blockedsigs, SIGPIPE);
|
||||
ignore_value(pthread_sigmask(SIG_BLOCK, &blockedsigs, &oldmask));
|
||||
|
||||
repoll:
|
||||
|
@ -147,7 +147,7 @@ int virNetSASLContextCheckIdentity(virNetSASLContextPtr ctxt,
|
||||
}
|
||||
|
||||
while (*wildcards) {
|
||||
int rv = fnmatch (*wildcards, identity, 0);
|
||||
int rv = fnmatch(*wildcards, identity, 0);
|
||||
if (rv == 0) {
|
||||
ret = 1;
|
||||
goto cleanup; /* Successful match */
|
||||
|
@ -1196,7 +1196,7 @@ virNetServerClientDispatchHandshake(virNetServerClientPtr client)
|
||||
/* Carry on waiting for more handshake. Update
|
||||
the events just in case handshake data flow
|
||||
direction has changed */
|
||||
virNetServerClientUpdateEvent (client);
|
||||
virNetServerClientUpdateEvent(client);
|
||||
} else {
|
||||
/* Fatal error in handshake */
|
||||
client->wantClose = true;
|
||||
|
@ -453,7 +453,7 @@ int virNetSocketNewConnectTCP(const char *nodename,
|
||||
if (e != 0) {
|
||||
virReportError(VIR_ERR_SYSTEM_ERROR,
|
||||
_("Unable to resolve address '%s' service '%s': %s"),
|
||||
nodename, service, gai_strerror (e));
|
||||
nodename, service, gai_strerror(e));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -373,7 +373,7 @@ virNetTLSContextCheckCertDNWhitelist(const char *dname,
|
||||
const char *const*wildcards)
|
||||
{
|
||||
while (*wildcards) {
|
||||
int ret = fnmatch (*wildcards, dname, 0);
|
||||
int ret = fnmatch(*wildcards, dname, 0);
|
||||
if (ret == 0) /* Successful match */
|
||||
return 1;
|
||||
if (ret != FNM_NOMATCH) {
|
||||
@ -600,7 +600,7 @@ static int virNetTLSContextLoadCredentials(virNetTLSContextPtr ctxt,
|
||||
if (err < 0) {
|
||||
virReportError(VIR_ERR_SYSTEM_ERROR,
|
||||
_("Unable to set x509 CA certificate: %s: %s"),
|
||||
cacert, gnutls_strerror (err));
|
||||
cacert, gnutls_strerror(err));
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
@ -911,7 +911,7 @@ virSecurityDACGenLabel(virSecurityManagerPtr mgr,
|
||||
return rc;
|
||||
}
|
||||
|
||||
switch(seclabel->type) {
|
||||
switch (seclabel->type) {
|
||||
case VIR_DOMAIN_SECLABEL_STATIC:
|
||||
if (seclabel->label == NULL) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -546,7 +546,7 @@ virSecuritySELinuxGenSecurityLabel(virSecurityManagerPtr mgr,
|
||||
|
||||
switch (seclabel->type) {
|
||||
case VIR_DOMAIN_SECLABEL_STATIC:
|
||||
if (!(ctx = context_new(seclabel->label)) ) {
|
||||
if (!(ctx = context_new(seclabel->label))) {
|
||||
virReportSystemError(errno,
|
||||
_("unable to allocate socket security context '%s'"),
|
||||
seclabel->label);
|
||||
|
@ -121,7 +121,7 @@ virSecurityStackVerify(virSecurityManagerPtr mgr,
|
||||
virSecurityStackItemPtr item = priv->itemsHead;
|
||||
int rc = 0;
|
||||
|
||||
for(; item; item = item->next) {
|
||||
for (; item; item = item->next) {
|
||||
if (virSecurityManagerVerify(item->securityManager, def) < 0) {
|
||||
rc = -1;
|
||||
break;
|
||||
|
@ -678,7 +678,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
|
||||
struct utsname utsname;
|
||||
|
||||
/* Really, this never fails - look at the man-page. */
|
||||
uname (&utsname);
|
||||
uname(&utsname);
|
||||
if ((ctl->arch = strdup(utsname.machine)) == NULL) {
|
||||
vah_error(ctl, 0, _("could not allocate memory"));
|
||||
goto cleanup;
|
||||
@ -692,7 +692,7 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
|
||||
rc = 0;
|
||||
|
||||
cleanup:
|
||||
xmlFreeDoc (xml);
|
||||
xmlFreeDoc(xml);
|
||||
xmlXPathFreeContext(ctxt);
|
||||
|
||||
return rc;
|
||||
|
@ -105,7 +105,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* return the geometry of the disk and then exit */
|
||||
if(cmd == DISK_GEOMETRY) {
|
||||
if (cmd == DISK_GEOMETRY) {
|
||||
printf("%d%c%d%c%d%c",
|
||||
dev->hw_geom.cylinders, '\0',
|
||||
dev->hw_geom.heads, '\0',
|
||||
@ -158,7 +158,7 @@ int main(int argc, char **argv)
|
||||
type, '\0',
|
||||
content, '\0',
|
||||
part->geom.start * dev->sector_size, '\0',
|
||||
(part->geom.end + 1 ) * dev->sector_size, '\0',
|
||||
(part->geom.end + 1) * dev->sector_size, '\0',
|
||||
part->geom.length * dev->sector_size, '\0');
|
||||
} else {
|
||||
printf("%s%c%s%c%s%c%llu%c%llu%c%llu%c",
|
||||
@ -166,7 +166,7 @@ int main(int argc, char **argv)
|
||||
type, '\0',
|
||||
content, '\0',
|
||||
part->geom.start * dev->sector_size, '\0',
|
||||
(part->geom.end + 1 ) * dev->sector_size, '\0',
|
||||
(part->geom.end + 1) * dev->sector_size, '\0',
|
||||
part->geom.length * dev->sector_size, '\0');
|
||||
}
|
||||
part = ped_disk_next_partition(disk, part);
|
||||
|
@ -128,7 +128,7 @@ enum {
|
||||
#define READ_BLOCK_SIZE_DEFAULT (1024 * 1024)
|
||||
#define WRITE_BLOCK_SIZE_DEFAULT (4 * 1024)
|
||||
|
||||
static int ATTRIBUTE_NONNULL (2)
|
||||
static int ATTRIBUTE_NONNULL(2)
|
||||
virStorageBackendCopyToFD(virStorageVolDefPtr vol,
|
||||
virStorageVolDefPtr inputvol,
|
||||
int fd,
|
||||
@ -1625,18 +1625,18 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool,
|
||||
size_t buf_len = 0;
|
||||
/* Be careful: even when it returns -1,
|
||||
this use of getdelim allocates memory. */
|
||||
ssize_t tok_len = getdelim (&buf, &buf_len, 0, fp);
|
||||
ssize_t tok_len = getdelim(&buf, &buf_len, 0, fp);
|
||||
v[n_tok] = buf;
|
||||
if (tok_len < 0) {
|
||||
/* Maybe EOF, maybe an error.
|
||||
If n_tok > 0, then we know it's an error. */
|
||||
if (n_tok && func (pool, n_tok, v, data) < 0)
|
||||
if (n_tok && func(pool, n_tok, v, data) < 0)
|
||||
goto cleanup;
|
||||
break;
|
||||
}
|
||||
++n_tok;
|
||||
if (n_tok == n_columns) {
|
||||
if (func (pool, n_tok, v, data) < 0)
|
||||
if (func(pool, n_tok, v, data) < 0)
|
||||
goto cleanup;
|
||||
n_tok = 0;
|
||||
for (i = 0; i < n_columns; i++) {
|
||||
|
@ -365,7 +365,7 @@ virStorageBackendDiskFindLabel(const char* device)
|
||||
/* if parted succeeds we have a valid partition table */
|
||||
ret = virCommandRun(cmd, NULL);
|
||||
if (ret < 0) {
|
||||
if (strstr (output, "unrecognised disk label"))
|
||||
if (strstr(output, "unrecognised disk label"))
|
||||
ret = 1;
|
||||
}
|
||||
|
||||
@ -410,7 +410,7 @@ virStorageBackendDiskBuildPool(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
else {
|
||||
int check;
|
||||
|
||||
check = virStorageBackendDiskFindLabel (
|
||||
check = virStorageBackendDiskFindLabel(
|
||||
pool->def->source.devices[0].path);
|
||||
if (check > 0) {
|
||||
ok_to_mklabel = true;
|
||||
|
@ -406,16 +406,16 @@ virStorageBackendFileSystemMount(virStoragePoolObjPtr pool) {
|
||||
pool->def->target.path,
|
||||
NULL);
|
||||
else if (glusterfs)
|
||||
cmd = virCommandNewArgList( MOUNT,
|
||||
"-t",
|
||||
(pool->def->type == VIR_STORAGE_POOL_FS ?
|
||||
virStoragePoolFormatFileSystemTypeToString(pool->def->source.format) :
|
||||
virStoragePoolFormatFileSystemNetTypeToString(pool->def->source.format)),
|
||||
src,
|
||||
"-o",
|
||||
"direct-io-mode=1",
|
||||
pool->def->target.path,
|
||||
NULL);
|
||||
cmd = virCommandNewArgList(MOUNT,
|
||||
"-t",
|
||||
(pool->def->type == VIR_STORAGE_POOL_FS ?
|
||||
virStoragePoolFormatFileSystemTypeToString(pool->def->source.format) :
|
||||
virStoragePoolFormatFileSystemNetTypeToString(pool->def->source.format)),
|
||||
src,
|
||||
"-o",
|
||||
"direct-io-mode=1",
|
||||
pool->def->target.path,
|
||||
NULL);
|
||||
else
|
||||
cmd = virCommandNewArgList(MOUNT,
|
||||
"-t",
|
||||
|
@ -287,7 +287,7 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool)
|
||||
|
||||
out:
|
||||
if (dmt != NULL) {
|
||||
dm_task_destroy (dmt);
|
||||
dm_task_destroy(dmt);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ storageDriverStartup(int privileged)
|
||||
storageDriverLock(driverState);
|
||||
|
||||
if (privileged) {
|
||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
||||
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||
goto out_of_memory;
|
||||
} else {
|
||||
base = virGetUserConfigDirectory();
|
||||
|
@ -336,7 +336,7 @@ testDomainGenerateIfname(virDomainDefPtr domdef) {
|
||||
/* Generate network interface names */
|
||||
for (i = 0 ; i < domdef->nnets ; i++) {
|
||||
if (domdef->nets[i]->ifname &&
|
||||
STREQ (domdef->nets[i]->ifname, ifname)) {
|
||||
STREQ(domdef->nets[i]->ifname, ifname)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@ -1175,7 +1175,7 @@ static int testClose(virConnectPtr conn)
|
||||
testDriverUnlock(privconn);
|
||||
virMutexDestroy(&privconn->lock);
|
||||
|
||||
VIR_FREE (privconn);
|
||||
VIR_FREE(privconn);
|
||||
conn->privateData = NULL;
|
||||
return 0;
|
||||
}
|
||||
@ -1218,7 +1218,7 @@ static int testNodeGetInfo(virConnectPtr conn,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *testGetCapabilities (virConnectPtr conn)
|
||||
static char *testGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
testConnPtr privconn = conn->privateData;
|
||||
char *xml;
|
||||
@ -1416,9 +1416,9 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int testListDomains (virConnectPtr conn,
|
||||
int *ids,
|
||||
int maxids)
|
||||
static int testListDomains(virConnectPtr conn,
|
||||
int *ids,
|
||||
int maxids)
|
||||
{
|
||||
testConnPtr privconn = conn->privateData;
|
||||
int n;
|
||||
@ -1430,7 +1430,7 @@ static int testListDomains (virConnectPtr conn,
|
||||
return n;
|
||||
}
|
||||
|
||||
static int testDestroyDomain (virDomainPtr domain)
|
||||
static int testDestroyDomain(virDomainPtr domain)
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom;
|
||||
@ -1467,7 +1467,7 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int testResumeDomain (virDomainPtr domain)
|
||||
static int testResumeDomain(virDomainPtr domain)
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom;
|
||||
@ -1508,7 +1508,7 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int testPauseDomain (virDomainPtr domain)
|
||||
static int testPauseDomain(virDomainPtr domain)
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom;
|
||||
@ -1597,14 +1597,14 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int testShutdownDomain (virDomainPtr domain)
|
||||
static int testShutdownDomain(virDomainPtr domain)
|
||||
{
|
||||
return testShutdownDomainFlags(domain, 0);
|
||||
}
|
||||
|
||||
/* Similar behaviour as shutdown */
|
||||
static int testRebootDomain (virDomainPtr domain,
|
||||
unsigned int action ATTRIBUTE_UNUSED)
|
||||
static int testRebootDomain(virDomainPtr domain,
|
||||
unsigned int action ATTRIBUTE_UNUSED)
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
virDomainObjPtr privdom;
|
||||
@ -1673,8 +1673,8 @@ cleanup:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int testGetDomainInfo (virDomainPtr domain,
|
||||
virDomainInfoPtr info)
|
||||
static int testGetDomainInfo(virDomainPtr domain,
|
||||
virDomainInfoPtr info)
|
||||
{
|
||||
testConnPtr privconn = domain->conn->privateData;
|
||||
struct timeval tv;
|
||||
@ -2851,7 +2851,7 @@ static int testDomainInterfaceStats(virDomainPtr domain,
|
||||
|
||||
for (i = 0 ; i < privdom->def->nnets ; i++) {
|
||||
if (privdom->def->nets[i]->ifname &&
|
||||
STREQ (privdom->def->nets[i]->ifname, path)) {
|
||||
STREQ(privdom->def->nets[i]->ifname, path)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
@ -5051,7 +5051,7 @@ cleanup:
|
||||
|
||||
static int testStorageVolumeTypeForPool(int pooltype) {
|
||||
|
||||
switch(pooltype) {
|
||||
switch (pooltype) {
|
||||
case VIR_STORAGE_POOL_DIR:
|
||||
case VIR_STORAGE_POOL_FS:
|
||||
case VIR_STORAGE_POOL_NETFS:
|
||||
|
@ -65,7 +65,7 @@ virCapsPtr umlCapsInit(void) {
|
||||
virCapsGuestPtr guest;
|
||||
|
||||
/* Really, this never fails - look at the man-page. */
|
||||
uname (&utsname);
|
||||
uname(&utsname);
|
||||
|
||||
if ((caps = virCapabilitiesNew(utsname.machine,
|
||||
0, 0)) == NULL)
|
||||
|
@ -455,7 +455,7 @@ umlStartup(int privileged)
|
||||
"%s/log/libvirt/uml", LOCALSTATEDIR) == -1)
|
||||
goto out_of_memory;
|
||||
|
||||
if ((base = strdup (SYSCONFDIR "/libvirt")) == NULL)
|
||||
if ((base = strdup(SYSCONFDIR "/libvirt")) == NULL)
|
||||
goto out_of_memory;
|
||||
|
||||
if (virAsprintf(¨_driver->monitorDir,
|
||||
@ -1173,7 +1173,7 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
} else {
|
||||
if (conn->uri->scheme == NULL ||
|
||||
STRNEQ (conn->uri->scheme, "uml"))
|
||||
STRNEQ(conn->uri->scheme, "uml"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
/* Allow remote driver to deal with URIs with hostname server */
|
||||
@ -1183,15 +1183,15 @@ static virDrvOpenStatus umlOpen(virConnectPtr conn,
|
||||
|
||||
/* Check path and tell them correct path if they made a mistake */
|
||||
if (uml_driver->privileged) {
|
||||
if (STRNEQ (conn->uri->path, "/system") &&
|
||||
STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/system") &&
|
||||
STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected UML URI path '%s', try uml:///system"),
|
||||
conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unexpected UML URI path '%s', try uml:///session"),
|
||||
conn->uri->path);
|
||||
|
@ -366,7 +366,7 @@ int virBitmapParse(const char *str,
|
||||
cur++;
|
||||
virSkipSpaces(&cur);
|
||||
neg = false;
|
||||
} else if(*cur == 0 || *cur == sep) {
|
||||
} else if (*cur == 0 || *cur == sep) {
|
||||
break;
|
||||
} else {
|
||||
goto parse_error;
|
||||
|
@ -269,7 +269,7 @@ virFork(pid_t *pid)
|
||||
if (*pid < 0) {
|
||||
/* attempt to restore signal mask, but ignore failure, to
|
||||
avoid obscuring the fork failure */
|
||||
ignore_value (pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
||||
ignore_value(pthread_sigmask(SIG_SETMASK, &oldmask, NULL));
|
||||
virReportSystemError(saved_errno,
|
||||
"%s", _("cannot fork child process"));
|
||||
goto cleanup;
|
||||
|
@ -492,7 +492,7 @@ virConfParseValue(virConfParserCtxtPtr ctxt)
|
||||
"lst" is guaranteed to be non-NULL. This stops it
|
||||
from issuing an invalid NULL-dereference warning about
|
||||
"prev = lst; while (prev->next..." below. */
|
||||
sa_assert (lst);
|
||||
sa_assert(lst);
|
||||
|
||||
if (CUR != ',') {
|
||||
virConfError(ctxt, VIR_ERR_CONF_SYNTAX,
|
||||
@ -880,9 +880,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
|
||||
* Returns 0 on success, or -1 on failure.
|
||||
*/
|
||||
int
|
||||
virConfSetValue (virConfPtr conf,
|
||||
const char *setting,
|
||||
virConfValuePtr value)
|
||||
virConfSetValue(virConfPtr conf,
|
||||
const char *setting,
|
||||
virConfValuePtr value)
|
||||
{
|
||||
virConfEntryPtr cur, prev = NULL;
|
||||
|
||||
@ -961,7 +961,7 @@ virConfWriteFile(const char *filename, virConfPtr conf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR );
|
||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
||||
if (fd < 0) {
|
||||
virBufferFreeAndReset(&buf);
|
||||
virConfError(NULL, VIR_ERR_WRITE_FAILED, _("failed to open file"));
|
||||
|
@ -247,7 +247,7 @@ ebtablesAddRemoveRule(ebtRules *rules, int action, const char *arg, ...)
|
||||
|
||||
command_idx = n;
|
||||
|
||||
if(action == ADD || action == REMOVE) {
|
||||
if (action == ADD || action == REMOVE) {
|
||||
if (!(argv[n++] = strdup("--insert")))
|
||||
goto error;
|
||||
|
||||
|
@ -503,7 +503,7 @@ static void virEventPollCleanupTimeouts(void) {
|
||||
/* Remove deleted entries, shuffling down remaining
|
||||
* entries as needed to form contiguous series
|
||||
*/
|
||||
for (i = 0 ; i < eventLoop.timeoutsCount ; ) {
|
||||
for (i = 0 ; i < eventLoop.timeoutsCount ;) {
|
||||
if (!eventLoop.timeouts[i].deleted) {
|
||||
i++;
|
||||
continue;
|
||||
@ -551,7 +551,7 @@ static void virEventPollCleanupHandles(void) {
|
||||
/* Remove deleted entries, shuffling down remaining
|
||||
* entries as needed to form contiguous series
|
||||
*/
|
||||
for (i = 0 ; i < eventLoop.handlesCount ; ) {
|
||||
for (i = 0 ; i < eventLoop.handlesCount ;) {
|
||||
if (!eventLoop.handles[i].deleted) {
|
||||
i++;
|
||||
continue;
|
||||
@ -717,13 +717,13 @@ int
|
||||
virEventPollToNativeEvents(int events)
|
||||
{
|
||||
int ret = 0;
|
||||
if(events & VIR_EVENT_HANDLE_READABLE)
|
||||
if (events & VIR_EVENT_HANDLE_READABLE)
|
||||
ret |= POLLIN;
|
||||
if(events & VIR_EVENT_HANDLE_WRITABLE)
|
||||
if (events & VIR_EVENT_HANDLE_WRITABLE)
|
||||
ret |= POLLOUT;
|
||||
if(events & VIR_EVENT_HANDLE_ERROR)
|
||||
if (events & VIR_EVENT_HANDLE_ERROR)
|
||||
ret |= POLLERR;
|
||||
if(events & VIR_EVENT_HANDLE_HANGUP)
|
||||
if (events & VIR_EVENT_HANDLE_HANGUP)
|
||||
ret |= POLLHUP;
|
||||
return ret;
|
||||
}
|
||||
@ -732,15 +732,15 @@ int
|
||||
virEventPollFromNativeEvents(int events)
|
||||
{
|
||||
int ret = 0;
|
||||
if(events & POLLIN)
|
||||
if (events & POLLIN)
|
||||
ret |= VIR_EVENT_HANDLE_READABLE;
|
||||
if(events & POLLOUT)
|
||||
if (events & POLLOUT)
|
||||
ret |= VIR_EVENT_HANDLE_WRITABLE;
|
||||
if(events & POLLERR)
|
||||
if (events & POLLERR)
|
||||
ret |= VIR_EVENT_HANDLE_ERROR;
|
||||
if(events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
|
||||
if (events & POLLNVAL) /* Treat NVAL as error, since libvirt doesn't distinguish */
|
||||
ret |= VIR_EVENT_HANDLE_ERROR;
|
||||
if(events & POLLHUP)
|
||||
if (events & POLLHUP)
|
||||
ret |= VIR_EVENT_HANDLE_HANGUP;
|
||||
return ret;
|
||||
}
|
||||
|
@ -356,13 +356,13 @@ virLogDumpAllFD(const char *msg, int len)
|
||||
int fd = (intptr_t) virLogOutputs[i].data;
|
||||
|
||||
if (fd >= 0) {
|
||||
ignore_value (safewrite(fd, msg, len));
|
||||
ignore_value(safewrite(fd, msg, len));
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
ignore_value (safewrite(STDERR_FILENO, msg, len));
|
||||
ignore_value(safewrite(STDERR_FILENO, msg, len));
|
||||
}
|
||||
|
||||
|
||||
@ -384,36 +384,36 @@ virLogEmergencyDumpAll(int signum)
|
||||
switch (signum) {
|
||||
#ifdef SIGFPE
|
||||
case SIGFPE:
|
||||
virLogDumpAllFD( "Caught signal Floating-point exception", -1);
|
||||
virLogDumpAllFD("Caught signal Floating-point exception", -1);
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGSEGV
|
||||
case SIGSEGV:
|
||||
virLogDumpAllFD( "Caught Segmentation violation", -1);
|
||||
virLogDumpAllFD("Caught Segmentation violation", -1);
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGILL
|
||||
case SIGILL:
|
||||
virLogDumpAllFD( "Caught illegal instruction", -1);
|
||||
virLogDumpAllFD("Caught illegal instruction", -1);
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGABRT
|
||||
case SIGABRT:
|
||||
virLogDumpAllFD( "Caught abort signal", -1);
|
||||
virLogDumpAllFD("Caught abort signal", -1);
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGBUS
|
||||
case SIGBUS:
|
||||
virLogDumpAllFD( "Caught bus error", -1);
|
||||
virLogDumpAllFD("Caught bus error", -1);
|
||||
break;
|
||||
#endif
|
||||
#ifdef SIGUSR2
|
||||
case SIGUSR2:
|
||||
virLogDumpAllFD( "Caught User-defined signal 2", -1);
|
||||
virLogDumpAllFD("Caught User-defined signal 2", -1);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
virLogDumpAllFD( "Caught unexpected signal", -1);
|
||||
virLogDumpAllFD("Caught unexpected signal", -1);
|
||||
break;
|
||||
}
|
||||
if ((virLogBuffer == NULL) || (virLogSize <= 0)) {
|
||||
|
@ -1857,7 +1857,7 @@ pciGetPciConfigAddressFromSysfsDeviceLink(const char *device_link,
|
||||
return ret;
|
||||
}
|
||||
|
||||
device_path = canonicalize_file_name (device_link);
|
||||
device_path = canonicalize_file_name(device_link);
|
||||
if (device_path == NULL) {
|
||||
memset(errbuf, '\0', sizeof(errbuf));
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
|
@ -56,16 +56,16 @@ linuxDomainInterfaceStats(const char *path,
|
||||
FILE *fp;
|
||||
char line[256], *colon;
|
||||
|
||||
fp = fopen ("/proc/net/dev", "r");
|
||||
fp = fopen("/proc/net/dev", "r");
|
||||
if (!fp) {
|
||||
virReportSystemError(errno, "%s",
|
||||
_("Could not open /proc/net/dev"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
path_len = strlen (path);
|
||||
path_len = strlen(path);
|
||||
|
||||
while (fgets (line, sizeof(line), fp)) {
|
||||
while (fgets(line, sizeof(line), fp)) {
|
||||
long long dummy;
|
||||
long long rx_bytes;
|
||||
long long rx_packets;
|
||||
@ -80,23 +80,23 @@ linuxDomainInterfaceStats(const char *path,
|
||||
* " eth0:..."
|
||||
* Split it at the colon.
|
||||
*/
|
||||
colon = strchr (line, ':');
|
||||
colon = strchr(line, ':');
|
||||
if (!colon) continue;
|
||||
*colon = '\0';
|
||||
if (colon-path_len >= line &&
|
||||
STREQ (colon-path_len, path)) {
|
||||
STREQ(colon-path_len, path)) {
|
||||
/* IMPORTANT NOTE!
|
||||
* /proc/net/dev vif<domid>.nn sees the network from the point
|
||||
* of view of dom0 / hypervisor. So bytes TRANSMITTED by dom0
|
||||
* are bytes RECEIVED by the domain. That's why the TX/RX fields
|
||||
* appear to be swapped here.
|
||||
*/
|
||||
if (sscanf (colon+1,
|
||||
"%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld",
|
||||
&tx_bytes, &tx_packets, &tx_errs, &tx_drop,
|
||||
&dummy, &dummy, &dummy, &dummy,
|
||||
&rx_bytes, &rx_packets, &rx_errs, &rx_drop,
|
||||
&dummy, &dummy, &dummy, &dummy) != 16)
|
||||
if (sscanf(colon+1,
|
||||
"%lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld %lld",
|
||||
&tx_bytes, &tx_packets, &tx_errs, &tx_drop,
|
||||
&dummy, &dummy, &dummy, &dummy,
|
||||
&rx_bytes, &rx_packets, &rx_errs, &rx_drop,
|
||||
&dummy, &dummy, &dummy, &dummy) != 16)
|
||||
continue;
|
||||
|
||||
stats->rx_bytes = rx_bytes;
|
||||
@ -107,7 +107,7 @@ linuxDomainInterfaceStats(const char *path,
|
||||
stats->tx_packets = tx_packets;
|
||||
stats->tx_errs = tx_errs;
|
||||
stats->tx_drop = tx_drop;
|
||||
VIR_FORCE_FCLOSE (fp);
|
||||
VIR_FORCE_FCLOSE(fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ cowGetBackingStore(char **res,
|
||||
return BACKING_STORE_OK;
|
||||
}
|
||||
|
||||
*res = strndup ((const char*)buf + 4+4, COW_FILENAME_MAXLEN);
|
||||
*res = strndup((const char*)buf + 4+4, COW_FILENAME_MAXLEN);
|
||||
if (*res == NULL) {
|
||||
virReportOOMError();
|
||||
return BACKING_STORE_ERROR;
|
||||
@ -459,23 +459,23 @@ cleanup:
|
||||
static unsigned long
|
||||
qedGetHeaderUL(const unsigned char *loc)
|
||||
{
|
||||
return ( ((unsigned long)loc[3] << 24)
|
||||
| ((unsigned long)loc[2] << 16)
|
||||
| ((unsigned long)loc[1] << 8)
|
||||
| ((unsigned long)loc[0] << 0));
|
||||
return (((unsigned long)loc[3] << 24) |
|
||||
((unsigned long)loc[2] << 16) |
|
||||
((unsigned long)loc[1] << 8) |
|
||||
((unsigned long)loc[0] << 0));
|
||||
}
|
||||
|
||||
static unsigned long long
|
||||
qedGetHeaderULL(const unsigned char *loc)
|
||||
{
|
||||
return ( ((unsigned long long)loc[7] << 56)
|
||||
| ((unsigned long long)loc[6] << 48)
|
||||
| ((unsigned long long)loc[5] << 40)
|
||||
| ((unsigned long long)loc[4] << 32)
|
||||
| ((unsigned long long)loc[3] << 24)
|
||||
| ((unsigned long long)loc[2] << 16)
|
||||
| ((unsigned long long)loc[1] << 8)
|
||||
| ((unsigned long long)loc[0] << 0));
|
||||
return (((unsigned long long)loc[7] << 56) |
|
||||
((unsigned long long)loc[6] << 48) |
|
||||
((unsigned long long)loc[5] << 40) |
|
||||
((unsigned long long)loc[4] << 32) |
|
||||
((unsigned long long)loc[3] << 24) |
|
||||
((unsigned long long)loc[2] << 16) |
|
||||
((unsigned long long)loc[1] << 8) |
|
||||
((unsigned long long)loc[0] << 0));
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -162,7 +162,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
|
||||
char *eol, *tmp_base;
|
||||
virSysinfoProcessorDefPtr processor;
|
||||
|
||||
while((tmp_base = strstr(base, "processor")) != NULL) {
|
||||
while ((tmp_base = strstr(base, "processor")) != NULL) {
|
||||
base = tmp_base;
|
||||
eol = strchr(base, '\n');
|
||||
cur = strchr(base, ':') + 1;
|
||||
@ -217,7 +217,7 @@ virSysinfoRead(void) {
|
||||
if (VIR_ALLOC(ret) < 0)
|
||||
goto no_memory;
|
||||
|
||||
if(virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
|
||||
if (virFileReadAll(CPUINFO, 2048, &outbuf) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Failed to open %s"), CPUINFO);
|
||||
return NULL;
|
||||
@ -516,7 +516,7 @@ virSysinfoParseProcessor(const char *base, virSysinfoDefPtr ret)
|
||||
char *eol;
|
||||
virSysinfoProcessorDefPtr processor;
|
||||
|
||||
while((tmp_base = strstr(base, "Processor Information")) != NULL) {
|
||||
while ((tmp_base = strstr(base, "Processor Information")) != NULL) {
|
||||
base = tmp_base;
|
||||
eol = NULL;
|
||||
|
||||
|
@ -285,7 +285,7 @@ int virSetInherit(int fd ATTRIBUTE_UNUSED, bool inherit ATTRIBUTE_UNUSED)
|
||||
#endif /* WIN32 */
|
||||
|
||||
int virSetBlocking(int fd, bool blocking) {
|
||||
return set_nonblocking_flag (fd, !blocking);
|
||||
return set_nonblocking_flag(fd, !blocking);
|
||||
}
|
||||
|
||||
int virSetNonBlock(int fd) {
|
||||
@ -314,7 +314,7 @@ virPipeReadUntilEOF(int outfd, int errfd,
|
||||
fds[1].revents = 0;
|
||||
finished[1] = 0;
|
||||
|
||||
while(!(finished[0] && finished[1])) {
|
||||
while (!(finished[0] && finished[1])) {
|
||||
|
||||
if (poll(fds, ARRAY_CARDINALITY(fds), -1) < 0) {
|
||||
if ((errno == EAGAIN) || (errno == EINTR))
|
||||
@ -386,7 +386,7 @@ error:
|
||||
number of bytes. If the length of the input is <= max_len, and
|
||||
upon error while reading that data, it works just like fread_file. */
|
||||
static char *
|
||||
saferead_lim (int fd, size_t max_len, size_t *length)
|
||||
saferead_lim(int fd, size_t max_len, size_t *length)
|
||||
{
|
||||
char *buf = NULL;
|
||||
size_t alloc = 0;
|
||||
@ -409,9 +409,9 @@ saferead_lim (int fd, size_t max_len, size_t *length)
|
||||
}
|
||||
|
||||
/* Ensure that (size + requested <= max_len); */
|
||||
requested = MIN (size < max_len ? max_len - size : 0,
|
||||
alloc - size - 1);
|
||||
count = saferead (fd, buf + size, requested);
|
||||
requested = MIN(size < max_len ? max_len - size : 0,
|
||||
alloc - size - 1);
|
||||
count = saferead(fd, buf + size, requested);
|
||||
size += count;
|
||||
|
||||
if (count != requested || requested == 0) {
|
||||
@ -441,7 +441,7 @@ virFileReadLimFD(int fd, int maxlen, char **buf)
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
s = saferead_lim (fd, maxlen+1, &len);
|
||||
s = saferead_lim(fd, maxlen+1, &len);
|
||||
if (s == NULL)
|
||||
return -1;
|
||||
if (len > maxlen || (int)len != len) {
|
||||
@ -540,9 +540,9 @@ int virFileLinkPointsTo(const char *checkLink,
|
||||
struct stat src_sb;
|
||||
struct stat dest_sb;
|
||||
|
||||
return (stat (checkLink, &src_sb) == 0
|
||||
&& stat (checkDest, &dest_sb) == 0
|
||||
&& SAME_INODE (src_sb, dest_sb));
|
||||
return (stat(checkLink, &src_sb) == 0
|
||||
&& stat(checkDest, &dest_sb) == 0
|
||||
&& SAME_INODE(src_sb, dest_sb));
|
||||
}
|
||||
|
||||
|
||||
@ -678,7 +678,7 @@ char *virFindFileInPath(const char *file)
|
||||
bool virFileIsDir(const char *path)
|
||||
{
|
||||
struct stat s;
|
||||
return (stat (path, &s) == 0) && S_ISDIR (s.st_mode);
|
||||
return (stat(path, &s) == 0) && S_ISDIR(s.st_mode);
|
||||
}
|
||||
|
||||
bool virFileExists(const char *path)
|
||||
@ -2270,7 +2270,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
char hostname[HOST_NAME_MAX+1], *result;
|
||||
struct addrinfo hints, *info;
|
||||
|
||||
r = gethostname (hostname, sizeof(hostname));
|
||||
r = gethostname(hostname, sizeof(hostname));
|
||||
if (r == -1) {
|
||||
virReportSystemError(errno,
|
||||
"%s", _("failed to determine host name"));
|
||||
@ -2305,7 +2305,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
}
|
||||
|
||||
/* Tell static analyzers about getaddrinfo semantics. */
|
||||
sa_assert (info);
|
||||
sa_assert(info);
|
||||
|
||||
if (info->ai_canonname == NULL ||
|
||||
STRPREFIX(info->ai_canonname, "localhost"))
|
||||
@ -2316,7 +2316,7 @@ char *virGetHostname(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
result = strdup(hostname);
|
||||
else
|
||||
/* Caller frees this string. */
|
||||
result = strdup (info->ai_canonname);
|
||||
result = strdup(info->ai_canonname);
|
||||
|
||||
freeaddrinfo(info);
|
||||
|
||||
@ -2827,7 +2827,7 @@ virGetUserDirectory(void)
|
||||
*/
|
||||
if (dir) {
|
||||
char *p;
|
||||
while ((p = strchr (dir, '/')) != NULL)
|
||||
while ((p = strchr(dir, '/')) != NULL)
|
||||
*p = '\\';
|
||||
}
|
||||
|
||||
|
@ -945,7 +945,7 @@ create_name:
|
||||
if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress,
|
||||
linkdev, vmuuid,
|
||||
virtPortProfile,
|
||||
vmOp) < 0 )
|
||||
vmOp) < 0)
|
||||
goto disassociate_exit;
|
||||
}
|
||||
|
||||
|
@ -288,15 +288,11 @@ virSocketAddrSetPort(virSocketAddrPtr addr, int port) {
|
||||
|
||||
port = htons(port);
|
||||
|
||||
if(addr->data.stor.ss_family == AF_INET) {
|
||||
if (addr->data.stor.ss_family == AF_INET) {
|
||||
addr->data.inet4.sin_port = port;
|
||||
}
|
||||
|
||||
else if(addr->data.stor.ss_family == AF_INET6) {
|
||||
} else if (addr->data.stor.ss_family == AF_INET6) {
|
||||
addr->data.inet6.sin6_port = port;
|
||||
}
|
||||
|
||||
else {
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -315,11 +311,9 @@ virSocketAddrGetPort(virSocketAddrPtr addr) {
|
||||
if (addr == NULL)
|
||||
return -1;
|
||||
|
||||
if(addr->data.stor.ss_family == AF_INET) {
|
||||
if (addr->data.stor.ss_family == AF_INET) {
|
||||
return ntohs(addr->data.inet4.sin_port);
|
||||
}
|
||||
|
||||
else if(addr->data.stor.ss_family == AF_INET6) {
|
||||
} else if (addr->data.stor.ss_family == AF_INET6) {
|
||||
return ntohs(addr->data.inet6.sin6_port);
|
||||
}
|
||||
|
||||
|
@ -1319,7 +1319,7 @@ void virReportSystemErrorFull(int domcode,
|
||||
size_t len = strlen(errnoDetail);
|
||||
if (0 <= n && n + 2 + len < sizeof(msgDetailBuf)) {
|
||||
char *p = msgDetailBuf + n;
|
||||
stpcpy (stpcpy (p, ": "), errnoDetail);
|
||||
stpcpy(stpcpy(p, ": "), errnoDetail);
|
||||
msgDetail = msgDetailBuf;
|
||||
}
|
||||
}
|
||||
|
@ -159,8 +159,8 @@ int virTimeFieldsThenRaw(unsigned long long when, struct tm *fields)
|
||||
|
||||
/* Adjust DAYS and Y to match the guessed year. */
|
||||
days -= ((yg - y) * 365
|
||||
+ LEAPS_THRU_END_OF (yg - 1)
|
||||
- LEAPS_THRU_END_OF (y - 1));
|
||||
+ LEAPS_THRU_END_OF(yg - 1)
|
||||
- LEAPS_THRU_END_OF(y - 1));
|
||||
y = yg;
|
||||
}
|
||||
fields->tm_year = y - 1900;
|
||||
|
@ -39,7 +39,7 @@ virURIParamAppend(virURIPtr uri,
|
||||
|
||||
if (!(pname = strdup(name)))
|
||||
goto no_memory;
|
||||
if (!(pvalue = strdup (value)))
|
||||
if (!(pvalue = strdup(value)))
|
||||
goto no_memory;
|
||||
|
||||
if (VIR_RESIZE_N(uri->params, uri->paramsAlloc, uri->paramsCount, 1) < 0)
|
||||
@ -73,14 +73,14 @@ virURIParseParams(virURIPtr uri)
|
||||
char *name = NULL, *value = NULL;
|
||||
|
||||
/* Find the next separator, or end of the string. */
|
||||
end = strchr (query, '&');
|
||||
end = strchr(query, '&');
|
||||
if (!end)
|
||||
end = strchr (query, ';');
|
||||
end = strchr(query, ';');
|
||||
if (!end)
|
||||
end = query + strlen (query);
|
||||
end = query + strlen(query);
|
||||
|
||||
/* Find the first '=' character between here and end. */
|
||||
eq = strchr (query, '=');
|
||||
eq = strchr(query, '=');
|
||||
if (eq && eq >= end) eq = NULL;
|
||||
|
||||
/* Empty section (eg. "&&"). */
|
||||
@ -91,14 +91,14 @@ virURIParseParams(virURIPtr uri)
|
||||
* and consistent with CGI.pm we assume value is "".
|
||||
*/
|
||||
else if (!eq) {
|
||||
name = xmlURIUnescapeString (query, end - query, NULL);
|
||||
name = xmlURIUnescapeString(query, end - query, NULL);
|
||||
if (!name) goto no_memory;
|
||||
}
|
||||
/* Or if we have "name=" here (works around annoying
|
||||
* problem when calling xmlURIUnescapeString with len = 0).
|
||||
*/
|
||||
else if (eq+1 == end) {
|
||||
name = xmlURIUnescapeString (query, eq - query, NULL);
|
||||
name = xmlURIUnescapeString(query, eq - query, NULL);
|
||||
if (!name) goto no_memory;
|
||||
}
|
||||
/* If the '=' character is at the beginning then we have
|
||||
@ -109,10 +109,10 @@ virURIParseParams(virURIPtr uri)
|
||||
|
||||
/* Otherwise it's "name=value". */
|
||||
else {
|
||||
name = xmlURIUnescapeString (query, eq - query, NULL);
|
||||
name = xmlURIUnescapeString(query, eq - query, NULL);
|
||||
if (!name)
|
||||
goto no_memory;
|
||||
value = xmlURIUnescapeString (eq+1, end - (eq+1), NULL);
|
||||
value = xmlURIUnescapeString(eq+1, end - (eq+1), NULL);
|
||||
if (!value) {
|
||||
VIR_FREE(name);
|
||||
goto no_memory;
|
||||
@ -292,9 +292,9 @@ char *virURIFormatParams(virURIPtr uri)
|
||||
|
||||
for (i = 0; i < uri->paramsCount; ++i) {
|
||||
if (!uri->params[i].ignore) {
|
||||
if (amp) virBufferAddChar (&buf, '&');
|
||||
virBufferStrcat (&buf, uri->params[i].name, "=", NULL);
|
||||
virBufferURIEncodeString (&buf, uri->params[i].value);
|
||||
if (amp) virBufferAddChar(&buf, '&');
|
||||
virBufferStrcat(&buf, uri->params[i].name, "=", NULL);
|
||||
virBufferURIEncodeString(&buf, uri->params[i].value);
|
||||
amp = 1;
|
||||
}
|
||||
}
|
||||
|
@ -782,11 +782,11 @@ error:
|
||||
|
||||
const char *virXMLPickShellSafeComment(const char *str1, const char *str2)
|
||||
{
|
||||
if(str1 && !strpbrk(str1, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||
!strstr(str1, "--"))
|
||||
if (str1 && !strpbrk(str1, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||
!strstr(str1, "--"))
|
||||
return str1;
|
||||
if(str2 && !strpbrk(str2, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||
!strstr(str2, "--"))
|
||||
if (str2 && !strpbrk(str2, "\r\t\n !\"#$&'()*;<>?[\\]^`{|}~") &&
|
||||
!strstr(str2, "--"))
|
||||
return str2;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn,
|
||||
|
||||
if (conn->uri == NULL ||
|
||||
conn->uri->scheme == NULL ||
|
||||
STRNEQ (conn->uri->scheme, "vbox") ||
|
||||
STRNEQ(conn->uri->scheme, "vbox") ||
|
||||
conn->uri->server != NULL)
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
@ -162,14 +162,14 @@ static virDrvOpenStatus vboxOpenDummy(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (uid != 0) {
|
||||
if (STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
} else { /* root */
|
||||
if (STRNEQ (conn->uri->path, "/system") &&
|
||||
STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/system") &&
|
||||
STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
|
@ -100,7 +100,7 @@
|
||||
#define VBOX_OBJECT_CHECK(conn, type, value) \
|
||||
vboxGlobalData *data = conn->privateData;\
|
||||
type ret = value;\
|
||||
if(!data->vboxObj) {\
|
||||
if (!data->vboxObj) {\
|
||||
return ret;\
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ if(!data->vboxObj) {\
|
||||
vboxGlobalData *data = conn->privateData;\
|
||||
type ret = value;\
|
||||
IHost *host = NULL;\
|
||||
if(!data->vboxObj) {\
|
||||
if (!data->vboxObj) {\
|
||||
return ret;\
|
||||
}\
|
||||
data->vboxObj->vtbl->GetHost(data->vboxObj, &host);\
|
||||
@ -119,7 +119,7 @@ if (!host) {\
|
||||
#if VBOX_API_VERSION < 3001
|
||||
|
||||
# define VBOX_MEDIUM_RELEASE(arg) \
|
||||
if(arg)\
|
||||
if (arg)\
|
||||
(arg)->vtbl->imedium.nsisupports.Release((nsISupports *)(arg))
|
||||
# define VBOX_MEDIUM_FUNC_ARG1(object, func, arg1) \
|
||||
(object)->vtbl->imedium.func((IMedium *)(object), arg1)
|
||||
@ -154,7 +154,7 @@ if (strUtf16) {\
|
||||
|
||||
#define DEBUGUUID(msg, iid) \
|
||||
{\
|
||||
VIR_DEBUG (msg ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",\
|
||||
VIR_DEBUG(msg ": {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",\
|
||||
(unsigned)(iid)->m0,\
|
||||
(unsigned)(iid)->m1,\
|
||||
(unsigned)(iid)->m2,\
|
||||
@ -293,7 +293,7 @@ static void nsIDtoChar(unsigned char *uuid, const nsID *iid) {
|
||||
uuidstrdst[16] = uuidstrsrc[14];
|
||||
uuidstrdst[17] = uuidstrsrc[15];
|
||||
|
||||
for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||
for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||
uuidstrdst[i] = uuidstrsrc[i];
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ static void nsIDFromChar(nsID *iid, const unsigned char *uuid) {
|
||||
uuidstrdst[16] = uuidstrsrc[14];
|
||||
uuidstrdst[17] = uuidstrsrc[15];
|
||||
|
||||
for(i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||
for (i = 18; i < VIR_UUID_STRING_BUFLEN; i++) {
|
||||
uuidstrdst[i] = uuidstrsrc[i];
|
||||
}
|
||||
|
||||
@ -594,12 +594,12 @@ static char *vboxGenerateMediumName(PRUint32 storageBus,
|
||||
PRUint32 maxPortPerInst = 0;
|
||||
PRUint32 maxSlotPerPort = 0;
|
||||
|
||||
if ( !aMaxPortPerInst
|
||||
|| !aMaxSlotPerPort)
|
||||
if (!aMaxPortPerInst ||
|
||||
!aMaxSlotPerPort)
|
||||
return NULL;
|
||||
|
||||
if ( (storageBus < StorageBus_IDE)
|
||||
|| (storageBus > StorageBus_Floppy))
|
||||
if ((storageBus < StorageBus_IDE) ||
|
||||
(storageBus > StorageBus_Floppy))
|
||||
return NULL;
|
||||
|
||||
maxPortPerInst = aMaxPortPerInst[storageBus];
|
||||
@ -610,8 +610,8 @@ static char *vboxGenerateMediumName(PRUint32 storageBus,
|
||||
|
||||
if (storageBus == StorageBus_IDE) {
|
||||
prefix = "hd";
|
||||
} else if ( (storageBus == StorageBus_SATA)
|
||||
|| (storageBus == StorageBus_SCSI)) {
|
||||
} else if ((storageBus == StorageBus_SATA) ||
|
||||
(storageBus == StorageBus_SCSI)) {
|
||||
prefix = "sd";
|
||||
} else if (storageBus == StorageBus_Floppy) {
|
||||
prefix = "fd";
|
||||
@ -653,16 +653,16 @@ static bool vboxGetDeviceDetails(const char *deviceName,
|
||||
PRUint32 maxPortPerInst = 0;
|
||||
PRUint32 maxSlotPerPort = 0;
|
||||
|
||||
if ( !deviceName
|
||||
|| !deviceInst
|
||||
|| !devicePort
|
||||
|| !deviceSlot
|
||||
|| !aMaxPortPerInst
|
||||
|| !aMaxSlotPerPort)
|
||||
if (!deviceName ||
|
||||
!deviceInst ||
|
||||
!devicePort ||
|
||||
!deviceSlot ||
|
||||
!aMaxPortPerInst ||
|
||||
!aMaxSlotPerPort)
|
||||
return false;
|
||||
|
||||
if ( (storageBus < StorageBus_IDE)
|
||||
|| (storageBus > StorageBus_Floppy))
|
||||
if ((storageBus < StorageBus_IDE) ||
|
||||
(storageBus > StorageBus_Floppy))
|
||||
return false;
|
||||
|
||||
total = virDiskNameToIndex(deviceName);
|
||||
@ -670,9 +670,9 @@ static bool vboxGetDeviceDetails(const char *deviceName,
|
||||
maxPortPerInst = aMaxPortPerInst[storageBus];
|
||||
maxSlotPerPort = aMaxSlotPerPort[storageBus];
|
||||
|
||||
if ( !maxPortPerInst
|
||||
|| !maxSlotPerPort
|
||||
|| (total < 0))
|
||||
if (!maxPortPerInst ||
|
||||
!maxSlotPerPort ||
|
||||
(total < 0))
|
||||
return false;
|
||||
|
||||
*deviceInst = total / (maxPortPerInst * maxSlotPerPort);
|
||||
@ -982,7 +982,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
|
||||
if (conn->uri->scheme == NULL ||
|
||||
STRNEQ (conn->uri->scheme, "vbox"))
|
||||
STRNEQ(conn->uri->scheme, "vbox"))
|
||||
return VIR_DRV_OPEN_DECLINED;
|
||||
|
||||
/* Leave for remote driver */
|
||||
@ -996,14 +996,14 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn,
|
||||
}
|
||||
|
||||
if (uid != 0) {
|
||||
if (STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown driver path '%s' specified (try vbox:///session)"), conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
}
|
||||
} else { /* root */
|
||||
if (STRNEQ (conn->uri->path, "/system") &&
|
||||
STRNEQ (conn->uri->path, "/session")) {
|
||||
if (STRNEQ(conn->uri->path, "/system") &&
|
||||
STRNEQ(conn->uri->path, "/session")) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("unknown driver path '%s' specified (try vbox:///system)"), conn->uri->path);
|
||||
return VIR_DRV_OPEN_ERROR;
|
||||
@ -1135,8 +1135,8 @@ static int vboxListDomains(virConnectPtr conn, int *ids, int nids) {
|
||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||
if (isAccessible) {
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
if ( (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) ) {
|
||||
if ((state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline)) {
|
||||
ret++;
|
||||
ids[j++] = i + 1;
|
||||
}
|
||||
@ -1172,8 +1172,8 @@ static int vboxNumOfDomains(virConnectPtr conn) {
|
||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||
if (isAccessible) {
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
if ( (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) )
|
||||
if ((state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline))
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
@ -1243,8 +1243,8 @@ static virDomainPtr vboxDomainLookupByID(virConnectPtr conn, int id) {
|
||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||
if (isAccessible) {
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
if ( (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) ) {
|
||||
if ((state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline)) {
|
||||
PRUnichar *machineNameUtf16 = NULL;
|
||||
char *machineNameUtf8 = NULL;
|
||||
|
||||
@ -1329,9 +1329,9 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch
|
||||
*/
|
||||
|
||||
ret = virGetDomain(conn, machineNameUtf8, iid_as_uuid);
|
||||
if ( ret
|
||||
&& (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) )
|
||||
if (ret &&
|
||||
(state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline))
|
||||
ret->id = i + 1;
|
||||
}
|
||||
|
||||
@ -1397,9 +1397,9 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)
|
||||
*/
|
||||
|
||||
ret = virGetDomain(conn, machineNameUtf8, uuid);
|
||||
if ( ret
|
||||
&& (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) )
|
||||
if (ret &&
|
||||
(state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline))
|
||||
ret->id = i + 1;
|
||||
}
|
||||
|
||||
@ -1466,8 +1466,8 @@ static int vboxDomainIsActive(virDomainPtr dom) {
|
||||
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
|
||||
if ( (state >= MachineState_FirstOnline)
|
||||
&& (state <= MachineState_LastOnline) )
|
||||
if ((state >= MachineState_FirstOnline) &&
|
||||
(state <= MachineState_LastOnline))
|
||||
ret = 1;
|
||||
else
|
||||
ret = 0;
|
||||
@ -1945,7 +1945,7 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {
|
||||
info->nrVirtCpu = CPUCount;
|
||||
info->memory = memorySize * 1024;
|
||||
info->maxMem = maxMemorySize * 1024;
|
||||
switch(state) {
|
||||
switch (state) {
|
||||
case MachineState_Running:
|
||||
info->state = VIR_DOMAIN_RUNNING;
|
||||
break;
|
||||
@ -2426,7 +2426,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
|
||||
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
||||
VBOX_UTF16_FREE(valueTypeUtf16);
|
||||
|
||||
if ( STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui") ) {
|
||||
if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) {
|
||||
PRUnichar *keyDislpayUtf16 = NULL;
|
||||
PRUnichar *valueDisplayUtf16 = NULL;
|
||||
char *valueDisplayUtf8 = NULL;
|
||||
@ -3350,7 +3350,7 @@ sharedFoldersCleanup:
|
||||
* alloc mem and set def->nhostdevs
|
||||
*/
|
||||
|
||||
for(i = 0; i < deviceFilters.count; i++) {
|
||||
for (i = 0; i < deviceFilters.count; i++) {
|
||||
PRBool active = PR_FALSE;
|
||||
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
||||
|
||||
@ -3364,7 +3364,7 @@ sharedFoldersCleanup:
|
||||
/* Alloc mem needed for the filters now */
|
||||
if (VIR_ALLOC_N(def->hostdevs, def->nhostdevs) >= 0) {
|
||||
|
||||
for(i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) {
|
||||
for (i = 0; (USBFilterCount < def->nhostdevs) || (i < deviceFilters.count); i++) {
|
||||
PRBool active = PR_FALSE;
|
||||
IUSBDeviceFilter *deviceFilter = deviceFilters.items[i];
|
||||
|
||||
@ -3462,8 +3462,8 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||
if (isAccessible) {
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
if ( (state < MachineState_FirstOnline)
|
||||
|| (state > MachineState_LastOnline) ) {
|
||||
if ((state < MachineState_FirstOnline) ||
|
||||
(state > MachineState_LastOnline)) {
|
||||
machine->vtbl->GetName(machine, &machineNameUtf16);
|
||||
VBOX_UTF16_TO_UTF8(machineNameUtf16, &machineName);
|
||||
names[j] = strdup(machineName);
|
||||
@ -3471,7 +3471,7 @@ static int vboxListDefinedDomains(virConnectPtr conn, char ** const names, int m
|
||||
VBOX_UTF8_FREE(machineName);
|
||||
if (!names[j]) {
|
||||
virReportOOMError();
|
||||
for ( ; j >= 0 ; j--)
|
||||
for (; j >= 0 ; j--)
|
||||
VIR_FREE(names[j]);
|
||||
ret = -1;
|
||||
goto cleanup;
|
||||
@ -3512,8 +3512,8 @@ static int vboxNumOfDefinedDomains(virConnectPtr conn) {
|
||||
machine->vtbl->GetAccessible(machine, &isAccessible);
|
||||
if (isAccessible) {
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
if ( (state < MachineState_FirstOnline)
|
||||
|| (state > MachineState_LastOnline) ) {
|
||||
if ((state < MachineState_FirstOnline) ||
|
||||
(state > MachineState_LastOnline)) {
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
@ -3555,7 +3555,7 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
|
||||
VBOX_UTF16_TO_UTF8(valueTypeUtf16, &valueTypeUtf8);
|
||||
VBOX_UTF16_FREE(valueTypeUtf16);
|
||||
|
||||
if ( STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui") ) {
|
||||
if (STREQ(valueTypeUtf8, "sdl") || STREQ(valueTypeUtf8, "gui")) {
|
||||
|
||||
VBOX_UTF8_TO_UTF16("FRONTEND/Display", &keyDislpayUtf16);
|
||||
machine->vtbl->GetExtraData(machine, keyDislpayUtf16,
|
||||
@ -3660,7 +3660,7 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
|
||||
iid->value,
|
||||
sessionType,
|
||||
env,
|
||||
&progress );
|
||||
&progress);
|
||||
#else /* VBOX_API_VERSION >= 4000 */
|
||||
rc = machine->vtbl->LaunchVMProcess(machine, data->vboxSession,
|
||||
sessionType, env, &progress);
|
||||
@ -3746,9 +3746,9 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) {
|
||||
PRUint32 state = MachineState_Null;
|
||||
machine->vtbl->GetState(machine, &state);
|
||||
|
||||
if ( (state == MachineState_PoweredOff) ||
|
||||
(state == MachineState_Saved) ||
|
||||
(state == MachineState_Aborted) ) {
|
||||
if ((state == MachineState_PoweredOff) ||
|
||||
(state == MachineState_Saved) ||
|
||||
(state == MachineState_Aborted)) {
|
||||
ret = vboxStartMachine(dom, i, machine, &iid);
|
||||
} else {
|
||||
virReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
@ -7174,8 +7174,8 @@ vboxCallbackQueryInterface(nsISupports *pThis, const nsID *iid, void **resultp)
|
||||
static const nsID isupportIID = NS_ISUPPORTS_IID;
|
||||
|
||||
/* Match UUID for IVirtualBoxCallback class */
|
||||
if ( memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0
|
||||
|| memcmp(iid, &isupportIID, sizeof(nsID)) == 0) {
|
||||
if (memcmp(iid, &ivirtualboxCallbackUUID, sizeof(nsID)) == 0 ||
|
||||
memcmp(iid, &isupportIID, sizeof(nsID)) == 0) {
|
||||
g_pVBoxGlobalData->vboxCallBackRefCount++;
|
||||
*resultp = that;
|
||||
|
||||
@ -7249,10 +7249,10 @@ static void vboxReadCallback(int watch ATTRIBUTE_UNUSED,
|
||||
}
|
||||
}
|
||||
|
||||
static int vboxDomainEventRegister (virConnectPtr conn,
|
||||
virConnectDomainEventCallback callback,
|
||||
void *opaque,
|
||||
virFreeCallback freecb) {
|
||||
static int vboxDomainEventRegister(virConnectPtr conn,
|
||||
virConnectDomainEventCallback callback,
|
||||
void *opaque,
|
||||
virFreeCallback freecb) {
|
||||
VBOX_OBJECT_CHECK(conn, int, -1);
|
||||
int vboxRet = -1;
|
||||
nsresult rc;
|
||||
@ -7293,9 +7293,9 @@ static int vboxDomainEventRegister (virConnectPtr conn,
|
||||
|
||||
ret = virDomainEventStateRegister(conn, data->domainEvents,
|
||||
callback, opaque, freecb);
|
||||
VIR_DEBUG("virDomainEventStateRegister (ret = %d) ( conn: %p, "
|
||||
VIR_DEBUG("virDomainEventStateRegister (ret = %d) (conn: %p, "
|
||||
"callback: %p, opaque: %p, "
|
||||
"freecb: %p )", ret, conn, callback,
|
||||
"freecb: %p)", ret, conn, callback,
|
||||
opaque, freecb);
|
||||
}
|
||||
}
|
||||
@ -7312,8 +7312,8 @@ static int vboxDomainEventRegister (virConnectPtr conn,
|
||||
}
|
||||
}
|
||||
|
||||
static int vboxDomainEventDeregister (virConnectPtr conn,
|
||||
virConnectDomainEventCallback callback) {
|
||||
static int vboxDomainEventDeregister(virConnectPtr conn,
|
||||
virConnectDomainEventCallback callback) {
|
||||
VBOX_OBJECT_CHECK(conn, int, -1);
|
||||
int cnt;
|
||||
|
||||
@ -7387,9 +7387,9 @@ static int vboxDomainEventRegisterAny(virConnectPtr conn,
|
||||
dom, eventID,
|
||||
callback, opaque, freecb, &ret) < 0)
|
||||
ret = -1;
|
||||
VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) ( conn: %p, "
|
||||
VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) (conn: %p, "
|
||||
"callback: %p, opaque: %p, "
|
||||
"freecb: %p )", ret, conn, callback,
|
||||
"freecb: %p)", ret, conn, callback,
|
||||
opaque, freecb);
|
||||
}
|
||||
}
|
||||
@ -7723,9 +7723,9 @@ static virNetworkPtr vboxNetworkDefineCreateXML(virConnectPtr conn, const char *
|
||||
virNetworkIpDefPtr ipdef;
|
||||
virSocketAddr netmask;
|
||||
|
||||
if ( (!def)
|
||||
|| (def->forwardType != VIR_NETWORK_FORWARD_NONE)
|
||||
|| (def->nips == 0 || !def->ips))
|
||||
if ((!def) ||
|
||||
(def->forwardType != VIR_NETWORK_FORWARD_NONE) ||
|
||||
(def->nips == 0 || !def->ips))
|
||||
goto cleanup;
|
||||
|
||||
/* Look for the first IPv4 IP address definition and use that.
|
||||
@ -8135,7 +8135,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
|
||||
&dhcpServer);
|
||||
if (dhcpServer) {
|
||||
ipdef->nranges = 1;
|
||||
if (VIR_ALLOC_N(ipdef->ranges, ipdef->nranges) >=0 ) {
|
||||
if (VIR_ALLOC_N(ipdef->ranges, ipdef->nranges) >=0) {
|
||||
PRUnichar *ipAddressUtf16 = NULL;
|
||||
PRUnichar *networkMaskUtf16 = NULL;
|
||||
PRUnichar *fromIPAddressUtf16 = NULL;
|
||||
@ -8174,7 +8174,7 @@ static char *vboxNetworkGetXMLDesc(virNetworkPtr network,
|
||||
}
|
||||
|
||||
ipdef->nhosts = 1;
|
||||
if (VIR_ALLOC_N(ipdef->hosts, ipdef->nhosts) >=0 ) {
|
||||
if (VIR_ALLOC_N(ipdef->hosts, ipdef->nhosts) >=0) {
|
||||
ipdef->hosts[0].name = strdup(network->name);
|
||||
if (ipdef->hosts[0].name == NULL) {
|
||||
VIR_FREE(ipdef->hosts);
|
||||
@ -8256,9 +8256,9 @@ cleanup:
|
||||
* The Storage Functions here on
|
||||
*/
|
||||
|
||||
static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
static virDrvOpenStatus vboxStorageOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
vboxGlobalData *data = conn->privateData;
|
||||
|
||||
@ -8277,7 +8277,7 @@ static virDrvOpenStatus vboxStorageOpen (virConnectPtr conn,
|
||||
return VIR_DRV_OPEN_SUCCESS;
|
||||
}
|
||||
|
||||
static int vboxStorageClose (virConnectPtr conn) {
|
||||
static int vboxStorageClose(virConnectPtr conn) {
|
||||
VIR_DEBUG("vbox storage uninitialized");
|
||||
conn->storagePrivateData = NULL;
|
||||
return 0;
|
||||
@ -8417,7 +8417,7 @@ static virStorageVolPtr vboxStorageVolLookupByName(virStoragePoolPtr pool, const
|
||||
nsresult rc;
|
||||
int i;
|
||||
|
||||
if(!name)
|
||||
if (!name)
|
||||
return ret;
|
||||
|
||||
rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks);
|
||||
@ -8628,8 +8628,8 @@ static virStorageVolPtr vboxStorageVolCreateXML(virStoragePoolPtr pool,
|
||||
if ((def = virStorageVolDefParseString(&poolDef, xml)) == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if ( !def->name
|
||||
|| (def->type != VIR_STORAGE_VOL_FILE))
|
||||
if (!def->name ||
|
||||
(def->type != VIR_STORAGE_VOL_FILE))
|
||||
goto cleanup;
|
||||
|
||||
/* TODO: for now only the vmdk, vpc and vdi type harddisk
|
||||
|
@ -163,7 +163,7 @@ vmwareLoadDomains(struct vmware_driver *driver)
|
||||
if (virCommandRun(cmd, NULL) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for(str = outbuf ; (vmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||
for (str = outbuf ; (vmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||
str = NULL) {
|
||||
|
||||
if (vmxPath[0] != '/')
|
||||
|
@ -205,8 +205,8 @@ vmwareUpdateVMStatus(struct vmware_driver *driver, virDomainObjPtr vm)
|
||||
&vmxAbsolutePath) < 0)
|
||||
goto cleanup;
|
||||
|
||||
for(str = outbuf ; (parsedVmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||
str = NULL) {
|
||||
for (str = outbuf ; (parsedVmxPath = strtok_r(str, "\n", &saveptr)) != NULL;
|
||||
str = NULL) {
|
||||
|
||||
if (parsedVmxPath[0] != '/')
|
||||
continue;
|
||||
@ -634,7 +634,7 @@ cleanup:
|
||||
virDomainDefFree(vmdef);
|
||||
VIR_FREE(vmx);
|
||||
VIR_FREE(vmxPath);
|
||||
if(vm)
|
||||
if (vm)
|
||||
virDomainObjUnlock(vm);
|
||||
vmwareDriverUnlock(driver);
|
||||
return dom;
|
||||
|
@ -60,13 +60,13 @@
|
||||
# endif
|
||||
|
||||
static int
|
||||
xstrtoint64 (char const *s, int base, int64_t *result)
|
||||
xstrtoint64(char const *s, int base, int64_t *result)
|
||||
{
|
||||
long long int lli;
|
||||
char *p;
|
||||
|
||||
errno = 0;
|
||||
lli = strtoll (s, &p, base);
|
||||
lli = strtoll(s, &p, base);
|
||||
if (errno || !(*p == 0 || *p == '\n') || p == s || (int64_t) lli != lli)
|
||||
return -1;
|
||||
*result = lli;
|
||||
@ -74,26 +74,26 @@ xstrtoint64 (char const *s, int base, int64_t *result)
|
||||
}
|
||||
|
||||
static int64_t
|
||||
read_stat (const char *path)
|
||||
read_stat(const char *path)
|
||||
{
|
||||
char str[64];
|
||||
int64_t r;
|
||||
int i;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen (path, "r");
|
||||
fp = fopen(path, "r");
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
/* read, but don't bail out before closing */
|
||||
i = fread (str, 1, sizeof(str) - 1, fp);
|
||||
i = fread(str, 1, sizeof(str) - 1, fp);
|
||||
|
||||
if (VIR_FCLOSE(fp) != 0 /* disk error */
|
||||
|| i < 1) /* ensure we read at least one byte */
|
||||
return -1;
|
||||
|
||||
str[i] = '\0'; /* make sure the string is nul-terminated */
|
||||
if (xstrtoint64 (str, 10, &r) == -1)
|
||||
if (xstrtoint64(str, 10, &r) == -1)
|
||||
return -1;
|
||||
|
||||
return r;
|
||||
@ -136,7 +136,7 @@ read_bd_stat(int device, int domid, const char *str)
|
||||
* is no connected device.
|
||||
*/
|
||||
static int
|
||||
check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
||||
check_bd_connected(xenUnifiedPrivatePtr priv, int device, int domid)
|
||||
{
|
||||
char s[256], *rs;
|
||||
int r;
|
||||
@ -146,11 +146,11 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
||||
* xenstore, etc.
|
||||
*/
|
||||
if (!priv->xshandle) return 1;
|
||||
snprintf (s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
|
||||
domid, device);
|
||||
snprintf(s, sizeof(s), "/local/domain/0/backend/vbd/%d/%d/state",
|
||||
domid, device);
|
||||
s[sizeof(s) - 1] = '\0';
|
||||
|
||||
rs = xs_read (priv->xshandle, 0, s, &len);
|
||||
rs = xs_read(priv->xshandle, 0, s, &len);
|
||||
if (!rs) return 1;
|
||||
if (len == 0) {
|
||||
/* Hmmm ... we can get to xenstore but it returns an empty
|
||||
@ -161,7 +161,7 @@ check_bd_connected (xenUnifiedPrivatePtr priv, int device, int domid)
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = STREQ (rs, "4");
|
||||
r = STREQ(rs, "4");
|
||||
VIR_FREE(rs);
|
||||
return r;
|
||||
}
|
||||
@ -170,11 +170,11 @@ static int
|
||||
read_bd_stats(xenUnifiedPrivatePtr priv,
|
||||
int device, int domid, struct _virDomainBlockStats *stats)
|
||||
{
|
||||
stats->rd_req = read_bd_stat (device, domid, "rd_req");
|
||||
stats->rd_bytes = read_bd_stat (device, domid, "rd_sect");
|
||||
stats->wr_req = read_bd_stat (device, domid, "wr_req");
|
||||
stats->wr_bytes = read_bd_stat (device, domid, "wr_sect");
|
||||
stats->errs = read_bd_stat (device, domid, "oo_req");
|
||||
stats->rd_req = read_bd_stat(device, domid, "rd_req");
|
||||
stats->rd_bytes = read_bd_stat(device, domid, "rd_sect");
|
||||
stats->wr_req = read_bd_stat(device, domid, "wr_req");
|
||||
stats->wr_bytes = read_bd_stat(device, domid, "wr_sect");
|
||||
stats->errs = read_bd_stat(device, domid, "oo_req");
|
||||
|
||||
/* None of the files were found - it's likely that this version
|
||||
* of Xen is an old one which just doesn't support stats collection.
|
||||
@ -195,7 +195,7 @@ read_bd_stats(xenUnifiedPrivatePtr priv,
|
||||
if (stats->rd_req == 0 && stats->rd_bytes == 0 &&
|
||||
stats->wr_req == 0 && stats->wr_bytes == 0 &&
|
||||
stats->errs == 0 &&
|
||||
!check_bd_connected (priv, device, domid)) {
|
||||
!check_bd_connected(priv, device, domid)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Frontend block device not connected for domain %d"),
|
||||
domid);
|
||||
@ -358,10 +358,10 @@ xenLinuxDomainDeviceID(int domid, const char *path)
|
||||
}
|
||||
|
||||
int
|
||||
xenLinuxDomainBlockStats (xenUnifiedPrivatePtr priv,
|
||||
virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainBlockStats *stats)
|
||||
xenLinuxDomainBlockStats(xenUnifiedPrivatePtr priv,
|
||||
virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainBlockStats *stats)
|
||||
{
|
||||
int device = xenLinuxDomainDeviceID(dom->id, path);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1463,9 +1463,9 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
|
||||
|
||||
|
||||
int
|
||||
xenHypervisorDomainBlockStats (virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainBlockStats *stats)
|
||||
xenHypervisorDomainBlockStats(virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainBlockStats *stats)
|
||||
{
|
||||
#ifdef __linux__
|
||||
xenUnifiedPrivatePtr priv;
|
||||
@ -1474,7 +1474,7 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
|
||||
priv = (xenUnifiedPrivatePtr) dom->conn->privateData;
|
||||
xenUnifiedLock(priv);
|
||||
/* Need to lock because it hits the xenstore handle :-( */
|
||||
ret = xenLinuxDomainBlockStats (priv, dom, path, stats);
|
||||
ret = xenLinuxDomainBlockStats(priv, dom, path, stats);
|
||||
xenUnifiedUnlock(priv);
|
||||
return ret;
|
||||
#else
|
||||
@ -1492,9 +1492,9 @@ xenHypervisorDomainBlockStats (virDomainPtr dom,
|
||||
* virNetwork interface, as yet not decided.
|
||||
*/
|
||||
int
|
||||
xenHypervisorDomainInterfaceStats (virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
xenHypervisorDomainInterfaceStats(virDomainPtr dom,
|
||||
const char *path,
|
||||
struct _virDomainInterfaceStats *stats)
|
||||
{
|
||||
#ifdef __linux__
|
||||
int rqdomid, device;
|
||||
@ -1983,30 +1983,30 @@ xenHypervisorInit(struct xenHypervisorVersions *override_versions)
|
||||
* Note that errors here are really internal errors since these
|
||||
* regexps should never fail to compile.
|
||||
*/
|
||||
errcode = regcomp (&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
|
||||
errcode = regcomp(&flags_hvm_rec, flags_hvm_re, REG_EXTENDED);
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror (errcode, &flags_hvm_rec, error, sizeof(error));
|
||||
regfree (&flags_hvm_rec);
|
||||
regerror(errcode, &flags_hvm_rec, error, sizeof(error));
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
return -1;
|
||||
}
|
||||
errcode = regcomp (&flags_pae_rec, flags_pae_re, REG_EXTENDED);
|
||||
errcode = regcomp(&flags_pae_rec, flags_pae_re, REG_EXTENDED);
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror (errcode, &flags_pae_rec, error, sizeof(error));
|
||||
regfree (&flags_pae_rec);
|
||||
regfree (&flags_hvm_rec);
|
||||
regerror(errcode, &flags_pae_rec, error, sizeof(error));
|
||||
regfree(&flags_pae_rec);
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
return -1;
|
||||
}
|
||||
errcode = regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||
errcode = regcomp(&xen_cap_rec, xen_cap_re, REG_EXTENDED);
|
||||
if (errcode != 0) {
|
||||
char error[100];
|
||||
regerror (errcode, &xen_cap_rec, error, sizeof(error));
|
||||
regfree (&xen_cap_rec);
|
||||
regfree (&flags_pae_rec);
|
||||
regfree (&flags_hvm_rec);
|
||||
regerror(errcode, &xen_cap_rec, error, sizeof(error));
|
||||
regfree(&xen_cap_rec);
|
||||
regfree(&flags_pae_rec);
|
||||
regfree(&flags_hvm_rec);
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", error);
|
||||
return -1;
|
||||
}
|
||||
@ -2512,7 +2512,7 @@ xenHypervisorMakeCapabilitiesSunOS(virConnectPtr conn)
|
||||
return NULL;
|
||||
|
||||
/* Really, this never fails - look at the man-page. */
|
||||
uname (&utsname);
|
||||
uname(&utsname);
|
||||
|
||||
guest_arches[i].model = "i686";
|
||||
guest_arches[i].bits = 32;
|
||||
@ -2594,15 +2594,15 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
|
||||
* architectures and non-Linux. (XXX)
|
||||
*/
|
||||
if (cpuinfo) {
|
||||
while (fgets (line, sizeof(line), cpuinfo)) {
|
||||
if (regexec (&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
|
||||
while (fgets(line, sizeof(line), cpuinfo)) {
|
||||
if (regexec(&flags_hvm_rec, line, sizeof(subs)/sizeof(regmatch_t), subs, 0) == 0
|
||||
&& subs[0].rm_so != -1) {
|
||||
if (virStrncpy(hvm_type,
|
||||
&line[subs[1].rm_so],
|
||||
subs[1].rm_eo-subs[1].rm_so,
|
||||
sizeof(hvm_type)) == NULL)
|
||||
goto no_memory;
|
||||
} else if (regexec (&flags_pae_rec, line, 0, NULL, 0) == 0)
|
||||
} else if (regexec(&flags_pae_rec, line, 0, NULL, 0) == 0)
|
||||
host_pae = 1;
|
||||
}
|
||||
}
|
||||
@ -2632,17 +2632,17 @@ xenHypervisorMakeCapabilitiesInternal(virConnectPtr conn,
|
||||
*/
|
||||
|
||||
/* Expecting one line in this file - ignore any more. */
|
||||
if ((capabilities) && (fgets (line, sizeof(line), capabilities))) {
|
||||
if ((capabilities) && (fgets(line, sizeof(line), capabilities))) {
|
||||
/* Split the line into tokens. strtok_r is OK here because we "own"
|
||||
* this buffer. Parse out the features from each token.
|
||||
*/
|
||||
for (str = line, nr_guest_archs = 0;
|
||||
nr_guest_archs < sizeof(guest_archs) / sizeof(guest_archs[0])
|
||||
&& (token = strtok_r (str, " ", &saveptr)) != NULL;
|
||||
&& (token = strtok_r(str, " ", &saveptr)) != NULL;
|
||||
str = NULL) {
|
||||
|
||||
if (regexec (&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
|
||||
subs, 0) == 0) {
|
||||
if (regexec(&xen_cap_rec, token, sizeof(subs) / sizeof(subs[0]),
|
||||
subs, 0) == 0) {
|
||||
int hvm = STRPREFIX(&token[subs[1].rm_so], "hvm");
|
||||
const char *model;
|
||||
int bits, pae = 0, nonpae = 0, ia64_be = 0;
|
||||
@ -2740,9 +2740,9 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
|
||||
struct utsname utsname;
|
||||
|
||||
/* Really, this never fails - look at the man-page. */
|
||||
uname (&utsname);
|
||||
uname(&utsname);
|
||||
|
||||
cpuinfo = fopen ("/proc/cpuinfo", "r");
|
||||
cpuinfo = fopen("/proc/cpuinfo", "r");
|
||||
if (cpuinfo == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
virReportSystemError(errno,
|
||||
@ -2752,7 +2752,7 @@ xenHypervisorMakeCapabilities(virConnectPtr conn)
|
||||
}
|
||||
}
|
||||
|
||||
capabilities = fopen ("/sys/hypervisor/properties/capabilities", "r");
|
||||
capabilities = fopen("/sys/hypervisor/properties/capabilities", "r");
|
||||
if (capabilities == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
VIR_FORCE_FCLOSE(cpuinfo);
|
||||
@ -2790,7 +2790,7 @@ cleanup:
|
||||
* Return the capabilities of this hypervisor.
|
||||
*/
|
||||
char *
|
||||
xenHypervisorGetCapabilities (virConnectPtr conn)
|
||||
xenHypervisorGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||
char *xml;
|
||||
@ -2920,7 +2920,7 @@ xenHypervisorListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||
|
||||
|
||||
char *
|
||||
xenHypervisorDomainGetOSType (virDomainPtr dom)
|
||||
xenHypervisorDomainGetOSType(virDomainPtr dom)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv;
|
||||
xen_getdomaininfo dominfo;
|
||||
@ -3161,7 +3161,7 @@ xenHypervisorGetDomMaxMemory(virConnectPtr conn, int id)
|
||||
*
|
||||
* Returns the memory size in kilobytes or 0 in case of error.
|
||||
*/
|
||||
static unsigned long long ATTRIBUTE_NONNULL (1)
|
||||
static unsigned long long ATTRIBUTE_NONNULL(1)
|
||||
xenHypervisorGetMaxMemory(virDomainPtr domain)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv;
|
||||
@ -3254,7 +3254,7 @@ xenHypervisorGetDomInfo(virConnectPtr conn, int id, virDomainInfoPtr info)
|
||||
info->cpuTime = XEN_GETDOMAININFO_CPUTIME(dominfo);
|
||||
info->memory = XEN_GETDOMAININFO_TOT_PAGES(dominfo) * kb_per_pages;
|
||||
info->maxMem = XEN_GETDOMAININFO_MAX_PAGES(dominfo);
|
||||
if(info->maxMem != UINT_MAX)
|
||||
if (info->maxMem != UINT_MAX)
|
||||
info->maxMem *= kb_per_pages;
|
||||
info->nrVirtCpu = XEN_GETDOMAININFO_CPUCOUNT(dominfo);
|
||||
return 0;
|
||||
@ -3717,7 +3717,7 @@ int
|
||||
xenHavePrivilege(void)
|
||||
{
|
||||
#ifdef __sun
|
||||
return priv_ineffect (PRIV_XVM_CONTROL);
|
||||
return priv_ineffect(PRIV_XVM_CONTROL);
|
||||
#else
|
||||
return access(XEN_HYPERVISOR_SOCKET, R_OK) == 0;
|
||||
#endif
|
||||
|
@ -96,7 +96,7 @@ xenInotifyXendDomainsDirLookup(virConnectPtr conn, const char *filename,
|
||||
initial list of domains */
|
||||
VIR_DEBUG("Looking for dom with uuid: %s", uuid_str);
|
||||
/* XXX Should not have to go via a virDomainPtr obj instance */
|
||||
if(!(dom = xenDaemonLookupByUUID(conn, rawuuid))) {
|
||||
if (!(dom = xenDaemonLookupByUUID(conn, rawuuid))) {
|
||||
/* If we are here, the domain has gone away.
|
||||
search for, and create a domain from the stored
|
||||
list info */
|
||||
@ -250,7 +250,7 @@ xenInotifyEvent(int watch ATTRIBUTE_UNUSED,
|
||||
|
||||
VIR_DEBUG("got inotify event");
|
||||
|
||||
if( conn && conn->privateData ) {
|
||||
if (conn && conn->privateData) {
|
||||
priv = conn->privateData;
|
||||
} else {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -299,14 +299,14 @@ reread:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("looking up dom"));
|
||||
|
||||
if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0 ) {
|
||||
if (xenInotifyRemoveDomainConfigInfo(conn, fname) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Error adding file to config cache"));
|
||||
goto cleanup;
|
||||
}
|
||||
} else if (e->mask & ( IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO) ) {
|
||||
} else if (e->mask & (IN_CREATE | IN_CLOSE_WRITE | IN_MOVED_TO)) {
|
||||
virDomainEventPtr event;
|
||||
if (xenInotifyAddDomainConfigInfo(conn, fname) < 0 ) {
|
||||
if (xenInotifyAddDomainConfigInfo(conn, fname) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Error adding file to config cache"));
|
||||
goto cleanup;
|
||||
@ -381,7 +381,7 @@ xenInotifyOpen(virConnectPtr conn,
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (xenInotifyAddDomainConfigInfo(conn, path) < 0 ) {
|
||||
if (xenInotifyAddDomainConfigInfo(conn, path) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("Error adding file to config list"));
|
||||
closedir(dh);
|
||||
@ -414,7 +414,7 @@ xenInotifyOpen(virConnectPtr conn,
|
||||
|
||||
VIR_DEBUG("Building initial config cache");
|
||||
if (priv->useXenConfigCache &&
|
||||
xenXMConfigCacheRefresh (conn) < 0) {
|
||||
xenXMConfigCacheRefresh(conn) < 0) {
|
||||
VIR_DEBUG("Failed to enable XM config cache %s", conn->err.message);
|
||||
return -1;
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ istartswith(const char *haystack, const char *needle)
|
||||
* Returns the HTTP return code and @content is set to the
|
||||
* allocated memory containing HTTP content.
|
||||
*/
|
||||
static int ATTRIBUTE_NONNULL (2)
|
||||
static int ATTRIBUTE_NONNULL(2)
|
||||
xend_req(int fd, char **content)
|
||||
{
|
||||
char *buffer;
|
||||
@ -308,7 +308,7 @@ xend_req(int fd, char **content)
|
||||
/* Allocate one byte beyond the end of the largest buffer we will read.
|
||||
Combined with the fact that VIR_ALLOC_N zeros the returned buffer,
|
||||
this guarantees that "content" will always be NUL-terminated. */
|
||||
if (VIR_ALLOC_N(*content, content_length + 1) < 0 ) {
|
||||
if (VIR_ALLOC_N(*content, content_length + 1) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
@ -682,13 +682,13 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
|
||||
for (r = res; r; r = r->ai_next) {
|
||||
int sock;
|
||||
|
||||
sock = socket (r->ai_family, SOCK_STREAM, r->ai_protocol);
|
||||
sock = socket(r->ai_family, SOCK_STREAM, r->ai_protocol);
|
||||
if (sock == -1) {
|
||||
saved_errno = errno;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (connect (sock, r->ai_addr, r->ai_addrlen) == -1) {
|
||||
if (connect(sock, r->ai_addr, r->ai_addrlen) == -1) {
|
||||
saved_errno = errno;
|
||||
VIR_FORCE_CLOSE(sock);
|
||||
continue;
|
||||
@ -704,7 +704,7 @@ xenDaemonOpen_tcp(virConnectPtr conn, const char *host, const char *port)
|
||||
break;
|
||||
}
|
||||
|
||||
freeaddrinfo (res);
|
||||
freeaddrinfo(res);
|
||||
|
||||
if (!priv->addrlen) {
|
||||
/* Don't raise error when unprivileged, since proxy takes over */
|
||||
@ -1288,7 +1288,7 @@ xenDaemonOpen(virConnectPtr conn,
|
||||
xend_detect_config_version(conn) == -1)
|
||||
goto failed;
|
||||
}
|
||||
else if (STRCASEEQ (conn->uri->scheme, "xen")) {
|
||||
else if (STRCASEEQ(conn->uri->scheme, "xen")) {
|
||||
/*
|
||||
* try first to open the unix socket
|
||||
*/
|
||||
@ -1302,7 +1302,7 @@ xenDaemonOpen(virConnectPtr conn,
|
||||
if (xenDaemonOpen_tcp(conn, "localhost", "8000") < 0 ||
|
||||
xend_detect_config_version(conn) == -1)
|
||||
goto failed;
|
||||
} else if (STRCASEEQ (conn->uri->scheme, "http")) {
|
||||
} else if (STRCASEEQ(conn->uri->scheme, "http")) {
|
||||
if (conn->uri->port &&
|
||||
virAsprintf(&port, "%d", conn->uri->port) == -1) {
|
||||
virReportOOMError();
|
||||
@ -3130,14 +3130,14 @@ xenDaemonDomainSetAutostart(virDomainPtr domain,
|
||||
}
|
||||
|
||||
int
|
||||
xenDaemonDomainMigratePrepare (virConnectPtr dconn,
|
||||
char **cookie ATTRIBUTE_UNUSED,
|
||||
int *cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri_in,
|
||||
char **uri_out,
|
||||
unsigned long flags,
|
||||
const char *dname ATTRIBUTE_UNUSED,
|
||||
unsigned long resource ATTRIBUTE_UNUSED)
|
||||
xenDaemonDomainMigratePrepare(virConnectPtr dconn,
|
||||
char **cookie ATTRIBUTE_UNUSED,
|
||||
int *cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri_in,
|
||||
char **uri_out,
|
||||
unsigned long flags,
|
||||
const char *dname ATTRIBUTE_UNUSED,
|
||||
unsigned long resource ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virCheckFlags(XEN_MIGRATION_FLAGS, -1);
|
||||
|
||||
@ -3155,13 +3155,13 @@ xenDaemonDomainMigratePrepare (virConnectPtr dconn,
|
||||
}
|
||||
|
||||
int
|
||||
xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
const char *cookie ATTRIBUTE_UNUSED,
|
||||
int cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long bandwidth)
|
||||
xenDaemonDomainMigratePerform(virDomainPtr domain,
|
||||
const char *cookie ATTRIBUTE_UNUSED,
|
||||
int cookielen ATTRIBUTE_UNUSED,
|
||||
const char *uri,
|
||||
unsigned long flags,
|
||||
const char *dname,
|
||||
unsigned long bandwidth)
|
||||
{
|
||||
/* Upper layers have already checked domain. */
|
||||
/* NB: Passing port=0 to xend means it ignores
|
||||
@ -3199,7 +3199,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
* Check the flags.
|
||||
*/
|
||||
if ((flags & VIR_MIGRATE_LIVE)) {
|
||||
strcpy (live, "1");
|
||||
strcpy(live, "1");
|
||||
flags &= ~VIR_MIGRATE_LIVE;
|
||||
}
|
||||
|
||||
@ -3235,36 +3235,36 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
* URI is non-NULL (guaranteed by caller). We expect either
|
||||
* "hostname", "hostname:port" or "xenmigr://hostname[:port]/".
|
||||
*/
|
||||
if (strstr (uri, "//")) { /* Full URI. */
|
||||
if (strstr(uri, "//")) { /* Full URI. */
|
||||
virURIPtr uriptr;
|
||||
if (!(uriptr = virURIParse (uri)))
|
||||
if (!(uriptr = virURIParse(uri)))
|
||||
return -1;
|
||||
|
||||
if (uriptr->scheme && STRCASENEQ (uriptr->scheme, "xenmigr")) {
|
||||
if (uriptr->scheme && STRCASENEQ(uriptr->scheme, "xenmigr")) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("xenDaemonDomainMigrate: only xenmigr://"
|
||||
" migrations are supported by Xen"));
|
||||
virURIFree (uriptr);
|
||||
virURIFree(uriptr);
|
||||
return -1;
|
||||
}
|
||||
if (!uriptr->server) {
|
||||
virReportError(VIR_ERR_INVALID_ARG,
|
||||
"%s", _("xenDaemonDomainMigrate: a hostname must be"
|
||||
" specified in the URI"));
|
||||
virURIFree (uriptr);
|
||||
virURIFree(uriptr);
|
||||
return -1;
|
||||
}
|
||||
hostname = strdup (uriptr->server);
|
||||
hostname = strdup(uriptr->server);
|
||||
if (!hostname) {
|
||||
virReportOOMError();
|
||||
virURIFree (uriptr);
|
||||
virURIFree(uriptr);
|
||||
return -1;
|
||||
}
|
||||
if (uriptr->port)
|
||||
snprintf (port, sizeof(port), "%d", uriptr->port);
|
||||
virURIFree (uriptr);
|
||||
snprintf(port, sizeof(port), "%d", uriptr->port);
|
||||
virURIFree(uriptr);
|
||||
}
|
||||
else if ((p = strrchr (uri, ':')) != NULL) { /* "hostname:port" */
|
||||
else if ((p = strrchr(uri, ':')) != NULL) { /* "hostname:port" */
|
||||
int port_nr, n;
|
||||
|
||||
if (virStrToLong_i(p+1, NULL, 10, &port_nr) < 0) {
|
||||
@ -3272,11 +3272,11 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
"%s", _("xenDaemonDomainMigrate: invalid port number"));
|
||||
return -1;
|
||||
}
|
||||
snprintf (port, sizeof(port), "%d", port_nr);
|
||||
snprintf(port, sizeof(port), "%d", port_nr);
|
||||
|
||||
/* Get the hostname. */
|
||||
n = p - uri; /* n = Length of hostname in bytes. */
|
||||
hostname = strdup (uri);
|
||||
hostname = strdup(uri);
|
||||
if (!hostname) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
@ -3284,7 +3284,7 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
hostname[n] = '\0';
|
||||
}
|
||||
else { /* "hostname" (or IP address) */
|
||||
hostname = strdup (uri);
|
||||
hostname = strdup(uri);
|
||||
if (!hostname) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
@ -3299,20 +3299,20 @@ xenDaemonDomainMigratePerform (virDomainPtr domain,
|
||||
* to our advantage since all parameters supported and required
|
||||
* by current xend can be included without breaking older xend.
|
||||
*/
|
||||
ret = xend_op (domain->conn, domain->name,
|
||||
"op", "migrate",
|
||||
"destination", hostname,
|
||||
"live", live,
|
||||
"port", port,
|
||||
"node", "-1", /* xen-unstable c/s 17753 */
|
||||
"ssl", "0", /* xen-unstable c/s 17709 */
|
||||
"change_home_server", "0", /* xen-unstable c/s 20326 */
|
||||
"resource", "0", /* removed by xen-unstable c/s 17553 */
|
||||
NULL);
|
||||
VIR_FREE (hostname);
|
||||
ret = xend_op(domain->conn, domain->name,
|
||||
"op", "migrate",
|
||||
"destination", hostname,
|
||||
"live", live,
|
||||
"port", port,
|
||||
"node", "-1", /* xen-unstable c/s 17753 */
|
||||
"ssl", "0", /* xen-unstable c/s 17709 */
|
||||
"change_home_server", "0", /* xen-unstable c/s 20326 */
|
||||
"resource", "0", /* removed by xen-unstable c/s 17553 */
|
||||
NULL);
|
||||
VIR_FREE(hostname);
|
||||
|
||||
if (ret == 0 && undefined_source)
|
||||
xenDaemonDomainUndefine (domain);
|
||||
xenDaemonDomainUndefine(domain);
|
||||
|
||||
VIR_DEBUG("migration done");
|
||||
|
||||
@ -3540,7 +3540,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
|
||||
"%s", _("node information incomplete, missing scheduler name"));
|
||||
goto error;
|
||||
}
|
||||
if (STREQ (ret, "credit")) {
|
||||
if (STREQ(ret, "credit")) {
|
||||
schedulertype = strdup("credit");
|
||||
if (schedulertype == NULL){
|
||||
virReportOOMError();
|
||||
@ -3548,7 +3548,7 @@ xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
|
||||
}
|
||||
if (nparams)
|
||||
*nparams = XEN_SCHED_CRED_NPARAM;
|
||||
} else if (STREQ (ret, "sedf")) {
|
||||
} else if (STREQ(ret, "sedf")) {
|
||||
schedulertype = strdup("sedf");
|
||||
if (schedulertype == NULL){
|
||||
virReportOOMError();
|
||||
@ -3738,10 +3738,10 @@ xenDaemonSetSchedulerParameters(virDomainPtr domain,
|
||||
memset(&buf_weight, 0, VIR_UUID_BUFLEN);
|
||||
memset(&buf_cap, 0, VIR_UUID_BUFLEN);
|
||||
for (i = 0; i < nparams; i++) {
|
||||
if (STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT) &&
|
||||
if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_WEIGHT) &&
|
||||
params[i].type == VIR_TYPED_PARAM_UINT) {
|
||||
snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui);
|
||||
} else if (STREQ (params[i].field, VIR_DOMAIN_SCHEDULER_CAP) &&
|
||||
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_CAP) &&
|
||||
params[i].type == VIR_TYPED_PARAM_UINT) {
|
||||
snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
|
||||
} else {
|
||||
@ -3797,9 +3797,9 @@ error:
|
||||
* Returns 0 if successful, -1 if error, -2 if declined.
|
||||
*/
|
||||
int
|
||||
xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer)
|
||||
xenDaemonDomainBlockPeek(virDomainPtr domain, const char *path,
|
||||
unsigned long long offset, size_t size,
|
||||
void *buffer)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv;
|
||||
struct sexpr *root = NULL;
|
||||
@ -3817,11 +3817,11 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
||||
|
||||
/* Security check: The path must correspond to a block device. */
|
||||
if (domain->id > 0)
|
||||
root = sexpr_get (domain->conn, "/xend/domain/%d?detail=1",
|
||||
domain->id);
|
||||
root = sexpr_get(domain->conn, "/xend/domain/%d?detail=1",
|
||||
domain->id);
|
||||
else if (domain->id < 0)
|
||||
root = sexpr_get (domain->conn, "/xend/domain/%s?detail=1",
|
||||
domain->name);
|
||||
root = sexpr_get(domain->conn, "/xend/domain/%s?detail=1",
|
||||
domain->name);
|
||||
else {
|
||||
/* This call always fails for dom0. */
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
@ -3852,7 +3852,7 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
||||
path = actual;
|
||||
|
||||
/* The path is correct, now try to open it and get its size. */
|
||||
fd = open (path, O_RDONLY);
|
||||
fd = open(path, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
virReportSystemError(errno,
|
||||
_("failed to open for reading: %s"),
|
||||
@ -3864,8 +3864,8 @@ xenDaemonDomainBlockPeek (virDomainPtr domain, const char *path,
|
||||
/* NB. Because we configure with AC_SYS_LARGEFILE, off_t should
|
||||
* be 64 bits on all platforms.
|
||||
*/
|
||||
if (lseek (fd, offset, SEEK_SET) == (off_t) -1 ||
|
||||
saferead (fd, buffer, size) == (ssize_t) -1) {
|
||||
if (lseek(fd, offset, SEEK_SET) == (off_t) -1 ||
|
||||
saferead(fd, buffer, size) == (ssize_t) -1) {
|
||||
virReportSystemError(errno,
|
||||
_("failed to lseek or read from file: %s"),
|
||||
path);
|
||||
|
@ -309,7 +309,7 @@ xenXMConfigCacheAddFile(virConnectPtr conn, const char *filename)
|
||||
* Caller must hold the lock on 'conn->privateData' before
|
||||
* calling this function
|
||||
*/
|
||||
int xenXMConfigCacheRefresh (virConnectPtr conn) {
|
||||
int xenXMConfigCacheRefresh(virConnectPtr conn) {
|
||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||
DIR *dh;
|
||||
struct dirent *ent;
|
||||
@ -411,9 +411,9 @@ int xenXMConfigCacheRefresh (virConnectPtr conn) {
|
||||
* every few seconds
|
||||
*/
|
||||
virDrvOpenStatus
|
||||
xenXMOpen (virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
xenXMOpen(virConnectPtr conn,
|
||||
virConnectAuthPtr auth ATTRIBUTE_UNUSED,
|
||||
unsigned int flags)
|
||||
{
|
||||
xenUnifiedPrivatePtr priv = conn->privateData;
|
||||
|
||||
@ -893,7 +893,7 @@ virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
|
||||
priv = conn->privateData;
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(filename = virHashLookup(priv->nameConfigMap, domname)))
|
||||
@ -949,7 +949,7 @@ virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
|
||||
priv = conn->privateData;
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (!(entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, (const void *)uuid)))
|
||||
@ -1049,7 +1049,7 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0) {
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0) {
|
||||
xenUnifiedUnlock(priv);
|
||||
return NULL;
|
||||
}
|
||||
@ -1261,7 +1261,7 @@ int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames
|
||||
priv = conn->privateData;
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (maxnames > virHashSize(priv->configCache))
|
||||
@ -1306,7 +1306,7 @@ int xenXMNumOfDefinedDomains(virConnectPtr conn) {
|
||||
priv = conn->privateData;
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh (conn) < 0)
|
||||
if (!xenInotifyActive(conn) && xenXMConfigCacheRefresh(conn) < 0)
|
||||
goto cleanup;
|
||||
|
||||
ret = virHashSize(priv->nameConfigMap);
|
||||
@ -1527,11 +1527,11 @@ xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
|
||||
}
|
||||
|
||||
int
|
||||
xenXMDomainBlockPeek (virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
const char *path ATTRIBUTE_UNUSED,
|
||||
unsigned long long offset ATTRIBUTE_UNUSED,
|
||||
size_t size ATTRIBUTE_UNUSED,
|
||||
void *buffer ATTRIBUTE_UNUSED)
|
||||
xenXMDomainBlockPeek(virDomainPtr dom ATTRIBUTE_UNUSED,
|
||||
const char *path ATTRIBUTE_UNUSED,
|
||||
unsigned long long offset ATTRIBUTE_UNUSED,
|
||||
size_t size ATTRIBUTE_UNUSED,
|
||||
void *buffer ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||
_("block peeking not implemented"));
|
||||
|
@ -95,7 +95,7 @@ virConnectDoStoreList(virConnectPtr conn, const char *path,
|
||||
if (priv->xshandle == NULL || path == NULL || nb == NULL)
|
||||
return NULL;
|
||||
|
||||
return xs_directory (priv->xshandle, 0, path, nb);
|
||||
return xs_directory(priv->xshandle, 0, path, nb);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,8 +287,8 @@ xenStoreOpen(virConnectPtr conn,
|
||||
}
|
||||
|
||||
/* This will get called once at start */
|
||||
if ( xenStoreAddWatch(conn, "@releaseDomain",
|
||||
"releaseDomain", xenStoreDomainReleased, priv) < 0 )
|
||||
if (xenStoreAddWatch(conn, "@releaseDomain",
|
||||
"releaseDomain", xenStoreDomainReleased, priv) < 0)
|
||||
{
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("adding watch @releaseDomain"));
|
||||
@ -296,8 +296,8 @@ xenStoreOpen(virConnectPtr conn,
|
||||
}
|
||||
|
||||
/* The initial call of this will fill domInfoList */
|
||||
if( xenStoreAddWatch(conn, "@introduceDomain",
|
||||
"introduceDomain", xenStoreDomainIntroduced, priv) < 0 )
|
||||
if (xenStoreAddWatch(conn, "@introduceDomain",
|
||||
"introduceDomain", xenStoreDomainIntroduced, priv) < 0)
|
||||
{
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("adding watch @introduceDomain"));
|
||||
@ -571,7 +571,7 @@ xenStoreNumOfDomains(virConnectPtr conn)
|
||||
realnum++;
|
||||
}
|
||||
out:
|
||||
VIR_FREE (idlist);
|
||||
VIR_FREE(idlist);
|
||||
ret = realnum;
|
||||
}
|
||||
return ret;
|
||||
@ -599,7 +599,7 @@ xenStoreDoListDomains(virConnectPtr conn, xenUnifiedPrivatePtr priv, int *ids, i
|
||||
if (priv->xshandle == NULL)
|
||||
goto out;
|
||||
|
||||
idlist = xs_directory (priv->xshandle, 0, "/local/domain", &num);
|
||||
idlist = xs_directory(priv->xshandle, 0, "/local/domain", &num);
|
||||
if (idlist == NULL)
|
||||
goto out;
|
||||
|
||||
@ -615,7 +615,7 @@ xenStoreDoListDomains(virConnectPtr conn, xenUnifiedPrivatePtr priv, int *ids, i
|
||||
}
|
||||
|
||||
out:
|
||||
VIR_FREE (idlist);
|
||||
VIR_FREE(idlist);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ xenStoreLookupByName(virConnectPtr conn, const char *name)
|
||||
prop[199] = 0;
|
||||
tmp = xs_read(priv->xshandle, 0, prop, &len);
|
||||
if (tmp != NULL) {
|
||||
found = STREQ (name, tmp);
|
||||
found = STREQ(name, tmp);
|
||||
VIR_FREE(tmp);
|
||||
if (found)
|
||||
break;
|
||||
@ -985,19 +985,19 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
|
||||
if (val == NULL)
|
||||
break;
|
||||
if ((devlen != len) || memcmp(val, dev, len)) {
|
||||
VIR_FREE (val);
|
||||
VIR_FREE(val);
|
||||
} else {
|
||||
ret = strdup(list[i]);
|
||||
|
||||
if (ret == NULL)
|
||||
virReportOOMError();
|
||||
|
||||
VIR_FREE (val);
|
||||
VIR_FREE (list);
|
||||
VIR_FREE(val);
|
||||
VIR_FREE(list);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
VIR_FREE (list);
|
||||
VIR_FREE(list);
|
||||
}
|
||||
snprintf(dir, sizeof(dir), "/local/domain/0/backend/tap/%d", id);
|
||||
list = xs_directory(priv->xshandle, 0, dir, &num);
|
||||
@ -1008,19 +1008,19 @@ xenStoreDomainGetDiskID(virConnectPtr conn, int id, const char *dev) {
|
||||
if (val == NULL)
|
||||
break;
|
||||
if ((devlen != len) || memcmp(val, dev, len)) {
|
||||
VIR_FREE (val);
|
||||
VIR_FREE(val);
|
||||
} else {
|
||||
ret = strdup(list[i]);
|
||||
|
||||
if (ret == NULL)
|
||||
virReportOOMError();
|
||||
|
||||
VIR_FREE (val);
|
||||
VIR_FREE (list);
|
||||
VIR_FREE(val);
|
||||
VIR_FREE(list);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
VIR_FREE (list);
|
||||
VIR_FREE(list);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -1164,12 +1164,12 @@ int xenStoreAddWatch(virConnectPtr conn,
|
||||
return -1;
|
||||
|
||||
list = priv->xsWatchList;
|
||||
if(!list)
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
/* check if we already have this callback on our list */
|
||||
for (n=0; n < list->count; n++) {
|
||||
if( STREQ(list->watches[n]->path, path) &&
|
||||
if (STREQ(list->watches[n]->path, path) &&
|
||||
STREQ(list->watches[n]->token, token)) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
"%s", _("watch already tracked"));
|
||||
@ -1228,11 +1228,11 @@ int xenStoreRemoveWatch(virConnectPtr conn,
|
||||
return -1;
|
||||
|
||||
list = priv->xsWatchList;
|
||||
if(!list)
|
||||
if (!list)
|
||||
return -1;
|
||||
|
||||
for (i = 0 ; i < list->count ; i++) {
|
||||
if( STREQ(list->watches[i]->path, path) &&
|
||||
if (STREQ(list->watches[i]->path, path) &&
|
||||
STREQ(list->watches[i]->token, token)) {
|
||||
|
||||
if (!xs_unwatch(priv->xshandle,
|
||||
@ -1271,8 +1271,8 @@ xenStoreFindWatch(xenStoreWatchListPtr list,
|
||||
{
|
||||
int i;
|
||||
for (i = 0 ; i < list->count ; i++)
|
||||
if( STREQ(path, list->watches[i]->path) &&
|
||||
STREQ(token, list->watches[i]->token) )
|
||||
if (STREQ(path, list->watches[i]->path) &&
|
||||
STREQ(token, list->watches[i]->token))
|
||||
return list->watches[i];
|
||||
|
||||
return NULL;
|
||||
@ -1293,14 +1293,14 @@ xenStoreWatchEvent(int watch ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn = data;
|
||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
|
||||
|
||||
if(!priv) return;
|
||||
if (!priv) return;
|
||||
|
||||
/* only set a watch on read and write events */
|
||||
if (events & (VIR_EVENT_HANDLE_ERROR | VIR_EVENT_HANDLE_HANGUP)) return;
|
||||
|
||||
xenUnifiedLock(priv);
|
||||
|
||||
if(!priv->xshandle)
|
||||
if (!priv->xshandle)
|
||||
goto cleanup;
|
||||
|
||||
event = xs_read_watch(priv->xshandle, &stringCount);
|
||||
@ -1311,7 +1311,7 @@ xenStoreWatchEvent(int watch ATTRIBUTE_UNUSED,
|
||||
token = event[XS_WATCH_TOKEN];
|
||||
|
||||
sw = xenStoreFindWatch(priv->xsWatchList, path, token);
|
||||
if( sw )
|
||||
if (sw)
|
||||
sw->cb(conn, path, token, sw->opaque);
|
||||
VIR_FREE(event);
|
||||
|
||||
@ -1342,7 +1342,7 @@ retry:
|
||||
if (new_domain_cnt < 0)
|
||||
return -1;
|
||||
|
||||
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
|
||||
if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
@ -1418,14 +1418,14 @@ int xenStoreDomainReleased(virConnectPtr conn,
|
||||
|
||||
xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) opaque;
|
||||
|
||||
if(!priv->activeDomainList->count) return 0;
|
||||
if (!priv->activeDomainList->count) return 0;
|
||||
|
||||
retry:
|
||||
new_domain_cnt = xenStoreNumOfDomains(conn);
|
||||
if (new_domain_cnt < 0)
|
||||
return -1;
|
||||
|
||||
if( VIR_ALLOC_N(new_domids,new_domain_cnt) < 0 ) {
|
||||
if (VIR_ALLOC_N(new_domids,new_domain_cnt) < 0) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ static int xenapiDefaultConsoleType(const char *ostype)
|
||||
* Return virCapsPtr on success or NULL on failure
|
||||
*/
|
||||
static virCapsPtr
|
||||
getCapsObject (void)
|
||||
getCapsObject(void)
|
||||
{
|
||||
virCapsGuestPtr guest1, guest2;
|
||||
virCapsGuestDomainPtr domain1, domain2;
|
||||
@ -98,8 +98,8 @@ getCapsObject (void)
|
||||
* Return VIR_DRV_OPEN_SUCCESS on success, else VIR_DRV_OPEN_ERROR
|
||||
*/
|
||||
static virDrvOpenStatus
|
||||
xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
|
||||
unsigned int flags)
|
||||
xenapiOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
||||
unsigned int flags)
|
||||
{
|
||||
char *username = NULL;
|
||||
char *password = NULL;
|
||||
@ -225,7 +225,7 @@ xenapiOpen (virConnectPtr conn, virConnectAuthPtr auth,
|
||||
*
|
||||
*/
|
||||
static int
|
||||
xenapiClose (virConnectPtr conn)
|
||||
xenapiClose(virConnectPtr conn)
|
||||
{
|
||||
struct _xenapiPrivate *priv = conn->privateData;
|
||||
|
||||
@ -251,7 +251,7 @@ xenapiClose (virConnectPtr conn)
|
||||
* Returns 0
|
||||
*/
|
||||
static int
|
||||
xenapiSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
xenapiSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
{
|
||||
switch (feature) {
|
||||
case VIR_DRV_FEATURE_MIGRATION_V2:
|
||||
@ -268,7 +268,7 @@ xenapiSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature)
|
||||
* Returns name of the driver
|
||||
*/
|
||||
static const char *
|
||||
xenapiType (virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
xenapiType(virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return "XenAPI";
|
||||
}
|
||||
@ -281,7 +281,7 @@ xenapiType (virConnectPtr conn ATTRIBUTE_UNUSED)
|
||||
*
|
||||
*/
|
||||
static int
|
||||
xenapiGetVersion (virConnectPtr conn, unsigned long *hvVer)
|
||||
xenapiGetVersion(virConnectPtr conn, unsigned long *hvVer)
|
||||
{
|
||||
xen_host host;
|
||||
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
||||
@ -333,7 +333,7 @@ xenapiGetVersion (virConnectPtr conn, unsigned long *hvVer)
|
||||
* Returns the hostname on success, or NULL on failure
|
||||
*/
|
||||
static char *
|
||||
xenapiGetHostname (virConnectPtr conn)
|
||||
xenapiGetHostname(virConnectPtr conn)
|
||||
{
|
||||
char *result = NULL;
|
||||
xen_host host;
|
||||
@ -356,7 +356,7 @@ xenapiGetHostname (virConnectPtr conn)
|
||||
* Returns a hardcoded value for Maximum VCPUS
|
||||
*/
|
||||
static int
|
||||
xenapiGetMaxVcpus (virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBUTE_UNUSED)
|
||||
xenapiGetMaxVcpus(virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* this is hardcoded for simplicity and set to a resonable value compared
|
||||
to the actual value */
|
||||
@ -371,7 +371,7 @@ xenapiGetMaxVcpus (virConnectPtr conn ATTRIBUTE_UNUSED, const char *type ATTRIBU
|
||||
* Returns Node details on success or else -1
|
||||
*/
|
||||
static int
|
||||
xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
|
||||
xenapiNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
||||
{
|
||||
int64_t memory, mhz;
|
||||
xen_host_cpu_set *host_cpu_set;
|
||||
@ -422,7 +422,7 @@ xenapiNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info)
|
||||
* Returns capabilities as an XML string
|
||||
*/
|
||||
static char *
|
||||
xenapiGetCapabilities (virConnectPtr conn)
|
||||
xenapiGetCapabilities(virConnectPtr conn)
|
||||
{
|
||||
virCapsPtr caps = ((struct _xenapiPrivate *)(conn->privateData))->caps;
|
||||
if (caps) {
|
||||
@ -444,7 +444,7 @@ xenapiGetCapabilities (virConnectPtr conn)
|
||||
* Returns the number of domain found or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiListDomains (virConnectPtr conn, int *ids, int maxids)
|
||||
xenapiListDomains(virConnectPtr conn, int *ids, int maxids)
|
||||
{
|
||||
/* vm.list */
|
||||
xen_host host;
|
||||
@ -481,7 +481,7 @@ xenapiListDomains (virConnectPtr conn, int *ids, int maxids)
|
||||
* Returns the number of domains found or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiNumOfDomains (virConnectPtr conn)
|
||||
xenapiNumOfDomains(virConnectPtr conn)
|
||||
{
|
||||
/* #(vm.list) */
|
||||
xen_vm_set *result = NULL;
|
||||
@ -510,9 +510,9 @@ xenapiNumOfDomains (virConnectPtr conn)
|
||||
* Returns the domain pointer or NULL in case of error
|
||||
*/
|
||||
static virDomainPtr
|
||||
xenapiDomainCreateXML (virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags)
|
||||
xenapiDomainCreateXML(virConnectPtr conn,
|
||||
const char *xmlDesc,
|
||||
unsigned int flags)
|
||||
{
|
||||
xen_vm_record *record = NULL;
|
||||
xen_vm vm = NULL;
|
||||
@ -562,7 +562,7 @@ xenapiDomainCreateXML (virConnectPtr conn,
|
||||
* or NULL in case of error
|
||||
*/
|
||||
static virDomainPtr
|
||||
xenapiDomainLookupByID (virConnectPtr conn, int id)
|
||||
xenapiDomainLookupByID(virConnectPtr conn, int id)
|
||||
{
|
||||
int i;
|
||||
int64_t domID;
|
||||
@ -617,8 +617,8 @@ xenapiDomainLookupByID (virConnectPtr conn, int id)
|
||||
* or -1 in case of error
|
||||
*/
|
||||
static virDomainPtr
|
||||
xenapiDomainLookupByUUID (virConnectPtr conn,
|
||||
const unsigned char *uuid)
|
||||
xenapiDomainLookupByUUID(virConnectPtr conn,
|
||||
const unsigned char *uuid)
|
||||
{
|
||||
/* vm.get_by_uuid */
|
||||
xen_vm vm;
|
||||
@ -655,8 +655,8 @@ xenapiDomainLookupByUUID (virConnectPtr conn,
|
||||
* or -1 in case of error
|
||||
*/
|
||||
static virDomainPtr
|
||||
xenapiDomainLookupByName (virConnectPtr conn,
|
||||
const char *name)
|
||||
xenapiDomainLookupByName(virConnectPtr conn,
|
||||
const char *name)
|
||||
{
|
||||
/* vm.get_by_name_label */
|
||||
xen_vm_set *vms = NULL;
|
||||
@ -706,7 +706,7 @@ xenapiDomainLookupByName (virConnectPtr conn,
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainSuspend (virDomainPtr dom)
|
||||
xenapiDomainSuspend(virDomainPtr dom)
|
||||
{
|
||||
/* vm.pause() */
|
||||
xen_vm vm;
|
||||
@ -741,7 +741,7 @@ xenapiDomainSuspend (virDomainPtr dom)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainResume (virDomainPtr dom)
|
||||
xenapiDomainResume(virDomainPtr dom)
|
||||
{
|
||||
/* vm.unpause() */
|
||||
xen_vm vm;
|
||||
@ -820,7 +820,7 @@ xenapiDomainShutdown(virDomainPtr dom)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainReboot (virDomainPtr dom, unsigned int flags)
|
||||
xenapiDomainReboot(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
/* vm.clean_reboot */
|
||||
xen_vm vm;
|
||||
@ -912,7 +912,7 @@ xenapiDomainDestroy(virDomainPtr dom)
|
||||
* Returns OS version on success or NULL in case of error
|
||||
*/
|
||||
static char *
|
||||
xenapiDomainGetOSType (virDomainPtr dom)
|
||||
xenapiDomainGetOSType(virDomainPtr dom)
|
||||
{
|
||||
xen_vm vm=NULL;
|
||||
xen_vm_set *vms;
|
||||
@ -949,7 +949,7 @@ xenapiDomainGetOSType (virDomainPtr dom)
|
||||
* or 0 in case of error
|
||||
*/
|
||||
static unsigned long long
|
||||
xenapiDomainGetMaxMemory (virDomainPtr dom)
|
||||
xenapiDomainGetMaxMemory(virDomainPtr dom)
|
||||
{
|
||||
int64_t mem_static_max = 0;
|
||||
xen_vm vm;
|
||||
@ -980,7 +980,7 @@ xenapiDomainGetMaxMemory (virDomainPtr dom)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
|
||||
xenapiDomainSetMaxMemory(virDomainPtr dom, unsigned long memory)
|
||||
{
|
||||
/* vm.set_memory_static_max */
|
||||
xen_vm vm;
|
||||
@ -1015,7 +1015,7 @@ xenapiDomainSetMaxMemory (virDomainPtr dom, unsigned long memory)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info)
|
||||
xenapiDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
|
||||
{
|
||||
int64_t maxmem = 0, memory = 0, vcpu = 0;
|
||||
xen_vm vm;
|
||||
@ -1108,8 +1108,8 @@ cleanup:
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
||||
unsigned int flags)
|
||||
xenapiDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
||||
unsigned int flags)
|
||||
{
|
||||
/* vm.set_vcpus_max */
|
||||
xen_vm vm;
|
||||
@ -1147,7 +1147,7 @@ xenapiDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus,
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
xenapiDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus)
|
||||
{
|
||||
return xenapiDomainSetVcpusFlags(dom, nvcpus, VIR_DOMAIN_VCPU_LIVE);
|
||||
}
|
||||
@ -1159,8 +1159,8 @@ xenapiDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainPinVcpu (virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
||||
unsigned char *cpumap, int maplen)
|
||||
xenapiDomainPinVcpu(virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
||||
unsigned char *cpumap, int maplen)
|
||||
{
|
||||
char *value = NULL;
|
||||
xen_vm vm;
|
||||
@ -1200,9 +1200,9 @@ xenapiDomainPinVcpu (virDomainPtr dom, unsigned int vcpu ATTRIBUTE_UNUSED,
|
||||
* Return number of structures filled on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainGetVcpus (virDomainPtr dom,
|
||||
virVcpuInfoPtr info, int maxinfo,
|
||||
unsigned char *cpumaps, int maplen)
|
||||
xenapiDomainGetVcpus(virDomainPtr dom,
|
||||
virVcpuInfoPtr info, int maxinfo,
|
||||
unsigned char *cpumaps, int maplen)
|
||||
{
|
||||
|
||||
xen_vm_set *vms = NULL;
|
||||
@ -1278,7 +1278,7 @@ xenapiDomainGetVcpus (virDomainPtr dom,
|
||||
* Returns Vcpus count on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
||||
xenapiDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
xen_vm vm;
|
||||
xen_vm_set *vms;
|
||||
@ -1321,7 +1321,7 @@ xenapiDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags)
|
||||
* Returns maximum number of Vcpus on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainGetMaxVcpus (virDomainPtr dom)
|
||||
xenapiDomainGetMaxVcpus(virDomainPtr dom)
|
||||
{
|
||||
return xenapiDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE |
|
||||
VIR_DOMAIN_VCPU_MAXIMUM));
|
||||
@ -1380,7 +1380,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
for (i = 0; i < result->size; i++) {
|
||||
if (STREQ(result->contents[i].key, "order")) {
|
||||
int cnt = 0;
|
||||
while(result->contents[i].val[cnt] != '\0') {
|
||||
while (result->contents[i].val[cnt] != '\0') {
|
||||
defPtr->os.bootDevs[cnt] = map2LibvirtBootOrder(result->contents[i].val[cnt]);
|
||||
cnt++;
|
||||
}
|
||||
@ -1421,7 +1421,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
}
|
||||
xen_vm_get_pv_args(session, &value, vm);
|
||||
if (STRNEQ(value, "")) {
|
||||
if(!(defPtr->os.cmdline = strdup(value))) {
|
||||
if (!(defPtr->os.cmdline = strdup(value))) {
|
||||
VIR_FREE(boot_policy);
|
||||
VIR_FREE(value);
|
||||
goto error_cleanup;
|
||||
@ -1462,7 +1462,7 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
xen_vm_get_platform(session, &result, vm);
|
||||
if (result != NULL) {
|
||||
int i;
|
||||
for(i = 0; i < result->size; i++) {
|
||||
for (i = 0; i < result->size; i++) {
|
||||
if (STREQ(result->contents[i].val, "true")) {
|
||||
if (STREQ(result->contents[i].key, "acpi"))
|
||||
defPtr->features = defPtr->features | (1<<VIR_DOMAIN_FEATURE_ACPI);
|
||||
@ -1535,8 +1535,8 @@ xenapiDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
|
||||
* Returns number of names provided in the array or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiListDefinedDomains (virConnectPtr conn, char **const names,
|
||||
int maxnames)
|
||||
xenapiListDefinedDomains(virConnectPtr conn, char **const names,
|
||||
int maxnames)
|
||||
{
|
||||
int i,j=0,doms;
|
||||
xen_vm_set *result;
|
||||
@ -1582,7 +1582,7 @@ xenapiListDefinedDomains (virConnectPtr conn, char **const names,
|
||||
* Returns number of domains found on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiNumOfDefinedDomains (virConnectPtr conn)
|
||||
xenapiNumOfDefinedDomains(virConnectPtr conn)
|
||||
{
|
||||
xen_vm_set *result;
|
||||
xen_vm_record *record;
|
||||
@ -1615,7 +1615,7 @@ xenapiNumOfDefinedDomains (virConnectPtr conn)
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
|
||||
xenapiDomainCreateWithFlags(virDomainPtr dom, unsigned int flags)
|
||||
{
|
||||
xen_vm_set *vms;
|
||||
xen_vm vm;
|
||||
@ -1657,7 +1657,7 @@ xenapiDomainCreateWithFlags (virDomainPtr dom, unsigned int flags)
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainCreate (virDomainPtr dom)
|
||||
xenapiDomainCreate(virDomainPtr dom)
|
||||
{
|
||||
return xenapiDomainCreateWithFlags(dom, 0);
|
||||
}
|
||||
@ -1669,7 +1669,7 @@ xenapiDomainCreate (virDomainPtr dom)
|
||||
* Returns 0 on success or -1 in case of error
|
||||
*/
|
||||
static virDomainPtr
|
||||
xenapiDomainDefineXML (virConnectPtr conn, const char *xml)
|
||||
xenapiDomainDefineXML(virConnectPtr conn, const char *xml)
|
||||
{
|
||||
xen_vm_record *record=NULL;
|
||||
xen_vm vm=NULL;
|
||||
@ -1755,7 +1755,7 @@ xenapiDomainUndefine(virDomainPtr dom)
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
|
||||
xenapiDomainGetAutostart(virDomainPtr dom, int *autostart)
|
||||
{
|
||||
int i,flag=0;
|
||||
xen_vm_set *vms;
|
||||
@ -1802,7 +1802,7 @@ xenapiDomainGetAutostart (virDomainPtr dom, int *autostart)
|
||||
* Return 0 on success or -1 in case of error
|
||||
*/
|
||||
static int
|
||||
xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
|
||||
xenapiDomainSetAutostart(virDomainPtr dom, int autostart)
|
||||
{
|
||||
xen_vm_set *vms;
|
||||
xen_vm vm;
|
||||
@ -1835,7 +1835,7 @@ xenapiDomainSetAutostart (virDomainPtr dom, int autostart)
|
||||
}
|
||||
|
||||
static char *
|
||||
xenapiDomainGetSchedulerType (virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
||||
xenapiDomainGetSchedulerType(virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
||||
{
|
||||
char *result = NULL;
|
||||
|
||||
@ -1853,7 +1853,7 @@ xenapiDomainGetSchedulerType (virDomainPtr dom ATTRIBUTE_UNUSED, int *nparams)
|
||||
* Returns memory size on success or 0 in case of error
|
||||
*/
|
||||
static unsigned long long
|
||||
xenapiNodeGetFreeMemory (virConnectPtr conn)
|
||||
xenapiNodeGetFreeMemory(virConnectPtr conn)
|
||||
{
|
||||
xen_host_metrics_set *xen_met_set;
|
||||
unsigned long long freeMem = 0;
|
||||
@ -1886,8 +1886,8 @@ xenapiDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED)
|
||||
* Returns the number of entries filled in freeMems, or -1 in case of error.
|
||||
*/
|
||||
static int
|
||||
xenapiNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMems,
|
||||
int startCell, int maxCells)
|
||||
xenapiNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems,
|
||||
int startCell, int maxCells)
|
||||
{
|
||||
if (maxCells > 1 && startCell > 0) {
|
||||
xenapiSessionErrorHandler(conn, VIR_ERR_NO_SUPPORT, NULL);
|
||||
@ -1970,9 +1970,9 @@ static virDriver xenapiDriver = {
|
||||
* Returns the driver priority or -1 in case of error.
|
||||
*/
|
||||
int
|
||||
xenapiRegister (void)
|
||||
xenapiRegister(void)
|
||||
{
|
||||
return virRegisterDriver (&xenapiDriver);
|
||||
return virRegisterDriver(&xenapiDriver);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -306,7 +306,7 @@ getCpuBitMapfromString(char *mask, unsigned char *cpumap, int maplen)
|
||||
if (virStrToLong_i(num, NULL, 10, &pos) < 0)
|
||||
return;
|
||||
if (pos < 0 || pos > max_bits - 1)
|
||||
VIR_WARN ("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
|
||||
VIR_WARN("number in str %d exceeds cpumap's max bits %d", pos, max_bits);
|
||||
else
|
||||
(cpumap)[pos / 8] |= (1 << (pos % 8));
|
||||
num = strtok_r(NULL, ",", &bp);
|
||||
@ -342,7 +342,7 @@ mapPowerState(enum xen_vm_power_state state)
|
||||
|
||||
/* allocate a flexible array and fill values(key,val) */
|
||||
int
|
||||
allocStringMap (xen_string_string_map **strings, char *key, char *val)
|
||||
allocStringMap(xen_string_string_map **strings, char *key, char *val)
|
||||
{
|
||||
int sz = ((*strings) == NULL) ? 0 : (*strings)->size;
|
||||
sz++;
|
||||
@ -383,8 +383,8 @@ xenapiSessionErrorHandle(virConnectPtr conn, virErrorNumber errNum,
|
||||
|
||||
/* creates network intereface for VM */
|
||||
static int
|
||||
createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
||||
char *bridge, char *mac)
|
||||
createVifNetwork(virConnectPtr conn, xen_vm vm, int device,
|
||||
char *bridge, char *mac)
|
||||
{
|
||||
xen_session *session = ((struct _xenapiPrivate *)(conn->privateData))->session;
|
||||
xen_vm xvm = NULL;
|
||||
@ -402,7 +402,7 @@ createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
||||
xen_network_record *net_rec = NULL;
|
||||
int cnt = 0;
|
||||
if (xen_network_get_all(session, &net_set)) {
|
||||
for(cnt = 0; cnt < net_set->size; cnt++) {
|
||||
for (cnt = 0; cnt < net_set->size; cnt++) {
|
||||
if (xen_network_get_record(session, &net_rec, net_set->contents[cnt])) {
|
||||
if (STREQ(net_rec->bridge, bridge)) {
|
||||
break;
|
||||
@ -446,8 +446,8 @@ createVifNetwork (virConnectPtr conn, xen_vm vm, int device,
|
||||
|
||||
/* Create a VM record from the XML description */
|
||||
int
|
||||
createVMRecordFromXml (virConnectPtr conn, virDomainDefPtr def,
|
||||
xen_vm_record **record, xen_vm *vm)
|
||||
createVMRecordFromXml(virConnectPtr conn, virDomainDefPtr def,
|
||||
xen_vm_record **record, xen_vm *vm)
|
||||
{
|
||||
char uuidStr[VIR_UUID_STRING_BUFLEN];
|
||||
xen_string_string_map *strings = NULL;
|
||||
|
@ -426,8 +426,8 @@ xenParseSxprDisks(virDomainDefPtr def,
|
||||
|
||||
src = offset + 1;
|
||||
|
||||
if (STREQ (disk->driverName, "tap") ||
|
||||
STREQ (disk->driverName, "tap2")) {
|
||||
if (STREQ(disk->driverName, "tap") ||
|
||||
STREQ(disk->driverName, "tap2")) {
|
||||
char *driverType = NULL;
|
||||
|
||||
offset = strchr(src, ':');
|
||||
@ -470,7 +470,7 @@ xenParseSxprDisks(virDomainDefPtr def,
|
||||
disk->type = VIR_DOMAIN_DISK_TYPE_FILE;
|
||||
}
|
||||
|
||||
if (STREQLEN (dst, "ioemu:", 6))
|
||||
if (STREQLEN(dst, "ioemu:", 6))
|
||||
dst += 6;
|
||||
|
||||
disk->device = VIR_DOMAIN_DISK_DEVICE_DISK;
|
||||
@ -478,9 +478,9 @@ xenParseSxprDisks(virDomainDefPtr def,
|
||||
if (xendConfigVersion >= XEND_CONFIG_VERSION_3_0_3) {
|
||||
offset = strrchr(dst, ':');
|
||||
if (offset) {
|
||||
if (STREQ (offset, ":cdrom")) {
|
||||
if (STREQ(offset, ":cdrom")) {
|
||||
disk->device = VIR_DOMAIN_DISK_DEVICE_CDROM;
|
||||
} else if (STREQ (offset, ":disk")) {
|
||||
} else if (STREQ(offset, ":disk")) {
|
||||
/* The default anyway */
|
||||
} else {
|
||||
/* Unknown, lets pretend its a disk too */
|
||||
|
@ -1209,7 +1209,7 @@ static int xenFormatXMDisk(virConfValuePtr list,
|
||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||
virConfValuePtr val, tmp;
|
||||
|
||||
if(disk->src) {
|
||||
if (disk->src) {
|
||||
if (disk->format) {
|
||||
const char *type;
|
||||
|
||||
|
@ -625,12 +625,12 @@ static int test16(const void *unused ATTRIBUTE_UNUSED)
|
||||
}
|
||||
if ((fd = open(abs_builddir "/commandhelper.log",
|
||||
O_CREAT | O_TRUNC | O_WRONLY, 0600)) < 0) {
|
||||
printf("Cannot open log file: %s\n", strerror (errno));
|
||||
printf("Cannot open log file: %s\n", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
virCommandWriteArgLog(cmd, fd);
|
||||
if (VIR_CLOSE(fd) < 0) {
|
||||
printf("Cannot close log file: %s\n", strerror (errno));
|
||||
printf("Cannot close log file: %s\n", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
virConfFree(conf);
|
||||
if (fwrite(buffer, 1, len, stdout) != len) {
|
||||
fprintf(stderr, "Write failed: %s\n", strerror (errno));
|
||||
fprintf(stderr, "Write failed: %s\n", strerror(errno));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ mymain(void)
|
||||
|
||||
if ((driver.caps = testQemuCapsInit()) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
if((driver.stateDir = strdup("/nowhere")) == NULL)
|
||||
if ((driver.stateDir = strdup("/nowhere")) == NULL)
|
||||
return EXIT_FAILURE;
|
||||
|
||||
# define DO_TEST_FULL(name, extraFlags, migrateFrom) \
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "virrandom.h"
|
||||
|
||||
int
|
||||
main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virSecurityManagerPtr mgr;
|
||||
const char *doi, *model;
|
||||
@ -19,23 +19,23 @@ main (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
|
||||
|
||||
mgr = virSecurityManagerNew(NULL, "QEMU", false, true, false);
|
||||
if (mgr == NULL) {
|
||||
fprintf (stderr, "Failed to start security driver");
|
||||
fprintf(stderr, "Failed to start security driver");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
model = virSecurityManagerGetModel(mgr);
|
||||
if (!model)
|
||||
{
|
||||
fprintf (stderr, "Failed to copy secModel model: %s",
|
||||
strerror (errno));
|
||||
fprintf(stderr, "Failed to copy secModel model: %s",
|
||||
strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
doi = virSecurityManagerGetDOI(mgr);
|
||||
if (!doi)
|
||||
{
|
||||
fprintf (stderr, "Failed to copy secModel DOI: %s",
|
||||
strerror (errno));
|
||||
fprintf(stderr, "Failed to copy secModel DOI: %s",
|
||||
strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ mymain(void)
|
||||
1, testCompareXMLToXMLHelper, &info) < 0) \
|
||||
ret = -1; \
|
||||
} \
|
||||
while(0);
|
||||
while (0);
|
||||
|
||||
DO_TEST("pool-dir", "vol-file");
|
||||
DO_TEST("pool-dir", "vol-file-backing");
|
||||
|
@ -216,12 +216,12 @@ virtTestLoadFile(const char *file, char **buf)
|
||||
int len, tmplen, buflen;
|
||||
|
||||
if (!fp) {
|
||||
fprintf (stderr, "%s: failed to open: %s\n", file, strerror(errno));
|
||||
fprintf(stderr, "%s: failed to open: %s\n", file, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (fstat(fileno(fp), &st) < 0) {
|
||||
fprintf (stderr, "%s: failed to fstat: %s\n", file, strerror(errno));
|
||||
fprintf(stderr, "%s: failed to fstat: %s\n", file, strerror(errno));
|
||||
VIR_FORCE_FCLOSE(fp);
|
||||
return -1;
|
||||
}
|
||||
@ -229,7 +229,7 @@ virtTestLoadFile(const char *file, char **buf)
|
||||
tmplen = buflen = st.st_size + 1;
|
||||
|
||||
if (VIR_ALLOC_N(*buf, buflen) < 0) {
|
||||
fprintf (stderr, "%s: larger than available memory (> %d)\n", file, buflen);
|
||||
fprintf(stderr, "%s: larger than available memory (> %d)\n", file, buflen);
|
||||
VIR_FORCE_FCLOSE(fp);
|
||||
return -1;
|
||||
}
|
||||
@ -253,7 +253,7 @@ virtTestLoadFile(const char *file, char **buf)
|
||||
tmplen -= len;
|
||||
}
|
||||
if (ferror(fp)) {
|
||||
fprintf (stderr, "%s: read failed: %s\n", file, strerror(errno));
|
||||
fprintf(stderr, "%s: read failed: %s\n", file, strerror(errno));
|
||||
VIR_FORCE_FCLOSE(fp);
|
||||
VIR_FREE(*buf);
|
||||
return -1;
|
||||
@ -282,7 +282,7 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
|
||||
if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
|
||||
goto cleanup;
|
||||
|
||||
open_max = sysconf (_SC_OPEN_MAX);
|
||||
open_max = sysconf(_SC_OPEN_MAX);
|
||||
for (i = 0; i < open_max; i++) {
|
||||
if (i != stdinfd &&
|
||||
i != pipefd) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user