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

[libvirt] [PATCH 05/11] xm: Clean up



Clean up some function headers.
---
 src/xen/xm_internal.c | 119 +++++++++++++++++++++++++++++++-------------------
 1 file changed, 75 insertions(+), 44 deletions(-)

diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index 1c1db54..912de3f 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -1,7 +1,7 @@
 /*
  * xm_internal.h: helper routines for dealing with inactive domains
  *
- * Copyright (C) 2006-2007, 2009-2012 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -124,7 +124,10 @@ struct xenXMConfigReaperData {
 };
 
 /* Remove any configs which were not refreshed recently */
-static int xenXMConfigReaper(const void *payload, const void *key ATTRIBUTE_UNUSED, const void *data) {
+static int
+xenXMConfigReaper(const void *payload, const void *key ATTRIBUTE_UNUSED,
+                  const void *data)
+{
     const struct xenXMConfigReaperData *args = data;
     xenXMConfCachePtr entry = (xenXMConfCachePtr)payload;
 
@@ -143,7 +146,8 @@ static int xenXMConfigReaper(const void *payload, const void *key ATTRIBUTE_UNUS
 
 
 static virDomainDefPtr
-xenXMConfigReadFile(virConnectPtr conn, const char *filename) {
+xenXMConfigReadFile(virConnectPtr conn, const char *filename)
+{
     virConfPtr conf;
     virDomainDefPtr def;
     xenUnifiedPrivatePtr priv = conn->privateData;
@@ -158,7 +162,9 @@ xenXMConfigReadFile(virConnectPtr conn, const char *filename) {
 }
 
 static int
-xenXMConfigSaveFile(virConnectPtr conn, const char *filename, virDomainDefPtr def) {
+xenXMConfigSaveFile(virConnectPtr conn, const char *filename,
+                    virDomainDefPtr def)
+{
     virConfPtr conf;
     xenUnifiedPrivatePtr priv = conn->privateData;
     int ret;
@@ -177,8 +183,7 @@ xenXMConfigSaveFile(virConnectPtr conn, const char *filename, virDomainDefPtr de
  * calling this function
  */
 int
-xenXMConfigCacheRemoveFile(virConnectPtr conn,
-                           const char *filename)
+xenXMConfigCacheRemoveFile(virConnectPtr conn, const char *filename)
 {
     xenUnifiedPrivatePtr priv = conn->privateData;
     xenXMConfCachePtr entry;
@@ -309,7 +314,9 @@ 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,8 +418,7 @@ int xenXMConfigCacheRefresh(virConnectPtr conn) {
  * every few seconds
  */
 virDrvOpenStatus
-xenXMOpen(virConnectPtr conn,
-          virConnectAuthPtr auth ATTRIBUTE_UNUSED,
+xenXMOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
           unsigned int flags)
 {
     xenUnifiedPrivatePtr priv = conn->privateData;
@@ -442,7 +448,9 @@ xenXMOpen(virConnectPtr conn,
  * Free the cached config files associated with this
  * connection
  */
-int xenXMClose(virConnectPtr conn) {
+int
+xenXMClose(virConnectPtr conn)
+{
     xenUnifiedPrivatePtr priv = conn->privateData;
 
     virHashFree(priv->nameConfigMap);
@@ -455,9 +463,7 @@ int xenXMClose(virConnectPtr conn) {
  * Since these are all offline domains, the state is always SHUTOFF.
  */
 int
-xenXMDomainGetState(virDomainPtr domain,
-                    int *state,
-                    int *reason,
+xenXMDomainGetState(virDomainPtr domain, int *state, int *reason,
                     unsigned int flags)
 {
     virCheckFlags(0, -1);
@@ -477,7 +483,9 @@ xenXMDomainGetState(virDomainPtr domain,
  * Since these are all offline domains, we only return info about
  * VCPUs and memory.
  */
-int xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info) {
+int
+xenXMDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
+{
     xenUnifiedPrivatePtr priv;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -519,7 +527,8 @@ error:
  * Turn a config record into a lump of XML describing the
  * domain, suitable for later feeding for virDomainCreateXML
  */
-char *xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
+char *
+xenXMDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
 {
     xenUnifiedPrivatePtr priv;
     const char *filename;
@@ -555,7 +564,9 @@ cleanup:
 /*
  * Update amount of memory in the config file
  */
-int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) {
+int
+xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory)
+{
     xenUnifiedPrivatePtr priv;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -565,11 +576,8 @@ int xenXMDomainSetMemory(virDomainPtr domain, unsigned long memory) {
         virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
-    if (domain->conn->flags & VIR_CONNECT_RO)
-        return -1;
-    if (domain->id != -1)
-        return -1;
-    if (memory < 1024 * MIN_XEN_GUEST_SIZE)
+    if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1 ||
+        memory < 1024 * MIN_XEN_GUEST_SIZE)
         return -1;
 
     priv = domain->conn->privateData;
@@ -600,7 +608,9 @@ cleanup:
 /*
  * Update maximum memory limit in config
  */
-int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) {
+int
+xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
+{
     xenUnifiedPrivatePtr priv;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -610,9 +620,7 @@ int xenXMDomainSetMaxMemory(virDomainPtr domain, unsigned long memory) {
         virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
         return -1;
     }
-    if (domain->conn->flags & VIR_CONNECT_RO)
-        return -1;
-    if (domain->id != -1)
+    if (domain->conn->flags & VIR_CONNECT_RO || domain->id != -1)
         return -1;
 
     priv = domain->conn->privateData;
@@ -643,7 +651,9 @@ cleanup:
 /*
  * Get max memory limit from config
  */
-unsigned long long xenXMDomainGetMaxMemory(virDomainPtr domain) {
+unsigned long long
+xenXMDomainGetMaxMemory(virDomainPtr domain)
+{
     xenUnifiedPrivatePtr priv;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -821,9 +831,9 @@ cleanup:
  *
  * Returns 0 for success; -1 (with errno) on error
  */
-int xenXMDomainPinVcpu(virDomainPtr domain,
-                       unsigned int vcpu ATTRIBUTE_UNUSED,
-                       unsigned char *cpumap, int maplen)
+int
+xenXMDomainPinVcpu(virDomainPtr domain, unsigned int vcpu ATTRIBUTE_UNUSED,
+                   unsigned char *cpumap, int maplen)
 {
     xenUnifiedPrivatePtr priv;
     const char *filename;
@@ -875,7 +885,9 @@ int xenXMDomainPinVcpu(virDomainPtr domain,
 /*
  * Find an inactive domain based on its name
  */
-virDomainPtr xenXMDomainLookupByName(virConnectPtr conn, const char *domname) {
+virDomainPtr
+xenXMDomainLookupByName(virConnectPtr conn, const char *domname)
+{
     xenUnifiedPrivatePtr priv = conn->privateData;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -908,7 +920,10 @@ cleanup:
 /*
  * Hash table iterator to search for a domain based on UUID
  */
-static int xenXMDomainSearchForUUID(const void *payload, const void *name ATTRIBUTE_UNUSED, const void *data) {
+static int
+xenXMDomainSearchForUUID(const void *payload, const void *name ATTRIBUTE_UNUSED,
+                         const void *data)
+{
     const unsigned char *wantuuid = (const unsigned char *)data;
     const xenXMConfCachePtr entry = (const xenXMConfCachePtr)payload;
 
@@ -921,8 +936,9 @@ static int xenXMDomainSearchForUUID(const void *payload, const void *name ATTRIB
 /*
  * Find an inactive domain based on its UUID
  */
-virDomainPtr xenXMDomainLookupByUUID(virConnectPtr conn,
-                                     const unsigned char *uuid) {
+virDomainPtr
+xenXMDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
+{
     xenUnifiedPrivatePtr priv = conn->privateData;
     xenXMConfCachePtr entry;
     virDomainPtr ret = NULL;
@@ -951,7 +967,9 @@ cleanup:
 /*
  * Start a domain from an existing defined config file
  */
-int xenXMDomainCreate(virDomainPtr domain) {
+int
+xenXMDomainCreate(virDomainPtr domain)
+{
     char *sexpr;
     int ret = -1;
     xenUnifiedPrivatePtr priv= (xenUnifiedPrivatePtr) domain->conn->privateData;
@@ -1004,7 +1022,8 @@ int xenXMDomainCreate(virDomainPtr domain) {
  * Create a config file for a domain, based on an XML
  * document describing its config
  */
-virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
+virDomainPtr
+xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
 {
     virDomainPtr ret;
     char *filename = NULL;
@@ -1141,7 +1160,9 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml)
 /*
  * Delete a domain from disk
  */
-int xenXMDomainUndefine(virDomainPtr domain) {
+int
+xenXMDomainUndefine(virDomainPtr domain)
+{
     xenUnifiedPrivatePtr priv;
     const char *filename;
     xenXMConfCachePtr entry;
@@ -1192,7 +1213,8 @@ struct xenXMListIteratorContext {
     char ** names;
 };
 
-static void xenXMListIterator(void *payload ATTRIBUTE_UNUSED, const void *name, void *data) {
+static void
+xenXMListIterator(void *payload ATTRIBUTE_UNUSED, const void *name, void *data) {
     struct xenXMListIteratorContext *ctx = data;
     virDomainPtr dom = NULL;
 
@@ -1218,7 +1240,9 @@ static void xenXMListIterator(void *payload ATTRIBUTE_UNUSED, const void *name,
  * List all defined domains, filtered to remove any which
  * are currently running
  */
-int xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
+int
+xenXMListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
+{
     xenUnifiedPrivatePtr priv = conn->privateData;
     struct xenXMListIteratorContext ctx;
     int i, ret = -1;
@@ -1258,7 +1282,9 @@ cleanup:
  * Return the maximum number of defined domains - not filtered
  * based on number running
  */
-int xenXMNumOfDefinedDomains(virConnectPtr conn) {
+int
+xenXMNumOfDefinedDomains(virConnectPtr conn)
+{
     xenUnifiedPrivatePtr priv = conn->privateData;
     int ret = -1;
 
@@ -1387,7 +1413,8 @@ xenXMDomainAttachDeviceFlags(virDomainPtr domain, const char *xml,
  */
 static int
 xenXMDomainDetachDeviceFlags(virDomainPtr domain, const char *xml,
-                             unsigned int flags) {
+                             unsigned int flags)
+{
     const char *filename = NULL;
     xenXMConfCachePtr entry = NULL;
     virDomainDeviceDefPtr dev = NULL;
@@ -1497,7 +1524,8 @@ xenXMDomainBlockPeek(virDomainPtr dom ATTRIBUTE_UNUSED,
 }
 
 
-static char *xenXMAutostartLinkName(virDomainPtr dom)
+static char *
+xenXMAutostartLinkName(virDomainPtr dom)
 {
     char *ret;
     if (virAsprintf(&ret, "/etc/xen/auto/%s", dom->name) < 0)
@@ -1505,7 +1533,8 @@ static char *xenXMAutostartLinkName(virDomainPtr dom)
     return ret;
 }
 
-static char *xenXMDomainConfigName(virDomainPtr dom)
+static char *
+xenXMDomainConfigName(virDomainPtr dom)
 {
     char *ret;
     if (virAsprintf(&ret, "/etc/xen/%s", dom->name) < 0)
@@ -1513,7 +1542,8 @@ static char *xenXMDomainConfigName(virDomainPtr dom)
     return ret;
 }
 
-int xenXMDomainGetAutostart(virDomainPtr dom, int *autostart)
+int
+xenXMDomainGetAutostart(virDomainPtr dom, int *autostart)
 {
     char *linkname = xenXMAutostartLinkName(dom);
     char *config = xenXMDomainConfigName(dom);
@@ -1541,7 +1571,8 @@ cleanup:
 }
 
 
-int xenXMDomainSetAutostart(virDomainPtr dom, int autostart)
+int
+xenXMDomainSetAutostart(virDomainPtr dom, int autostart)
 {
     char *linkname = xenXMAutostartLinkName(dom);
     char *config = xenXMDomainConfigName(dom);
-- 
1.7.11.7


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