From: Wei Liu <wei.liu2@citrix.com>
To: Alexandra Sandulescu <alecsandra.sandulescu@gmail.com>
Cc: xen-devel@lists.xenproject.org, wei.liu2@citrix.com,
ian.campbell@citrix.com
Subject: Re: [PATCH] tools: Refactor code in libxl/xl_cmdimpl.c
Date: Mon, 20 Oct 2014 14:45:26 +0100 [thread overview]
Message-ID: <20141020134526.GD19994@zion.uk.xensource.com> (raw)
In-Reply-To: <1413763288-4650-1-git-send-email-alecsandra.sandulescu@gmail.com>
On Mon, Oct 20, 2014 at 03:01:28AM +0300, Alexandra Sandulescu wrote:
> This patch removes duplicate code in /tools/libxl/xl_cmdimpl.c by
> adding set_device_data function. This function parses configuration
> data and adds the information into libxl_device_nic struct. It is
> called in both main_networkattach and parse_config_data functions
> to replace duplicate code.
> ---
> tools/libxl/xl_cmdimpl.c | 160 +++++++++++++++++------------------------------
> 1 file changed, 57 insertions(+), 103 deletions(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 988ee28..449aa91 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -823,6 +823,8 @@ static void parse_vcpu_affinity(libxl_domain_build_info *b_info,
> }
> }
>
> +static int set_device_data(libxl_device_nic *nic, XLU_Config **config, char *token);
> +
Since this function operates on libxl_device_nic, it should be named
accordingly.
> static void parse_config_data(const char *config_source,
> const char *config_data,
> int config_len,
> @@ -1389,61 +1391,7 @@ static void parse_config_data(const char *config_source,
> if ((p2 = strchr(p, '=')) == NULL)
> break;
> *p2 = '\0';
You can get rid of p2, can't you?
[...]
> - fprintf(stderr, "unrecognized argument `%s'\n", *argv);
> - return 1;
> - }
> + if (set_device_data(&nic, &config, *argv)) { return 1;}
Coding style.
> }
>
> if (dryrun_only) {
> --
> 1.9.1
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-10-20 13:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-20 0:01 [PATCH] tools: Refactor code in libxl/xl_cmdimpl.c Alexandra Sandulescu
2014-10-20 13:45 ` Wei Liu [this message]
2014-10-20 13:51 ` 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=20141020134526.GD19994@zion.uk.xensource.com \
--to=wei.liu2@citrix.com \
--cc=alecsandra.sandulescu@gmail.com \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.