[libvirt PATCH v2 06/17] ch_driver: fix indentation in ch_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Praveen K Paladugu <prapal@xxxxxxxxxxxxxxxxxxx>
---
 src/ch/ch_driver.c | 241 +++++++++++++++++++++++----------------------
 1 file changed, 121 insertions(+), 120 deletions(-)

diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c
index 464bcef907..75c6a15dd6 100644
--- a/src/ch/ch_driver.c
+++ b/src/ch/ch_driver.c
@@ -50,7 +50,7 @@ VIR_LOG_INIT("ch.ch_driver");
 virCHDriver *ch_driver = NULL;
 
 static virDomainObj *
-chDomObjFromDomain(virDomain *domain)
+chDomObjFromDomain(virDomain * domain)
 {
     virDomainObj *vm;
     virCHDriver *driver = domain->conn->privateData;
@@ -79,10 +79,10 @@ chConnectURIProbe(char **uri)
     return 1;
 }
 
-static virDrvOpenStatus chConnectOpen(virConnectPtr conn,
-                                      virConnectAuthPtr auth G_GNUC_UNUSED,
-                                      virConf *conf G_GNUC_UNUSED,
-                                      unsigned int flags)
+static virDrvOpenStatus
+chConnectOpen(virConnectPtr conn,
+              virConnectAuthPtr auth G_GNUC_UNUSED,
+              virConf * conf G_GNUC_UNUSED, unsigned int flags)
 {
     virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
 
@@ -101,13 +101,15 @@ static virDrvOpenStatus chConnectOpen(virConnectPtr conn,
     return VIR_DRV_OPEN_SUCCESS;
 }
 
-static int chConnectClose(virConnectPtr conn)
+static int
+chConnectClose(virConnectPtr conn)
 {
     conn->privateData = NULL;
     return 0;
 }
 
-static const char *chConnectGetType(virConnectPtr conn)
+static const char *
+chConnectGetType(virConnectPtr conn)
 {
     if (virConnectGetTypeEnsureACL(conn) < 0)
         return NULL;
@@ -115,8 +117,8 @@ static const char *chConnectGetType(virConnectPtr conn)
     return "CH";
 }
 
-static int chConnectGetVersion(virConnectPtr conn,
-                               unsigned long *version)
+static int
+chConnectGetVersion(virConnectPtr conn, unsigned long *version)
 {
     virCHDriver *driver = conn->privateData;
 
@@ -129,7 +131,8 @@ static int chConnectGetVersion(virConnectPtr conn,
     return 0;
 }
 
-static char *chConnectGetHostname(virConnectPtr conn)
+static char *
+chConnectGetHostname(virConnectPtr conn)
 {
     if (virConnectGetHostnameEnsureACL(conn) < 0)
         return NULL;
@@ -137,7 +140,8 @@ static char *chConnectGetHostname(virConnectPtr conn)
     return virGetHostname();
 }
 
-static int chConnectNumOfDomains(virConnectPtr conn)
+static int
+chConnectNumOfDomains(virConnectPtr conn)
 {
     virCHDriver *driver = conn->privateData;
 
@@ -148,7 +152,8 @@ static int chConnectNumOfDomains(virConnectPtr conn)
                                         virConnectNumOfDomainsCheckACL, conn);
 }
 
-static int chConnectListDomains(virConnectPtr conn, int *ids, int nids)
+static int
+chConnectListDomains(virConnectPtr conn, int *ids, int nids)
 {
     virCHDriver *driver = conn->privateData;
 
@@ -156,13 +161,12 @@ static int chConnectListDomains(virConnectPtr conn, int *ids, int nids)
         return -1;
 
     return virDomainObjListGetActiveIDs(driver->domains, ids, nids,
-                                     virConnectListDomainsCheckACL, conn);
+                                        virConnectListDomainsCheckACL, conn);
 }
 
 static int
 chConnectListAllDomains(virConnectPtr conn,
-                        virDomainPtr **domains,
-                        unsigned int flags)
+                        virDomainPtr ** domains, unsigned int flags)
 {
     virCHDriver *driver = conn->privateData;
 
@@ -172,11 +176,11 @@ chConnectListAllDomains(virConnectPtr conn,
         return -1;
 
     return virDomainObjListExport(driver->domains, conn, domains,
-                                 virConnectListAllDomainsCheckACL, flags);
+                                  virConnectListAllDomainsCheckACL, flags);
 }
 
-static int chNodeGetInfo(virConnectPtr conn,
-                         virNodeInfoPtr nodeinfo)
+static int
+chNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
 {
     if (virNodeGetInfoEnsureACL(conn) < 0)
         return -1;
@@ -184,7 +188,8 @@ static int chNodeGetInfo(virConnectPtr conn,
     return virCapabilitiesGetNodeInfo(nodeinfo);
 }
 
-static char *chConnectGetCapabilities(virConnectPtr conn)
+static char *
+chConnectGetCapabilities(virConnectPtr conn)
 {
     virCHDriver *driver = conn->privateData;
     virCaps *caps;
@@ -213,9 +218,7 @@ static char *chConnectGetCapabilities(virConnectPtr conn)
  * Returns a new domain object or NULL in case of failure.
  */
 static virDomainPtr
-chDomainCreateXML(virConnectPtr conn,
-                  const char *xml,
-                  unsigned int flags)
+chDomainCreateXML(virConnectPtr conn, const char *xml, unsigned int flags)
 {
     virCHDriver *driver = conn->privateData;
     virDomainDef *vmdef = NULL;
@@ -240,8 +243,7 @@ chDomainCreateXML(virConnectPtr conn,
                                    &vmdef,
                                    driver->xmlopt,
                                    VIR_DOMAIN_OBJ_LIST_ADD_LIVE |
-                                       VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE,
-                                   NULL)))
+                                   VIR_DOMAIN_OBJ_LIST_ADD_CHECK_LIVE, NULL)))
         goto cleanup;
 
     if (virCHDomainObjBeginJob(vm, CH_JOB_MODIFY) < 0)
@@ -343,8 +345,7 @@ chDomainDefineXML(virConnectPtr conn, const char *xml)
 }
 
 static int
-chDomainUndefineFlags(virDomainPtr dom,
-                      unsigned int flags)
+chDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
 {
     virCHDriver *driver = dom->conn->privateData;
     virDomainObj *vm;
@@ -383,7 +384,8 @@ chDomainUndefine(virDomainPtr dom)
     return chDomainUndefineFlags(dom, 0);
 }
 
-static int chDomainIsActive(virDomainPtr dom)
+static int
+chDomainIsActive(virDomainPtr dom)
 {
     virCHDriver *driver = dom->conn->privateData;
     virDomainObj *vm;
@@ -405,8 +407,7 @@ static int chDomainIsActive(virDomainPtr dom)
 }
 
 static int
-chDomainShutdownFlags(virDomainPtr dom,
-                      unsigned int flags)
+chDomainShutdownFlags(virDomainPtr dom, unsigned int flags)
 {
     virCHDomainObjPrivate *priv;
     virDomainObj *vm;
@@ -437,7 +438,7 @@ chDomainShutdownFlags(virDomainPtr dom,
     } else {
         if (virCHMonitorShutdownVM(priv->monitor) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                        _("failed to shutdown guest VM"));
+                           _("failed to shutdown guest VM"));
             goto endjob;
         }
     }
@@ -501,7 +502,8 @@ chDomainReboot(virDomainPtr dom, unsigned int flags)
     if (state == VIR_DOMAIN_RUNNING)
         virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_BOOTED);
     else
-        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING, VIR_DOMAIN_RUNNING_UNPAUSED);
+        virDomainObjSetState(vm, VIR_DOMAIN_RUNNING,
+                             VIR_DOMAIN_RUNNING_UNPAUSED);
 
     ret = 0;
 
@@ -541,7 +543,7 @@ chDomainSuspend(virDomainPtr dom)
     } else {
         if (virCHMonitorSuspendVM(priv->monitor) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                        _("failed to suspend domain"));
+                           _("failed to suspend domain"));
             goto endjob;
         }
     }
@@ -586,7 +588,7 @@ chDomainResume(virDomainPtr dom)
     } else {
         if (virCHMonitorResumeVM(priv->monitor) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                        _("failed to resume domain"));
+                           _("failed to resume domain"));
             goto endjob;
         }
     }
@@ -651,8 +653,8 @@ chDomainDestroy(virDomainPtr dom)
     return chDomainDestroyFlags(dom, 0);
 }
 
-static virDomainPtr chDomainLookupByID(virConnectPtr conn,
-                                       int id)
+static virDomainPtr
+chDomainLookupByID(virConnectPtr conn, int id)
 {
     virCHDriver *driver = conn->privateData;
     virDomainObj *vm;
@@ -678,8 +680,8 @@ static virDomainPtr chDomainLookupByID(virConnectPtr conn,
     return dom;
 }
 
-static virDomainPtr chDomainLookupByName(virConnectPtr conn,
-                                         const char *name)
+static virDomainPtr
+chDomainLookupByName(virConnectPtr conn, const char *name)
 {
     virCHDriver *driver = conn->privateData;
     virDomainObj *vm;
@@ -705,8 +707,8 @@ static virDomainPtr chDomainLookupByName(virConnectPtr conn,
     return dom;
 }
 
-static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
-                                         const unsigned char *uuid)
+static virDomainPtr
+chDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
 {
     virCHDriver *driver = conn->privateData;
     virDomainObj *vm;
@@ -718,6 +720,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
 
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
+
         virUUIDFormat(uuid, uuidstr);
         virReportError(VIR_ERR_NO_DOMAIN,
                        _("no domain with matching uuid '%s'"), uuidstr);
@@ -735,10 +738,7 @@ static virDomainPtr chDomainLookupByUUID(virConnectPtr conn,
 }
 
 static int
-chDomainGetState(virDomainPtr dom,
-                 int *state,
-                 int *reason,
-                 unsigned int flags)
+chDomainGetState(virDomainPtr dom, int *state, int *reason, unsigned int flags)
 {
     virDomainObj *vm;
     int ret = -1;
@@ -759,8 +759,8 @@ chDomainGetState(virDomainPtr dom,
     return ret;
 }
 
-static char *chDomainGetXMLDesc(virDomainPtr dom,
-                                unsigned int flags)
+static char *
+chDomainGetXMLDesc(virDomainPtr dom, unsigned int flags)
 {
     virCHDriver *driver = dom->conn->privateData;
     virDomainObj *vm;
@@ -782,8 +782,8 @@ static char *chDomainGetXMLDesc(virDomainPtr dom,
     return ret;
 }
 
-static int chDomainGetInfo(virDomainPtr dom,
-                           virDomainInfoPtr info)
+static int
+chDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info)
 {
     virDomainObj *vm;
     int ret = -1;
@@ -811,77 +811,76 @@ static int chDomainGetInfo(virDomainPtr dom,
 
 static int
 chDomainOpenConsole(virDomainPtr dom,
-                    const char *dev_name,
-                    virStreamPtr st,
-                    unsigned int flags)
-{
-     virDomainObj *vm = NULL;
-     int ret = -1;
-     size_t i;
-     virDomainChrDef *chr = NULL;
-     virCHDomainObjPrivate *priv;
-
-     virCheckFlags(VIR_DOMAIN_CONSOLE_SAFE | VIR_DOMAIN_CONSOLE_FORCE, -1);
-
-     if (!(vm = chDomObjFromDomain(dom)))
-          goto cleanup;
-
-     if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
-          goto cleanup;
-
-     if (virDomainObjCheckActive(vm) < 0)
-          goto cleanup;
-
-     priv = vm->privateData;
-
-     if (dev_name) {
-          for (i = 0; !chr && i < vm->def->nconsoles; i++) {
-               if (vm->def->consoles[i]->info.alias &&
-                   STREQ(dev_name, vm->def->consoles[i]->info.alias))
-                    chr = vm->def->consoles[i];
-          }
-          for (i = 0; !chr && i < vm->def->nserials; i++) {
-               if (STREQ(dev_name, vm->def->serials[i]->info.alias))
-                    chr = vm->def->serials[i];
-          }
-     } else {
-          if (vm->def->nconsoles &&
-              vm->def->consoles[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
-               chr = vm->def->consoles[0];
-          else if (vm->def->nserials &&
-                   vm->def->serials[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
-               chr = vm->def->serials[0];
-     }
-
-     if (!chr) {
-          virReportError(VIR_ERR_INTERNAL_ERROR, _("cannot find character device %s"),
-                         NULLSTR(dev_name));
-          goto cleanup;
-     }
-
-     if (chr->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
-          virReportError(VIR_ERR_INTERNAL_ERROR,
-                         _("character device %s is not using a PTY"),
-                         dev_name ? dev_name : NULLSTR(chr->info.alias));
-          goto cleanup;
-     }
-
-     /* handle mutually exclusive access to console devices */
-     ret = virChrdevOpen(priv->chrdevs, chr->source, st,
-                         (flags & VIR_DOMAIN_CONSOLE_FORCE) != 0);
-
-     if (ret == 1) {
-          virReportError(VIR_ERR_OPERATION_FAILED, "%s",
-                         _("Active console session exists for this domain"));
-          ret = -1;
-     }
+                    const char *dev_name, virStreamPtr st, unsigned int flags)
+{
+    virDomainObj *vm = NULL;
+    int ret = -1;
+    size_t i;
+    virDomainChrDef *chr = NULL;
+    virCHDomainObjPrivate *priv;
+
+    virCheckFlags(VIR_DOMAIN_CONSOLE_SAFE | VIR_DOMAIN_CONSOLE_FORCE, -1);
+
+    if (!(vm = chDomObjFromDomain(dom)))
+        goto cleanup;
+
+    if (virDomainOpenConsoleEnsureACL(dom->conn, vm->def) < 0)
+        goto cleanup;
+
+    if (virDomainObjCheckActive(vm) < 0)
+        goto cleanup;
+
+    priv = vm->privateData;
+
+    if (dev_name) {
+        for (i = 0; !chr && i < vm->def->nconsoles; i++) {
+            if (vm->def->consoles[i]->info.alias &&
+                STREQ(dev_name, vm->def->consoles[i]->info.alias))
+                chr = vm->def->consoles[i];
+        }
+        for (i = 0; !chr && i < vm->def->nserials; i++) {
+            if (STREQ(dev_name, vm->def->serials[i]->info.alias))
+                chr = vm->def->serials[i];
+        }
+    } else {
+        if (vm->def->nconsoles &&
+            vm->def->consoles[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
+            chr = vm->def->consoles[0];
+        else if (vm->def->nserials &&
+                 vm->def->serials[0]->source->type == VIR_DOMAIN_CHR_TYPE_PTY)
+            chr = vm->def->serials[0];
+    }
+
+    if (!chr) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("cannot find character device %s"), NULLSTR(dev_name));
+        goto cleanup;
+    }
+
+    if (chr->source->type != VIR_DOMAIN_CHR_TYPE_PTY) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("character device %s is not using a PTY"),
+                       dev_name ? dev_name : NULLSTR(chr->info.alias));
+        goto cleanup;
+    }
+
+    /* handle mutually exclusive access to console devices */
+    ret = virChrdevOpen(priv->chrdevs, chr->source, st,
+                        (flags & VIR_DOMAIN_CONSOLE_FORCE) != 0);
+
+    if (ret == 1) {
+        virReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                       _("Active console session exists for this domain"));
+        ret = -1;
+    }
 
  cleanup:
-     virDomainObjEndAPI(&vm);
-     return ret;
+    virDomainObjEndAPI(&vm);
+    return ret;
 }
 
-static int chStateCleanup(void)
+static int
+chStateCleanup(void)
 {
     if (ch_driver == NULL)
         return -1;
@@ -897,10 +896,11 @@ static int chStateCleanup(void)
     return 0;
 }
 
-static int chStateInitialize(bool privileged,
-                             const char *root,
-                             virStateInhibitCallback callback G_GNUC_UNUSED,
-                             void *opaque G_GNUC_UNUSED)
+static int
+chStateInitialize(bool privileged,
+                  const char *root,
+                  virStateInhibitCallback callback G_GNUC_UNUSED,
+                  void *opaque G_GNUC_UNUSED)
 {
     int ret = VIR_DRV_STATE_INIT_ERROR;
     int rv;
@@ -984,7 +984,7 @@ static virHypervisorDriver chHypervisorDriver = {
 
 static virConnectDriver chConnectDriver = {
     .localOnly = true,
-    .uriSchemes = (const char *[]){"ch", NULL},
+    .uriSchemes = (const char *[]) {"ch", NULL},
     .hypervisorDriver = &chHypervisorDriver,
 };
 
@@ -994,7 +994,8 @@ static virStateDriver chStateDriver = {
     .stateCleanup = chStateCleanup,
 };
 
-int chRegister(void)
+int
+chRegister(void)
 {
     if (virRegisterConnectDriver(&chConnectDriver, true) < 0)
         return -1;
-- 
2.27.0





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux