From: Wei Liu <wl@xen.org>
To: Juergen Gross <jgross@suse.com>
Cc: Anthony PERARD <anthony.perard@citrix.com>,
xen-devel@lists.xenproject.org,
Ian Jackson <ian.jackson@eu.citrix.com>, Wei Liu <wl@xen.org>
Subject: Re: [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters
Date: Tue, 19 May 2020 08:17:18 +0000 [thread overview]
Message-ID: <20200519081718.tkp7rsd3fseqmyzv@liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net> (raw)
In-Reply-To: <20200519072106.26894-11-jgross@suse.com>
On Tue, May 19, 2020 at 09:21:04AM +0200, Juergen Gross wrote:
> Instead of xc_set_parameters() use xenhypfs_write() for setting
> parameters of the hypervisor.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
> V6:
> - new patch
> ---
> tools/Rules.mk | 2 +-
> tools/libxl/Makefile | 3 +-
> tools/libxl/libxl.c | 53 ++++++++++++++++++++++++++++++++----
> tools/libxl/libxl_internal.h | 1 +
> tools/libxl/xenlight.pc.in | 2 +-
> tools/xl/xl_misc.c | 1 -
> 6 files changed, 52 insertions(+), 10 deletions(-)
>
> diff --git a/tools/Rules.mk b/tools/Rules.mk
> index ad6073fcad..883a193f9e 100644
> --- a/tools/Rules.mk
> +++ b/tools/Rules.mk
> @@ -178,7 +178,7 @@ CFLAGS += -O2 -fomit-frame-pointer
> endif
>
> CFLAGS_libxenlight = -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xeninclude)
> -SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore)
> +SHDEPS_libxenlight = $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_libxenhypfs)
> LDLIBS_libxenlight = $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(libextension)
> SHLIB_libxenlight = $(SHDEPS_libxenlight) -Wl,-rpath-link=$(XEN_XENLIGHT)
>
> diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
> index 69fcf21577..a89ebab0b4 100644
> --- a/tools/libxl/Makefile
> +++ b/tools/libxl/Makefile
> @@ -20,7 +20,7 @@ LIBUUID_LIBS += -luuid
> endif
>
> LIBXL_LIBS =
> -LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
> +LIBXL_LIBS = $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenhypfs) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
> ifeq ($(CONFIG_LIBNL),y)
> LIBXL_LIBS += $(LIBNL3_LIBS)
> endif
> @@ -33,6 +33,7 @@ CFLAGS_LIBXL += $(CFLAGS_libxentoolcore)
> CFLAGS_LIBXL += $(CFLAGS_libxenevtchn)
> CFLAGS_LIBXL += $(CFLAGS_libxenctrl)
> CFLAGS_LIBXL += $(CFLAGS_libxenguest)
> +CFLAGS_LIBXL += $(CFLAGS_libxenhypfs)
> CFLAGS_LIBXL += $(CFLAGS_libxenstore)
> ifeq ($(CONFIG_LIBNL),y)
> CFLAGS_LIBXL += $(LIBNL3_CFLAGS)
> diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
> index f60fd3e4fd..621acc88f3 100644
> --- a/tools/libxl/libxl.c
> +++ b/tools/libxl/libxl.c
> @@ -663,15 +663,56 @@ int libxl_set_parameters(libxl_ctx *ctx, char *params)
> {
> int ret;
> GC_INIT(ctx);
> + char *par, *val, *end, *path;
> + xenhypfs_handle *hypfs;
>
> - ret = xc_set_parameters(ctx->xch, params);
> - if (ret < 0) {
> - LOGEV(ERROR, ret, "setting parameters");
> - GC_FREE;
> - return ERROR_FAIL;
> + hypfs = xenhypfs_open(ctx->lg, 0);
> + if (!hypfs) {
> + LOGE(ERROR, "opening Xen hypfs");
> + ret = ERROR_FAIL;
> + goto out;
> }
> +
> + while (isblank(*params))
> + params++;
> +
> + for (par = params; *par; par = end) {
> + end = strchr(par, ' ');
> + if (!end)
> + end = par + strlen(par);
> +
> + val = strchr(par, '=');
> + if (val > end)
> + val = NULL;
> + if (!val && !strncmp(par, "no", 2)) {
> + path = libxl__sprintf(gc, "/params/%s", par + 2);
> + path[end - par - 2 + 8] = 0;
> + val = "no";
> + par += 2;
> + } else {
> + path = libxl__sprintf(gc, "/params/%s", par);
> + path[val - par + 8] = 0;
> + val = libxl__strndup(gc, val + 1, end - val - 1);
> + }
> +
> + LOG(DEBUG, "setting node \"%s\" to value \"%s\"", path, val);
Indentation is wrong, but this can be fixed upon committing.
I would very much like the parsing be moved to libxlu. That can wait
till another day.
Acked-by: Wei Liu <wl@xen.org>
next prev parent reply other threads:[~2020-05-19 8:17 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-19 7:20 [PATCH v10 00/12] Add hypervisor sysfs-like support Juergen Gross
2020-05-19 7:20 ` [PATCH v10 01/12] xen/vmx: let opt_ept_ad always reflect the current setting Juergen Gross
2020-05-25 2:23 ` Tian, Kevin
2020-05-19 7:20 ` [PATCH v10 02/12] xen: add a generic way to include binary files as variables Juergen Gross
2020-05-19 7:47 ` Jan Beulich
2020-05-19 7:52 ` Jürgen Groß
2020-05-19 7:58 ` Jan Beulich
2020-05-19 8:14 ` Jürgen Groß
2020-05-19 7:20 ` [PATCH v10 03/12] docs: add feature document for Xen hypervisor sysfs-like support Juergen Gross
2020-05-19 7:20 ` [PATCH v10 04/12] xen: add basic hypervisor filesystem support Juergen Gross
2020-05-21 12:51 ` Julien Grall
2020-05-19 7:20 ` [PATCH v10 05/12] libs: add libxenhypfs Juergen Gross
2020-05-30 15:54 ` Andrew Cooper
2020-06-01 5:27 ` Jürgen Groß
2020-05-19 7:21 ` [PATCH v10 06/12] tools: add xenfs tool Juergen Gross
2020-05-19 7:21 ` [PATCH v10 07/12] xen: provide version information in hypfs Juergen Gross
2020-05-29 8:34 ` Jan Beulich
2020-05-29 9:19 ` Jürgen Groß
2020-05-29 9:53 ` Jan Beulich
2020-05-29 9:56 ` Jürgen Groß
2020-05-19 7:21 ` [PATCH v10 08/12] xen: add /buildinfo/config entry to hypervisor filesystem Juergen Gross
2020-06-02 9:03 ` Andrew Cooper
2020-06-02 10:43 ` Jürgen Groß
2020-05-19 7:21 ` [PATCH v10 09/12] xen: add runtime parameter access support to hypfs Juergen Gross
2020-05-21 12:52 ` Julien Grall
2020-05-19 7:21 ` [PATCH v10 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters Juergen Gross
2020-05-19 8:17 ` Wei Liu [this message]
2020-09-10 20:09 ` Regression: " Andrew Cooper
2020-09-11 5:40 ` Jürgen Groß
2020-05-19 7:21 ` [PATCH v10 11/12] tools/libxc: remove xc_set_parameters() Juergen Gross
2020-05-19 8:09 ` Wei Liu
2020-05-19 7:21 ` [PATCH v10 12/12] xen: remove XEN_SYSCTL_set_parameter support Juergen Gross
2020-05-19 7:30 ` [PATCH v10 00/12] Add hypervisor sysfs-like support Jürgen Groß
2020-05-19 7:45 ` Jan Beulich
2020-05-19 8:06 ` Paul Durrant
2020-05-25 7:02 ` Jürgen Groß
2020-05-26 8:00 ` Paul Durrant
2020-05-26 8:08 ` Jan Beulich
2020-05-26 8:18 ` Jürgen Groß
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=20200519081718.tkp7rsd3fseqmyzv@liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net \
--to=wl@xen.org \
--cc=anthony.perard@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jgross@suse.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).