diff options
114 files changed, 1925 insertions, 1930 deletions
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c index d9dfea1901..78380441fd 100644 --- a/daemon/libvirtd-config.c +++ b/daemon/libvirtd-config.c @@ -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; diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c index 624831ad52..1ebbac1d95 100644 --- a/daemon/libvirtd.c +++ b/daemon/libvirtd.c @@ -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); } } diff --git a/python/libvirt-override.c b/python/libvirt-override.c index cd482279d0..c07b33a997 100644 --- a/python/libvirt-override.c +++ b/python/libvirt-override.c @@ -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; } diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7bf0282b87..0575fcd76b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -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; diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 3cfd9f0760..cf37308663 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -355,7 +355,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn, int ret = 0; /* Check incoming */ - if ( !cbList ) { + if (!cbList) { return -1; } diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 31b921936e..fc3602a36c 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -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); diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index e9a8d0a396..228951d4f2 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -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) && diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c index b6d5d40869..46580e9eb9 100644 --- a/src/conf/nwfilter_conf.c +++ b/src/conf/nwfilter_conf.c @@ -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; diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c index 83facf655c..e420ffb0ce 100644 --- a/src/cpu/cpu_powerpc.c +++ b/src/cpu/cpu_powerpc.c @@ -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; } diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index e691c04a27..ca8cd92188 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -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); diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index 2aa6978d05..13e8887b75 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -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; diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index 0d2b970226..097ed4843f 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -2440,7 +2440,7 @@ esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx, } if ((!inverse && powerState_ == powerState) || - ( inverse && powerState_ != powerState)) { + (inverse && powerState_ != powerState)) { count++; } } else { diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index c5ddb51734..01467285fc 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -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; \ diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index c0422fc2fe..4023588b32 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -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); diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index 55abbadf1c..226e020cb5 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -152,7 +152,7 @@ netcf_error: { ncf_close(driverState->netcf); } - virMutexDestroy (&driverState->lock); + virMutexDestroy(&driverState->lock); mutex_error: VIR_FREE(driverState); alloc_error: diff --git a/src/libvirt.c b/src/libvirt.c index 2a01b8078f..ca4ad2a365 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -256,7 +256,7 @@ virConnectAuthPtr virConnectAuthPtrDefault = &virConnectAuthDefault; #if HAVE_WINSOCK2_H static int -winsock_init (void) +winsock_init(void) { WORD winsock_version, err; WSADATA winsock_data; @@ -268,8 +268,8 @@ winsock_init (void) } #endif -static int virTLSMutexInit (void **priv) -{ \ +static int virTLSMutexInit(void **priv) +{ virMutexPtr lock = NULL; if (VIR_ALLOC(lock) < 0) @@ -417,7 +417,7 @@ virGlobalInit(void) VIR_DEBUG("register drivers"); #if HAVE_WINSOCK2_H - if (winsock_init () == -1) + if (winsock_init() == -1) goto error; #endif @@ -465,7 +465,7 @@ virGlobalInit(void) goto error; #endif #ifdef WITH_REMOTE - if (remoteRegister () == -1) + if (remoteRegister() == -1) goto error; #endif @@ -503,12 +503,12 @@ virInitialize(void) #ifdef WIN32 BOOL WINAPI -DllMain (HINSTANCE instance, DWORD reason, LPVOID ignore); +DllMain(HINSTANCE instance, DWORD reason, LPVOID ignore); BOOL WINAPI -DllMain (HINSTANCE instance ATTRIBUTE_UNUSED, - DWORD reason, - LPVOID ignore ATTRIBUTE_UNUSED) +DllMain(HINSTANCE instance ATTRIBUTE_UNUSED, + DWORD reason, + LPVOID ignore ATTRIBUTE_UNUSED) { switch (reason) { case DLL_PROCESS_ATTACH: @@ -590,7 +590,7 @@ virRegisterNetworkDriver(virNetworkDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as network driver %d", + VIR_DEBUG("registering %s as network driver %d", driver->name, virNetworkDriverTabCount); virNetworkDriverTab[virNetworkDriverTabCount] = driver; @@ -617,7 +617,7 @@ virRegisterInterfaceDriver(virInterfaceDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as interface driver %d", + VIR_DEBUG("registering %s as interface driver %d", driver->name, virInterfaceDriverTabCount); virInterfaceDriverTab[virInterfaceDriverTabCount] = driver; @@ -644,7 +644,7 @@ virRegisterStorageDriver(virStorageDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as storage driver %d", + VIR_DEBUG("registering %s as storage driver %d", driver->name, virStorageDriverTabCount); virStorageDriverTab[virStorageDriverTabCount] = driver; @@ -671,7 +671,7 @@ virRegisterDeviceMonitor(virDeviceMonitorPtr driver) return -1; } - VIR_DEBUG ("registering %s as device driver %d", + VIR_DEBUG("registering %s as device driver %d", driver->name, virDeviceMonitorTabCount); virDeviceMonitorTab[virDeviceMonitorTabCount] = driver; @@ -698,7 +698,7 @@ virRegisterSecretDriver(virSecretDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as secret driver %d", + VIR_DEBUG("registering %s as secret driver %d", driver->name, virSecretDriverTabCount); virSecretDriverTab[virSecretDriverTabCount] = driver; @@ -725,7 +725,7 @@ virRegisterNWFilterDriver(virNWFilterDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as network filter driver %d", + VIR_DEBUG("registering %s as network filter driver %d", driver->name, virNWFilterDriverTabCount); virNWFilterDriverTab[virNWFilterDriverTabCount] = driver; @@ -755,7 +755,7 @@ virRegisterDriver(virDriverPtr driver) return -1; } - VIR_DEBUG ("registering %s as driver %d", + VIR_DEBUG("registering %s as driver %d", driver->name, virDriverTabCount); virDriverTab[virDriverTabCount] = driver; @@ -1076,9 +1076,9 @@ cleanup: } static virConnectPtr -do_open (const char *name, - virConnectAuthPtr auth, - unsigned int flags) +do_open(const char *name, + virConnectAuthPtr auth, + unsigned int flags) { int i, res; virConnectPtr ret; @@ -1114,14 +1114,14 @@ do_open (const char *name, /* Convert xen:// -> xen:/// because xmlParseURI cannot parse the * former. This allows URIs such as xen://localhost to work. */ - if (STREQ (name, "xen://")) + if (STREQ(name, "xen://")) name = "xen:///"; if (!(flags & VIR_CONNECT_NO_ALIASES) && virConnectOpenResolveURIAlias(conf, name, &alias) < 0) goto failed; - if (!(ret->uri = virURIParse (alias ? alias : name))) { + if (!(ret->uri = virURIParse(alias ? alias : name))) { VIR_FREE(alias); goto failed; } @@ -1183,7 +1183,7 @@ do_open (const char *name, VIR_DEBUG("trying driver %d (%s) ...", i, virDriverTab[i]->name); - res = virDriverTab[i]->open (ret, auth, flags); + res = virDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("driver %d %s returned %s", i, virDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1205,7 +1205,7 @@ do_open (const char *name, } for (i = 0; i < virNetworkDriverTabCount; i++) { - res = virNetworkDriverTab[i]->open (ret, auth, flags); + res = virNetworkDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("network driver %d %s returned %s", i, virNetworkDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1220,7 +1220,7 @@ do_open (const char *name, } for (i = 0; i < virInterfaceDriverTabCount; i++) { - res = virInterfaceDriverTab[i]->open (ret, auth, flags); + res = virInterfaceDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("interface driver %d %s returned %s", i, virInterfaceDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1236,7 +1236,7 @@ do_open (const char *name, /* Secondary driver for storage. Optional */ for (i = 0; i < virStorageDriverTabCount; i++) { - res = virStorageDriverTab[i]->open (ret, auth, flags); + res = virStorageDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("storage driver %d %s returned %s", i, virStorageDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1252,7 +1252,7 @@ do_open (const char *name, /* Node driver (optional) */ for (i = 0; i < virDeviceMonitorTabCount; i++) { - res = virDeviceMonitorTab[i]->open (ret, auth, flags); + res = virDeviceMonitorTab[i]->open(ret, auth, flags); VIR_DEBUG("node driver %d %s returned %s", i, virDeviceMonitorTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1268,7 +1268,7 @@ do_open (const char *name, /* Secret manipulation driver. Optional */ for (i = 0; i < virSecretDriverTabCount; i++) { - res = virSecretDriverTab[i]->open (ret, auth, flags); + res = virSecretDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("secret driver %d %s returned %s", i, virSecretDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1284,7 +1284,7 @@ do_open (const char *name, /* Network filter driver. Optional */ for (i = 0; i < virNWFilterDriverTabCount; i++) { - res = virNWFilterDriverTab[i]->open (ret, auth, flags); + res = virNWFilterDriverTab[i]->open(ret, auth, flags); VIR_DEBUG("nwfilter driver %d %s returned %s", i, virNWFilterDriverTab[i]->name, res == VIR_DRV_OPEN_SUCCESS ? "SUCCESS" : @@ -1332,7 +1332,7 @@ failed: * URIs are documented at http://libvirt.org/uri.html */ virConnectPtr -virConnectOpen (const char *name) +virConnectOpen(const char *name) { virConnectPtr ret = NULL; @@ -1341,7 +1341,7 @@ virConnectOpen (const char *name) VIR_DEBUG("name=%s", name); virResetLastError(); - ret = do_open (name, NULL, 0); + ret = do_open(name, NULL, 0); if (!ret) goto error; return ret; @@ -1376,7 +1376,7 @@ virConnectOpenReadOnly(const char *name) VIR_DEBUG("name=%s", name); virResetLastError(); - ret = do_open (name, NULL, VIR_CONNECT_RO); + ret = do_open(name, NULL, VIR_CONNECT_RO); if (!ret) goto error; return ret; @@ -1415,7 +1415,7 @@ virConnectOpenAuth(const char *name, VIR_DEBUG("name=%s, auth=%p, flags=%x", NULLSTR(name), auth, flags); virResetLastError(); - ret = do_open (name, auth, flags); + ret = do_open(name, auth, flags); if (!ret) goto error; return ret; @@ -1510,7 +1510,7 @@ virConnectRef(virConnectPtr conn) * implementation of driver features in the remote case. */ int -virDrvSupportsFeature (virConnectPtr conn, int feature) +virDrvSupportsFeature(virConnectPtr conn, int feature) { int ret; VIR_DEBUG("conn=%p, feature=%d", conn, feature); @@ -1560,7 +1560,7 @@ virConnectGetType(virConnectPtr conn) } if (conn->driver->type) { - ret = conn->driver->type (conn); + ret = conn->driver->type(conn); if (ret) return ret; } return conn->driver->name; @@ -1595,7 +1595,7 @@ virConnectGetVersion(virConnectPtr conn, unsigned long *hvVer) virCheckNonNullArgGoto(hvVer, error); if (conn->driver->version) { - int ret = conn->driver->version (conn, hvVer); + int ret = conn->driver->version(conn, hvVer); if (ret < 0) goto error; return ret; @@ -1663,7 +1663,7 @@ error: * NULL if there was an error. */ char * -virConnectGetHostname (virConnectPtr conn) +virConnectGetHostname(virConnectPtr conn) { VIR_DEBUG("conn=%p", conn); @@ -1676,7 +1676,7 @@ virConnectGetHostname (virConnectPtr conn) } if (conn->driver->getHostname) { - char *ret = conn->driver->getHostname (conn); + char *ret = conn->driver->getHostname(conn); if (!ret) goto error; return ret; @@ -1705,7 +1705,7 @@ error: * NULL if there was an error. */ char * -virConnectGetURI (virConnectPtr conn) +virConnectGetURI(virConnectPtr conn) { char *name; VIR_DEBUG("conn=%p", conn); @@ -1742,7 +1742,7 @@ error: * NULL if there was an error. */ char * -virConnectGetSysinfo (virConnectPtr conn, unsigned int flags) +virConnectGetSysinfo(virConnectPtr conn, unsigned int flags) { VIR_DEBUG("conn=%p, flags=%x", conn, flags); @@ -1755,7 +1755,7 @@ virConnectGetSysinfo (virConnectPtr conn, unsigned int flags) } if (conn->driver->getSysinfo) { - char *ret = conn->driver->getSysinfo (conn, flags); + char *ret = conn->driver->getSysinfo(conn, flags); if (!ret) goto error; return ret; @@ -1794,7 +1794,7 @@ virConnectGetMaxVcpus(virConnectPtr conn, } if (conn->driver->getMaxVcpus) { - int ret = conn->driver->getMaxVcpus (conn, type); + int ret = conn->driver->getMaxVcpus(conn, type); if (ret < 0) goto error; return ret; @@ -1840,7 +1840,7 @@ virConnectListDomains(virConnectPtr conn, int *ids, int maxids) virCheckNonNegativeArgGoto(maxids, error); if (conn->driver->listDomains) { - int ret = conn->driver->listDomains (conn, ids, maxids); + int ret = conn->driver->listDomains(conn, ids, maxids); if (ret < 0) goto error; return ret; @@ -1874,7 +1874,7 @@ virConnectNumOfDomains(virConnectPtr conn) } if (conn->driver->numOfDomains) { - int ret = conn->driver->numOfDomains (conn); + int ret = conn->driver->numOfDomains(conn); if (ret < 0) goto error; return ret; @@ -1901,13 +1901,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virDomainGetConnect (virDomainPtr dom) +virDomainGetConnect(virDomainPtr dom) { VIR_DOMAIN_DEBUG(dom); virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -1962,7 +1962,7 @@ virDomainCreateXML(virConnectPtr conn, const char *xmlDesc, if (conn->driver->domainCreateXML) { virDomainPtr ret; - ret = conn->driver->domainCreateXML (conn, xmlDesc, flags); + ret = conn->driver->domainCreateXML(conn, xmlDesc, flags); if (!ret) goto error; return ret; @@ -2021,7 +2021,7 @@ virDomainLookupByID(virConnectPtr conn, int id) if (conn->driver->domainLookupByID) { virDomainPtr ret; - ret = conn->driver->domainLookupByID (conn, id); + ret = conn->driver->domainLookupByID(conn, id); if (!ret) goto error; return ret; @@ -2060,7 +2060,7 @@ virDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (conn->driver->domainLookupByUUID) { virDomainPtr ret; - ret = conn->driver->domainLookupByUUID (conn, uuid); + ret = conn->driver->domainLookupByUUID(conn, uuid); if (!ret) goto error; return ret; @@ -2138,7 +2138,7 @@ virDomainLookupByName(virConnectPtr conn, const char *name) if (conn->driver->domainLookupByName) { virDomainPtr dom; - dom = conn->driver->domainLookupByName (conn, name); + dom = conn->driver->domainLookupByName(conn, name); if (!dom) goto error; return dom; @@ -2198,7 +2198,7 @@ virDomainDestroy(virDomainPtr domain) if (conn->driver->domainDestroy) { int ret; - ret = conn->driver->domainDestroy (domain); + ret = conn->driver->domainDestroy(domain); if (ret < 0) goto error; return ret; @@ -2371,7 +2371,7 @@ virDomainSuspend(virDomainPtr domain) if (conn->driver->domainSuspend) { int ret; - ret = conn->driver->domainSuspend (domain); + ret = conn->driver->domainSuspend(domain); if (ret < 0) goto error; return ret; @@ -2419,7 +2419,7 @@ virDomainResume(virDomainPtr domain) if (conn->driver->domainResume) { int ret; - ret = conn->driver->domainResume (domain); + ret = conn->driver->domainResume(domain); if (ret < 0) goto error; return ret; @@ -3187,7 +3187,7 @@ virDomainShutdown(virDomainPtr domain) if (conn->driver->domainShutdown) { int ret; - ret = conn->driver->domainShutdown (domain); + ret = conn->driver->domainShutdown(domain); if (ret < 0) goto error; return ret; @@ -3316,7 +3316,7 @@ virDomainReboot(virDomainPtr domain, unsigned int flags) if (conn->driver->domainReboot) { int ret; - ret = conn->driver->domainReboot (domain, flags); + ret = conn->driver->domainReboot(domain, flags); if (ret < 0) goto error; return ret; @@ -3366,7 +3366,7 @@ virDomainReset(virDomainPtr domain, unsigned int flags) if (conn->driver->domainReset) { int ret; - ret = conn->driver->domainReset (domain, flags); + ret = conn->driver->domainReset(domain, flags); if (ret < 0) goto error; return ret; @@ -3519,7 +3519,7 @@ virDomainGetOSType(virDomainPtr domain) if (conn->driver->domainGetOSType) { char *ret; - ret = conn->driver->domainGetOSType (domain); + ret = conn->driver->domainGetOSType(domain); if (!ret) goto error; return ret; @@ -3562,7 +3562,7 @@ virDomainGetMaxMemory(virDomainPtr domain) if (conn->driver->domainGetMaxMemory) { unsigned long long ret; - ret = conn->driver->domainGetMaxMemory (domain); + ret = conn->driver->domainGetMaxMemory(domain); if (ret == 0) goto error; if ((unsigned long) ret != ret) { @@ -3620,7 +3620,7 @@ virDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) if (conn->driver->domainSetMaxMemory) { int ret; - ret = conn->driver->domainSetMaxMemory (domain, memory); + ret = conn->driver->domainSetMaxMemory(domain, memory); if (ret < 0) goto error; return ret; @@ -3672,7 +3672,7 @@ virDomainSetMemory(virDomainPtr domain, unsigned long memory) if (conn->driver->domainSetMemory) { int ret; - ret = conn->driver->domainSetMemory (domain, memory); + ret = conn->driver->domainSetMemory(domain, memory); if (ret < 0) goto error; return ret; @@ -3835,7 +3835,7 @@ virDomainSetMemoryParameters(virDomainPtr domain, if (conn->driver->domainSetMemoryParameters) { int ret; - ret = conn->driver->domainSetMemoryParameters (domain, params, nparams, flags); + ret = conn->driver->domainSetMemoryParameters(domain, params, nparams, flags); if (ret < 0) goto error; return ret; @@ -3921,7 +3921,7 @@ virDomainGetMemoryParameters(virDomainPtr domain, if (conn->driver->domainGetMemoryParameters) { int ret; - ret = conn->driver->domainGetMemoryParameters (domain, params, nparams, flags); + ret = conn->driver->domainGetMemoryParameters(domain, params, nparams, flags); if (ret < 0) goto error; return ret; @@ -4104,7 +4104,7 @@ virDomainSetBlkioParameters(virDomainPtr domain, if (conn->driver->domainSetBlkioParameters) { int ret; - ret = conn->driver->domainSetBlkioParameters (domain, params, nparams, flags); + ret = conn->driver->domainSetBlkioParameters(domain, params, nparams, flags); if (ret < 0) goto error; return ret; @@ -4181,12 +4181,12 @@ virDomainGetBlkioParameters(virDomainPtr domain, if (conn->driver->domainGetBlkioParameters) { int ret; - ret = conn->driver->domainGetBlkioParameters (domain, params, nparams, flags); + ret = conn->driver->domainGetBlkioParameters(domain, params, nparams, flags); if (ret < 0) goto error; return ret; } - virLibConnError (VIR_ERR_NO_SUPPORT, __FUNCTION__); + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); error: virDispatchError(domain->conn); @@ -4226,7 +4226,7 @@ virDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) if (conn->driver->domainGetInfo) { int ret; - ret = conn->driver->domainGetInfo (domain, info); + ret = conn->driver->domainGetInfo(domain, info); if (ret < 0) goto error; return ret; @@ -4427,10 +4427,10 @@ char *virConnectDomainXMLFromNative(virConnectPtr conn, if (conn->driver->domainXMLFromNative) { char *ret; - ret = conn->driver->domainXMLFromNative (conn, - nativeFormat, - nativeConfig, - flags); + ret = conn->driver->domainXMLFromNative(conn, + nativeFormat, + nativeConfig, + flags); if (!ret) goto error; return ret; @@ -4516,12 +4516,12 @@ error: * */ static virDomainPtr -virDomainMigrateVersion1 (virDomainPtr domain, - virConnectPtr dconn, - unsigned long flags, - const char *dname, - const char *uri, - unsigned long bandwidth) +virDomainMigrateVersion1(virDomainPtr domain, + virConnectPtr dconn, + unsigned long flags, + const char *dname, + const char *uri, + unsigned long bandwidth) { virDomainPtr ddomain = NULL; char *uri_out = NULL; @@ -4532,7 +4532,7 @@ virDomainMigrateVersion1 (virDomainPtr domain, "dconn=%p, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", dconn, flags, NULLSTR(dname), NULLSTR(uri), bandwidth); - ret = virDomainGetInfo (domain, &info); + ret = virDomainGetInfo(domain, &info); if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) { flags |= VIR_MIGRATE_PAUSED; } @@ -4578,11 +4578,11 @@ virDomainMigrateVersion1 (virDomainPtr domain, ddomain = dconn->driver->domainMigrateFinish (dconn, dname, cookie, cookielen, uri, flags); else - ddomain = virDomainLookupByName (dconn, dname); + ddomain = virDomainLookupByName(dconn, dname); done: - VIR_FREE (uri_out); - VIR_FREE (cookie); + VIR_FREE(uri_out); + VIR_FREE(cookie); return ddomain; } @@ -4606,12 +4606,12 @@ virDomainMigrateVersion1 (virDomainPtr domain, * */ static virDomainPtr -virDomainMigrateVersion2 (virDomainPtr domain, - virConnectPtr dconn, - unsigned long flags, - const char *dname, - const char *uri, - unsigned long bandwidth) +virDomainMigrateVersion2(virDomainPtr domain, + virConnectPtr dconn, + unsigned long flags, + const char *dname, + const char *uri, + unsigned long bandwidth) { virDomainPtr ddomain = NULL; char *uri_out = NULL; @@ -4659,7 +4659,7 @@ virDomainMigrateVersion2 (virDomainPtr domain, if (!dom_xml) return NULL; - ret = virDomainGetInfo (domain, &info); + ret = virDomainGetInfo(domain, &info); if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) { flags |= VIR_MIGRATE_PAUSED; } @@ -4668,7 +4668,7 @@ virDomainMigrateVersion2 (virDomainPtr domain, ret = dconn->driver->domainMigratePrepare2 (dconn, &cookie, &cookielen, uri, &uri_out, flags, dname, bandwidth, dom_xml); - VIR_FREE (dom_xml); + VIR_FREE(dom_xml); if (ret == -1) goto done; @@ -4713,8 +4713,8 @@ finish: virSetError(orig_err); virFreeError(orig_err); } - VIR_FREE (uri_out); - VIR_FREE (cookie); + VIR_FREE(uri_out); + VIR_FREE(cookie); return ddomain; } @@ -4792,7 +4792,7 @@ virDomainMigrateVersion3(virDomainPtr domain, if (!dom_xml) goto done; - ret = virDomainGetInfo (domain, &info); + ret = virDomainGetInfo(domain, &info); if (ret == 0 && info.state == VIR_DOMAIN_PAUSED) { flags |= VIR_MIGRATE_PAUSED; } @@ -4805,7 +4805,7 @@ virDomainMigrateVersion3(virDomainPtr domain, ret = dconn->driver->domainMigratePrepare3 (dconn, cookiein, cookieinlen, &cookieout, &cookieoutlen, uri, &uri_out, flags, dname, bandwidth, dom_xml); - VIR_FREE (dom_xml); + VIR_FREE(dom_xml); if (ret == -1) { if (protection) { /* Begin already started a migration job so we need to cancel it by @@ -4940,13 +4940,13 @@ confirm: * migration itself. */ static int -virDomainMigratePeer2Peer (virDomainPtr domain, - const char *xmlin, - unsigned long flags, - const char *dname, - const char *dconnuri, - const char *uri, - unsigned long bandwidth) +virDomainMigratePeer2Peer(virDomainPtr domain, + const char *xmlin, + unsigned long flags, + const char *dname, + const char *dconnuri, + const char *uri, + unsigned long bandwidth) { virURIPtr tempuri = NULL; VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lx, dname=%s, " @@ -5035,12 +5035,12 @@ virDomainMigratePeer2Peer (virDomainPtr domain, * need to be involved at all, or even running */ static int -virDomainMigrateDirect (virDomainPtr domain, - const char *xmlin, - unsigned long flags, - const char *dname, - const char *uri, - unsigned long bandwidth) +virDomainMigrateDirect(virDomainPtr domain, + const char *xmlin, + unsigned long flags, + const char *dname, + const char *uri, + unsigned long bandwidth) { VIR_DOMAIN_DEBUG(domain, "xmlin=%s, flags=%lx, dname=%s, uri=%s, bandwidth=%lu", @@ -5160,12 +5160,12 @@ virDomainMigrateDirect (virDomainPtr domain, * exists in the scope of the destination connection (dconn). */ virDomainPtr -virDomainMigrate (virDomainPtr domain, - virConnectPtr dconn, - unsigned long flags, - const char *dname, - const char *uri, - unsigned long bandwidth) +virDomainMigrate(virDomainPtr domain, + virConnectPtr dconn, + unsigned long flags, + const char *dname, + const char *uri, + unsigned long bandwidth) { virDomainPtr ddomain = NULL; @@ -5176,7 +5176,7 @@ virDomainMigrate (virDomainPtr domain, virResetLastError(); /* First checkout the source */ - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -5198,8 +5198,8 @@ virDomainMigrate (virDomainPtr domain, } if (flags & VIR_MIGRATE_PEER2PEER) { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_P2P)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_P2P)) { char *dstURI = NULL; if (uri == NULL) { dstURI = virConnectGetURI(dconn); @@ -5215,7 +5215,7 @@ virDomainMigrate (virDomainPtr domain, } VIR_FREE(dstURI); - ddomain = virDomainLookupByName (dconn, dname ? dname : domain->name); + ddomain = virDomainLookupByName(dconn, dname ? dname : domain->name); } else { /* This driver does not support peer to peer migration */ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); @@ -5381,7 +5381,7 @@ virDomainMigrate2(virDomainPtr domain, virResetLastError(); /* First checkout the source */ - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -5403,8 +5403,8 @@ virDomainMigrate2(virDomainPtr domain, } if (flags & VIR_MIGRATE_PEER2PEER) { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_P2P)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_P2P)) { char *dstURI = virConnectGetURI(dconn); if (!dstURI) return NULL; @@ -5417,7 +5417,7 @@ virDomainMigrate2(virDomainPtr domain, } VIR_FREE(dstURI); - ddomain = virDomainLookupByName (dconn, dname ? dname : domain->name); + ddomain = virDomainLookupByName(dconn, dname ? dname : domain->name); } else { /* This driver does not support peer to peer migration */ virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); @@ -5555,11 +5555,11 @@ error: * Returns 0 if the migration succeeded, -1 upon error. */ int -virDomainMigrateToURI (virDomainPtr domain, - const char *duri, - unsigned long flags, - const char *dname, - unsigned long bandwidth) +virDomainMigrateToURI(virDomainPtr domain, + const char *duri, + unsigned long flags, + const char *dname, + unsigned long bandwidth) { VIR_DOMAIN_DEBUG(domain, "duri=%p, flags=%lx, dname=%s, bandwidth=%lu", NULLSTR(duri), flags, NULLSTR(dname), bandwidth); @@ -5567,7 +5567,7 @@ virDomainMigrateToURI (virDomainPtr domain, virResetLastError(); /* First checkout the source */ - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -5580,8 +5580,8 @@ virDomainMigrateToURI (virDomainPtr domain, virCheckNonNullArgGoto(duri, error); if (flags & VIR_MIGRATE_PEER2PEER) { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_P2P)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_P2P)) { VIR_DEBUG("Using peer2peer migration"); if (virDomainMigratePeer2Peer(domain, NULL, flags, dname, duri, NULL, bandwidth) < 0) @@ -5592,8 +5592,8 @@ virDomainMigrateToURI (virDomainPtr domain, goto error; } } else { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_DIRECT)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_DIRECT)) { VIR_DEBUG("Using direct migration"); if (virDomainMigrateDirect(domain, NULL, flags, dname, duri, bandwidth) < 0) @@ -5705,7 +5705,7 @@ virDomainMigrateToURI2(virDomainPtr domain, virResetLastError(); /* First checkout the source */ - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -5716,8 +5716,8 @@ virDomainMigrateToURI2(virDomainPtr domain, } if (flags & VIR_MIGRATE_PEER2PEER) { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_P2P)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_P2P)) { VIR_DEBUG("Using peer2peer migration"); if (virDomainMigratePeer2Peer(domain, dxml, flags, dname, dconnuri, miguri, bandwidth) < 0) @@ -5728,8 +5728,8 @@ virDomainMigrateToURI2(virDomainPtr domain, goto error; } } else { - if (VIR_DRV_SUPPORTS_FEATURE (domain->conn->driver, domain->conn, - VIR_DRV_FEATURE_MIGRATION_DIRECT)) { + if (VIR_DRV_SUPPORTS_FEATURE(domain->conn->driver, domain->conn, + VIR_DRV_FEATURE_MIGRATION_DIRECT)) { VIR_DEBUG("Using direct migration"); if (virDomainMigrateDirect(domain, dxml, flags, dname, miguri, bandwidth) < 0) @@ -5756,14 +5756,14 @@ error: * implementation of migration in the remote case. */ int -virDomainMigratePrepare (virConnectPtr dconn, - char **cookie, - int *cookielen, - const char *uri_in, - char **uri_out, - unsigned long flags, - const char *dname, - unsigned long bandwidth) +virDomainMigratePrepare(virConnectPtr dconn, + char **cookie, + int *cookielen, + const char *uri_in, + char **uri_out, + unsigned long flags, + const char *dname, + unsigned long bandwidth) { VIR_DEBUG("dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p, " "flags=%lx, dname=%s, bandwidth=%lu", dconn, cookie, cookielen, @@ -5771,7 +5771,7 @@ virDomainMigratePrepare (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -5784,9 +5784,9 @@ virDomainMigratePrepare (virConnectPtr dconn, if (dconn->driver->domainMigratePrepare) { int ret; - ret = dconn->driver->domainMigratePrepare (dconn, cookie, cookielen, - uri_in, uri_out, - flags, dname, bandwidth); + ret = dconn->driver->domainMigratePrepare(dconn, cookie, cookielen, + uri_in, uri_out, + flags, dname, bandwidth); if (ret < 0) goto error; return ret; @@ -5804,13 +5804,13 @@ error: * implementation of migration in the remote case. */ int -virDomainMigratePerform (virDomainPtr domain, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags, - const char *dname, - unsigned long bandwidth) +virDomainMigratePerform(virDomainPtr domain, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags, + const char *dname, + unsigned long bandwidth) { virConnectPtr conn; @@ -5820,7 +5820,7 @@ virDomainMigratePerform (virDomainPtr domain, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -5834,9 +5834,9 @@ virDomainMigratePerform (virDomainPtr domain, if (conn->driver->domainMigratePerform) { int ret; - ret = conn->driver->domainMigratePerform (domain, cookie, cookielen, - uri, - flags, dname, bandwidth); + ret = conn->driver->domainMigratePerform(domain, cookie, cookielen, + uri, + flags, dname, bandwidth); if (ret < 0) goto error; return ret; @@ -5854,12 +5854,12 @@ error: * implementation of migration in the remote case. */ virDomainPtr -virDomainMigrateFinish (virConnectPtr dconn, - const char *dname, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags) +virDomainMigrateFinish(virConnectPtr dconn, + const char *dname, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags) { VIR_DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, " "flags=%lx", dconn, NULLSTR(dname), cookie, cookielen, @@ -5867,7 +5867,7 @@ virDomainMigrateFinish (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -5880,9 +5880,9 @@ virDomainMigrateFinish (virConnectPtr dconn, if (dconn->driver->domainMigrateFinish) { virDomainPtr ret; - ret = dconn->driver->domainMigrateFinish (dconn, dname, - cookie, cookielen, - uri, flags); + ret = dconn->driver->domainMigrateFinish(dconn, dname, + cookie, cookielen, + uri, flags); if (!ret) goto error; return ret; @@ -5901,15 +5901,15 @@ error: * implementation of migration in the remote case. */ int -virDomainMigratePrepare2 (virConnectPtr dconn, - char **cookie, - int *cookielen, - const char *uri_in, - char **uri_out, - unsigned long flags, - const char *dname, - unsigned long bandwidth, - const char *dom_xml) +virDomainMigratePrepare2(virConnectPtr dconn, + char **cookie, + int *cookielen, + const char *uri_in, + char **uri_out, + unsigned long flags, + const char *dname, + unsigned long bandwidth, + const char *dom_xml) { VIR_DEBUG("dconn=%p, cookie=%p, cookielen=%p, uri_in=%s, uri_out=%p," "flags=%lx, dname=%s, bandwidth=%lu, dom_xml=%s", dconn, @@ -5918,7 +5918,7 @@ virDomainMigratePrepare2 (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -5931,10 +5931,10 @@ virDomainMigratePrepare2 (virConnectPtr dconn, if (dconn->driver->domainMigratePrepare2) { int ret; - ret = dconn->driver->domainMigratePrepare2 (dconn, cookie, cookielen, - uri_in, uri_out, - flags, dname, bandwidth, - dom_xml); + ret = dconn->driver->domainMigratePrepare2(dconn, cookie, cookielen, + uri_in, uri_out, + flags, dname, bandwidth, + dom_xml); if (ret < 0) goto error; return ret; @@ -5952,13 +5952,13 @@ error: * implementation of migration in the remote case. */ virDomainPtr -virDomainMigrateFinish2 (virConnectPtr dconn, - const char *dname, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags, - int retcode) +virDomainMigrateFinish2(virConnectPtr dconn, + const char *dname, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags, + int retcode) { VIR_DEBUG("dconn=%p, dname=%s, cookie=%p, cookielen=%d, uri=%s, " "flags=%lx, retcode=%d", dconn, NULLSTR(dname), cookie, @@ -5966,7 +5966,7 @@ virDomainMigrateFinish2 (virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -5979,10 +5979,10 @@ virDomainMigrateFinish2 (virConnectPtr dconn, if (dconn->driver->domainMigrateFinish2) { virDomainPtr ret; - ret = dconn->driver->domainMigrateFinish2 (dconn, dname, - cookie, cookielen, - uri, flags, - retcode); + ret = dconn->driver->domainMigrateFinish2(dconn, dname, + cookie, cookielen, + uri, flags, + retcode); if (!ret) goto error; return ret; @@ -6070,7 +6070,7 @@ virDomainMigrateBegin3(virDomainPtr domain, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -6126,7 +6126,7 @@ virDomainMigratePrepare3(virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -6247,7 +6247,7 @@ virDomainMigratePerform3(virDomainPtr domain, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -6302,7 +6302,7 @@ virDomainMigrateFinish3(virConnectPtr dconn, virResetLastError(); - if (!VIR_IS_CONNECT (dconn)) { + if (!VIR_IS_CONNECT(dconn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -6352,7 +6352,7 @@ virDomainMigrateConfirm3(virDomainPtr domain, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (domain)) { + if (!VIR_IS_CONNECTED_DOMAIN(domain)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -6407,7 +6407,7 @@ virNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) if (conn->driver->nodeGetInfo) { int ret; - ret = conn->driver->nodeGetInfo (conn, info); + ret = conn->driver->nodeGetInfo(conn, info); if (ret < 0) goto error; return ret; @@ -6431,13 +6431,13 @@ error: * The client must free the returned string after use. */ char * -virConnectGetCapabilities (virConnectPtr conn) +virConnectGetCapabilities(virConnectPtr conn) { VIR_DEBUG("conn=%p", conn); virResetLastError(); - if (!VIR_IS_CONNECT (conn)) { + if (!VIR_IS_CONNECT(conn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -6445,7 +6445,7 @@ virConnectGetCapabilities (virConnectPtr conn) if (conn->driver->getCapabilities) { char *ret; - ret = conn->driver->getCapabilities (conn); + ret = conn->driver->getCapabilities(conn); if (!ret) goto error; VIR_DEBUG("conn=%p ret=%s", conn, ret); @@ -6513,10 +6513,10 @@ error: * * Returns -1 in case of error, 0 in case of success. */ -int virNodeGetCPUStats (virConnectPtr conn, - int cpuNum, - virNodeCPUStatsPtr params, - int *nparams, unsigned int flags) +int virNodeGetCPUStats(virConnectPtr conn, + int cpuNum, + virNodeCPUStatsPtr params, + int *nparams, unsigned int flags) { VIR_DEBUG("conn=%p, cpuNum=%d, params=%p, nparams=%d, flags=%x", conn, cpuNum, params, nparams ? *nparams : -1, flags); @@ -6540,7 +6540,7 @@ int virNodeGetCPUStats (virConnectPtr conn, if (conn->driver->nodeGetCPUStats) { int ret; - ret = conn->driver->nodeGetCPUStats (conn, cpuNum, params, nparams, flags); + ret = conn->driver->nodeGetCPUStats(conn, cpuNum, params, nparams, flags); if (ret < 0) goto error; return ret; @@ -6602,10 +6602,10 @@ error: * * Returns -1 in case of error, 0 in case of success. */ -int virNodeGetMemoryStats (virConnectPtr conn, - int cellNum, - virNodeMemoryStatsPtr params, - int *nparams, unsigned int flags) +int virNodeGetMemoryStats(virConnectPtr conn, + int cellNum, + virNodeMemoryStatsPtr params, + int *nparams, unsigned int flags) { VIR_DEBUG("conn=%p, cellNum=%d, params=%p, nparams=%d, flags=%x", conn, cellNum, params, nparams ? *nparams : -1, flags); @@ -6629,7 +6629,7 @@ int virNodeGetMemoryStats (virConnectPtr conn, if (conn->driver->nodeGetMemoryStats) { int ret; - ret = conn->driver->nodeGetMemoryStats (conn, cellNum, params, nparams, flags); + ret = conn->driver->nodeGetMemoryStats(conn, cellNum, params, nparams, flags); if (ret < 0) goto error; return ret; @@ -6658,7 +6658,7 @@ virNodeGetFreeMemory(virConnectPtr conn) virResetLastError(); - if (!VIR_IS_CONNECT (conn)) { + if (!VIR_IS_CONNECT(conn)) { virLibConnError(VIR_ERR_INVALID_CONN, __FUNCTION__); virDispatchError(NULL); return 0; @@ -6666,7 +6666,7 @@ virNodeGetFreeMemory(virConnectPtr conn) if (conn->driver->nodeGetFreeMemory) { unsigned long long ret; - ret = conn->driver->nodeGetFreeMemory (conn); + ret = conn->driver->nodeGetFreeMemory(conn); if (ret == 0) goto error; return ret; @@ -6894,7 +6894,7 @@ virDomainGetSchedulerType(virDomainPtr domain, int *nparams) conn = domain->conn; if (conn->driver->domainGetSchedulerType){ - schedtype = conn->driver->domainGetSchedulerType (domain, nparams); + schedtype = conn->driver->domainGetSchedulerType(domain, nparams); if (!schedtype) goto error; return schedtype; @@ -6952,7 +6952,7 @@ virDomainGetSchedulerParameters(virDomainPtr domain, if (conn->driver->domainGetSchedulerParameters) { int ret; - ret = conn->driver->domainGetSchedulerParameters (domain, params, nparams); + ret = conn->driver->domainGetSchedulerParameters(domain, params, nparams); if (ret < 0) goto error; return ret; @@ -7034,8 +7034,8 @@ virDomainGetSchedulerParametersFlags(virDomainPtr domain, if (conn->driver->domainGetSchedulerParametersFlags) { int ret; - ret = conn->driver->domainGetSchedulerParametersFlags (domain, params, - nparams, flags); + ret = conn->driver->domainGetSchedulerParametersFlags(domain, params, + nparams, flags); if (ret < 0) goto error; return ret; @@ -7093,7 +7093,7 @@ virDomainSetSchedulerParameters(virDomainPtr domain, if (conn->driver->domainSetSchedulerParameters) { int ret; - ret = conn->driver->domainSetSchedulerParameters (domain, params, nparams); + ret = conn->driver->domainSetSchedulerParameters(domain, params, nparams); if (ret < 0) goto error; return ret; @@ -7211,7 +7211,7 @@ virDomainBlockStats(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7227,10 +7227,10 @@ virDomainBlockStats(virDomainPtr dom, const char *disk, conn = dom->conn; if (conn->driver->domainBlockStats) { - if (conn->driver->domainBlockStats (dom, disk, &stats2) == -1) + if (conn->driver->domainBlockStats(dom, disk, &stats2) == -1) goto error; - memcpy (stats, &stats2, size); + memcpy(stats, &stats2, size); return 0; } @@ -7291,7 +7291,7 @@ int virDomainBlockStatsFlags(virDomainPtr dom, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7344,8 +7344,8 @@ error: * Returns: 0 in case of success or -1 in case of failure. */ int -virDomainInterfaceStats (virDomainPtr dom, const char *path, - virDomainInterfaceStatsPtr stats, size_t size) +virDomainInterfaceStats(virDomainPtr dom, const char *path, + virDomainInterfaceStatsPtr stats, size_t size) { virConnectPtr conn; struct _virDomainInterfaceStats stats2 = { -1, -1, -1, -1, @@ -7356,7 +7356,7 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7373,10 +7373,10 @@ virDomainInterfaceStats (virDomainPtr dom, const char *path, conn = dom->conn; if (conn->driver->domainInterfaceStats) { - if (conn->driver->domainInterfaceStats (dom, path, &stats2) == -1) + if (conn->driver->domainInterfaceStats(dom, path, &stats2) == -1) goto error; - memcpy (stats, &stats2, size); + memcpy(stats, &stats2, size); return 0; } @@ -7557,8 +7557,8 @@ error: * * Returns: The number of stats provided or -1 in case of failure. */ -int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats, - unsigned int nr_stats, unsigned int flags) +int virDomainMemoryStats(virDomainPtr dom, virDomainMemoryStatPtr stats, + unsigned int nr_stats, unsigned int flags) { virConnectPtr conn; unsigned long nr_stats_ret = 0; @@ -7568,7 +7568,7 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7582,8 +7582,8 @@ int virDomainMemoryStats (virDomainPtr dom, virDomainMemoryStatPtr stats, conn = dom->conn; if (conn->driver->domainMemoryStats) { - nr_stats_ret = conn->driver->domainMemoryStats (dom, stats, nr_stats, - flags); + nr_stats_ret = conn->driver->domainMemoryStats(dom, stats, nr_stats, + flags); if (nr_stats_ret == -1) goto error; return nr_stats_ret; @@ -7639,12 +7639,12 @@ error: * Returns: 0 in case of success or -1 in case of failure. */ int -virDomainBlockPeek (virDomainPtr dom, - const char *disk, - unsigned long long offset /* really 64 bits */, - size_t size, - void *buffer, - unsigned int flags) +virDomainBlockPeek(virDomainPtr dom, + const char *disk, + unsigned long long offset /* really 64 bits */, + size_t size, + void *buffer, + unsigned int flags) { virConnectPtr conn; @@ -7653,7 +7653,7 @@ virDomainBlockPeek (virDomainPtr dom, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7716,10 +7716,10 @@ error: */ int -virDomainBlockResize (virDomainPtr dom, - const char *disk, - unsigned long long size, - unsigned int flags) +virDomainBlockResize(virDomainPtr dom, + const char *disk, + unsigned long long size, + unsigned int flags) { virConnectPtr conn; @@ -7727,7 +7727,7 @@ virDomainBlockResize (virDomainPtr dom, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7789,11 +7789,11 @@ error: * Returns: 0 in case of success or -1 in case of failure. */ int -virDomainMemoryPeek (virDomainPtr dom, - unsigned long long start /* really 64 bits */, - size_t size, - void *buffer, - unsigned int flags) +virDomainMemoryPeek(virDomainPtr dom, + unsigned long long start /* really 64 bits */, + size_t size, + void *buffer, + unsigned int flags) { virConnectPtr conn; @@ -7802,7 +7802,7 @@ virDomainMemoryPeek (virDomainPtr dom, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -7851,8 +7851,8 @@ virDomainMemoryPeek (virDomainPtr dom, if (conn->driver->domainMemoryPeek) { int ret; - ret = conn->driver->domainMemoryPeek (dom, start, size, - buffer, flags); + ret = conn->driver->domainMemoryPeek(dom, start, size, + buffer, flags); if (ret < 0) goto error; return ret; @@ -7908,7 +7908,7 @@ virDomainGetBlockInfo(virDomainPtr domain, const char *disk, if (conn->driver->domainGetBlockInfo) { int ret; - ret = conn->driver->domainGetBlockInfo (domain, disk, info, flags); + ret = conn->driver->domainGetBlockInfo(domain, disk, info, flags); if (ret < 0) goto error; return ret; @@ -7964,7 +7964,7 @@ virDomainDefineXML(virConnectPtr conn, const char *xml) { if (conn->driver->domainDefineXML) { virDomainPtr ret; - ret = conn->driver->domainDefineXML (conn, xml); + ret = conn->driver->domainDefineXML(conn, xml); if (!ret) goto error; return ret; @@ -8013,7 +8013,7 @@ virDomainUndefine(virDomainPtr domain) { if (conn->driver->domainUndefine) { int ret; - ret = conn->driver->domainUndefine (domain); + ret = conn->driver->domainUndefine(domain); if (ret < 0) goto error; return ret; @@ -8073,7 +8073,7 @@ virDomainUndefineFlags(virDomainPtr domain, if (conn->driver->domainUndefineFlags) { int ret; - ret = conn->driver->domainUndefineFlags (domain, flags); + ret = conn->driver->domainUndefineFlags(domain, flags); if (ret < 0) goto error; return ret; @@ -8110,7 +8110,7 @@ virConnectNumOfDefinedDomains(virConnectPtr conn) if (conn->driver->numOfDefinedDomains) { int ret; - ret = conn->driver->numOfDefinedDomains (conn); + ret = conn->driver->numOfDefinedDomains(conn); if (ret < 0) goto error; return ret; @@ -8159,7 +8159,7 @@ virConnectListDefinedDomains(virConnectPtr conn, char **const names, if (conn->driver->listDefinedDomains) { int ret; - ret = conn->driver->listDefinedDomains (conn, names, maxnames); + ret = conn->driver->listDefinedDomains(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -8310,7 +8310,7 @@ virDomainCreate(virDomainPtr domain) { if (conn->driver->domainCreate) { int ret; - ret = conn->driver->domainCreate (domain); + ret = conn->driver->domainCreate(domain); if (ret < 0) goto error; return ret; @@ -8377,7 +8377,7 @@ virDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) { if (conn->driver->domainCreateWithFlags) { int ret; - ret = conn->driver->domainCreateWithFlags (domain, flags); + ret = conn->driver->domainCreateWithFlags(domain, flags); if (ret < 0) goto error; return ret; @@ -8422,7 +8422,7 @@ virDomainGetAutostart(virDomainPtr domain, if (conn->driver->domainGetAutostart) { int ret; - ret = conn->driver->domainGetAutostart (domain, autostart); + ret = conn->driver->domainGetAutostart(domain, autostart); if (ret < 0) goto error; return ret; @@ -8470,7 +8470,7 @@ virDomainSetAutostart(virDomainPtr domain, if (conn->driver->domainSetAutostart) { int ret; - ret = conn->driver->domainSetAutostart (domain, autostart); + ret = conn->driver->domainSetAutostart(domain, autostart); if (ret < 0) goto error; return ret; @@ -8520,7 +8520,7 @@ int virDomainInjectNMI(virDomainPtr domain, unsigned int flags) return ret; } - virLibConnError (VIR_ERR_NO_SUPPORT, __FUNCTION__); + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); error: virDispatchError(domain->conn); @@ -8582,7 +8582,7 @@ int virDomainSendKey(virDomainPtr domain, return ret; } - virLibConnError (VIR_ERR_NO_SUPPORT, __FUNCTION__); + virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); error: virDispatchError(domain->conn); @@ -8632,7 +8632,7 @@ virDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus) if (conn->driver->domainSetVcpus) { int ret; - ret = conn->driver->domainSetVcpus (domain, nvcpus); + ret = conn->driver->domainSetVcpus(domain, nvcpus); if (ret < 0) goto error; return ret; @@ -8706,7 +8706,7 @@ virDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus, if (conn->driver->domainSetVcpusFlags) { int ret; - ret = conn->driver->domainSetVcpusFlags (domain, nvcpus, flags); + ret = conn->driver->domainSetVcpusFlags(domain, nvcpus, flags); if (ret < 0) goto error; return ret; @@ -8771,7 +8771,7 @@ virDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags) if (conn->driver->domainGetVcpusFlags) { int ret; - ret = conn->driver->domainGetVcpusFlags (domain, flags); + ret = conn->driver->domainGetVcpusFlags(domain, flags); if (ret < 0) goto error; return ret; @@ -8838,7 +8838,7 @@ virDomainPinVcpu(virDomainPtr domain, unsigned int vcpu, if (conn->driver->domainPinVcpu) { int ret; - ret = conn->driver->domainPinVcpu (domain, vcpu, cpumap, maplen); + ret = conn->driver->domainPinVcpu(domain, vcpu, cpumap, maplen); if (ret < 0) goto error; return ret; @@ -8918,7 +8918,7 @@ virDomainPinVcpuFlags(virDomainPtr domain, unsigned int vcpu, if (conn->driver->domainPinVcpuFlags) { int ret; - ret = conn->driver->domainPinVcpuFlags (domain, vcpu, cpumap, maplen, flags); + ret = conn->driver->domainPinVcpuFlags(domain, vcpu, cpumap, maplen, flags); if (ret < 0) goto error; return ret; @@ -8995,8 +8995,8 @@ virDomainGetVcpuPinInfo(virDomainPtr domain, int ncpumaps, if (conn->driver->domainGetVcpuPinInfo) { int ret; - ret = conn->driver->domainGetVcpuPinInfo (domain, ncpumaps, - cpumaps, maplen, flags); + ret = conn->driver->domainGetVcpuPinInfo(domain, ncpumaps, + cpumaps, maplen, flags); if (ret < 0) goto error; return ret; @@ -9072,7 +9072,7 @@ virDomainPinEmulator(virDomainPtr domain, unsigned char *cpumap, if (conn->driver->domainPinEmulator) { int ret; - ret = conn->driver->domainPinEmulator (domain, cpumap, maplen, flags); + ret = conn->driver->domainPinEmulator(domain, cpumap, maplen, flags); if (ret < 0) goto error; return ret; @@ -9213,8 +9213,8 @@ virDomainGetVcpus(virDomainPtr domain, virVcpuInfoPtr info, int maxinfo, if (conn->driver->domainGetVcpus) { int ret; - ret = conn->driver->domainGetVcpus (domain, info, maxinfo, - cpumaps, maplen); + ret = conn->driver->domainGetVcpus(domain, info, maxinfo, + cpumaps, maplen); if (ret < 0) goto error; return ret; @@ -9258,7 +9258,7 @@ virDomainGetMaxVcpus(virDomainPtr domain) if (conn->driver->domainGetMaxVcpus) { int ret; - ret = conn->driver->domainGetMaxVcpus (domain); + ret = conn->driver->domainGetMaxVcpus(domain); if (ret < 0) goto error; return ret; @@ -9610,7 +9610,7 @@ virDomainAttachDevice(virDomainPtr domain, const char *xml) if (conn->driver->domainAttachDevice) { int ret; - ret = conn->driver->domainAttachDevice (domain, xml); + ret = conn->driver->domainAttachDevice(domain, xml); if (ret < 0) goto error; return ret; @@ -9721,7 +9721,7 @@ virDomainDetachDevice(virDomainPtr domain, const char *xml) if (conn->driver->domainDetachDevice) { int ret; - ret = conn->driver->domainDetachDevice (domain, xml); + ret = conn->driver->domainDetachDevice(domain, xml); if (ret < 0) goto error; return ret; @@ -9899,7 +9899,7 @@ virNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, if (conn->driver->nodeGetCellsFreeMemory) { int ret; - ret = conn->driver->nodeGetCellsFreeMemory (conn, freeMems, startCell, maxCells); + ret = conn->driver->nodeGetCellsFreeMemory(conn, freeMems, startCell, maxCells); if (ret < 0) goto error; return ret; @@ -9927,13 +9927,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virNetworkGetConnect (virNetworkPtr net) +virNetworkGetConnect(virNetworkPtr net) { VIR_DEBUG("net=%p", net); virResetLastError(); - if (!VIR_IS_CONNECTED_NETWORK (net)) { + if (!VIR_IS_CONNECTED_NETWORK(net)) { virLibNetworkError(VIR_ERR_INVALID_NETWORK, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -10034,7 +10034,7 @@ virConnectNumOfNetworks(virConnectPtr conn) if (conn->networkDriver && conn->networkDriver->numOfNetworks) { int ret; - ret = conn->networkDriver->numOfNetworks (conn); + ret = conn->networkDriver->numOfNetworks(conn); if (ret < 0) goto error; return ret; @@ -10081,7 +10081,7 @@ virConnectListNetworks(virConnectPtr conn, char **const names, int maxnames) if (conn->networkDriver && conn->networkDriver->listNetworks) { int ret; - ret = conn->networkDriver->listNetworks (conn, names, maxnames); + ret = conn->networkDriver->listNetworks(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -10117,7 +10117,7 @@ virConnectNumOfDefinedNetworks(virConnectPtr conn) if (conn->networkDriver && conn->networkDriver->numOfDefinedNetworks) { int ret; - ret = conn->networkDriver->numOfDefinedNetworks (conn); + ret = conn->networkDriver->numOfDefinedNetworks(conn); if (ret < 0) goto error; return ret; @@ -10165,8 +10165,8 @@ virConnectListDefinedNetworks(virConnectPtr conn, char **const names, if (conn->networkDriver && conn->networkDriver->listDefinedNetworks) { int ret; - ret = conn->networkDriver->listDefinedNetworks (conn, - names, maxnames); + ret = conn->networkDriver->listDefinedNetworks(conn, + names, maxnames); if (ret < 0) goto error; return ret; @@ -10205,7 +10205,7 @@ virNetworkLookupByName(virConnectPtr conn, const char *name) if (conn->networkDriver && conn->networkDriver->networkLookupByName) { virNetworkPtr ret; - ret = conn->networkDriver->networkLookupByName (conn, name); + ret = conn->networkDriver->networkLookupByName(conn, name); if (!ret) goto error; return ret; @@ -10245,7 +10245,7 @@ virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (conn->networkDriver && conn->networkDriver->networkLookupByUUID){ virNetworkPtr ret; - ret = conn->networkDriver->networkLookupByUUID (conn, uuid); + ret = conn->networkDriver->networkLookupByUUID(conn, uuid); if (!ret) goto error; return ret; @@ -10329,7 +10329,7 @@ virNetworkCreateXML(virConnectPtr conn, const char *xmlDesc) if (conn->networkDriver && conn->networkDriver->networkCreateXML) { virNetworkPtr ret; - ret = conn->networkDriver->networkCreateXML (conn, xmlDesc); + ret = conn->networkDriver->networkCreateXML(conn, xmlDesc); if (!ret) goto error; return ret; @@ -10371,7 +10371,7 @@ virNetworkDefineXML(virConnectPtr conn, const char *xml) if (conn->networkDriver && conn->networkDriver->networkDefineXML) { virNetworkPtr ret; - ret = conn->networkDriver->networkDefineXML (conn, xml); + ret = conn->networkDriver->networkDefineXML(conn, xml); if (!ret) goto error; return ret; @@ -10412,7 +10412,7 @@ virNetworkUndefine(virNetworkPtr network) { if (conn->networkDriver && conn->networkDriver->networkUndefine) { int ret; - ret = conn->networkDriver->networkUndefine (network); + ret = conn->networkDriver->networkUndefine(network); if (ret < 0) goto error; return ret; @@ -10517,7 +10517,7 @@ virNetworkCreate(virNetworkPtr network) if (conn->networkDriver && conn->networkDriver->networkCreate) { int ret; - ret = conn->networkDriver->networkCreate (network); + ret = conn->networkDriver->networkCreate(network); if (ret < 0) goto error; return ret; @@ -10563,7 +10563,7 @@ virNetworkDestroy(virNetworkPtr network) if (conn->networkDriver && conn->networkDriver->networkDestroy) { int ret; - ret = conn->networkDriver->networkDestroy (network); + ret = conn->networkDriver->networkDestroy(network); if (ret < 0) goto error; return ret; @@ -10798,7 +10798,7 @@ virNetworkGetBridgeName(virNetworkPtr network) if (conn->networkDriver && conn->networkDriver->networkGetBridgeName) { char *ret; - ret = conn->networkDriver->networkGetBridgeName (network); + ret = conn->networkDriver->networkGetBridgeName(network); if (!ret) goto error; return ret; @@ -10842,7 +10842,7 @@ virNetworkGetAutostart(virNetworkPtr network, if (conn->networkDriver && conn->networkDriver->networkGetAutostart) { int ret; - ret = conn->networkDriver->networkGetAutostart (network, autostart); + ret = conn->networkDriver->networkGetAutostart(network, autostart); if (ret < 0) goto error; return ret; @@ -10889,7 +10889,7 @@ virNetworkSetAutostart(virNetworkPtr network, if (conn->networkDriver && conn->networkDriver->networkSetAutostart) { int ret; - ret = conn->networkDriver->networkSetAutostart (network, autostart); + ret = conn->networkDriver->networkSetAutostart(network, autostart); if (ret < 0) goto error; return ret; @@ -10917,13 +10917,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virInterfaceGetConnect (virInterfacePtr iface) +virInterfaceGetConnect(virInterfacePtr iface) { VIR_DEBUG("iface=%p", iface); virResetLastError(); - if (!VIR_IS_CONNECTED_INTERFACE (iface)) { + if (!VIR_IS_CONNECTED_INTERFACE(iface)) { virLibInterfaceError(VIR_ERR_INVALID_INTERFACE, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -11015,7 +11015,7 @@ virConnectNumOfInterfaces(virConnectPtr conn) if (conn->interfaceDriver && conn->interfaceDriver->numOfInterfaces) { int ret; - ret = conn->interfaceDriver->numOfInterfaces (conn); + ret = conn->interfaceDriver->numOfInterfaces(conn); if (ret < 0) goto error; return ret; @@ -11063,7 +11063,7 @@ virConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames) if (conn->interfaceDriver && conn->interfaceDriver->listInterfaces) { int ret; - ret = conn->interfaceDriver->listInterfaces (conn, names, maxnames); + ret = conn->interfaceDriver->listInterfaces(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -11099,7 +11099,7 @@ virConnectNumOfDefinedInterfaces(virConnectPtr conn) if (conn->interfaceDriver && conn->interfaceDriver->numOfDefinedInterfaces) { int ret; - ret = conn->interfaceDriver->numOfDefinedInterfaces (conn); + ret = conn->interfaceDriver->numOfDefinedInterfaces(conn); if (ret < 0) goto error; return ret; @@ -11149,7 +11149,7 @@ virConnectListDefinedInterfaces(virConnectPtr conn, if (conn->interfaceDriver && conn->interfaceDriver->listDefinedInterfaces) { int ret; - ret = conn->interfaceDriver->listDefinedInterfaces (conn, names, maxnames); + ret = conn->interfaceDriver->listDefinedInterfaces(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -11188,7 +11188,7 @@ virInterfaceLookupByName(virConnectPtr conn, const char *name) if (conn->interfaceDriver && conn->interfaceDriver->interfaceLookupByName) { virInterfacePtr ret; - ret = conn->interfaceDriver->interfaceLookupByName (conn, name); + ret = conn->interfaceDriver->interfaceLookupByName(conn, name); if (!ret) goto error; return ret; @@ -11227,7 +11227,7 @@ virInterfaceLookupByMACString(virConnectPtr conn, const char *macstr) if (conn->interfaceDriver && conn->interfaceDriver->interfaceLookupByMACString) { virInterfacePtr ret; - ret = conn->interfaceDriver->interfaceLookupByMACString (conn, macstr); + ret = conn->interfaceDriver->interfaceLookupByMACString(conn, macstr); if (!ret) goto error; return ret; @@ -11326,7 +11326,7 @@ virInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags) if (conn->interfaceDriver && conn->interfaceDriver->interfaceGetXMLDesc) { char *ret; - ret = conn->interfaceDriver->interfaceGetXMLDesc (iface, flags); + ret = conn->interfaceDriver->interfaceGetXMLDesc(iface, flags); if (!ret) goto error; return ret; @@ -11379,7 +11379,7 @@ virInterfaceDefineXML(virConnectPtr conn, const char *xml, unsigned int flags) if (conn->interfaceDriver && conn->interfaceDriver->interfaceDefineXML) { virInterfacePtr ret; - ret = conn->interfaceDriver->interfaceDefineXML (conn, xml, flags); + ret = conn->interfaceDriver->interfaceDefineXML(conn, xml, flags); if (!ret) goto error; return ret; @@ -11431,7 +11431,7 @@ virInterfaceUndefine(virInterfacePtr iface) { if (conn->interfaceDriver && conn->interfaceDriver->interfaceUndefine) { int ret; - ret = conn->interfaceDriver->interfaceUndefine (iface); + ret = conn->interfaceDriver->interfaceUndefine(iface); if (ret < 0) goto error; return ret; @@ -11479,7 +11479,7 @@ virInterfaceCreate(virInterfacePtr iface, unsigned int flags) if (conn->interfaceDriver && conn->interfaceDriver->interfaceCreate) { int ret; - ret = conn->interfaceDriver->interfaceCreate (iface, flags); + ret = conn->interfaceDriver->interfaceCreate(iface, flags); if (ret < 0) goto error; return ret; @@ -11532,7 +11532,7 @@ virInterfaceDestroy(virInterfacePtr iface, unsigned int flags) if (conn->interfaceDriver && conn->interfaceDriver->interfaceDestroy) { int ret; - ret = conn->interfaceDriver->interfaceDestroy (iface, flags); + ret = conn->interfaceDriver->interfaceDestroy(iface, flags); if (ret < 0) goto error; return ret; @@ -11761,13 +11761,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virStoragePoolGetConnect (virStoragePoolPtr pool) +virStoragePoolGetConnect(virStoragePoolPtr pool) { VIR_DEBUG("pool=%p", pool); virResetLastError(); - if (!VIR_IS_CONNECTED_STORAGE_POOL (pool)) { + if (!VIR_IS_CONNECTED_STORAGE_POOL(pool)) { virLibStoragePoolError(VIR_ERR_INVALID_STORAGE_POOL, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -11882,7 +11882,7 @@ virConnectNumOfStoragePools(virConnectPtr conn) if (conn->storageDriver && conn->storageDriver->numOfPools) { int ret; - ret = conn->storageDriver->numOfPools (conn); + ret = conn->storageDriver->numOfPools(conn); if (ret < 0) goto error; return ret; @@ -11933,7 +11933,7 @@ virConnectListStoragePools(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->listPools) { int ret; - ret = conn->storageDriver->listPools (conn, names, maxnames); + ret = conn->storageDriver->listPools(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -11970,7 +11970,7 @@ virConnectNumOfDefinedStoragePools(virConnectPtr conn) if (conn->storageDriver && conn->storageDriver->numOfDefinedPools) { int ret; - ret = conn->storageDriver->numOfDefinedPools (conn); + ret = conn->storageDriver->numOfDefinedPools(conn); if (ret < 0) goto error; return ret; @@ -12022,7 +12022,7 @@ virConnectListDefinedStoragePools(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->listDefinedPools) { int ret; - ret = conn->storageDriver->listDefinedPools (conn, names, maxnames); + ret = conn->storageDriver->listDefinedPools(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -12122,7 +12122,7 @@ virStoragePoolLookupByName(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->poolLookupByName) { virStoragePoolPtr ret; - ret = conn->storageDriver->poolLookupByName (conn, name); + ret = conn->storageDriver->poolLookupByName(conn, name); if (!ret) goto error; return ret; @@ -12162,7 +12162,7 @@ virStoragePoolLookupByUUID(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->poolLookupByUUID) { virStoragePoolPtr ret; - ret = conn->storageDriver->poolLookupByUUID (conn, uuid); + ret = conn->storageDriver->poolLookupByUUID(conn, uuid); if (!ret) goto error; return ret; @@ -12239,7 +12239,7 @@ virStoragePoolLookupByVolume(virStorageVolPtr vol) if (vol->conn->storageDriver && vol->conn->storageDriver->poolLookupByVolume) { virStoragePoolPtr ret; - ret = vol->conn->storageDriver->poolLookupByVolume (vol); + ret = vol->conn->storageDriver->poolLookupByVolume(vol); if (!ret) goto error; return ret; @@ -12287,7 +12287,7 @@ virStoragePoolCreateXML(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->poolCreateXML) { virStoragePoolPtr ret; - ret = conn->storageDriver->poolCreateXML (conn, xmlDesc, flags); + ret = conn->storageDriver->poolCreateXML(conn, xmlDesc, flags); if (!ret) goto error; return ret; @@ -12333,7 +12333,7 @@ virStoragePoolDefineXML(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->poolDefineXML) { virStoragePoolPtr ret; - ret = conn->storageDriver->poolDefineXML (conn, xml, flags); + ret = conn->storageDriver->poolDefineXML(conn, xml, flags); if (!ret) goto error; return ret; @@ -12380,7 +12380,7 @@ virStoragePoolBuild(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolBuild) { int ret; - ret = conn->storageDriver->poolBuild (pool, flags); + ret = conn->storageDriver->poolBuild(pool, flags); if (ret < 0) goto error; return ret; @@ -12423,7 +12423,7 @@ virStoragePoolUndefine(virStoragePoolPtr pool) if (conn->storageDriver && conn->storageDriver->poolUndefine) { int ret; - ret = conn->storageDriver->poolUndefine (pool); + ret = conn->storageDriver->poolUndefine(pool); if (ret < 0) goto error; return ret; @@ -12468,7 +12468,7 @@ virStoragePoolCreate(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolCreate) { int ret; - ret = conn->storageDriver->poolCreate (pool, flags); + ret = conn->storageDriver->poolCreate(pool, flags); if (ret < 0) goto error; return ret; @@ -12516,7 +12516,7 @@ virStoragePoolDestroy(virStoragePoolPtr pool) if (conn->storageDriver && conn->storageDriver->poolDestroy) { int ret; - ret = conn->storageDriver->poolDestroy (pool); + ret = conn->storageDriver->poolDestroy(pool); if (ret < 0) goto error; return ret; @@ -12563,7 +12563,7 @@ virStoragePoolDelete(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolDelete) { int ret; - ret = conn->storageDriver->poolDelete (pool, flags); + ret = conn->storageDriver->poolDelete(pool, flags); if (ret < 0) goto error; return ret; @@ -12668,7 +12668,7 @@ virStoragePoolRefresh(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolRefresh) { int ret; - ret = conn->storageDriver->poolRefresh (pool, flags); + ret = conn->storageDriver->poolRefresh(pool, flags); if (ret < 0) goto error; return ret; @@ -12808,7 +12808,7 @@ virStoragePoolGetInfo(virStoragePoolPtr pool, if (conn->storageDriver->poolGetInfo) { int ret; - ret = conn->storageDriver->poolGetInfo (pool, info); + ret = conn->storageDriver->poolGetInfo(pool, info); if (ret < 0) goto error; return ret; @@ -12852,7 +12852,7 @@ virStoragePoolGetXMLDesc(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolGetXMLDesc) { char *ret; - ret = conn->storageDriver->poolGetXMLDesc (pool, flags); + ret = conn->storageDriver->poolGetXMLDesc(pool, flags); if (!ret) goto error; return ret; @@ -12896,7 +12896,7 @@ virStoragePoolGetAutostart(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolGetAutostart) { int ret; - ret = conn->storageDriver->poolGetAutostart (pool, autostart); + ret = conn->storageDriver->poolGetAutostart(pool, autostart); if (ret < 0) goto error; return ret; @@ -12943,7 +12943,7 @@ virStoragePoolSetAutostart(virStoragePoolPtr pool, if (conn->storageDriver && conn->storageDriver->poolSetAutostart) { int ret; - ret = conn->storageDriver->poolSetAutostart (pool, autostart); + ret = conn->storageDriver->poolSetAutostart(pool, autostart); if (ret < 0) goto error; return ret; @@ -13028,7 +13028,7 @@ virStoragePoolNumOfVolumes(virStoragePoolPtr pool) if (pool->conn->storageDriver && pool->conn->storageDriver->poolNumOfVolumes) { int ret; - ret = pool->conn->storageDriver->poolNumOfVolumes (pool); + ret = pool->conn->storageDriver->poolNumOfVolumes(pool); if (ret < 0) goto error; return ret; @@ -13075,7 +13075,7 @@ virStoragePoolListVolumes(virStoragePoolPtr pool, if (pool->conn->storageDriver && pool->conn->storageDriver->poolListVolumes) { int ret; - ret = pool->conn->storageDriver->poolListVolumes (pool, names, maxnames); + ret = pool->conn->storageDriver->poolListVolumes(pool, names, maxnames); if (ret < 0) goto error; return ret; @@ -13104,13 +13104,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virStorageVolGetConnect (virStorageVolPtr vol) +virStorageVolGetConnect(virStorageVolPtr vol) { VIR_DEBUG("vol=%p", vol); virResetLastError(); - if (!VIR_IS_STORAGE_VOL (vol)) { + if (!VIR_IS_STORAGE_VOL(vol)) { virLibStorageVolError(VIR_ERR_INVALID_STORAGE_VOL, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -13147,7 +13147,7 @@ virStorageVolLookupByName(virStoragePoolPtr pool, if (pool->conn->storageDriver && pool->conn->storageDriver->volLookupByName) { virStorageVolPtr ret; - ret = pool->conn->storageDriver->volLookupByName (pool, name); + ret = pool->conn->storageDriver->volLookupByName(pool, name); if (!ret) goto error; return ret; @@ -13190,7 +13190,7 @@ virStorageVolLookupByKey(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->volLookupByKey) { virStorageVolPtr ret; - ret = conn->storageDriver->volLookupByKey (conn, key); + ret = conn->storageDriver->volLookupByKey(conn, key); if (!ret) goto error; return ret; @@ -13230,7 +13230,7 @@ virStorageVolLookupByPath(virConnectPtr conn, if (conn->storageDriver && conn->storageDriver->volLookupByPath) { virStorageVolPtr ret; - ret = conn->storageDriver->volLookupByPath (conn, path); + ret = conn->storageDriver->volLookupByPath(conn, path); if (!ret) goto error; return ret; @@ -13331,7 +13331,7 @@ virStorageVolCreateXML(virStoragePoolPtr pool, if (pool->conn->storageDriver && pool->conn->storageDriver->volCreateXML) { virStorageVolPtr ret; - ret = pool->conn->storageDriver->volCreateXML (pool, xmlDesc, flags); + ret = pool->conn->storageDriver->volCreateXML(pool, xmlDesc, flags); if (!ret) goto error; return ret; @@ -13392,8 +13392,8 @@ virStorageVolCreateXMLFrom(virStoragePoolPtr pool, if (pool->conn->storageDriver && pool->conn->storageDriver->volCreateXMLFrom) { virStorageVolPtr ret; - ret = pool->conn->storageDriver->volCreateXMLFrom (pool, xmlDesc, - clonevol, flags); + ret = pool->conn->storageDriver->volCreateXMLFrom(pool, xmlDesc, + clonevol, flags); if (!ret) goto error; return ret; @@ -13579,7 +13579,7 @@ virStorageVolDelete(virStorageVolPtr vol, if (conn->storageDriver && conn->storageDriver->volDelete) { int ret; - ret = conn->storageDriver->volDelete (vol, flags); + ret = conn->storageDriver->volDelete(vol, flags); if (ret < 0) goto error; return ret; @@ -13777,7 +13777,7 @@ virStorageVolGetInfo(virStorageVolPtr vol, if (conn->storageDriver->volGetInfo){ int ret; - ret = conn->storageDriver->volGetInfo (vol, info); + ret = conn->storageDriver->volGetInfo(vol, info); if (ret < 0) goto error; return ret; @@ -13820,7 +13820,7 @@ virStorageVolGetXMLDesc(virStorageVolPtr vol, if (conn->storageDriver && conn->storageDriver->volGetXMLDesc) { char *ret; - ret = conn->storageDriver->volGetXMLDesc (vol, flags); + ret = conn->storageDriver->volGetXMLDesc(vol, flags); if (!ret) goto error; return ret; @@ -13865,7 +13865,7 @@ virStorageVolGetPath(virStorageVolPtr vol) if (conn->storageDriver && conn->storageDriver->volGetPath) { char *ret; - ret = conn->storageDriver->volGetPath (vol); + ret = conn->storageDriver->volGetPath(vol); if (!ret) goto error; return ret; @@ -13986,7 +13986,7 @@ virNodeNumOfDevices(virConnectPtr conn, const char *cap, unsigned int flags) if (conn->deviceMonitor && conn->deviceMonitor->numOfDevices) { int ret; - ret = conn->deviceMonitor->numOfDevices (conn, cap, flags); + ret = conn->deviceMonitor->numOfDevices(conn, cap, flags); if (ret < 0) goto error; return ret; @@ -14107,7 +14107,7 @@ virNodeListDevices(virConnectPtr conn, if (conn->deviceMonitor && conn->deviceMonitor->listDevices) { int ret; - ret = conn->deviceMonitor->listDevices (conn, cap, names, maxnames, flags); + ret = conn->deviceMonitor->listDevices(conn, cap, names, maxnames, flags); if (ret < 0) goto error; return ret; @@ -14146,7 +14146,7 @@ virNodeDevicePtr virNodeDeviceLookupByName(virConnectPtr conn, const char *name) if (conn->deviceMonitor && conn->deviceMonitor->deviceLookupByName) { virNodeDevicePtr ret; - ret = conn->deviceMonitor->deviceLookupByName (conn, name); + ret = conn->deviceMonitor->deviceLookupByName(conn, name); if (!ret) goto error; return ret; @@ -14242,7 +14242,7 @@ const char *virNodeDeviceGetParent(virNodeDevicePtr dev) if (!dev->parent) { if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->deviceGetParent) { - dev->parent = dev->conn->deviceMonitor->deviceGetParent (dev); + dev->parent = dev->conn->deviceMonitor->deviceGetParent(dev); } else { virLibConnError(VIR_ERR_NO_SUPPORT, __FUNCTION__); virDispatchError(dev->conn); @@ -14274,7 +14274,7 @@ int virNodeDeviceNumOfCaps(virNodeDevicePtr dev) if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->deviceNumOfCaps) { int ret; - ret = dev->conn->deviceMonitor->deviceNumOfCaps (dev); + ret = dev->conn->deviceMonitor->deviceNumOfCaps(dev); if (ret < 0) goto error; return ret; @@ -14317,7 +14317,7 @@ int virNodeDeviceListCaps(virNodeDevicePtr dev, if (dev->conn->deviceMonitor && dev->conn->deviceMonitor->deviceListCaps) { int ret; - ret = dev->conn->deviceMonitor->deviceListCaps (dev, names, maxnames); + ret = dev->conn->deviceMonitor->deviceListCaps(dev, names, maxnames); if (ret < 0) goto error; return ret; @@ -14425,7 +14425,7 @@ virNodeDeviceDettach(virNodeDevicePtr dev) if (dev->conn->driver->nodeDeviceDettach) { int ret; - ret = dev->conn->driver->nodeDeviceDettach (dev); + ret = dev->conn->driver->nodeDeviceDettach(dev); if (ret < 0) goto error; return ret; @@ -14473,7 +14473,7 @@ virNodeDeviceReAttach(virNodeDevicePtr dev) if (dev->conn->driver->nodeDeviceReAttach) { int ret; - ret = dev->conn->driver->nodeDeviceReAttach (dev); + ret = dev->conn->driver->nodeDeviceReAttach(dev); if (ret < 0) goto error; return ret; @@ -14523,7 +14523,7 @@ virNodeDeviceReset(virNodeDevicePtr dev) if (dev->conn->driver->nodeDeviceReset) { int ret; - ret = dev->conn->driver->nodeDeviceReset (dev); + ret = dev->conn->driver->nodeDeviceReset(dev); if (ret < 0) goto error; return ret; @@ -14676,7 +14676,7 @@ virConnectDomainEventRegister(virConnectPtr conn, if ((conn->driver) && (conn->driver->domainEventRegister)) { int ret; - ret = conn->driver->domainEventRegister (conn, cb, opaque, freecb); + ret = conn->driver->domainEventRegister(conn, cb, opaque, freecb); if (ret < 0) goto error; return ret; @@ -14719,7 +14719,7 @@ virConnectDomainEventDeregister(virConnectPtr conn, if ((conn->driver) && (conn->driver->domainEventDeregister)) { int ret; - ret = conn->driver->domainEventDeregister (conn, cb); + ret = conn->driver->domainEventDeregister(conn, cb); if (ret < 0) goto error; return ret; @@ -14744,13 +14744,13 @@ error: * Returns the virConnectPtr or NULL in case of failure. */ virConnectPtr -virSecretGetConnect (virSecretPtr secret) +virSecretGetConnect(virSecretPtr secret) { VIR_DEBUG("secret=%p", secret); virResetLastError(); - if (!VIR_IS_CONNECTED_SECRET (secret)) { + if (!VIR_IS_CONNECTED_SECRET(secret)) { virLibSecretError(VIR_ERR_INVALID_SECRET, __FUNCTION__); virDispatchError(NULL); return NULL; @@ -14932,7 +14932,7 @@ virSecretLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (conn->secretDriver && conn->secretDriver->lookupByUUID) { virSecretPtr ret; - ret = conn->secretDriver->lookupByUUID (conn, uuid); + ret = conn->secretDriver->lookupByUUID(conn, uuid); if (!ret) goto error; return ret; @@ -15018,7 +15018,7 @@ virSecretLookupByUsage(virConnectPtr conn, if (conn->secretDriver && conn->secretDriver->lookupByUsage) { virSecretPtr ret; - ret = conn->secretDriver->lookupByUsage (conn, usageType, usageID); + ret = conn->secretDriver->lookupByUsage(conn, usageType, usageID); if (!ret) goto error; return ret; @@ -16422,7 +16422,7 @@ virConnectNumOfNWFilters(virConnectPtr conn) if (conn->nwfilterDriver && conn->nwfilterDriver->numOfNWFilters) { int ret; - ret = conn->nwfilterDriver->numOfNWFilters (conn); + ret = conn->nwfilterDriver->numOfNWFilters(conn); if (ret < 0) goto error; return ret; @@ -16514,7 +16514,7 @@ virConnectListNWFilters(virConnectPtr conn, char **const names, int maxnames) if (conn->nwfilterDriver && conn->nwfilterDriver->listNWFilters) { int ret; - ret = conn->nwfilterDriver->listNWFilters (conn, names, maxnames); + ret = conn->nwfilterDriver->listNWFilters(conn, names, maxnames); if (ret < 0) goto error; return ret; @@ -16554,7 +16554,7 @@ virNWFilterLookupByName(virConnectPtr conn, const char *name) if (conn->nwfilterDriver && conn->nwfilterDriver->nwfilterLookupByName) { virNWFilterPtr ret; - ret = conn->nwfilterDriver->nwfilterLookupByName (conn, name); + ret = conn->nwfilterDriver->nwfilterLookupByName(conn, name); if (!ret) goto error; return ret; @@ -16593,7 +16593,7 @@ virNWFilterLookupByUUID(virConnectPtr conn, const unsigned char *uuid) if (conn->nwfilterDriver && conn->nwfilterDriver->nwfilterLookupByUUID){ virNWFilterPtr ret; - ret = conn->nwfilterDriver->nwfilterLookupByUUID (conn, uuid); + ret = conn->nwfilterDriver->nwfilterLookupByUUID(conn, uuid); if (!ret) goto error; return ret; @@ -16795,7 +16795,7 @@ virNWFilterDefineXML(virConnectPtr conn, const char *xmlDesc) if (conn->nwfilterDriver && conn->nwfilterDriver->defineXML) { virNWFilterPtr ret; - ret = conn->nwfilterDriver->defineXML (conn, xmlDesc); + ret = conn->nwfilterDriver->defineXML(conn, xmlDesc); if (!ret) goto error; return ret; @@ -16841,7 +16841,7 @@ virNWFilterUndefine(virNWFilterPtr nwfilter) if (conn->nwfilterDriver && conn->nwfilterDriver->undefine) { int ret; - ret = conn->nwfilterDriver->undefine (nwfilter); + ret = conn->nwfilterDriver->undefine(nwfilter); if (ret < 0) goto error; return ret; @@ -16884,7 +16884,7 @@ virNWFilterGetXMLDesc(virNWFilterPtr nwfilter, unsigned int flags) if (conn->nwfilterDriver && conn->nwfilterDriver->getXMLDesc) { char *ret; - ret = conn->nwfilterDriver->getXMLDesc (nwfilter, flags); + ret = conn->nwfilterDriver->getXMLDesc(nwfilter, flags); if (!ret) goto error; return ret; @@ -17163,7 +17163,7 @@ virDomainGetJobInfo(virDomainPtr domain, virDomainJobInfoPtr info) if (conn->driver->domainGetJobInfo) { int ret; - ret = conn->driver->domainGetJobInfo (domain, info); + ret = conn->driver->domainGetJobInfo(domain, info); if (ret < 0) goto error; return ret; @@ -18957,7 +18957,7 @@ int virDomainBlockJobAbort(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -19014,7 +19014,7 @@ int virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -19068,7 +19068,7 @@ int virDomainBlockJobSetSpeed(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -19140,7 +19140,7 @@ int virDomainBlockPull(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -19259,7 +19259,7 @@ int virDomainBlockRebase(virDomainPtr dom, const char *disk, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -19812,7 +19812,7 @@ int virDomainGetBlockIoTune(virDomainPtr dom, virResetLastError(); - if (!VIR_IS_CONNECTED_DOMAIN (dom)) { + if (!VIR_IS_CONNECTED_DOMAIN(dom)) { virLibDomainError(VIR_ERR_INVALID_DOMAIN, __FUNCTION__); virDispatchError(NULL); return -1; @@ -20096,7 +20096,7 @@ virDomainGetHostname(virDomainPtr domain, unsigned int flags) if (conn->driver->domainGetHostname) { char *ret; - ret = conn->driver->domainGetHostname (domain, flags); + ret = conn->driver->domainGetHostname(domain, flags); if (!ret) goto error; return ret; diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c index fa931c38b8..52771b8b19 100644 --- a/src/libxl/libxl_conf.c +++ b/src/libxl/libxl_conf.c @@ -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", diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index f4e9aa669b..bc75730d3f 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -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; diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c index d988a6db3c..d24f3d693e 100644 --- a/src/locking/lock_driver_sanlock.c +++ b/src/locking/lock_driver_sanlock.c @@ -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(); diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c index 47dc7f1b7e..138b697fe8 100644 --- a/src/lxc/lxc_conf.c +++ b/src/lxc/lxc_conf.c @@ -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; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index 8faa664d74..db1f6ed18f 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -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; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 2072f008a3..991b593f86 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -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) { diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index c81ba88ccd..c153d36da7 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -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(); diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 943e020584..acd78f28ae 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -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; } diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 3348ae7091..36fbd66c7d 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -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) diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c index 350a8ecd3e..807fd28825 100644 --- a/src/nwfilter/nwfilter_dhcpsnoop.c +++ b/src/nwfilter/nwfilter_dhcpsnoop.c @@ -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 " diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index a80bb66e7e..12f47ef44e 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -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(); diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c index 9bff8f1db0..cdf0efce54 100644 --- a/src/nwfilter/nwfilter_ebiptables_driver.c +++ b/src/nwfilter/nwfilter_ebiptables_driver.c @@ -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); } diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c index 8e5861c1c2..572acf4c8b 100644 --- a/src/nwfilter/nwfilter_gentech_driver.c +++ b/src/nwfilter/nwfilter_gentech_driver.c @@ -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; diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c index 1d31a463d5..85e0e7e9bd 100644 --- a/src/nwfilter/nwfilter_learnipaddr.c +++ b/src/nwfilter/nwfilter_learnipaddr.c @@ -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 " diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index b9f85a8269..ea86a0efce 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -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; diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c index fb3c5524e5..c5f5ca0068 100644 --- a/src/openvz/openvz_driver.c +++ b/src/openvz/openvz_driver.c @@ -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; } diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c index 62db626b46..28779fa16f 100644 --- a/src/parallels/parallels_driver.c +++ b/src/parallels/parallels_driver.c @@ -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)) { diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 5c4f5185b7..97b0b248dc 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -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); diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 5ce748a230..288187c9af 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -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); diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 0b6d2f8143..389c480e4c 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -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; diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 8f3922f5d6..dc4d68070d 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -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; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 15f4211825..c18c2053d7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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, diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index e24c022f4a..94ba2419b5 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -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: diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index aae857491f..ae8381ee93 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -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"), diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index e0acc20d5d..5f8a9c587f 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -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, diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a92f74d63e..cbde2b1607 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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; diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c index 0e46fd94f4..9af5cd35cf 100644 --- a/src/qemu/qemu_monitor_text.c +++ b/src/qemu/qemu_monitor_text.c @@ -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++; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 5eca0fab19..62b77296da 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -114,39 +114,39 @@ static int callWithFD(virConnectPtr conn, struct private_data *priv, unsigned int flags, int fd, int proc_nr, xdrproc_t args_filter, char *args, xdrproc_t ret_filter, char *ret); -static int remoteAuthenticate (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth, const char *authtype); +static int remoteAuthenticate(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth, const char *authtype); #if HAVE_SASL -static int remoteAuthSASL (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth, const char *mech); +static int remoteAuthSASL(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth, const char *mech); #endif #if HAVE_POLKIT -static int remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth); +static int remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth); #endif /* HAVE_POLKIT */ -static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain); -static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network); -static virNWFilterPtr get_nonnull_nwfilter (virConnectPtr conn, remote_nonnull_nwfilter nwfilter); -static virInterfacePtr get_nonnull_interface (virConnectPtr conn, remote_nonnull_interface iface); -static virStoragePoolPtr get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool); -static virStorageVolPtr get_nonnull_storage_vol (virConnectPtr conn, remote_nonnull_storage_vol vol); -static virNodeDevicePtr get_nonnull_node_device (virConnectPtr conn, remote_nonnull_node_device dev); -static virSecretPtr get_nonnull_secret (virConnectPtr conn, remote_nonnull_secret secret); -static virDomainSnapshotPtr get_nonnull_domain_snapshot (virDomainPtr domain, remote_nonnull_domain_snapshot snapshot); -static void make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src); -static void make_nonnull_network (remote_nonnull_network *net_dst, virNetworkPtr net_src); -static void make_nonnull_interface (remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); -static void make_nonnull_storage_pool (remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr vol_src); -static void make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); -static void make_nonnull_secret (remote_nonnull_secret *secret_dst, virSecretPtr secret_src); -static void make_nonnull_nwfilter (remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src); -static void make_nonnull_domain_snapshot (remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src); +static virDomainPtr get_nonnull_domain(virConnectPtr conn, remote_nonnull_domain domain); +static virNetworkPtr get_nonnull_network(virConnectPtr conn, remote_nonnull_network network); +static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter); +static virInterfacePtr get_nonnull_interface(virConnectPtr conn, remote_nonnull_interface iface); +static virStoragePoolPtr get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool); +static virStorageVolPtr get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol); +static virNodeDevicePtr get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev); +static virSecretPtr get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret); +static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot); +static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src); +static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src); +static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src); +static void make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr vol_src); +static void make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src); +static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src); +static void make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src); +static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src); static void remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr event); /*----------------------------------------------------------------------*/ /* Helper functions for remoteOpen. */ -static char *get_transport_from_scheme (char *scheme); +static char *get_transport_from_scheme(char *scheme); #ifdef WITH_LIBVIRTD static int @@ -503,7 +503,7 @@ doRemoteOpen(virConnectPtr conn, goto no_memory; if (conn->uri && conn->uri->user && - !(username = strdup (conn->uri->user))) + !(username = strdup(conn->uri->user))) goto no_memory; /* Get the variables from the query string. @@ -907,9 +907,9 @@ remoteOpenSecondaryDriver(virConnectPtr conn, } static virDrvOpenStatus -remoteOpen (virConnectPtr conn, - virConnectAuthPtr auth, - unsigned int flags) +remoteOpen(virConnectPtr conn, + virConnectAuthPtr auth, + unsigned int flags) { struct private_data *priv; int ret, rflags = 0; @@ -1033,7 +1033,7 @@ remoteClose(virConnectPtr conn) conn->privateData = NULL; remoteDriverUnlock(priv); virMutexDestroy(&priv->lock); - VIR_FREE (priv); + VIR_FREE(priv); } if (priv) remoteDriverUnlock(priv); @@ -1223,7 +1223,7 @@ remoteNodeGetMemoryStats(virConnectPtr conn, args.cellNum = cellNum; args.flags = flags; - memset (&ret, 0, sizeof(ret)); + memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_STATS, (xdrproc_t) xdr_remote_node_get_memory_stats_args, (char *) &args, (xdrproc_t) xdr_remote_node_get_memory_stats_ret, (char *) &ret) == -1) @@ -1456,7 +1456,7 @@ remoteSerializeTypedParameters(virTypedParameterPtr params, for (i = 0; i < nparams; ++i) { /* call() will free this: */ - val[i].field = strdup (params[i].field); + val[i].field = strdup(params[i].field); if (val[i].field == NULL) { virReportOOMError(); goto cleanup; @@ -1629,15 +1629,15 @@ remoteDomainBlockStatsFlags(virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.path = (char *) path; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS, - (xdrproc_t) xdr_remote_domain_block_stats_flags_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_STATS_FLAGS, + (xdrproc_t) xdr_remote_domain_block_stats_flags_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_block_stats_flags_ret, (char *) &ret) == -1) goto done; /* Check the length of the returned list carefully. */ @@ -1671,17 +1671,17 @@ remoteDomainBlockStatsFlags(virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_block_stats_flags_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_block_stats_flags_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int -remoteDomainGetMemoryParameters (virDomainPtr domain, - virTypedParameterPtr params, int *nparams, - unsigned int flags) +remoteDomainGetMemoryParameters(virDomainPtr domain, + virTypedParameterPtr params, int *nparams, + unsigned int flags) { int rv = -1; remote_domain_get_memory_parameters_args args; @@ -1690,14 +1690,14 @@ remoteDomainGetMemoryParameters (virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS, - (xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_MEMORY_PARAMETERS, + (xdrproc_t) xdr_remote_domain_get_memory_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters @@ -1719,17 +1719,17 @@ remoteDomainGetMemoryParameters (virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_memory_parameters_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int -remoteDomainGetNumaParameters (virDomainPtr domain, - virTypedParameterPtr params, int *nparams, - unsigned int flags) +remoteDomainGetNumaParameters(virDomainPtr domain, + virTypedParameterPtr params, int *nparams, + unsigned int flags) { int rv = -1; remote_domain_get_numa_parameters_args args; @@ -1738,14 +1738,14 @@ remoteDomainGetNumaParameters (virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS, - (xdrproc_t) xdr_remote_domain_get_numa_parameters_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_NUMA_PARAMETERS, + (xdrproc_t) xdr_remote_domain_get_numa_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters @@ -1767,17 +1767,17 @@ remoteDomainGetNumaParameters (virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_numa_parameters_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int -remoteDomainGetBlkioParameters (virDomainPtr domain, - virTypedParameterPtr params, int *nparams, - unsigned int flags) +remoteDomainGetBlkioParameters(virDomainPtr domain, + virTypedParameterPtr params, int *nparams, + unsigned int flags) { int rv = -1; remote_domain_get_blkio_parameters_args args; @@ -1786,14 +1786,14 @@ remoteDomainGetBlkioParameters (virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.nparams = *nparams; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS, - (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_BLKIO_PARAMETERS, + (xdrproc_t) xdr_remote_domain_get_blkio_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters @@ -1815,19 +1815,19 @@ remoteDomainGetBlkioParameters (virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_blkio_parameters_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; } static int -remoteDomainGetVcpuPinInfo (virDomainPtr domain, - int ncpumaps, - unsigned char *cpumaps, - int maplen, - unsigned int flags) +remoteDomainGetVcpuPinInfo(virDomainPtr domain, + int ncpumaps, + unsigned char *cpumaps, + int maplen, + unsigned int flags) { int rv = -1; int i; @@ -1852,18 +1852,18 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain, goto done; } - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.ncpumaps = ncpumaps; args.maplen = maplen; args.flags = flags; - memset (&ret, 0, sizeof(ret)); + memset(&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO, - (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, - (char *) &ret) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPU_PIN_INFO, + (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, + (char *) &ret) == -1) goto done; if (ret.num > ncpumaps) { @@ -1880,7 +1880,7 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain, goto cleanup; } - memset (cpumaps, 0, ncpumaps * maplen); + memset(cpumaps, 0, ncpumaps * maplen); for (i = 0; i < ret.cpumaps.cpumaps_len; ++i) cpumaps[i] = ret.cpumaps.cpumaps_val[i]; @@ -1888,7 +1888,7 @@ remoteDomainGetVcpuPinInfo (virDomainPtr domain, rv = ret.num; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_vcpu_pin_info_ret, (char *) &ret); done: remoteDriverUnlock(priv); @@ -1896,10 +1896,10 @@ done: } static int -remoteDomainPinEmulator (virDomainPtr dom, - unsigned char *cpumap, - int cpumaplen, - unsigned int flags) +remoteDomainPinEmulator(virDomainPtr dom, + unsigned char *cpumap, + int cpumaplen, + unsigned int flags) { int rv = -1; struct private_data *priv = dom->conn->privateData; @@ -1935,10 +1935,10 @@ done: static int -remoteDomainGetEmulatorPinInfo (virDomainPtr domain, - unsigned char *cpumaps, - int maplen, - unsigned int flags) +remoteDomainGetEmulatorPinInfo(virDomainPtr domain, + unsigned char *cpumaps, + int maplen, + unsigned int flags) { int rv = -1; int i; @@ -1962,11 +1962,11 @@ remoteDomainGetEmulatorPinInfo (virDomainPtr domain, memset(&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO, - (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, - (char *) &ret) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_EMULATOR_PIN_INFO, + (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, + (char *) &ret) == -1) goto done; if (ret.cpumaps.cpumaps_len > maplen) { @@ -1984,8 +1984,8 @@ remoteDomainGetEmulatorPinInfo (virDomainPtr domain, rv = ret.ret; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_emulator_pin_info_ret, + (char *) &ret); done: remoteDriverUnlock(priv); @@ -1993,11 +1993,11 @@ done: } static int -remoteDomainGetVcpus (virDomainPtr domain, - virVcpuInfoPtr info, - int maxinfo, - unsigned char *cpumaps, - int maplen) +remoteDomainGetVcpus(virDomainPtr domain, + virVcpuInfoPtr info, + int maxinfo, + unsigned char *cpumaps, + int maplen) { int rv = -1; int i; @@ -2021,14 +2021,14 @@ remoteDomainGetVcpus (virDomainPtr domain, goto done; } - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.maxinfo = maxinfo; args.maplen = maplen; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS, - (xdrproc_t) xdr_remote_domain_get_vcpus_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_VCPUS, + (xdrproc_t) xdr_remote_domain_get_vcpus_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret) == -1) goto done; if (ret.info.info_len > maxinfo) { @@ -2044,8 +2044,8 @@ remoteDomainGetVcpus (virDomainPtr domain, goto cleanup; } - memset (info, 0, sizeof(virVcpuInfo) * maxinfo); - memset (cpumaps, 0, maxinfo * maplen); + memset(info, 0, sizeof(virVcpuInfo) * maxinfo); + memset(cpumaps, 0, maxinfo * maplen); for (i = 0; i < ret.info.info_len; ++i) { info[i].number = ret.info.info_val[i].number; @@ -2060,7 +2060,7 @@ remoteDomainGetVcpus (virDomainPtr domain, rv = ret.info.info_len; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_vcpus_ret, (char *) &ret); done: remoteDriverUnlock(priv); @@ -2068,7 +2068,7 @@ done: } static int -remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel) +remoteDomainGetSecurityLabel(virDomainPtr domain, virSecurityLabelPtr seclabel) { remote_domain_get_security_label_args args; remote_domain_get_security_label_ret ret; @@ -2077,23 +2077,23 @@ remoteDomainGetSecurityLabel (virDomainPtr domain, virSecurityLabelPtr seclabel) remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); - memset (&ret, 0, sizeof(ret)); - memset (seclabel, 0, sizeof(*seclabel)); + make_nonnull_domain(&args.dom, domain); + memset(&ret, 0, sizeof(ret)); + memset(seclabel, 0, sizeof(*seclabel)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL, - (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args, - (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) { + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL, + (xdrproc_t) xdr_remote_domain_get_security_label_args, (char *)&args, + (xdrproc_t) xdr_remote_domain_get_security_label_ret, (char *)&ret) == -1) { goto done; } if (ret.label.label_val != NULL) { - if (strlen (ret.label.label_val) >= sizeof(seclabel->label)) { + if (strlen(ret.label.label_val) >= sizeof(seclabel->label)) { virReportError(VIR_ERR_RPC, _("security label exceeds maximum: %zu"), sizeof(seclabel->label) - 1); goto cleanup; } - strcpy (seclabel->label, ret.label.label_val); + strcpy(seclabel->label, ret.label.label_val); seclabel->enforcing = ret.enforcing; } @@ -2108,7 +2108,7 @@ done: } static int -remoteDomainGetSecurityLabelList (virDomainPtr domain, virSecurityLabelPtr* seclabels) +remoteDomainGetSecurityLabelList(virDomainPtr domain, virSecurityLabelPtr* seclabels) { remote_domain_get_security_label_list_args args; remote_domain_get_security_label_list_ret ret; @@ -2117,12 +2117,12 @@ remoteDomainGetSecurityLabelList (virDomainPtr domain, virSecurityLabelPtr* secl remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); memset(&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST, - (xdrproc_t) xdr_remote_domain_get_security_label_list_args, (char *)&args, - (xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret) == -1) { + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SECURITY_LABEL_LIST, + (xdrproc_t) xdr_remote_domain_get_security_label_list_args, (char *)&args, + (xdrproc_t) xdr_remote_domain_get_security_label_list_ret, (char *)&ret) == -1) { goto done; } @@ -2186,7 +2186,7 @@ done: } static int -remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) +remoteNodeGetSecurityModel(virConnectPtr conn, virSecurityModelPtr secmodel) { remote_node_get_security_model_ret ret; struct private_data *priv = conn->privateData; @@ -2194,31 +2194,31 @@ remoteNodeGetSecurityModel (virConnectPtr conn, virSecurityModelPtr secmodel) remoteDriverLock(priv); - memset (&ret, 0, sizeof(ret)); - memset (secmodel, 0, sizeof(*secmodel)); + memset(&ret, 0, sizeof(ret)); + memset(secmodel, 0, sizeof(*secmodel)); - if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL, - (xdrproc_t) xdr_void, NULL, - (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) { + if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_SECURITY_MODEL, + (xdrproc_t) xdr_void, NULL, + (xdrproc_t) xdr_remote_node_get_security_model_ret, (char *)&ret) == -1) { goto done; } if (ret.model.model_val != NULL) { - if (strlen (ret.model.model_val) >= sizeof(secmodel->model)) { + if (strlen(ret.model.model_val) >= sizeof(secmodel->model)) { virReportError(VIR_ERR_RPC, _("security model exceeds maximum: %zu"), sizeof(secmodel->model) - 1); goto cleanup; } - strcpy (secmodel->model, ret.model.model_val); + strcpy(secmodel->model, ret.model.model_val); } if (ret.doi.doi_val != NULL) { - if (strlen (ret.doi.doi_val) >= sizeof(secmodel->doi)) { + if (strlen(ret.doi.doi_val) >= sizeof(secmodel->doi)) { virReportError(VIR_ERR_RPC, _("security doi exceeds maximum: %zu"), sizeof(secmodel->doi) - 1); goto cleanup; } - strcpy (secmodel->doi, ret.doi.doi_val); + strcpy(secmodel->doi, ret.doi.doi_val); } rv = 0; @@ -2232,11 +2232,11 @@ done: } static int -remoteDomainMigratePrepare (virConnectPtr dconn, - char **cookie, int *cookielen, - const char *uri_in, char **uri_out, - unsigned long flags, const char *dname, - unsigned long resource) +remoteDomainMigratePrepare(virConnectPtr dconn, + char **cookie, int *cookielen, + const char *uri_in, char **uri_out, + unsigned long flags, const char *dname, + unsigned long resource) { int rv = -1; remote_domain_migrate_prepare_args args; @@ -2250,10 +2250,10 @@ remoteDomainMigratePrepare (virConnectPtr dconn, args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; - memset (&ret, 0, sizeof(ret)); - if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE, - (xdrproc_t) xdr_remote_domain_migrate_prepare_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_prepare_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE, + (xdrproc_t) xdr_remote_domain_migrate_prepare_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_prepare_ret, (char *) &ret) == -1) goto done; if (ret.cookie.cookie_len > 0) { @@ -2272,12 +2272,12 @@ done: } static int -remoteDomainMigratePrepare2 (virConnectPtr dconn, - char **cookie, int *cookielen, - const char *uri_in, char **uri_out, - unsigned long flags, const char *dname, - unsigned long resource, - const char *dom_xml) +remoteDomainMigratePrepare2(virConnectPtr dconn, + char **cookie, int *cookielen, + const char *uri_in, char **uri_out, + unsigned long flags, const char *dname, + unsigned long resource, + const char *dom_xml) { int rv = -1; remote_domain_migrate_prepare2_args args; @@ -2292,10 +2292,10 @@ remoteDomainMigratePrepare2 (virConnectPtr dconn, args.resource = resource; args.dom_xml = (char *) dom_xml; - memset (&ret, 0, sizeof(ret)); - if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2, - (xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE2, + (xdrproc_t) xdr_remote_domain_migrate_prepare2_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_prepare2_ret, (char *) &ret) == -1) goto done; if (ret.cookie.cookie_len > 0) { @@ -2331,7 +2331,7 @@ error: } static int -remoteDomainCreate (virDomainPtr domain) +remoteDomainCreate(virDomainPtr domain) { int rv = -1; remote_domain_create_args args; @@ -2341,26 +2341,26 @@ remoteDomainCreate (virDomainPtr domain) remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE, - (xdrproc_t) xdr_remote_domain_create_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_CREATE, + (xdrproc_t) xdr_remote_domain_create_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; /* Need to do a lookup figure out ID of newly started guest, because * bug in design of REMOTE_PROC_DOMAIN_CREATE means we aren't getting * it returned. */ - memcpy (args2.uuid, domain->uuid, VIR_UUID_BUFLEN); - memset (&ret2, 0, sizeof(ret2)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID, - (xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2, - (xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1) + memcpy(args2.uuid, domain->uuid, VIR_UUID_BUFLEN); + memset(&ret2, 0, sizeof(ret2)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_LOOKUP_BY_UUID, + (xdrproc_t) xdr_remote_domain_lookup_by_uuid_args, (char *) &args2, + (xdrproc_t) xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2) == -1) goto done; domain->id = ret2.dom.id; - xdr_free ((xdrproc_t) &xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2); + xdr_free((xdrproc_t) &xdr_remote_domain_lookup_by_uuid_ret, (char *) &ret2); rv = 0; @@ -2370,7 +2370,7 @@ done: } static char * -remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams) +remoteDomainGetSchedulerType(virDomainPtr domain, int *nparams) { char *rv = NULL; remote_domain_get_scheduler_type_args args; @@ -2379,12 +2379,12 @@ remoteDomainGetSchedulerType (virDomainPtr domain, int *nparams) remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE, - (xdrproc_t) xdr_remote_domain_get_scheduler_type_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_scheduler_type_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_SCHEDULER_TYPE, + (xdrproc_t) xdr_remote_domain_get_scheduler_type_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_scheduler_type_ret, (char *) &ret) == -1) goto done; if (nparams) *nparams = ret.nparams; @@ -2398,10 +2398,10 @@ done: } static int -remoteDomainMemoryStats (virDomainPtr domain, - struct _virDomainMemoryStat *stats, - unsigned int nr_stats, - unsigned int flags) +remoteDomainMemoryStats(virDomainPtr domain, + struct _virDomainMemoryStat *stats, + unsigned int nr_stats, + unsigned int flags) { int rv = -1; remote_domain_memory_stats_args args; @@ -2411,7 +2411,7 @@ remoteDomainMemoryStats (virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); if (nr_stats > REMOTE_DOMAIN_MEMORY_STATS_MAX) { virReportError(VIR_ERR_RPC, _("too many memory stats requested: %d > %d"), nr_stats, @@ -2420,13 +2420,13 @@ remoteDomainMemoryStats (virDomainPtr domain, } args.maxStats = nr_stats; args.flags = flags; - memset (&ret, 0, sizeof(ret)); + memset(&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS, - (xdrproc_t) xdr_remote_domain_memory_stats_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_memory_stats_ret, - (char *) &ret) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_STATS, + (xdrproc_t) xdr_remote_domain_memory_stats_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_memory_stats_ret, + (char *) &ret) == -1) goto done; for (i = 0; i < ret.stats.stats_len; i++) { @@ -2442,12 +2442,12 @@ done: } static int -remoteDomainBlockPeek (virDomainPtr domain, - const char *path, - unsigned long long offset, - size_t size, - void *buffer, - unsigned int flags) +remoteDomainBlockPeek(virDomainPtr domain, + const char *path, + unsigned long long offset, + size_t size, + void *buffer, + unsigned int flags) { int rv = -1; remote_domain_block_peek_args args; @@ -2463,18 +2463,18 @@ remoteDomainBlockPeek (virDomainPtr domain, goto done; } - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.path = (char *) path; args.offset = offset; args.size = size; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PEEK, - (xdrproc_t) xdr_remote_domain_block_peek_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_block_peek_ret, - (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_BLOCK_PEEK, + (xdrproc_t) xdr_remote_domain_block_peek_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_block_peek_ret, + (char *) &ret) == -1) goto done; if (ret.buffer.buffer_len != size) { @@ -2483,7 +2483,7 @@ remoteDomainBlockPeek (virDomainPtr domain, goto cleanup; } - memcpy (buffer, ret.buffer.buffer_val, size); + memcpy(buffer, ret.buffer.buffer_val, size); rv = 0; cleanup: @@ -2495,11 +2495,11 @@ done: } static int -remoteDomainMemoryPeek (virDomainPtr domain, - unsigned long long offset, - size_t size, - void *buffer, - unsigned int flags) +remoteDomainMemoryPeek(virDomainPtr domain, + unsigned long long offset, + size_t size, + void *buffer, + unsigned int flags) { int rv = -1; remote_domain_memory_peek_args args; @@ -2515,17 +2515,17 @@ remoteDomainMemoryPeek (virDomainPtr domain, goto done; } - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.offset = offset; args.size = size; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_PEEK, - (xdrproc_t) xdr_remote_domain_memory_peek_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_memory_peek_ret, - (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MEMORY_PEEK, + (xdrproc_t) xdr_remote_domain_memory_peek_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_memory_peek_ret, + (char *) &ret) == -1) goto done; if (ret.buffer.buffer_len != size) { @@ -2534,7 +2534,7 @@ remoteDomainMemoryPeek (virDomainPtr domain, goto cleanup; } - memcpy (buffer, ret.buffer.buffer_val, size); + memcpy(buffer, ret.buffer.buffer_val, size); rv = 0; cleanup: @@ -2631,8 +2631,8 @@ static int remoteDomainGetBlockIoTune(virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_block_io_tune_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_block_io_tune_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; @@ -2722,8 +2722,8 @@ cleanup: if (rv < 0) virTypedParameterArrayClear(params, nparams * ncpus); - xdr_free ((xdrproc_t) xdr_remote_domain_get_cpu_stats_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_cpu_stats_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; @@ -2765,7 +2765,7 @@ remoteConnectListAllNetworks(virConnectPtr conn, } for (i = 0; i < ret.nets.nets_len; i++) { - tmp_nets[i] = get_nonnull_network (conn, ret.nets.nets_val[i]); + tmp_nets[i] = get_nonnull_network(conn, ret.nets.nets_val[i]); if (!tmp_nets[i]) { virReportOOMError(); goto cleanup; @@ -2828,7 +2828,7 @@ remoteConnectListAllInterfaces(virConnectPtr conn, } for (i = 0; i < ret.ifaces.ifaces_len; i++) { - tmp_ifaces[i] = get_nonnull_interface (conn, ret.ifaces.ifaces_val[i]); + tmp_ifaces[i] = get_nonnull_interface(conn, ret.ifaces.ifaces_val[i]); if (!tmp_ifaces[i]) { virReportOOMError(); goto cleanup; @@ -3017,7 +3017,7 @@ remoteConnectListAllSecrets(virConnectPtr conn, } for (i = 0; i < ret.secrets.secrets_len; i++) { - tmp_secrets[i] = get_nonnull_secret (conn, ret.secrets.secrets_val[i]); + tmp_secrets[i] = get_nonnull_secret(conn, ret.secrets.secrets_val[i]); if (!tmp_secrets[i]) { virReportOOMError(); goto cleanup; @@ -3046,7 +3046,7 @@ done: /*----------------------------------------------------------------------*/ -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags, void **genericPrivateData) { @@ -3054,7 +3054,7 @@ remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth, return VIR_DRV_OPEN_DECLINED; if (conn->driver && - STREQ (conn->driver->name, "remote")) { + STREQ(conn->driver->name, "remote")) { struct private_data *priv; /* If we're here, the remote driver is already @@ -3067,7 +3067,7 @@ remoteGenericOpen(virConnectPtr conn, virConnectAuthPtr auth, remoteDriverUnlock(priv); return VIR_DRV_OPEN_SUCCESS; } else if (conn->networkDriver && - STREQ (conn->networkDriver->name, "remote")) { + STREQ(conn->networkDriver->name, "remote")) { struct private_data *priv = conn->networkPrivateData; remoteDriverLock(priv); *genericPrivateData = priv; @@ -3106,7 +3106,7 @@ remoteGenericClose(virConnectPtr conn, void **genericPrivateData) return rv; } -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteNetworkOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -3121,7 +3121,7 @@ remoteNetworkClose(virConnectPtr conn) /*----------------------------------------------------------------------*/ -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteInterfaceOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -3136,7 +3136,7 @@ remoteInterfaceClose(virConnectPtr conn) /*----------------------------------------------------------------------*/ -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteStorageOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -3150,10 +3150,10 @@ remoteStorageClose(virConnectPtr conn) } static char * -remoteFindStoragePoolSources (virConnectPtr conn, - const char *type, - const char *srcSpec, - unsigned int flags) +remoteFindStoragePoolSources(virConnectPtr conn, + const char *type, + const char *srcSpec, + unsigned int flags) { char *rv = NULL; remote_find_storage_pool_sources_args args; @@ -3166,16 +3166,16 @@ remoteFindStoragePoolSources (virConnectPtr conn, args.srcSpec = srcSpec ? (char **)&srcSpec : NULL; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (conn, priv, 0, REMOTE_PROC_FIND_STORAGE_POOL_SOURCES, - (xdrproc_t) xdr_remote_find_storage_pool_sources_args, (char *) &args, - (xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_FIND_STORAGE_POOL_SOURCES, + (xdrproc_t) xdr_remote_find_storage_pool_sources_args, (char *) &args, + (xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret) == -1) goto done; rv = ret.xml; ret.xml = NULL; /* To stop xdr_free free'ing it */ - xdr_free ((xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_find_storage_pool_sources_ret, (char *) &ret); done: remoteDriverUnlock(priv); @@ -3183,9 +3183,9 @@ done: } static int -remoteConnectListAllStoragePools (virConnectPtr conn, - virStoragePoolPtr **pools, - unsigned int flags) +remoteConnectListAllStoragePools(virConnectPtr conn, + virStoragePoolPtr **pools, + unsigned int flags) { int rv = -1; int i; @@ -3312,7 +3312,7 @@ done: /*----------------------------------------------------------------------*/ -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteDevMonOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -3326,7 +3326,7 @@ remoteDevMonClose(virConnectPtr conn) } static int -remoteNodeDeviceDettach (virNodeDevicePtr dev) +remoteNodeDeviceDettach(virNodeDevicePtr dev) { int rv = -1; remote_node_device_dettach_args args; @@ -3338,9 +3338,9 @@ remoteNodeDeviceDettach (virNodeDevicePtr dev) args.name = dev->name; - if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DETTACH, - (xdrproc_t) xdr_remote_node_device_dettach_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_DETTACH, + (xdrproc_t) xdr_remote_node_device_dettach_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; @@ -3351,7 +3351,7 @@ done: } static int -remoteNodeDeviceReAttach (virNodeDevicePtr dev) +remoteNodeDeviceReAttach(virNodeDevicePtr dev) { int rv = -1; remote_node_device_re_attach_args args; @@ -3363,9 +3363,9 @@ remoteNodeDeviceReAttach (virNodeDevicePtr dev) args.name = dev->name; - if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RE_ATTACH, - (xdrproc_t) xdr_remote_node_device_re_attach_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RE_ATTACH, + (xdrproc_t) xdr_remote_node_device_re_attach_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; @@ -3376,7 +3376,7 @@ done: } static int -remoteNodeDeviceReset (virNodeDevicePtr dev) +remoteNodeDeviceReset(virNodeDevicePtr dev) { int rv = -1; remote_node_device_reset_args args; @@ -3388,9 +3388,9 @@ remoteNodeDeviceReset (virNodeDevicePtr dev) args.name = dev->name; - if (call (dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RESET, - (xdrproc_t) xdr_remote_node_device_reset_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(dev->conn, priv, 0, REMOTE_PROC_NODE_DEVICE_RESET, + (xdrproc_t) xdr_remote_node_device_reset_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; @@ -3402,7 +3402,7 @@ done: /* ------------------------------------------------------------- */ -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteNWFilterOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -3418,18 +3418,18 @@ remoteNWFilterClose(virConnectPtr conn) /*----------------------------------------------------------------------*/ static int -remoteAuthenticate (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth ATTRIBUTE_UNUSED, - const char *authtype) +remoteAuthenticate(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth ATTRIBUTE_UNUSED, + const char *authtype) { struct remote_auth_list_ret ret; int err, type = REMOTE_AUTH_NONE; memset(&ret, 0, sizeof(ret)); - err = call (conn, priv, 0, - REMOTE_PROC_AUTH_LIST, - (xdrproc_t) xdr_void, (char *) NULL, - (xdrproc_t) xdr_remote_auth_list_ret, (char *) &ret); + err = call(conn, priv, 0, + REMOTE_PROC_AUTH_LIST, + (xdrproc_t) xdr_void, (char *) NULL, + (xdrproc_t) xdr_remote_auth_list_ret, (char *) &ret); if (err < 0) { virErrorPtr verr = virGetLastError(); if (verr && verr->code == VIR_ERR_NO_SUPPORT) { @@ -3829,8 +3829,8 @@ cleanup: /* Perform the SASL authentication process */ static int -remoteAuthSASL (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth, const char *wantmech) +remoteAuthSASL(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth, const char *wantmech) { remote_auth_sasl_init_ret iret; remote_auth_sasl_start_args sargs; @@ -3894,10 +3894,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, goto cleanup; /* First call is to inquire about supported mechanisms in the server */ - memset (&iret, 0, sizeof(iret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT, - (xdrproc_t) xdr_void, (char *)NULL, - (xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0) + memset(&iret, 0, sizeof(iret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_INIT, + (xdrproc_t) xdr_void, (char *)NULL, + (xdrproc_t) xdr_remote_auth_sasl_init_ret, (char *) &iret) != 0) goto cleanup; @@ -3949,10 +3949,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, mech, clientoutlen, clientout); /* Now send the initial auth data to the server */ - memset (&sret, 0, sizeof(sret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_START, - (xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs, - (xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0) + memset(&sret, 0, sizeof(sret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_START, + (xdrproc_t) xdr_remote_auth_sasl_start_args, (char *) &sargs, + (xdrproc_t) xdr_remote_auth_sasl_start_ret, (char *) &sret) != 0) goto cleanup; complete = sret.complete; @@ -4001,10 +4001,10 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, VIR_DEBUG("Server step with %zu bytes %p", clientoutlen, clientout); - memset (&pret, 0, sizeof(pret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP, - (xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs, - (xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0) + memset(&pret, 0, sizeof(pret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_SASL_STEP, + (xdrproc_t) xdr_remote_auth_sasl_step_args, (char *) &pargs, + (xdrproc_t) xdr_remote_auth_sasl_step_ret, (char *) &pret) != 0) goto cleanup; complete = pret.complete; @@ -4056,16 +4056,16 @@ remoteAuthSASL (virConnectPtr conn, struct private_data *priv, #if HAVE_POLKIT # if HAVE_POLKIT1 static int -remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth ATTRIBUTE_UNUSED) +remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth ATTRIBUTE_UNUSED) { remote_auth_polkit_ret ret; VIR_DEBUG("Client initialize PolicyKit-1 authentication"); - memset (&ret, 0, sizeof(ret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, - (xdrproc_t) xdr_void, (char *)NULL, - (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) { + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, + (xdrproc_t) xdr_void, (char *)NULL, + (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) { return -1; /* virError already set by call */ } @@ -4076,8 +4076,8 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, /* Perform the PolicyKit authentication process */ static int -remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, - virConnectAuthPtr auth) +remoteAuthPolkit(virConnectPtr conn, struct private_data *priv, + virConnectAuthPtr auth) { remote_auth_polkit_ret ret; int i, allowcb = 0; @@ -4092,10 +4092,10 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, VIR_DEBUG("Client initialize PolicyKit-0 authentication"); /* Check auth first and if it succeeds we are done. */ - memset (&ret, 0, sizeof(ret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, - (xdrproc_t) xdr_void, (char *)NULL, - (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) == 0) + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, + (xdrproc_t) xdr_void, (char *)NULL, + (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) == 0) goto out; /* Auth failed. Ask client to obtain it and check again. */ @@ -4123,10 +4123,10 @@ remoteAuthPolkit (virConnectPtr conn, struct private_data *priv, return -1; } - memset (&ret, 0, sizeof(ret)); - if (call (conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, - (xdrproc_t) xdr_void, (char *)NULL, - (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) { + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_AUTH_POLKIT, + (xdrproc_t) xdr_void, (char *)NULL, + (xdrproc_t) xdr_remote_auth_polkit_ret, (char *) &ret) != 0) { return -1; /* virError already set by call */ } @@ -4157,9 +4157,9 @@ static int remoteDomainEventRegister(virConnectPtr conn, if (count == 1) { /* Tell the server when we are the first callback deregistering */ - if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_REGISTER, - (xdrproc_t) xdr_void, (char *) NULL, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_REGISTER, + (xdrproc_t) xdr_void, (char *) NULL, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } @@ -4186,9 +4186,9 @@ static int remoteDomainEventDeregister(virConnectPtr conn, if (count == 0) { /* Tell the server when we are the last callback deregistering */ - if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER, - (xdrproc_t) xdr_void, (char *) NULL, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER, + (xdrproc_t) xdr_void, (char *) NULL, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } @@ -4606,7 +4606,7 @@ remoteDomainBuildEventPMSuspendDisk(virNetClientProgramPtr prog ATTRIBUTE_UNUSED } -static virDrvOpenStatus ATTRIBUTE_NONNULL (1) +static virDrvOpenStatus ATTRIBUTE_NONNULL(1) remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { @@ -4614,21 +4614,21 @@ remoteSecretOpen(virConnectPtr conn, virConnectAuthPtr auth, } static int -remoteSecretClose (virConnectPtr conn) +remoteSecretClose(virConnectPtr conn) { return remoteGenericClose(conn, &conn->secretPrivateData); } static unsigned char * -remoteSecretGetValue (virSecretPtr secret, size_t *value_size, - unsigned int flags, unsigned int internalFlags) +remoteSecretGetValue(virSecretPtr secret, size_t *value_size, + unsigned int flags, unsigned int internalFlags) { unsigned char *rv = NULL; remote_secret_get_value_args args; remote_secret_get_value_ret ret; struct private_data *priv = secret->conn->secretPrivateData; - remoteDriverLock (priv); + remoteDriverLock(priv); /* internalFlags intentionally do not go over the wire */ if (internalFlags) { @@ -4636,20 +4636,20 @@ remoteSecretGetValue (virSecretPtr secret, size_t *value_size, goto done; } - make_nonnull_secret (&args.secret, secret); + make_nonnull_secret(&args.secret, secret); args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (secret->conn, priv, 0, REMOTE_PROC_SECRET_GET_VALUE, - (xdrproc_t) xdr_remote_secret_get_value_args, (char *) &args, - (xdrproc_t) xdr_remote_secret_get_value_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(secret->conn, priv, 0, REMOTE_PROC_SECRET_GET_VALUE, + (xdrproc_t) xdr_remote_secret_get_value_args, (char *) &args, + (xdrproc_t) xdr_remote_secret_get_value_ret, (char *) &ret) == -1) goto done; *value_size = ret.value.value_len; rv = (unsigned char *) ret.value.value_val; /* Caller frees. */ done: - remoteDriverUnlock (priv); + remoteDriverUnlock(priv); return rv; } @@ -4926,9 +4926,9 @@ static int remoteDomainEventRegisterAny(virConnectPtr conn, if (count == 1) { args.eventID = eventID; - if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY, - (xdrproc_t) xdr_remote_domain_events_register_any_args, (char *) &args, - (xdrproc_t) xdr_void, (char *)NULL) == -1) { + if (call(conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY, + (xdrproc_t) xdr_remote_domain_events_register_any_args, (char *) &args, + (xdrproc_t) xdr_void, (char *)NULL) == -1) { virDomainEventStateDeregisterID(conn, priv->domainEventState, callbackID); @@ -4974,9 +4974,9 @@ static int remoteDomainEventDeregisterAny(virConnectPtr conn, if (count == 0) { args.eventID = callbackID; - if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY, - (xdrproc_t) xdr_remote_domain_events_deregister_any_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY, + (xdrproc_t) xdr_remote_domain_events_deregister_any_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; } @@ -4991,8 +4991,8 @@ done: /*----------------------------------------------------------------------*/ static int -remoteQemuDomainMonitorCommand (virDomainPtr domain, const char *cmd, - char **result, unsigned int flags) +remoteQemuDomainMonitorCommand(virDomainPtr domain, const char *cmd, + char **result, unsigned int flags) { int rv = -1; qemu_monitor_command_args args; @@ -5005,10 +5005,10 @@ remoteQemuDomainMonitorCommand (virDomainPtr domain, const char *cmd, args.cmd = (char *)cmd; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_MONITOR_COMMAND, - (xdrproc_t) xdr_qemu_monitor_command_args, (char *) &args, - (xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, REMOTE_CALL_QEMU, QEMU_PROC_MONITOR_COMMAND, + (xdrproc_t) xdr_qemu_monitor_command_args, (char *) &args, + (xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret) == -1) goto done; *result = strdup(ret.result); @@ -5020,7 +5020,7 @@ remoteQemuDomainMonitorCommand (virDomainPtr domain, const char *cmd, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret); + xdr_free((xdrproc_t) xdr_qemu_monitor_command_ret, (char *) &ret); done: remoteDriverUnlock(priv); @@ -5047,15 +5047,15 @@ remoteDomainMigrateBegin3(virDomainPtr domain, memset(&args, 0, sizeof(args)); memset(&ret, 0, sizeof(ret)); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.xmlin = xmlin == NULL ? NULL : (char **) &xmlin; args.flags = flags; args.dname = dname == NULL ? NULL : (char **) &dname; args.resource = resource; - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3, - (xdrproc_t) xdr_remote_domain_migrate_begin3_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_begin3_ret, (char *) &ret) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_BEGIN3, + (xdrproc_t) xdr_remote_domain_migrate_begin3_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_begin3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { @@ -5111,10 +5111,10 @@ remoteDomainMigratePrepare3(virConnectPtr dconn, args.resource = resource; args.dom_xml = (char *) dom_xml; - memset (&ret, 0, sizeof(ret)); - if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3, - (xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PREPARE3, + (xdrproc_t) xdr_remote_domain_migrate_prepare3_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_prepare3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { @@ -5256,9 +5256,9 @@ remoteDomainMigratePerform3(virDomainPtr dom, args.dconnuri = dconnuri == NULL ? NULL : (char **) &dconnuri; args.resource = resource; - if (call (dom->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3, - (xdrproc_t) xdr_remote_domain_migrate_perform3_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_perform3_ret, (char *) &ret) == -1) + if (call(dom->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_PERFORM3, + (xdrproc_t) xdr_remote_domain_migrate_perform3_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_perform3_ret, (char *) &ret) == -1) goto done; if (ret.cookie_out.cookie_out_len > 0) { @@ -5313,9 +5313,9 @@ remoteDomainMigrateFinish3(virConnectPtr dconn, args.flags = flags; args.cancelled = cancelled; - if (call (dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH3, - (xdrproc_t) xdr_remote_domain_migrate_finish3_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1) + if (call(dconn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_FINISH3, + (xdrproc_t) xdr_remote_domain_migrate_finish3_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_migrate_finish3_ret, (char *) &ret) == -1) goto done; rv = get_nonnull_domain(dconn, ret.dom); @@ -5332,7 +5332,7 @@ remoteDomainMigrateFinish3(virConnectPtr dconn, ret.cookie_out.cookie_out_len = 0; } - xdr_free ((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret); + xdr_free((xdrproc_t) &xdr_remote_domain_migrate_finish3_ret, (char *) &ret); done: remoteDriverUnlock(priv); @@ -5359,15 +5359,15 @@ remoteDomainMigrateConfirm3(virDomainPtr domain, memset(&args, 0, sizeof(args)); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.cookie_in.cookie_in_len = cookieinlen; args.cookie_in.cookie_in_val = (char *) cookiein; args.flags = flags; args.cancelled = cancelled; - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3, - (xdrproc_t) xdr_remote_domain_migrate_confirm3_args, (char *) &args, - (xdrproc_t) xdr_void, (char *) NULL) == -1) + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_MIGRATE_CONFIRM3, + (xdrproc_t) xdr_remote_domain_migrate_confirm3_args, (char *) &args, + (xdrproc_t) xdr_void, (char *) NULL) == -1) goto done; rv = 0; @@ -5390,7 +5390,7 @@ remoteDomainOpenGraphics(virDomainPtr dom, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, dom); + make_nonnull_domain(&args.dom, dom); args.idx = idx; args.flags = flags; @@ -5543,12 +5543,12 @@ callWithFD(virConnectPtr conn ATTRIBUTE_UNUSED, } static int -call (virConnectPtr conn, - struct private_data *priv, - unsigned int flags, - int proc_nr, - xdrproc_t args_filter, char *args, - xdrproc_t ret_filter, char *ret) +call(virConnectPtr conn, + struct private_data *priv, + unsigned int flags, + int proc_nr, + xdrproc_t args_filter, char *args, + xdrproc_t ret_filter, char *ret) { return callWithFD(conn, priv, flags, -1, proc_nr, args_filter, args, @@ -5557,10 +5557,10 @@ call (virConnectPtr conn, static int -remoteDomainGetInterfaceParameters (virDomainPtr domain, - const char *device, - virTypedParameterPtr params, int *nparams, - unsigned int flags) +remoteDomainGetInterfaceParameters(virDomainPtr domain, + const char *device, + virTypedParameterPtr params, int *nparams, + unsigned int flags) { int rv = -1; remote_domain_get_interface_parameters_args args; @@ -5569,15 +5569,15 @@ remoteDomainGetInterfaceParameters (virDomainPtr domain, remoteDriverLock(priv); - make_nonnull_domain (&args.dom, domain); + make_nonnull_domain(&args.dom, domain); args.device = (char *)device; args.nparams = *nparams; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS, - (xdrproc_t) xdr_remote_domain_get_interface_parameters_args, (char *) &args, - (xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(domain->conn, priv, 0, REMOTE_PROC_DOMAIN_GET_INTERFACE_PARAMETERS, + (xdrproc_t) xdr_remote_domain_get_interface_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters @@ -5599,8 +5599,8 @@ remoteDomainGetInterfaceParameters (virDomainPtr domain, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_domain_get_interface_parameters_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; @@ -5626,14 +5626,14 @@ remoteDomainListAllSnapshots(virDomainPtr dom, args.flags = flags; memset(&ret, 0, sizeof(ret)); - if (call (dom->conn, - priv, - 0, - REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS, - (xdrproc_t) xdr_remote_domain_list_all_snapshots_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_list_all_snapshots_ret, - (char *) &ret) == -1) + if (call(dom->conn, + priv, + 0, + REMOTE_PROC_DOMAIN_LIST_ALL_SNAPSHOTS, + (xdrproc_t) xdr_remote_domain_list_all_snapshots_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_list_all_snapshots_ret, + (char *) &ret) == -1) goto done; if (snapshots) { @@ -5689,14 +5689,14 @@ remoteDomainSnapshotListAllChildren(virDomainSnapshotPtr parent, make_nonnull_domain_snapshot(&args.snapshot, parent); memset(&ret, 0, sizeof(ret)); - if (call (parent->domain->conn, - priv, - 0, - REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN, - (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_args, - (char *) &args, - (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_ret, - (char *) &ret) == -1) + if (call(parent->domain->conn, + priv, + 0, + REMOTE_PROC_DOMAIN_SNAPSHOT_LIST_ALL_CHILDREN, + (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_args, + (char *) &args, + (xdrproc_t) xdr_remote_domain_snapshot_list_all_children_ret, + (char *) &ret) == -1) goto done; if (snapshots) { @@ -5748,10 +5748,10 @@ remoteNodeGetMemoryParameters(virConnectPtr conn, args.nparams = *nparams; args.flags = flags; - memset (&ret, 0, sizeof(ret)); - if (call (conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS, - (xdrproc_t) xdr_remote_node_get_memory_parameters_args, (char *) &args, - (xdrproc_t) xdr_remote_node_get_memory_parameters_ret, (char *) &ret) == -1) + memset(&ret, 0, sizeof(ret)); + if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_MEMORY_PARAMETERS, + (xdrproc_t) xdr_remote_node_get_memory_parameters_args, (char *) &args, + (xdrproc_t) xdr_remote_node_get_memory_parameters_ret, (char *) &ret) == -1) goto done; /* Handle the case when the caller does not know the number of parameters @@ -5773,8 +5773,8 @@ remoteNodeGetMemoryParameters(virConnectPtr conn, rv = 0; cleanup: - xdr_free ((xdrproc_t) xdr_remote_node_get_memory_parameters_ret, - (char *) &ret); + xdr_free((xdrproc_t) xdr_remote_node_get_memory_parameters_ret, + (char *) &ret); done: remoteDriverUnlock(priv); return rv; @@ -5797,7 +5797,7 @@ remoteNodeGetCPUMap(virConnectPtr conn, args.need_online = !!online; args.flags = flags; - memset (&ret, 0, sizeof(ret)); + memset(&ret, 0, sizeof(ret)); if (call(conn, priv, 0, REMOTE_PROC_NODE_GET_CPU_MAP, (xdrproc_t) xdr_remote_node_get_cpu_map_args, (char *) &args, @@ -5840,58 +5840,58 @@ remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr event) * but if they do then virterror_internal.has been set. */ static virDomainPtr -get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain) +get_nonnull_domain(virConnectPtr conn, remote_nonnull_domain domain) { virDomainPtr dom; - dom = virGetDomain (conn, domain.name, BAD_CAST domain.uuid); + dom = virGetDomain(conn, domain.name, BAD_CAST domain.uuid); if (dom) dom->id = domain.id; return dom; } static virNetworkPtr -get_nonnull_network (virConnectPtr conn, remote_nonnull_network network) +get_nonnull_network(virConnectPtr conn, remote_nonnull_network network) { - return virGetNetwork (conn, network.name, BAD_CAST network.uuid); + return virGetNetwork(conn, network.name, BAD_CAST network.uuid); } static virInterfacePtr -get_nonnull_interface (virConnectPtr conn, remote_nonnull_interface iface) +get_nonnull_interface(virConnectPtr conn, remote_nonnull_interface iface) { - return virGetInterface (conn, iface.name, iface.mac); + return virGetInterface(conn, iface.name, iface.mac); } static virStoragePoolPtr -get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool) +get_nonnull_storage_pool(virConnectPtr conn, remote_nonnull_storage_pool pool) { - return virGetStoragePool (conn, pool.name, BAD_CAST pool.uuid); + return virGetStoragePool(conn, pool.name, BAD_CAST pool.uuid); } static virStorageVolPtr -get_nonnull_storage_vol (virConnectPtr conn, remote_nonnull_storage_vol vol) +get_nonnull_storage_vol(virConnectPtr conn, remote_nonnull_storage_vol vol) { - return virGetStorageVol (conn, vol.pool, vol.name, vol.key); + return virGetStorageVol(conn, vol.pool, vol.name, vol.key); } static virNodeDevicePtr -get_nonnull_node_device (virConnectPtr conn, remote_nonnull_node_device dev) +get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev) { return virGetNodeDevice(conn, dev.name); } static virSecretPtr -get_nonnull_secret (virConnectPtr conn, remote_nonnull_secret secret) +get_nonnull_secret(virConnectPtr conn, remote_nonnull_secret secret) { return virGetSecret(conn, BAD_CAST secret.uuid, secret.usageType, secret.usageID); } static virNWFilterPtr -get_nonnull_nwfilter (virConnectPtr conn, remote_nonnull_nwfilter nwfilter) +get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nwfilter nwfilter) { - return virGetNWFilter (conn, nwfilter.name, BAD_CAST nwfilter.uuid); + return virGetNWFilter(conn, nwfilter.name, BAD_CAST nwfilter.uuid); } static virDomainSnapshotPtr -get_nonnull_domain_snapshot (virDomainPtr domain, remote_nonnull_domain_snapshot snapshot) +get_nonnull_domain_snapshot(virDomainPtr domain, remote_nonnull_domain_snapshot snapshot) { return virGetDomainSnapshot(domain, snapshot.name); } @@ -5899,22 +5899,22 @@ get_nonnull_domain_snapshot (virDomainPtr domain, remote_nonnull_domain_snapshot /* Make remote_nonnull_domain and remote_nonnull_network. */ static void -make_nonnull_domain (remote_nonnull_domain *dom_dst, virDomainPtr dom_src) +make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src) { dom_dst->id = dom_src->id; dom_dst->name = dom_src->name; - memcpy (dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN); + memcpy(dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN); } static void -make_nonnull_network (remote_nonnull_network *net_dst, virNetworkPtr net_src) +make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src) { net_dst->name = net_src->name; - memcpy (net_dst->uuid, net_src->uuid, VIR_UUID_BUFLEN); + memcpy(net_dst->uuid, net_src->uuid, VIR_UUID_BUFLEN); } static void -make_nonnull_interface (remote_nonnull_interface *interface_dst, +make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src) { interface_dst->name = interface_src->name; @@ -5922,14 +5922,14 @@ make_nonnull_interface (remote_nonnull_interface *interface_dst, } static void -make_nonnull_storage_pool (remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src) +make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src) { pool_dst->name = pool_src->name; - memcpy (pool_dst->uuid, pool_src->uuid, VIR_UUID_BUFLEN); + memcpy(pool_dst->uuid, pool_src->uuid, VIR_UUID_BUFLEN); } static void -make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src) +make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src) { vol_dst->pool = vol_src->pool; vol_dst->name = vol_src->name; @@ -5937,22 +5937,22 @@ make_nonnull_storage_vol (remote_nonnull_storage_vol *vol_dst, virStorageVolPtr } static void -make_nonnull_secret (remote_nonnull_secret *secret_dst, virSecretPtr secret_src) +make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src) { - memcpy (secret_dst->uuid, secret_src->uuid, VIR_UUID_BUFLEN); + memcpy(secret_dst->uuid, secret_src->uuid, VIR_UUID_BUFLEN); secret_dst->usageType = secret_src->usageType; secret_dst->usageID = secret_src->usageID; } static void -make_nonnull_nwfilter (remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src) +make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src) { nwfilter_dst->name = nwfilter_src->name; - memcpy (nwfilter_dst->uuid, nwfilter_src->uuid, VIR_UUID_BUFLEN); + memcpy(nwfilter_dst->uuid, nwfilter_src->uuid, VIR_UUID_BUFLEN); } static void -make_nonnull_domain_snapshot (remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src) +make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src) { snapshot_dst->name = snapshot_src->name; make_nonnull_domain(&snapshot_dst->dom, snapshot_src->domain); @@ -6301,19 +6301,19 @@ static virStateDriver state_driver = { * Returns -1 on error. */ int -remoteRegister (void) +remoteRegister(void) { remoteDriver = &remote_driver; - if (virRegisterDriver (&remote_driver) == -1) return -1; - if (virRegisterNetworkDriver (&network_driver) == -1) return -1; - if (virRegisterInterfaceDriver (&interface_driver) == -1) return -1; - if (virRegisterStorageDriver (&storage_driver) == -1) return -1; - if (virRegisterDeviceMonitor (&dev_monitor) == -1) return -1; - if (virRegisterSecretDriver (&secret_driver) == -1) return -1; + if (virRegisterDriver(&remote_driver) == -1) return -1; + if (virRegisterNetworkDriver(&network_driver) == -1) return -1; + if (virRegisterInterfaceDriver(&interface_driver) == -1) return -1; + if (virRegisterStorageDriver(&storage_driver) == -1) return -1; + if (virRegisterDeviceMonitor(&dev_monitor) == -1) return -1; + if (virRegisterSecretDriver(&secret_driver) == -1) return -1; if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1; #ifdef WITH_LIBVIRTD - if (virRegisterStateDriver (&state_driver) == -1) return -1; + if (virRegisterStateDriver(&state_driver) == -1) return -1; #endif return 0; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index 18f60c1fac..bf2547cd6e 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -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: diff --git a/src/rpc/virnetsaslcontext.c b/src/rpc/virnetsaslcontext.c index 7ed1e39275..3001871bcd 100644 --- a/src/rpc/virnetsaslcontext.c +++ b/src/rpc/virnetsaslcontext.c @@ -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 */ diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 2777e6690a..ed26719741 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -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; diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 55243b9dec..a1b64d7309 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -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; } diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 0c89a545dd..1d32327fb6 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -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; } } diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 0bdbd51023..b07c1328f4 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -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, diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 7681f1b91c..8fcaaa8283 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -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); diff --git a/src/security/security_stack.c b/src/security/security_stack.c index 91401c6c7c..1094cbe4ac 100644 --- a/src/security/security_stack.c +++ b/src/security/security_stack.c @@ -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; diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index c3a9265484..634a3fc34a 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -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; diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c index 0743776ba4..5417ced8a5 100644 --- a/src/storage/parthelper.c +++ b/src/storage/parthelper.c @@ -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); diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index 75a3667bfb..41a19a1438 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -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++) { diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 3cd4362cdb..06b5909e78 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -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; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 30e203ca37..332267759f 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -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", diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c index 4c74e8c6ba..efcfb28526 100644 --- a/src/storage/storage_backend_mpath.c +++ b/src/storage/storage_backend_mpath.c @@ -287,7 +287,7 @@ virStorageBackendGetMaps(virStoragePoolObjPtr pool) out: if (dmt != NULL) { - dm_task_destroy (dmt); + dm_task_destroy(dmt); } return retval; } diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 4fbc0c015d..faca2a2189 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -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(); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 58c4e67eac..c974e1abb4 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -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: diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c index 1d91ce8d38..036181cc5d 100644 --- a/src/uml/uml_conf.c +++ b/src/uml/uml_conf.c @@ -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) diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 2c6e820a3d..62077e191c 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -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); diff --git a/src/util/bitmap.c b/src/util/bitmap.c index 2dd3403645..5ec54400b1 100644 --- a/src/util/bitmap.c +++ b/src/util/bitmap.c @@ -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; diff --git a/src/util/command.c b/src/util/command.c index 2657a1d38e..ebdd636740 100644 --- a/src/util/command.c +++ b/src/util/command.c @@ -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; diff --git a/src/util/conf.c b/src/util/conf.c index 346b3df7c1..ba8009770b 100644 --- a/src/util/conf.c +++ b/src/util/conf.c @@ -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")); diff --git a/src/util/ebtables.c b/src/util/ebtables.c index 5496c36b23..f1b29865b6 100644 --- a/src/util/ebtables.c +++ b/src/util/ebtables.c @@ -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; diff --git a/src/util/event_poll.c b/src/util/event_poll.c index e596109263..276d66d88b 100644 --- a/src/util/event_poll.c +++ b/src/util/event_poll.c @@ -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; } diff --git a/src/util/logging.c b/src/util/logging.c index dd4384276e..2df9e2763a 100644 --- a/src/util/logging.c +++ b/src/util/logging.c @@ -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)) { diff --git a/src/util/pci.c b/src/util/pci.c index 83d86b73a8..d1ad121743 100644 --- a/src/util/pci.c +++ b/src/util/pci.c @@ -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, diff --git a/src/util/stats_linux.c b/src/util/stats_linux.c index a0daee9e97..2dfc30d846 100644 --- a/src/util/stats_linux.c +++ b/src/util/stats_linux.c @@ -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; } diff --git a/src/util/storage_file.c b/src/util/storage_file.c index a0399abd00..e9771d7df0 100644 --- a/src/util/storage_file.c +++ b/src/util/storage_file.c @@ -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 diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index 8add936ea8..bac4b234b2 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -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; diff --git a/src/util/util.c b/src/util/util.c index 117a50fa0a..75b18c1bd3 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -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 = '\\'; } diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c index 7208954be4..bd26ba98e4 100644 --- a/src/util/virnetdevmacvlan.c +++ b/src/util/virnetdevmacvlan.c @@ -945,7 +945,7 @@ create_name: if (virNetDevMacVLanVPortProfileRegisterCallback(cr_ifname, macaddress, linkdev, vmuuid, virtPortProfile, - vmOp) < 0 ) + vmOp) < 0) goto disassociate_exit; } diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c index e9ebac837c..b6cc16f02c 100644 --- a/src/util/virsocketaddr.c +++ b/src/util/virsocketaddr.c @@ -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); } diff --git a/src/util/virterror.c b/src/util/virterror.c index 9572116ca7..e49e320ff8 100644 --- a/src/util/virterror.c +++ b/src/util/virterror.c @@ -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; } } diff --git a/src/util/virtime.c b/src/util/virtime.c index bd6fdce6a8..a2610c444c 100644 --- a/src/util/virtime.c +++ b/src/util/virtime.c @@ -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; diff --git a/src/util/viruri.c b/src/util/viruri.c index 47d41a34ac..26dbf24420 100644 --- a/src/util/viruri.c +++ b/src/util/viruri.c @@ -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; } } diff --git a/src/util/xml.c b/src/util/xml.c index 30323b39e5..84db8655da 100644 --- a/src/util/xml.c +++ b/src/util/xml.c @@ -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; } diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c index c4037f8ec1..56726edab5 100644 --- a/src/vbox/vbox_driver.c +++ b/src/vbox/vbox_driver.c @@ -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; diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 6f245daeba..5ec0ba0d89 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -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 diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c index ae873160c9..8101cc78a2 100644 --- a/src/vmware/vmware_conf.c +++ b/src/vmware/vmware_conf.c @@ -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] != '/') diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c index 86202e33f1..3e7397f724 100644 --- a/src/vmware/vmware_driver.c +++ b/src/vmware/vmware_driver.c @@ -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; diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c index 5ab1ce4ace..e50b5ff3ed 100644 --- a/src/xen/block_stats.c +++ b/src/xen/block_stats.c @@ -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); diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 6f08aad27e..bfdca3d449 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -69,13 +69,13 @@ #define VIR_FROM_THIS VIR_FROM_XEN static int -xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info); +xenUnifiedNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info); static int -xenUnifiedDomainGetMaxVcpus (virDomainPtr dom); +xenUnifiedDomainGetMaxVcpus(virDomainPtr dom); static int -xenUnifiedDomainGetVcpus (virDomainPtr dom, - virVcpuInfoPtr info, int maxinfo, - unsigned char *cpumaps, int maplen); +xenUnifiedDomainGetVcpus(virDomainPtr dom, + virVcpuInfoPtr info, int maxinfo, + unsigned char *cpumaps, int maplen); /* The five Xen drivers below us. */ @@ -201,7 +201,7 @@ done: #ifdef WITH_LIBVIRTD static int -xenInitialize (int privileged ATTRIBUTE_UNUSED) +xenInitialize(int privileged ATTRIBUTE_UNUSED) { inside_daemon = 1; return 0; @@ -226,7 +226,7 @@ static virStateDriver state_driver = { */ static int -xenUnifiedProbe (void) +xenUnifiedProbe(void) { #ifdef __linux__ if (virFileExists("/proc/xen")) @@ -245,7 +245,7 @@ xenUnifiedProbe (void) #ifdef WITH_LIBXL static int -xenUnifiedXendProbe (void) +xenUnifiedXendProbe(void) { virCommandPtr cmd; int status; @@ -263,7 +263,7 @@ xenUnifiedXendProbe (void) static virDrvOpenStatus -xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) +xenUnifiedOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { int i, ret = VIR_DRV_OPEN_DECLINED; xenUnifiedPrivatePtr priv; @@ -425,7 +425,7 @@ clean: xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) (conn)->privateData static int -xenUnifiedClose (virConnectPtr conn) +xenUnifiedClose(virConnectPtr conn) { GET_PRIVATE(conn); int i; @@ -455,7 +455,7 @@ unsigned long xenUnifiedVersion(void) static const char * -xenUnifiedType (virConnectPtr conn) +xenUnifiedType(virConnectPtr conn) { GET_PRIVATE(conn); int i; @@ -469,7 +469,7 @@ xenUnifiedType (virConnectPtr conn) /* Which features are supported by this driver? */ static int -xenUnifiedSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature) +xenUnifiedSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, int feature) { switch (feature) { case VIR_DRV_FEATURE_MIGRATION_V1: @@ -481,7 +481,7 @@ xenUnifiedSupportsFeature (virConnectPtr conn ATTRIBUTE_UNUSED, int feature) } static int -xenUnifiedGetVersion (virConnectPtr conn, unsigned long *hvVer) +xenUnifiedGetVersion(virConnectPtr conn, unsigned long *hvVer) { GET_PRIVATE(conn); int i; @@ -489,7 +489,7 @@ xenUnifiedGetVersion (virConnectPtr conn, unsigned long *hvVer) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenVersion && - drivers[i]->xenVersion (conn, hvVer) == 0) + drivers[i]->xenVersion(conn, hvVer) == 0) return 0; return -1; @@ -523,17 +523,17 @@ xenUnifiedIsAlive(virConnectPtr conn ATTRIBUTE_UNUSED) } int -xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type) +xenUnifiedGetMaxVcpus(virConnectPtr conn, const char *type) { GET_PRIVATE(conn); - if (type && STRCASENEQ (type, "Xen")) { + if (type && STRCASENEQ(type, "Xen")) { virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__); return -1; } if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) - return xenHypervisorGetMaxVcpus (conn, type); + return xenHypervisorGetMaxVcpus(conn, type); else { virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; @@ -541,7 +541,7 @@ xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type) } static int -xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info) +xenUnifiedNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) { GET_PRIVATE(conn); @@ -551,7 +551,7 @@ xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info) } static char * -xenUnifiedGetCapabilities (virConnectPtr conn) +xenUnifiedGetCapabilities(virConnectPtr conn) { xenUnifiedPrivatePtr priv = conn->privateData; char *xml; @@ -565,26 +565,26 @@ xenUnifiedGetCapabilities (virConnectPtr conn) } static int -xenUnifiedListDomains (virConnectPtr conn, int *ids, int maxids) +xenUnifiedListDomains(virConnectPtr conn, int *ids, int maxids) { GET_PRIVATE(conn); int ret; /* Try xenstore. */ if (priv->opened[XEN_UNIFIED_XS_OFFSET]) { - ret = xenStoreListDomains (conn, ids, maxids); + ret = xenStoreListDomains(conn, ids, maxids); if (ret >= 0) return ret; } /* Try HV. */ if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) { - ret = xenHypervisorListDomains (conn, ids, maxids); + ret = xenHypervisorListDomains(conn, ids, maxids); if (ret >= 0) return ret; } /* Try xend. */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - ret = xenDaemonListDomains (conn, ids, maxids); + ret = xenDaemonListDomains(conn, ids, maxids); if (ret >= 0) return ret; } @@ -592,26 +592,26 @@ xenUnifiedListDomains (virConnectPtr conn, int *ids, int maxids) } static int -xenUnifiedNumOfDomains (virConnectPtr conn) +xenUnifiedNumOfDomains(virConnectPtr conn) { GET_PRIVATE(conn); int ret; /* Try xenstore. */ if (priv->opened[XEN_UNIFIED_XS_OFFSET]) { - ret = xenStoreNumOfDomains (conn); + ret = xenStoreNumOfDomains(conn); if (ret >= 0) return ret; } /* Try HV. */ if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) { - ret = xenHypervisorNumOfDomains (conn); + ret = xenHypervisorNumOfDomains(conn); if (ret >= 0) return ret; } /* Try xend. */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - ret = xenDaemonNumOfDomains (conn); + ret = xenDaemonNumOfDomains(conn); if (ret >= 0) return ret; } @@ -619,8 +619,8 @@ xenUnifiedNumOfDomains (virConnectPtr conn) } static virDomainPtr -xenUnifiedDomainCreateXML (virConnectPtr conn, - const char *xmlDesc, unsigned int flags) +xenUnifiedDomainCreateXML(virConnectPtr conn, + const char *xmlDesc, unsigned int flags) { GET_PRIVATE(conn); @@ -634,7 +634,7 @@ xenUnifiedDomainCreateXML (virConnectPtr conn, * the Lookup* functions return a NULL but do not set virterror. */ static virDomainPtr -xenUnifiedDomainLookupByID (virConnectPtr conn, int id) +xenUnifiedDomainLookupByID(virConnectPtr conn, int id) { GET_PRIVATE(conn); virDomainPtr ret; @@ -642,18 +642,18 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id) /* Reset any connection-level errors in virterror first, in case * there is one hanging around from a previous call. */ - virConnResetLastError (conn); + virConnResetLastError(conn); /* Try hypervisor/xenstore combo. */ if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) { - ret = xenHypervisorLookupDomainByID (conn, id); + ret = xenHypervisorLookupDomainByID(conn, id); if (ret || conn->err.code != VIR_ERR_OK) return ret; } /* Try xend. */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - ret = xenDaemonLookupByID (conn, id); + ret = xenDaemonLookupByID(conn, id); if (ret || conn->err.code != VIR_ERR_OK) return ret; } @@ -664,8 +664,8 @@ xenUnifiedDomainLookupByID (virConnectPtr conn, int id) } static virDomainPtr -xenUnifiedDomainLookupByUUID (virConnectPtr conn, - const unsigned char *uuid) +xenUnifiedDomainLookupByUUID(virConnectPtr conn, + const unsigned char *uuid) { GET_PRIVATE(conn); virDomainPtr ret; @@ -673,25 +673,25 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn, /* Reset any connection-level errors in virterror first, in case * there is one hanging around from a previous call. */ - virConnResetLastError (conn); + virConnResetLastError(conn); /* Try hypervisor/xenstore combo. */ if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) { - ret = xenHypervisorLookupDomainByUUID (conn, uuid); + ret = xenHypervisorLookupDomainByUUID(conn, uuid); if (ret || conn->err.code != VIR_ERR_OK) return ret; } /* Try xend. */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - ret = xenDaemonLookupByUUID (conn, uuid); + ret = xenDaemonLookupByUUID(conn, uuid); if (ret || conn->err.code != VIR_ERR_OK) return ret; } /* Try XM for inactive domains. */ if (priv->opened[XEN_UNIFIED_XM_OFFSET]) { - ret = xenXMDomainLookupByUUID (conn, uuid); + ret = xenXMDomainLookupByUUID(conn, uuid); if (ret || conn->err.code != VIR_ERR_OK) return ret; } @@ -702,8 +702,8 @@ xenUnifiedDomainLookupByUUID (virConnectPtr conn, } static virDomainPtr -xenUnifiedDomainLookupByName (virConnectPtr conn, - const char *name) +xenUnifiedDomainLookupByName(virConnectPtr conn, + const char *name) { GET_PRIVATE(conn); virDomainPtr ret; @@ -711,25 +711,25 @@ xenUnifiedDomainLookupByName (virConnectPtr conn, /* Reset any connection-level errors in virterror first, in case * there is one hanging around from a previous call. */ - virConnResetLastError (conn); + virConnResetLastError(conn); /* Try xend. */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - ret = xenDaemonLookupByName (conn, name); + ret = xenDaemonLookupByName(conn, name); if (ret || conn->err.code != VIR_ERR_OK) return ret; } /* Try xenstore for inactive domains. */ if (priv->opened[XEN_UNIFIED_XS_OFFSET]) { - ret = xenStoreLookupByName (conn, name); + ret = xenStoreLookupByName(conn, name); if (ret || conn->err.code != VIR_ERR_OK) return ret; } /* Try XM for inactive domains. */ if (priv->opened[XEN_UNIFIED_XM_OFFSET]) { - ret = xenXMDomainLookupByName (conn, name); + ret = xenXMDomainLookupByName(conn, name); if (ret || conn->err.code != VIR_ERR_OK) return ret; } @@ -815,7 +815,7 @@ xenUnifiedDomainIsUpdated(virDomainPtr dom ATTRIBUTE_UNUSED) } static int -xenUnifiedDomainSuspend (virDomainPtr dom) +xenUnifiedDomainSuspend(virDomainPtr dom) { GET_PRIVATE(dom->conn); int i; @@ -827,7 +827,7 @@ xenUnifiedDomainSuspend (virDomainPtr dom) if (i != XEN_UNIFIED_HYPERVISOR_OFFSET && priv->opened[i] && drivers[i]->xenDomainSuspend && - drivers[i]->xenDomainSuspend (dom) == 0) + drivers[i]->xenDomainSuspend(dom) == 0) return 0; if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] && @@ -838,7 +838,7 @@ xenUnifiedDomainSuspend (virDomainPtr dom) } static int -xenUnifiedDomainResume (virDomainPtr dom) +xenUnifiedDomainResume(virDomainPtr dom) { GET_PRIVATE(dom->conn); int i; @@ -850,7 +850,7 @@ xenUnifiedDomainResume (virDomainPtr dom) if (i != XEN_UNIFIED_HYPERVISOR_OFFSET && priv->opened[i] && drivers[i]->xenDomainResume && - drivers[i]->xenDomainResume (dom) == 0) + drivers[i]->xenDomainResume(dom) == 0) return 0; if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET] && @@ -885,7 +885,7 @@ xenUnifiedDomainShutdown(virDomainPtr dom) } static int -xenUnifiedDomainReboot (virDomainPtr dom, unsigned int flags) +xenUnifiedDomainReboot(virDomainPtr dom, unsigned int flags) { GET_PRIVATE(dom->conn); int i; @@ -893,7 +893,7 @@ xenUnifiedDomainReboot (virDomainPtr dom, unsigned int flags) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainReboot && - drivers[i]->xenDomainReboot (dom, flags) == 0) + drivers[i]->xenDomainReboot(dom, flags) == 0) return 0; return -1; @@ -932,7 +932,7 @@ xenUnifiedDomainDestroy(virDomainPtr dom) } static char * -xenUnifiedDomainGetOSType (virDomainPtr dom) +xenUnifiedDomainGetOSType(virDomainPtr dom) { GET_PRIVATE(dom->conn); int i; @@ -940,7 +940,7 @@ xenUnifiedDomainGetOSType (virDomainPtr dom) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainGetOSType) { - ret = drivers[i]->xenDomainGetOSType (dom); + ret = drivers[i]->xenDomainGetOSType(dom); if (ret) return ret; } @@ -948,7 +948,7 @@ xenUnifiedDomainGetOSType (virDomainPtr dom) } static unsigned long long -xenUnifiedDomainGetMaxMemory (virDomainPtr dom) +xenUnifiedDomainGetMaxMemory(virDomainPtr dom) { GET_PRIVATE(dom->conn); int i; @@ -956,7 +956,7 @@ xenUnifiedDomainGetMaxMemory (virDomainPtr dom) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainGetMaxMemory) { - ret = drivers[i]->xenDomainGetMaxMemory (dom); + ret = drivers[i]->xenDomainGetMaxMemory(dom); if (ret != 0) return ret; } @@ -964,14 +964,14 @@ xenUnifiedDomainGetMaxMemory (virDomainPtr dom) } static int -xenUnifiedDomainSetMaxMemory (virDomainPtr dom, unsigned long memory) +xenUnifiedDomainSetMaxMemory(virDomainPtr dom, unsigned long memory) { GET_PRIVATE(dom->conn); int i; /* Prefer xend for setting max memory */ if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - if (xenDaemonDomainSetMaxMemory (dom, memory) == 0) + if (xenDaemonDomainSetMaxMemory(dom, memory) == 0) return 0; } @@ -979,14 +979,14 @@ xenUnifiedDomainSetMaxMemory (virDomainPtr dom, unsigned long memory) if (i != XEN_UNIFIED_XEND_OFFSET && priv->opened[i] && drivers[i]->xenDomainSetMaxMemory && - drivers[i]->xenDomainSetMaxMemory (dom, memory) == 0) + drivers[i]->xenDomainSetMaxMemory(dom, memory) == 0) return 0; return -1; } static int -xenUnifiedDomainSetMemory (virDomainPtr dom, unsigned long memory) +xenUnifiedDomainSetMemory(virDomainPtr dom, unsigned long memory) { GET_PRIVATE(dom->conn); int i; @@ -994,14 +994,14 @@ xenUnifiedDomainSetMemory (virDomainPtr dom, unsigned long memory) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainSetMemory && - drivers[i]->xenDomainSetMemory (dom, memory) == 0) + drivers[i]->xenDomainSetMemory(dom, memory) == 0) return 0; return -1; } static int -xenUnifiedDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info) +xenUnifiedDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) { GET_PRIVATE(dom->conn); int i; @@ -1009,7 +1009,7 @@ xenUnifiedDomainGetInfo (virDomainPtr dom, virDomainInfoPtr info) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainGetInfo && - drivers[i]->xenDomainGetInfo (dom, info) == 0) + drivers[i]->xenDomainGetInfo(dom, info) == 0) return 0; return -1; @@ -1099,13 +1099,13 @@ xenUnifiedDomainRestoreFlags(virConnectPtr conn, const char *from, } static int -xenUnifiedDomainRestore (virConnectPtr conn, const char *from) +xenUnifiedDomainRestore(virConnectPtr conn, const char *from) { return xenUnifiedDomainRestoreFlags(conn, from, NULL, 0); } static int -xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, unsigned int flags) +xenUnifiedDomainCoreDump(virDomainPtr dom, const char *to, unsigned int flags) { GET_PRIVATE(dom->conn); @@ -1115,8 +1115,8 @@ xenUnifiedDomainCoreDump (virDomainPtr dom, const char *to, unsigned int flags) } static int -xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus, - unsigned int flags) +xenUnifiedDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, + unsigned int flags) { GET_PRIVATE(dom->conn); int ret; @@ -1161,7 +1161,7 @@ xenUnifiedDomainSetVcpusFlags (virDomainPtr dom, unsigned int nvcpus, } static int -xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus) +xenUnifiedDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) { unsigned int flags = VIR_DOMAIN_VCPU_LIVE; xenUnifiedPrivatePtr priv; @@ -1178,8 +1178,8 @@ xenUnifiedDomainSetVcpus (virDomainPtr dom, unsigned int nvcpus) } static int -xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu, - unsigned char *cpumap, int maplen) +xenUnifiedDomainPinVcpu(virDomainPtr dom, unsigned int vcpu, + unsigned char *cpumap, int maplen) { GET_PRIVATE(dom->conn); int i; @@ -1187,23 +1187,23 @@ xenUnifiedDomainPinVcpu (virDomainPtr dom, unsigned int vcpu, for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainPinVcpu && - drivers[i]->xenDomainPinVcpu (dom, vcpu, cpumap, maplen) == 0) + drivers[i]->xenDomainPinVcpu(dom, vcpu, cpumap, maplen) == 0) return 0; return -1; } static int -xenUnifiedDomainGetVcpus (virDomainPtr dom, - virVcpuInfoPtr info, int maxinfo, - unsigned char *cpumaps, int maplen) +xenUnifiedDomainGetVcpus(virDomainPtr dom, + virVcpuInfoPtr info, int maxinfo, + unsigned char *cpumaps, int maplen) { GET_PRIVATE(dom->conn); int i, ret; for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainGetVcpus) { - ret = drivers[i]->xenDomainGetVcpus (dom, info, maxinfo, cpumaps, maplen); + ret = drivers[i]->xenDomainGetVcpus(dom, info, maxinfo, cpumaps, maplen); if (ret > 0) return ret; } @@ -1211,7 +1211,7 @@ xenUnifiedDomainGetVcpus (virDomainPtr dom, } static int -xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags) +xenUnifiedDomainGetVcpusFlags(virDomainPtr dom, unsigned int flags) { GET_PRIVATE(dom->conn); int ret; @@ -1238,7 +1238,7 @@ xenUnifiedDomainGetVcpusFlags (virDomainPtr dom, unsigned int flags) } static int -xenUnifiedDomainGetMaxVcpus (virDomainPtr dom) +xenUnifiedDomainGetMaxVcpus(virDomainPtr dom) { return xenUnifiedDomainGetVcpusFlags(dom, (VIR_DOMAIN_VCPU_LIVE | VIR_DOMAIN_VCPU_MAXIMUM)); @@ -1373,56 +1373,56 @@ cleanup: static int -xenUnifiedDomainMigratePrepare (virConnectPtr dconn, - char **cookie, - int *cookielen, - const char *uri_in, - char **uri_out, - unsigned long flags, - const char *dname, - unsigned long resource) +xenUnifiedDomainMigratePrepare(virConnectPtr dconn, + char **cookie, + int *cookielen, + const char *uri_in, + char **uri_out, + unsigned long flags, + const char *dname, + unsigned long resource) { GET_PRIVATE(dconn); virCheckFlags(XEN_MIGRATION_FLAGS, -1); if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) - return xenDaemonDomainMigratePrepare (dconn, cookie, cookielen, - uri_in, uri_out, - flags, dname, resource); + return xenDaemonDomainMigratePrepare(dconn, cookie, cookielen, + uri_in, uri_out, + flags, dname, resource); virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } static int -xenUnifiedDomainMigratePerform (virDomainPtr dom, - const char *cookie, - int cookielen, - const char *uri, - unsigned long flags, - const char *dname, - unsigned long resource) +xenUnifiedDomainMigratePerform(virDomainPtr dom, + const char *cookie, + int cookielen, + const char *uri, + unsigned long flags, + const char *dname, + unsigned long resource) { GET_PRIVATE(dom->conn); virCheckFlags(XEN_MIGRATION_FLAGS, -1); if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) - return xenDaemonDomainMigratePerform (dom, cookie, cookielen, uri, - flags, dname, resource); + return xenDaemonDomainMigratePerform(dom, cookie, cookielen, uri, + flags, dname, resource); virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } static virDomainPtr -xenUnifiedDomainMigrateFinish (virConnectPtr dconn, - const char *dname, - const char *cookie ATTRIBUTE_UNUSED, - int cookielen ATTRIBUTE_UNUSED, - const char *uri ATTRIBUTE_UNUSED, - unsigned long flags) +xenUnifiedDomainMigrateFinish(virConnectPtr dconn, + const char *dname, + const char *cookie ATTRIBUTE_UNUSED, + int cookielen ATTRIBUTE_UNUSED, + const char *uri ATTRIBUTE_UNUSED, + unsigned long flags) { virDomainPtr dom = NULL; char *domain_xml = NULL; @@ -1430,7 +1430,7 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn, virCheckFlags(XEN_MIGRATION_FLAGS, NULL); - dom = xenUnifiedDomainLookupByName (dconn, dname); + dom = xenUnifiedDomainLookupByName(dconn, dname); if (! dom) { return NULL; } @@ -1443,7 +1443,7 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn, goto failure; } - dom_new = xenDaemonDomainDefineXML (dconn, domain_xml); + dom_new = xenDaemonDomainDefineXML(dconn, domain_xml); if (! dom_new) { virReportError(VIR_ERR_MIGRATE_PERSIST_FAILED, "%s", _("failed to define domain on destination host")); @@ -1451,25 +1451,25 @@ xenUnifiedDomainMigrateFinish (virConnectPtr dconn, } /* Free additional reference added by Define */ - virDomainFree (dom_new); + virDomainFree(dom_new); } - VIR_FREE (domain_xml); + VIR_FREE(domain_xml); return dom; failure: - virDomainFree (dom); + virDomainFree(dom); - VIR_FREE (domain_xml); + VIR_FREE(domain_xml); return NULL; } static int -xenUnifiedListDefinedDomains (virConnectPtr conn, char **const names, - int maxnames) +xenUnifiedListDefinedDomains(virConnectPtr conn, char **const names, + int maxnames) { GET_PRIVATE(conn); int i; @@ -1477,7 +1477,7 @@ xenUnifiedListDefinedDomains (virConnectPtr conn, char **const names, for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenListDefinedDomains) { - ret = drivers[i]->xenListDefinedDomains (conn, names, maxnames); + ret = drivers[i]->xenListDefinedDomains(conn, names, maxnames); if (ret >= 0) return ret; } @@ -1485,7 +1485,7 @@ xenUnifiedListDefinedDomains (virConnectPtr conn, char **const names, } static int -xenUnifiedNumOfDefinedDomains (virConnectPtr conn) +xenUnifiedNumOfDefinedDomains(virConnectPtr conn) { GET_PRIVATE(conn); int i; @@ -1493,7 +1493,7 @@ xenUnifiedNumOfDefinedDomains (virConnectPtr conn) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenNumOfDefinedDomains) { - ret = drivers[i]->xenNumOfDefinedDomains (conn); + ret = drivers[i]->xenNumOfDefinedDomains(conn); if (ret >= 0) return ret; } @@ -1501,7 +1501,7 @@ xenUnifiedNumOfDefinedDomains (virConnectPtr conn) } static int -xenUnifiedDomainCreateWithFlags (virDomainPtr dom, unsigned int flags) +xenUnifiedDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { GET_PRIVATE(dom->conn); int i; @@ -1510,20 +1510,20 @@ xenUnifiedDomainCreateWithFlags (virDomainPtr dom, unsigned int flags) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainCreate && - drivers[i]->xenDomainCreate (dom) == 0) + drivers[i]->xenDomainCreate(dom) == 0) return 0; return -1; } static int -xenUnifiedDomainCreate (virDomainPtr dom) +xenUnifiedDomainCreate(virDomainPtr dom) { return xenUnifiedDomainCreateWithFlags(dom, 0); } static virDomainPtr -xenUnifiedDomainDefineXML (virConnectPtr conn, const char *xml) +xenUnifiedDomainDefineXML(virConnectPtr conn, const char *xml) { GET_PRIVATE(conn); int i; @@ -1531,7 +1531,7 @@ xenUnifiedDomainDefineXML (virConnectPtr conn, const char *xml) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainDefineXML) { - ret = drivers[i]->xenDomainDefineXML (conn, xml); + ret = drivers[i]->xenDomainDefineXML(conn, xml); if (ret) return ret; } @@ -1539,7 +1539,7 @@ xenUnifiedDomainDefineXML (virConnectPtr conn, const char *xml) } static int -xenUnifiedDomainUndefineFlags (virDomainPtr dom, unsigned int flags) +xenUnifiedDomainUndefineFlags(virDomainPtr dom, unsigned int flags) { GET_PRIVATE(dom->conn); int i; @@ -1547,19 +1547,19 @@ xenUnifiedDomainUndefineFlags (virDomainPtr dom, unsigned int flags) virCheckFlags(0, -1); for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) if (priv->opened[i] && drivers[i]->xenDomainUndefine && - drivers[i]->xenDomainUndefine (dom) == 0) + drivers[i]->xenDomainUndefine(dom) == 0) return 0; return -1; } static int -xenUnifiedDomainUndefine (virDomainPtr dom) { +xenUnifiedDomainUndefine(virDomainPtr dom) { return xenUnifiedDomainUndefineFlags(dom, 0); } static int -xenUnifiedDomainAttachDevice (virDomainPtr dom, const char *xml) +xenUnifiedDomainAttachDevice(virDomainPtr dom, const char *xml) { GET_PRIVATE(dom->conn); int i; @@ -1583,8 +1583,8 @@ xenUnifiedDomainAttachDevice (virDomainPtr dom, const char *xml) } static int -xenUnifiedDomainAttachDeviceFlags (virDomainPtr dom, const char *xml, - unsigned int flags) +xenUnifiedDomainAttachDeviceFlags(virDomainPtr dom, const char *xml, + unsigned int flags) { GET_PRIVATE(dom->conn); int i; @@ -1598,7 +1598,7 @@ xenUnifiedDomainAttachDeviceFlags (virDomainPtr dom, const char *xml, } static int -xenUnifiedDomainDetachDevice (virDomainPtr dom, const char *xml) +xenUnifiedDomainDetachDevice(virDomainPtr dom, const char *xml) { GET_PRIVATE(dom->conn); int i; @@ -1622,8 +1622,8 @@ xenUnifiedDomainDetachDevice (virDomainPtr dom, const char *xml) } static int -xenUnifiedDomainDetachDeviceFlags (virDomainPtr dom, const char *xml, - unsigned int flags) +xenUnifiedDomainDetachDeviceFlags(virDomainPtr dom, const char *xml, + unsigned int flags) { GET_PRIVATE(dom->conn); int i; @@ -1637,8 +1637,8 @@ xenUnifiedDomainDetachDeviceFlags (virDomainPtr dom, const char *xml, } static int -xenUnifiedDomainUpdateDeviceFlags (virDomainPtr dom, const char *xml, - unsigned int flags) +xenUnifiedDomainUpdateDeviceFlags(virDomainPtr dom, const char *xml, + unsigned int flags) { GET_PRIVATE(dom->conn); @@ -1648,7 +1648,7 @@ xenUnifiedDomainUpdateDeviceFlags (virDomainPtr dom, const char *xml, } static int -xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart) +xenUnifiedDomainGetAutostart(virDomainPtr dom, int *autostart) { GET_PRIVATE(dom->conn); @@ -1665,7 +1665,7 @@ xenUnifiedDomainGetAutostart (virDomainPtr dom, int *autostart) } static int -xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart) +xenUnifiedDomainSetAutostart(virDomainPtr dom, int autostart) { GET_PRIVATE(dom->conn); @@ -1682,7 +1682,7 @@ xenUnifiedDomainSetAutostart (virDomainPtr dom, int autostart) } static char * -xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams) +xenUnifiedDomainGetSchedulerType(virDomainPtr dom, int *nparams) { GET_PRIVATE(dom->conn); int i; @@ -1690,7 +1690,7 @@ xenUnifiedDomainGetSchedulerType (virDomainPtr dom, int *nparams) for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; i++) { if (priv->opened[i] && drivers[i]->xenDomainGetSchedulerType) { - schedulertype = drivers[i]->xenDomainGetSchedulerType (dom, nparams); + schedulertype = drivers[i]->xenDomainGetSchedulerType(dom, nparams); if (schedulertype != NULL) return schedulertype; } @@ -1761,49 +1761,49 @@ xenUnifiedDomainSetSchedulerParameters(virDomainPtr dom, } static int -xenUnifiedDomainBlockStats (virDomainPtr dom, const char *path, - struct _virDomainBlockStats *stats) +xenUnifiedDomainBlockStats(virDomainPtr dom, const char *path, + struct _virDomainBlockStats *stats) { - GET_PRIVATE (dom->conn); + GET_PRIVATE(dom->conn); if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) - return xenHypervisorDomainBlockStats (dom, path, stats); + return xenHypervisorDomainBlockStats(dom, path, stats); virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } static int -xenUnifiedDomainInterfaceStats (virDomainPtr dom, const char *path, - struct _virDomainInterfaceStats *stats) +xenUnifiedDomainInterfaceStats(virDomainPtr dom, const char *path, + struct _virDomainInterfaceStats *stats) { - GET_PRIVATE (dom->conn); + GET_PRIVATE(dom->conn); if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) - return xenHypervisorDomainInterfaceStats (dom, path, stats); + return xenHypervisorDomainInterfaceStats(dom, path, stats); virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } static int -xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path, - unsigned long long offset, size_t size, - void *buffer, unsigned int flags) +xenUnifiedDomainBlockPeek(virDomainPtr dom, const char *path, + unsigned long long offset, size_t size, + void *buffer, unsigned int flags) { int r; - GET_PRIVATE (dom->conn); + GET_PRIVATE(dom->conn); virCheckFlags(0, -1); if (priv->opened[XEN_UNIFIED_XEND_OFFSET]) { - r = xenDaemonDomainBlockPeek (dom, path, offset, size, buffer); + r = xenDaemonDomainBlockPeek(dom, path, offset, size, buffer); if (r != -2) return r; /* r == -2 means declined, so fall through to XM driver ... */ } if (priv->opened[XEN_UNIFIED_XM_OFFSET]) { - if (xenXMDomainBlockPeek (dom, path, offset, size, buffer) == 0) + if (xenXMDomainBlockPeek(dom, path, offset, size, buffer) == 0) return 0; } @@ -1812,29 +1812,29 @@ xenUnifiedDomainBlockPeek (virDomainPtr dom, const char *path, } static int -xenUnifiedNodeGetCellsFreeMemory (virConnectPtr conn, unsigned long long *freeMems, - int startCell, int maxCells) +xenUnifiedNodeGetCellsFreeMemory(virConnectPtr conn, unsigned long long *freeMems, + int startCell, int maxCells) { - GET_PRIVATE (conn); + GET_PRIVATE(conn); if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) - return xenHypervisorNodeGetCellsFreeMemory (conn, freeMems, - startCell, maxCells); + return xenHypervisorNodeGetCellsFreeMemory(conn, freeMems, + startCell, maxCells); virReportError(VIR_ERR_NO_SUPPORT, __FUNCTION__); return -1; } static unsigned long long -xenUnifiedNodeGetFreeMemory (virConnectPtr conn) +xenUnifiedNodeGetFreeMemory(virConnectPtr conn) { unsigned long long freeMem = 0; int ret; - GET_PRIVATE (conn); + GET_PRIVATE(conn); if (priv->opened[XEN_UNIFIED_HYPERVISOR_OFFSET]) { - ret = xenHypervisorNodeGetCellsFreeMemory (conn, &freeMem, - -1, 1); + ret = xenHypervisorNodeGetCellsFreeMemory(conn, &freeMem, + -1, 1); if (ret != 1) return 0; return freeMem; @@ -1851,7 +1851,7 @@ xenUnifiedDomainEventRegister(virConnectPtr conn, void *opaque, virFreeCallback freefunc) { - GET_PRIVATE (conn); + GET_PRIVATE(conn); int ret; xenUnifiedLock(priv); @@ -1875,7 +1875,7 @@ xenUnifiedDomainEventDeregister(virConnectPtr conn, virConnectDomainEventCallback callback) { int ret; - GET_PRIVATE (conn); + GET_PRIVATE(conn); xenUnifiedLock(priv); if (priv->xsWatch == -1) { @@ -1901,7 +1901,7 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn, void *opaque, virFreeCallback freefunc) { - GET_PRIVATE (conn); + GET_PRIVATE(conn); int ret; xenUnifiedLock(priv); @@ -1926,7 +1926,7 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn, int callbackID) { int ret; - GET_PRIVATE (conn); + GET_PRIVATE(conn); xenUnifiedLock(priv); if (priv->xsWatch == -1) { @@ -1945,11 +1945,11 @@ xenUnifiedDomainEventDeregisterAny(virConnectPtr conn, static int -xenUnifiedNodeDeviceGetPciInfo (virNodeDevicePtr dev, - unsigned *domain, - unsigned *bus, - unsigned *slot, - unsigned *function) +xenUnifiedNodeDeviceGetPciInfo(virNodeDevicePtr dev, + unsigned *domain, + unsigned *bus, + unsigned *slot, + unsigned *function) { virNodeDeviceDefPtr def = NULL; virNodeDevCapsDefPtr cap; @@ -1991,7 +1991,7 @@ out: } static int -xenUnifiedNodeDeviceDettach (virNodeDevicePtr dev) +xenUnifiedNodeDeviceDettach(virNodeDevicePtr dev) { pciDevice *pci; unsigned domain, bus, slot, function; @@ -2014,7 +2014,7 @@ out: } static int -xenUnifiedNodeDeviceAssignedDomainId (virNodeDevicePtr dev) +xenUnifiedNodeDeviceAssignedDomainId(virNodeDevicePtr dev) { int numdomains; int ret = -1, i; @@ -2052,7 +2052,7 @@ xenUnifiedNodeDeviceAssignedDomainId (virNodeDevicePtr dev) xenUnifiedLock(priv); /* Check if bdf is assigned to one of active domains */ - for (i = 0; i < numdomains; i++ ) { + for (i = 0; i < numdomains; i++) { xref = xenStoreDomainGetPCIID(conn, ids[i], bdf); if (xref == NULL) { continue; @@ -2072,7 +2072,7 @@ out: } static int -xenUnifiedNodeDeviceReAttach (virNodeDevicePtr dev) +xenUnifiedNodeDeviceReAttach(virNodeDevicePtr dev) { pciDevice *pci; unsigned domain, bus, slot, function; @@ -2104,7 +2104,7 @@ out: } static int -xenUnifiedNodeDeviceReset (virNodeDevicePtr dev) +xenUnifiedNodeDeviceReset(virNodeDevicePtr dev) { pciDevice *pci; unsigned domain, bus, slot, function; @@ -2284,13 +2284,13 @@ static virDriver xenUnifiedDriver = { * Returns the driver priority or -1 in case of error. */ int -xenRegister (void) +xenRegister(void) { #ifdef WITH_LIBVIRTD - if (virRegisterStateDriver (&state_driver) == -1) return -1; + if (virRegisterStateDriver(&state_driver) == -1) return -1; #endif - return virRegisterDriver (&xenUnifiedDriver); + return virRegisterDriver(&xenUnifiedDriver); } /** @@ -2377,7 +2377,7 @@ xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr list, { int i; for (i = 0 ; i < list->count ; i++) { - if( list->doms[i]->id == id && + if (list->doms[i]->id == id && STREQ(list->doms[i]->name, name) && !memcmp(list->doms[i]->uuid, uuid, VIR_UUID_BUFLEN)) { @@ -2413,7 +2413,7 @@ xenUnifiedRemoveDomainInfo(xenUnifiedDomainInfoListPtr list, * The caller must hold the lock in 'priv' before invoking * */ -void xenUnifiedDomainEventDispatch (xenUnifiedPrivatePtr priv, +void xenUnifiedDomainEventDispatch(xenUnifiedPrivatePtr priv, virDomainEventPtr event) { if (!priv) diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c index 406079bc8c..d1f7b41cf7 100644 --- a/src/xen/xen_hypervisor.c +++ b/src/xen/xen_hypervisor.c @@ -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 diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c index 10b7834812..2e40015bd4 100644 --- a/src/xen/xen_inotify.c +++ b/src/xen/xen_inotify.c @@ -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; } diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index 95152f8759..922c571e23 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -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); diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index 7b3d340f13..9da2974c71 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -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")); diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index a91d409491..8a0af62426 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -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; } diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c index d60ad23a3b..a170befd97 100644 --- a/src/xenapi/xenapi_driver.c +++ b/src/xenapi/xenapi_driver.c @@ -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); } /* diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c index fd881f3359..8c906f44f9 100644 --- a/src/xenapi/xenapi_utils.c +++ b/src/xenapi/xenapi_utils.c @@ -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; diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c index 35ad496c75..3e8396b178 100644 --- a/src/xenxs/xen_sxpr.c +++ b/src/xenxs/xen_sxpr.c @@ -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 */ diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c index 2e560a65ae..23b303748c 100644 --- a/src/xenxs/xen_xm.c +++ b/src/xenxs/xen_xm.c @@ -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; diff --git a/tests/commandtest.c b/tests/commandtest.c index cba6cb6ecf..19bf9bab43 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -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; } diff --git a/tests/conftest.c b/tests/conftest.c index 6514f4df52..4342a5253d 100644 --- a/tests/conftest.c +++ b/tests/conftest.c @@ -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; } diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c index 70de8c3173..48b1005cc7 100644 --- a/tests/qemuargv2xmltest.c +++ b/tests/qemuargv2xmltest.c @@ -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) \ diff --git a/tests/seclabeltest.c b/tests/seclabeltest.c index 81ef323934..7033293eee 100644 --- a/tests/seclabeltest.c +++ b/tests/seclabeltest.c @@ -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); } diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c index ee85988195..0902496de5 100644 --- a/tests/storagevolxml2xmltest.c +++ b/tests/storagevolxml2xmltest.c @@ -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"); diff --git a/tests/testutils.c b/tests/testutils.c index 2a9102be41..0177423861 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -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) { diff --git a/tests/testutilsxen.c b/tests/testutilsxen.c index 7d5a872a8e..b5f20cb1a4 100644 --- a/tests/testutilsxen.c +++ b/tests/testutilsxen.c @@ -27,7 +27,7 @@ virCapsPtr testXenCapsInit(void) { "xenpv" }; - uname (&utsname); + uname(&utsname); if ((caps = virCapabilitiesNew(utsname.machine, 0, 0)) == NULL) return NULL; diff --git a/tests/viratomictest.c b/tests/viratomictest.c index d813dbc90e..88f387b292 100644 --- a/tests/viratomictest.c +++ b/tests/viratomictest.c @@ -36,7 +36,7 @@ testTypes(const void *data ATTRIBUTE_UNUSED) bool res; #define virAssertCmpInt(a, op, b) \ - if (!((a) op (b))) \ + if (!(a op b)) \ return -1; virAtomicIntSet(&u, 5); u2 = virAtomicIntGet(&u); diff --git a/tests/virhashtest.c b/tests/virhashtest.c index be82281c74..721e877911 100644 --- a/tests/virhashtest.c +++ b/tests/virhashtest.c @@ -501,14 +501,14 @@ static int testHashGetItemsCompKey(const virHashKeyValuePairPtr a, const virHashKeyValuePairPtr b) { - return strcmp (a->key, b->key); + return strcmp(a->key, b->key); } static int testHashGetItemsCompValue(const virHashKeyValuePairPtr a, const virHashKeyValuePairPtr b) { - return strcmp (a->value, b->value); + return strcmp(a->value, b->value); } static int diff --git a/tests/virtimetest.c b/tests/virtimetest.c index 96f8842ca1..dca4efbb7e 100644 --- a/tests/virtimetest.c +++ b/tests/virtimetest.c @@ -98,18 +98,18 @@ mymain(void) ret = -1; \ } while (0) - TEST_FIELDS( 0ull, 1970, 1, 1, 0, 0, 0); - TEST_FIELDS( 5000ull, 1970, 1, 1, 0, 0, 5); - TEST_FIELDS( 3605000ull, 1970, 1, 1, 1, 0, 5); - TEST_FIELDS( 86405000ull, 1970, 1, 2, 0, 0, 5); - TEST_FIELDS( 31536000000ull, 1971, 1, 1, 0, 0, 0); - - TEST_FIELDS( 30866399000ull, 1970, 12, 24, 5, 59, 59); - TEST_FIELDS( 123465599000ull, 1973, 11, 29, 23, 59, 59); - TEST_FIELDS( 155001599000ull, 1974, 11, 29, 23, 59, 59); - - TEST_FIELDS( 186537599000ull, 1975, 11, 29, 23, 59, 59); - TEST_FIELDS( 344390399000ull, 1980, 11, 29, 23, 59, 59); + TEST_FIELDS(0ull, 1970, 1, 1, 0, 0, 0); + TEST_FIELDS(5000ull, 1970, 1, 1, 0, 0, 5); + TEST_FIELDS(3605000ull, 1970, 1, 1, 1, 0, 5); + TEST_FIELDS(86405000ull, 1970, 1, 2, 0, 0, 5); + TEST_FIELDS(31536000000ull, 1971, 1, 1, 0, 0, 0); + + TEST_FIELDS(30866399000ull, 1970, 12, 24, 5, 59, 59); + TEST_FIELDS(123465599000ull, 1973, 11, 29, 23, 59, 59); + TEST_FIELDS(155001599000ull, 1974, 11, 29, 23, 59, 59); + + TEST_FIELDS(186537599000ull, 1975, 11, 29, 23, 59, 59); + TEST_FIELDS(344390399000ull, 1980, 11, 29, 23, 59, 59); TEST_FIELDS(1203161493000ull, 2008, 2, 16, 11, 31, 33); TEST_FIELDS(1234567890000ull, 2009, 2, 13, 23, 31, 30); diff --git a/tools/console.c b/tools/console.c index 8b377dd01f..40de8eb2df 100644 --- a/tools/console.c +++ b/tools/console.c @@ -83,7 +83,7 @@ static void do_signal(int sig ATTRIBUTE_UNUSED) { # ifndef HAVE_CFMAKERAW static void -cfmakeraw (struct termios *attr) +cfmakeraw(struct termios *attr) { attr->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c index b264f15351..4590803205 100644 --- a/tools/virsh-domain-monitor.c +++ b/tools/virsh-domain-monitor.c @@ -1132,7 +1132,7 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd) /* Check and display whether the domain autostarts or not */ if (!virDomainGetAutostart(dom, &autostart)) { vshPrint(ctl, "%-15s %s\n", _("Autostart:"), - autostart ? _("enable") : _("disable") ); + autostart ? _("enable") : _("disable")); } has_managed_save = virDomainHasManagedSaveImage(dom, 0); diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 255669f5df..393b67b56b 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2079,7 +2079,7 @@ hit: goto cleanup; } - if (xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0 ) { + if (xmlNodeDump(xml_buf, xml, obj->nodesetval->nodeTab[i], 0, 0) < 0) { vshError(ctl, _("Failed to create XML")); goto cleanup; } @@ -2965,8 +2965,8 @@ out_sig: ignore_value(safewrite(data->writefd, &ret, sizeof(ret))); } -typedef void (*jobWatchTimeoutFunc) (vshControl *ctl, virDomainPtr dom, - void *opaque); +typedef void (*jobWatchTimeoutFunc)(vshControl *ctl, virDomainPtr dom, + void *opaque); static bool vshWatchJob(vshControl *ctl, diff --git a/tools/virsh-edit.c b/tools/virsh-edit.c index 61008a90a7..9d612a3e3b 100644 --- a/tools/virsh-edit.c +++ b/tools/virsh-edit.c @@ -147,7 +147,7 @@ edit_cleanup: VIR_FREE(doc_edited); VIR_FREE(doc_reread); if (tmp) { - unlink (tmp); + unlink(tmp); VIR_FREE(tmp); } diff --git a/tools/virsh-host.c b/tools/virsh-host.c index 2ea24ac1a2..5e6842a5bf 100644 --- a/tools/virsh-host.c +++ b/tools/virsh-host.c @@ -148,7 +148,7 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd) xmlDocPtr xml = NULL; xmlXPathContextPtr ctxt = NULL; - if ( (cell_given = vshCommandOptInt(cmd, "cellno", &cell)) < 0) { + if ((cell_given = vshCommandOptInt(cmd, "cellno", &cell)) < 0) { vshError(ctl, "%s", _("cell number has to be a number")); goto cleanup; } @@ -808,7 +808,7 @@ cmdHostname(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) return false; } - vshPrint (ctl, "%s\n", hostname); + vshPrint(ctl, "%s\n", hostname); VIR_FREE(hostname); return true; diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c index c27b6bcabc..9ceb122f9c 100644 --- a/tools/virsh-interface.c +++ b/tools/virsh-interface.c @@ -774,7 +774,7 @@ cmdInterfaceBridge(vshControl *ctl, const vshCmd *cmd) /* Set stp and delay attributes in <bridge> according to the * commandline options. */ - if (!xmlSetProp(br_node, BAD_CAST "stp", BAD_CAST (stp ? "on" : "off"))) { + if (!xmlSetProp(br_node, BAD_CAST "stp", BAD_CAST(stp ? "on" : "off"))) { vshError(ctl, "%s", _("Failed to set stp attribute in xml document")); goto cleanup; } diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index daf51d298e..8cf96bed05 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -365,7 +365,7 @@ cmdNodeListDevices(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) return false; } - switch(cap_type) { + switch (cap_type) { case VIR_NODE_DEV_CAP_SYSTEM: flags |= VIR_CONNECT_LIST_NODE_DEVICES_CAP_SYSTEM; break; diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 22df323aa4..c08cce654a 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -863,7 +863,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED) return false; } - switch(poolType) { + switch (poolType) { case VIR_STORAGE_POOL_DIR: flags |= VIR_CONNECT_LIST_STORAGE_POOLS_DIR; break; diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 029758c3d8..f219de98b2 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -813,7 +813,7 @@ cmdVolInfo(vshControl *ctl, const vshCmd *cmd) if (virStorageVolGetInfo(vol, &info) == 0) { double val; const char *unit; - switch(info.type) { + switch (info.type) { case VIR_STORAGE_VOL_FILE: vshPrint(ctl, "%-15s %s\n", _("Type:"), _("file")); break; diff --git a/tools/virsh.c b/tools/virsh.c index 7bb7781af6..a5585e1012 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -559,7 +559,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *doc) int fd; char ebuf[1024]; - tmpdir = getenv ("TMPDIR"); + tmpdir = getenv("TMPDIR"); if (!tmpdir) tmpdir = "/tmp"; if (virAsprintf(&ret, "%s/virshXXXXXX.xml", tmpdir) < 0) { vshError(ctl, "%s", _("out of memory")); @@ -1959,7 +1959,7 @@ vshGetTypedParamValue(vshControl *ctl, virTypedParameterPtr item) int ret = 0; char *str = NULL; - switch(item->type) { + switch (item->type) { case VIR_TYPED_PARAM_INT: ret = virAsprintf(&str, "%d", item->value.i); break; |