xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Anthony PERARD <anthony.perard@citrix.com>
To: Kelley Nielsen <kelleynnn@gmail.com>
Cc: xen-devel@lists.xensource.com, Ian.Campbell@citrix.com
Subject: Re: [PATCH OPW 01/11] libxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c
Date: Thu, 14 Nov 2013 14:00:11 +0000	[thread overview]
Message-ID: <20131114140010.GA2663@perard.uk.xensource.com> (raw)
In-Reply-To: <1384212240-1235-2-git-send-email-kelleynnn@gmail.com>

On Mon, Nov 11, 2013 at 03:23:50PM -0800, Kelley Nielsen wrote:
> Coding style has recently been changed for libxl. The convenience
> macro LOG() has been introduced, and invocations of the old macro
> LIBXL__LOG() are to be replaced with it. Change occurences of the
> old macro to the new one in the functions qmp_handle_response()
> and qmp_handle_error_response(). The new macros need access to a
> local libxl__gc *gc, so add it as a parameter to both these functions,
> and pass the instance in qmp_next() down the call chain to
> qmp_handle_response() and in turn to qmp_handle_error_response().
> 
> Suggested-by: Anthony PERARD <anthony.perard@citrix.com>
> Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
> ---
>  tools/libxl/libxl_qmp.c | 24 +++++++++++-------------
>  1 file changed, 11 insertions(+), 13 deletions(-)
> 
> diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
> index 1f76d53..04cab58 100644
> --- a/tools/libxl/libxl_qmp.c
> +++ b/tools/libxl/libxl_qmp.c
> @@ -138,7 +138,7 @@ static int register_serials_chardev_callback(libxl__qmp_handler *qmp,
>              port_number = strtol(s, &endptr, 10);
>              if (*s == 0 || *endptr != 0) {
>                  LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
> -                           "Invalid serial port number: %s", s);
> +			   "Invalid serial port number: %s", s);

You are introducing <TAB>s here, there should be no tabs in C files.

>                  return -1;
>              }
>              ret = store_serial_port_info(qmp, chardev, port_number);
> @@ -260,7 +260,7 @@ static callback_id_pair *qmp_get_callback_from_id(libxl__qmp_handler *qmp,
>      return NULL;
>  }
>  
> -static void qmp_handle_error_response(libxl__qmp_handler *qmp,
> +static void qmp_handle_error_response(libxl__gc *gc, libxl__qmp_handler *qmp,
>                                        const libxl__json_object *resp)
>  {
>      callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp);
> @@ -283,19 +283,17 @@ static void qmp_handle_error_response(libxl__qmp_handler *qmp,
>          free(pp);
>      }
>  
> -    LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
> -               "received an error message from QMP server: %s",
> -               libxl__json_object_get_string(resp));
> +    LOG(ERROR, "received an error message from QMP server: %s",
> +        libxl__json_object_get_string(resp));
>  }
>  
> -static int qmp_handle_response(libxl__qmp_handler *qmp,
> +static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp,
>                                 const libxl__json_object *resp)
>  {
>      libxl__qmp_message_type type = LIBXL__QMP_MESSAGE_TYPE_INVALID;
>  
>      type = qmp_response_type(qmp, resp);
> -    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG,
> -               "message type: %s", libxl__qmp_message_type_to_string(type));
> +    LOG(DEBUG, "message type: %s", libxl__qmp_message_type_to_string(type));
>  
>      switch (type) {
>      case LIBXL__QMP_MESSAGE_TYPE_QMP:
> @@ -317,14 +315,14 @@ static int qmp_handle_response(libxl__qmp_handler *qmp,
>                  /* tell that the id have been processed */
>                  qmp->wait_for_id = 0;
>              }
> -            LIBXL_STAILQ_REMOVE(
> -                &qmp->callback_list, pp, callback_id_pair, next);
> +            LIBXL_STAILQ_REMOVE(&qmp->callback_list, pp, callback_id_pair,
> +			        next);

Same here (tabs).

>              free(pp);
>          }
> -        return 0;
> +	return 0;

And here.

>      }
>      case LIBXL__QMP_MESSAGE_TYPE_ERROR:
> -        qmp_handle_error_response(qmp, resp);
> +        qmp_handle_error_response(gc, qmp, resp);
>          return -1;
>      case LIBXL__QMP_MESSAGE_TYPE_EVENT:
>          return 0;
> @@ -481,7 +479,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
>                  o = libxl__json_parse(gc, s);
>  
>                  if (o) {
> -                    rc = qmp_handle_response(qmp, o);
> +                    rc = qmp_handle_response(gc, qmp, o);
>                  } else {
>                      LOG(ERROR, "Parse error of : %s\n", s);
>                      return -1;
> -- 
> 1.8.1.2
> 

Once the tabs are replace by space:
Reviewed-by: Anthony PERARD <anthony.perard@citrix.com>

-- 
Anthony PERARD

  reply	other threads:[~2013-11-14 14:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-11 23:23 [PATCH 0/11 OPW] All outstanding and corrected patches Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 01/11] libxl: change most remaining LIBXL_LOG to LOG in libxl_qmp.c Kelley Nielsen
2013-11-14 14:00   ` Anthony PERARD [this message]
2013-11-11 23:23 ` [PATCH OPW 02/11] libxl: Use new macro LOGE() " Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 03/11] libxl: use GCSPRINTF in place of libxl_sprintf() " Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 04/11] libxl: use GCSPRINTF instead of libxl__sprintf Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 05/11] libxl: use LOGE instead of LIBXL__LOG_ERRNO in libxl_utils.c Kelley Nielsen
2013-11-14 14:29   ` Anthony PERARD
2013-11-11 23:23 ` [PATCH OPW 06/11] libxl: use LOG and LOGE instead of LIBXL__LOG* " Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 07/11] libxl: use LOG instead of LIBXL__LOG " Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 08/11] opw: libxl: add convenience macros to qmp_send() in libxl_qmp.c Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 09/11] opw: libxl: use macro CTX " Kelley Nielsen
2013-11-11 23:23 ` [PATCH OPW 10/11] opw: libxl: use macro GCNEW " Kelley Nielsen
2013-11-11 23:24 ` [PATCH OPW 11/11] opw: libxl: use CTX macro in libxl_utils.c Kelley Nielsen
2013-11-12 17:26 ` [PATCH 0/11 OPW] All outstanding and corrected patches Matt Wilson
2013-11-19 14:29 ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20131114140010.GA2663@perard.uk.xensource.com \
    --to=anthony.perard@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=kelleynnn@gmail.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).