From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Wei Liu <wei.liu2@citrix.com>, Ian Jackson <Ian.Jackson@eu.citrix.com>
Subject: [PATCH 3/6] libxl: linux hotplug: clean up get_hotplug_env
Date: Mon, 6 Jun 2016 11:52:09 +0100 [thread overview]
Message-ID: <1465210332-25440-4-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1465210332-25440-1-git-send-email-wei.liu2@citrix.com>
That get_hotplug_env function is called for both block and nic. Move
some nic specific code out of common code to appropriate place.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
tools/libxl/libxl_linux.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c
index aed8009..0033a0e 100644
--- a/tools/libxl/libxl_linux.c
+++ b/tools/libxl/libxl_linux.c
@@ -39,12 +39,7 @@ static char **get_hotplug_env(libxl__gc *gc,
const char *type = libxl__device_kind_to_string(dev->backend_kind);
char *be_path = libxl__device_backend_path(gc, dev);
char **env;
- char *gatewaydev;
int nr = 0;
- libxl_nic_type nictype;
-
- gatewaydev = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/%s", be_path,
- "gatewaydev"));
const int arraysize = 15;
GCNEW_ARRAY(env, arraysize);
@@ -56,9 +51,15 @@ static char **get_hotplug_env(libxl__gc *gc,
env[nr++] = GCSPRINTF("backend/%s/%u/%d", type, dev->domid, dev->devid);
env[nr++] = "XENBUS_BASE_PATH";
env[nr++] = "backend";
- env[nr++] = "netdev";
- env[nr++] = gatewaydev ? : "";
if (dev->backend_kind == LIBXL__DEVICE_KIND_VIF) {
+ libxl_nic_type nictype;
+ char *gatewaydev;
+
+ gatewaydev = libxl__xs_read(gc, XBT_NULL,
+ GCSPRINTF("%s/%s", be_path, "gatewaydev"));
+ env[nr++] = "netdev";
+ env[nr++] = gatewaydev ? : "";
+
if (libxl__nic_type(gc, dev, &nictype)) {
LOG(ERROR, "unable to get nictype");
return NULL;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-06 10:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-06 10:52 [PATCH 0/6] xl/libxl: some cleanup / debugging aid patches Wei Liu
2016-06-06 10:52 ` [PATCH 1/6] xl: remus/colo: only initialise ha variable when necessary Wei Liu
2016-06-14 10:18 ` Ian Jackson
2016-06-14 10:23 ` Wei Liu
2016-06-14 14:15 ` Ian Jackson
2016-06-14 14:18 ` Wei Liu
2016-06-06 10:52 ` [PATCH 2/6] libxl: add emacs block to libxl_linux.c Wei Liu
2016-06-14 10:19 ` Ian Jackson
2016-06-06 10:52 ` Wei Liu [this message]
2016-06-14 10:20 ` [PATCH 3/6] libxl: linux hotplug: clean up get_hotplug_env Ian Jackson
2016-06-06 10:52 ` [PATCH 4/6] libxl: debug output for args and env when invoking hotplug script Wei Liu
2016-06-14 10:26 ` Ian Jackson
2016-06-14 12:46 ` Wei Liu
2016-07-02 10:21 ` Wei Liu
2016-07-04 17:06 ` Ian Jackson
2016-07-06 17:23 ` Wei Liu
2016-06-06 10:52 ` [PATCH 5/6] libxl: rename a field in libxl__domain_create_state Wei Liu
2016-06-14 10:27 ` Ian Jackson
2016-06-06 10:52 ` [PATCH 6/6] libxl: log file name in failure in libxl__create_qemu_logfile Wei Liu
2016-06-14 10:28 ` Ian Jackson
2016-06-14 13:10 ` [PATCH 0/6] xl/libxl: some cleanup / debugging aid patches Wei Liu
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=1465210332-25440-4-git-send-email-wei.liu2@citrix.com \
--to=wei.liu2@citrix.com \
--cc=Ian.Jackson@eu.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 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).