Re: [PATCH 08/11] xend: Clean up

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

 



John Ferlan wrote:
> Clean up some function headers
> ---
>  src/xen/xend_internal.c | 114 ++++++++++++++++++++++--------------------------
>  1 file changed, 51 insertions(+), 63 deletions(-)
>
> diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
> index 51f1f15..8bf6fc1 100644
> --- a/src/xen/xend_internal.c
> +++ b/src/xen/xend_internal.c
> @@ -1,7 +1,7 @@
>  /*
>   * xend_internal.c: access to Xen though the Xen Daemon interface
>   *
> - * Copyright (C) 2010-2012 Red Hat, Inc.
> + * Copyright (C) 2010-2013 Red Hat, Inc.
>   * Copyright (C) 2005 Anthony Liguori <aliguori@xxxxxxxxxx>
>   *
>   *  This file is subject to the terms and conditions of the GNU Lesser General
> @@ -60,11 +60,8 @@
>  #define XEND_RCV_BUF_MAX_LEN (256 * 1024)
>  
>  static int
> -virDomainXMLDevID(virDomainPtr domain,
> -                  virDomainDeviceDefPtr dev,
> -                  char *class,
> -                  char *ref,
> -                  int ref_len);
> +virDomainXMLDevID(virDomainPtr domain, virDomainDeviceDefPtr dev, char *class,
> +                  char *ref, int ref_len);
>   

Style preference as Osier mentioned...

>  
>  /**
>   * do_connect:
> @@ -331,8 +328,7 @@ xend_req(int fd, char **content)
>   * Returns the HTTP return code or -1 in case or error.
>   */
>  static int ATTRIBUTE_NONNULL(3)
> -xend_get(virConnectPtr xend, const char *path,
> -         char **content)
> +xend_get(virConnectPtr xend, const char *path, char **content)
>  {
>      int ret;
>      int s = do_connect(xend);
> @@ -871,9 +867,7 @@ xenDaemonDomainLookupByName_ids(virConnectPtr xend, const char *domname,
>   * Returns the 0 on success; -1 (with errno) on error
>   */
>  int
> -xenDaemonDomainLookupByID(virConnectPtr xend,
> -                          int id,
> -                          char **domname,
> +xenDaemonDomainLookupByID(virConnectPtr xend, int id, char **domname,
>                            unsigned char *uuid)
>  {
>      const char *name = NULL;
> @@ -917,7 +911,8 @@ error:
>  
>  
>  static int
> -xend_detect_config_version(virConnectPtr conn) {
> +xend_detect_config_version(virConnectPtr conn)
> +{
>   

ACK to these changes for consistency's sake.

>      struct sexpr *root;
>      const char *value;
>      xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
> @@ -1085,8 +1080,7 @@ sexpr_to_xend_node_info(const struct sexpr *root, virNodeInfoPtr info)
>   * Returns 0 in case of success, -1 in case of error
>   */
>  static int
> -sexpr_to_xend_topology(const struct sexpr *root,
> -                       virCapsPtr caps)
> +sexpr_to_xend_topology(const struct sexpr *root, virCapsPtr caps)
>   

I personally prefer one line when it fits within 80 columns :).

>  {
>      const char *nodeToCpu;
>      const char *cur;
> @@ -1235,8 +1229,7 @@ error:
>   * Returns 0 in case of success, -1 in case of error.
>   */
>  virDrvOpenStatus
> -xenDaemonOpen(virConnectPtr conn,
> -              virConnectAuthPtr auth ATTRIBUTE_UNUSED,
> +xenDaemonOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
>                unsigned int flags)
>  {
>      char *port = NULL;
> @@ -1440,8 +1433,7 @@ xenDaemonDomainReboot(virDomainPtr domain, unsigned int flags)
>   * Returns 0 in case of success, -1 (with errno) in case of error.
>   */
>  int
> -xenDaemonDomainDestroyFlags(virDomainPtr domain,
> -                            unsigned int flags)
> +xenDaemonDomainDestroyFlags(virDomainPtr domain, unsigned int flags)
>  {
>      virCheckFlags(0, -1);
>  
> @@ -1473,7 +1465,7 @@ xenDaemonDomainGetOSType(virDomainPtr domain)
>  {
>      char *type;
>      struct sexpr *root;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>   

ACK to these changes as well since this is the style used throughout the
sources.

Regards,
Jim

>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -1604,7 +1596,7 @@ xenDaemonDomainGetMaxMemory(virDomainPtr domain)
>  {
>      unsigned long long ret = 0;
>      struct sexpr *root;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -1641,7 +1633,7 @@ int
>  xenDaemonDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
>  {
>      char buf[1024];
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -1676,7 +1668,7 @@ int
>  xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
>  {
>      char buf[1024];
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -1693,9 +1685,7 @@ xenDaemonDomainSetMemory(virDomainPtr domain, unsigned long memory)
>  
>  
>  virDomainDefPtr
> -xenDaemonDomainFetch(virConnectPtr conn,
> -                     int domid,
> -                     const char *name,
> +xenDaemonDomainFetch(virConnectPtr conn, int domid, const char *name,
>                       const char *cpus)
>  {
>      struct sexpr *root;
> @@ -1749,7 +1739,7 @@ char *
>  xenDaemonDomainGetXMLDesc(virDomainPtr domain, unsigned int flags,
>                            const char *cpus)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      virDomainDefPtr def;
>      char *xml;
>  
> @@ -1794,7 +1784,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
>  {
>      struct sexpr *root;
>      int ret;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -1826,9 +1816,7 @@ xenDaemonDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
>   * Returns 0 in case of success, -1 in case of error
>   */
>  int
> -xenDaemonDomainGetState(virDomainPtr domain,
> -                        int *state,
> -                        int *reason,
> +xenDaemonDomainGetState(virDomainPtr domain, int *state, int *reason,
>                          unsigned int flags)
>  {
>      xenUnifiedPrivatePtr priv = domain->conn->privateData;
> @@ -1891,7 +1879,8 @@ error:
>   * Returns 0 in case of success and -1 in case of failure.
>   */
>  int
> -xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
> +xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
> +{
>      int ret = -1;
>      struct sexpr *root;
>  
> @@ -1914,8 +1903,8 @@ xenDaemonNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info) {
>   * Returns -1 in case of error, 0 otherwise.
>   */
>  int
> -xenDaemonNodeGetTopology(virConnectPtr conn,
> -                         virCapsPtr caps) {
> +xenDaemonNodeGetTopology(virConnectPtr conn, virCapsPtr caps)
> +{
>      int ret = -1;
>      struct sexpr *root;
>  
> @@ -2051,7 +2040,8 @@ error:
>   * Returns a new domain object or NULL in case of failure
>   */
>  virDomainPtr
> -xenDaemonLookupByID(virConnectPtr conn, int id) {
> +xenDaemonLookupByID(virConnectPtr conn, int id)
> +{
>      char *name = NULL;
>      unsigned char uuid[VIR_UUID_BUFLEN];
>      virDomainPtr ret;
> @@ -2088,7 +2078,7 @@ xenDaemonDomainSetVcpusFlags(virDomainPtr domain, unsigned int vcpus,
>                               unsigned int flags)
>  {
>      char buf[VIR_UUID_BUFLEN];
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      int max;
>  
>      virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
> @@ -2171,7 +2161,7 @@ xenDaemonDomainPinVcpu(virDomainPtr domain, unsigned int vcpu,
>  {
>      char buf[VIR_UUID_BUFLEN], mapstr[sizeof(cpumap_t) * 64];
>      int i, j, ret;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      virDomainDefPtr def = NULL;
>  
>      if (maplen > (int)sizeof(cpumap_t)) {
> @@ -2250,7 +2240,7 @@ xenDaemonDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
>  {
>      struct sexpr *root;
>      int ret;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      virCheckFlags(VIR_DOMAIN_VCPU_LIVE |
>                    VIR_DOMAIN_VCPU_CONFIG |
> @@ -2470,13 +2460,12 @@ xenDaemonLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
>   * Returns a new domain object or NULL in case of failure
>   */
>  virDomainPtr
> -xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc,
> -                     unsigned int flags)
> +xenDaemonCreateXML(virConnectPtr conn, const char *xmlDesc, unsigned int flags)
>  {
>      int ret;
>      char *sexpr;
>      virDomainPtr dom = NULL;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) conn->privateData;
>      virDomainDefPtr def;
>  
>      virCheckFlags(0, NULL);
> @@ -2536,7 +2525,7 @@ static int
>  xenDaemonAttachDeviceFlags(virDomainPtr domain, const char *xml,
>                             unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      char *sexpr = NULL;
>      int ret = -1;
>      virDomainDeviceDefPtr dev = NULL;
> @@ -2702,7 +2691,7 @@ int
>  xenDaemonUpdateDeviceFlags(virDomainPtr domain, const char *xml,
>                             unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      char *sexpr = NULL;
>      int ret = -1;
>      virDomainDeviceDefPtr dev = NULL;
> @@ -2814,7 +2803,7 @@ static int
>  xenDaemonDetachDeviceFlags(virDomainPtr domain, const char *xml,
>                             unsigned int flags)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      char class[8], ref[80];
>      virDomainDeviceDefPtr dev = NULL;
>      virDomainDefPtr def = NULL;
> @@ -2908,12 +2897,11 @@ cleanup:
>  }
>  
>  int
> -xenDaemonDomainGetAutostart(virDomainPtr domain,
> -                            int *autostart)
> +xenDaemonDomainGetAutostart(virDomainPtr domain, int *autostart)
>  {
>      struct sexpr *root;
>      const char *tmp;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -2945,14 +2933,13 @@ xenDaemonDomainGetAutostart(virDomainPtr domain,
>  }
>  
>  int
> -xenDaemonDomainSetAutostart(virDomainPtr domain,
> -                            int autostart)
> +xenDaemonDomainSetAutostart(virDomainPtr domain, int autostart)
>  {
>      struct sexpr *root, *autonode;
>      virBuffer buffer = VIR_BUFFER_INITIALIZER;
>      char *content = NULL;
>      int ret = -1;
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INTERNAL_ERROR, __FUNCTION__);
> @@ -3258,9 +3245,10 @@ xenDaemonDomainDefineXML(virConnectPtr conn, const char *xmlDesc)
>      virDomainDefFree(def);
>      return NULL;
>  }
> -int xenDaemonDomainCreate(virDomainPtr domain)
> +int
> +xenDaemonDomainCreate(virDomainPtr domain)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      int ret;
>      virDomainPtr tmp;
>  
> @@ -3285,9 +3273,10 @@ int xenDaemonDomainCreate(virDomainPtr domain)
>      return ret;
>  }
>  
> -int xenDaemonDomainUndefine(virDomainPtr domain)
> +int
> +xenDaemonDomainUndefine(virDomainPtr domain)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>  
>      if (domain->name == NULL) {
>          virReportError(VIR_ERR_INVALID_ARG, __FUNCTION__);
> @@ -3342,7 +3331,9 @@ error:
>  }
>  
>  static int
> -xenDaemonListDefinedDomains(virConnectPtr conn, char **const names, int maxnames) {
> +xenDaemonListDefinedDomains(virConnectPtr conn, char **const names,
> +                            int maxnames)
> +{
>      struct sexpr *root = NULL;
>      int i, ret = -1;
>      struct sexpr *_for_i, *node;
> @@ -3401,7 +3392,7 @@ error:
>  static char *
>  xenDaemonGetSchedulerType(virDomainPtr domain, int *nparams)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      struct sexpr *root;
>      const char *ret = NULL;
>      char *schedulertype = NULL;
> @@ -3472,7 +3463,7 @@ static int
>  xenDaemonGetSchedulerParameters(virDomainPtr domain,
>                                  virTypedParameterPtr params, int *nparams)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      struct sexpr *root;
>      char *sched_type = NULL;
>      int sched_nparam = 0;
> @@ -3578,7 +3569,7 @@ static int
>  xenDaemonSetSchedulerParameters(virDomainPtr domain,
>                                  virTypedParameterPtr params, int nparams)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      struct sexpr *root;
>      char *sched_type = NULL;
>      int i;
> @@ -3688,7 +3679,7 @@ xenDaemonDomainBlockPeek(virDomainPtr domain, const char *path,
>                           unsigned long long offset, size_t size,
>                           void *buffer)
>  {
> -    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
> +    xenUnifiedPrivatePtr priv = (xenUnifiedPrivatePtr)domain->conn->privateData;
>      struct sexpr *root = NULL;
>      int fd = -1, ret = -1;
>      virDomainDefPtr def;
> @@ -3810,11 +3801,8 @@ struct xenUnifiedDriver xenDaemonDriver = {
>   * Returns 0 in case of success, -1 in case of failure.
>   */
>  static int
> -virDomainXMLDevID(virDomainPtr domain,
> -                  virDomainDeviceDefPtr dev,
> -                  char *class,
> -                  char *ref,
> -                  int ref_len)
> +virDomainXMLDevID(virDomainPtr domain, virDomainDeviceDefPtr dev,
> +                  char *class, char *ref, int ref_len)
>  {
>      xenUnifiedPrivatePtr priv = domain->conn->privateData;
>      char *xref;
>   

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[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]