[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: linux hotplug: clean up get_hotplug_env
commit 5e6e8546cf975b12c36b96c1b495bbfd2f0657f5 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Mon Jun 6 11:52:09 2016 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Jun 14 14:31:26 2016 +0100 libxl: linux hotplug: clean up get_hotplug_env 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@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- 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; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |