From nobody Mon Feb 9 17:37:04 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1582721291; cv=none; d=zohomail.com; s=zohoarc; b=bMr67pbxOORvqUTFEj9zFKzV/qAR30hZiHVc8xnc8Kz70AgWiWpvtPzTSh0NENzf/2UQCeefcMAYWm6o7imHxYfiV/SfmWp/x997CAvMf9nXfa67bA9ruEh5lxKPTcIdR5vZmnPdnEqtlgOoReLXbalL+URtj5ju3/UWBe1VzJk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582721291; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ps8nhZ0XdOemDIUr8Etn+CSQzzd4vgOaQvQoHhLJumk=; b=gTKdLbLGY/Z5qz1ebdzr3GcqdL24gX07oCWB6UFREvfQyLodtq7vuaaJiAwMlcJCtSno8p+RvI5x5H/3enVe6fPCRAOOPE8mWXpua/HNELcrfDs927sKkrdjH9TRH3+r8RsSabJIZTWqYH7HQj+HauiMLoHIco7m7ujNRdOYySQ= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1582721291476995.4305772313078; Wed, 26 Feb 2020 04:48:11 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6w66-0002Lw-P0; Wed, 26 Feb 2020 12:47:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1j6w65-0002Kx-Hf for xen-devel@lists.xenproject.org; Wed, 26 Feb 2020 12:47:29 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1ad9e654-5896-11ea-aba8-bc764e2007e4; Wed, 26 Feb 2020 12:47:11 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 18E77B018; Wed, 26 Feb 2020 12:47:10 +0000 (UTC) X-Inumbo-ID: 1ad9e654-5896-11ea-aba8-bc764e2007e4 X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 26 Feb 2020 13:47:03 +0100 Message-Id: <20200226124705.29212-11-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20200226124705.29212-1-jgross@suse.com> References: <20200226124705.29212-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v6 10/12] tools/libxl: use libxenhypfs for setting xen runtime parameters X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Anthony PERARD , Ian Jackson , Wei Liu MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Instead of xc_set_parameters() use xenhypfs_write() for setting parameters of the hypervisor. Signed-off-by: Juergen Gross --- 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 a04697a33c..4b3fcef90b 100644 --- a/tools/Rules.mk +++ b/tools/Rules.mk @@ -180,7 +180,7 @@ CFLAGS +=3D -O2 -fomit-frame-pointer endif =20 CFLAGS_libxenlight =3D -I$(XEN_XENLIGHT) $(CFLAGS_libxenctrl) $(CFLAGS_xen= include) -SHDEPS_libxenlight =3D $(SHLIB_libxenctrl) $(SHLIB_libxenstore) +SHDEPS_libxenlight =3D $(SHLIB_libxenctrl) $(SHLIB_libxenstore) $(SHLIB_li= bxenhypfs) LDLIBS_libxenlight =3D $(SHDEPS_libxenlight) $(XEN_XENLIGHT)/libxenlight$(= libextension) SHLIB_libxenlight =3D $(SHDEPS_libxenlight) -Wl,-rpath-link=3D$(XEN_XENLI= GHT) =20 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 +=3D -luuid endif =20 LIBXL_LIBS =3D -LIBXL_LIBS =3D $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_lib= xenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libxentoolcor= e) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) +LIBXL_LIBS =3D $(LDLIBS_libxentoollog) $(LDLIBS_libxenevtchn) $(LDLIBS_lib= xenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenhypfs) $(LDLIBS_libxenstore) = $(LDLIBS_libxentoolcore) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS) ifeq ($(CONFIG_LIBNL),y) LIBXL_LIBS +=3D $(LIBNL3_LIBS) endif @@ -33,6 +33,7 @@ CFLAGS_LIBXL +=3D $(CFLAGS_libxentoolcore) CFLAGS_LIBXL +=3D $(CFLAGS_libxenevtchn) CFLAGS_LIBXL +=3D $(CFLAGS_libxenctrl) CFLAGS_LIBXL +=3D $(CFLAGS_libxenguest) +CFLAGS_LIBXL +=3D $(CFLAGS_libxenhypfs) CFLAGS_LIBXL +=3D $(CFLAGS_libxenstore) ifeq ($(CONFIG_LIBNL),y) CFLAGS_LIBXL +=3D $(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; =20 - ret =3D xc_set_parameters(ctx->xch, params); - if (ret < 0) { - LOGEV(ERROR, ret, "setting parameters"); - GC_FREE; - return ERROR_FAIL; + hypfs =3D xenhypfs_open(ctx->lg, 0); + if (!hypfs) { + LOGE(ERROR, "opening Xen hypfs"); + ret =3D ERROR_FAIL; + goto out; } + + while (isblank(*params)) + params++; + + for (par =3D params; *par; par =3D end) { + end =3D strchr(par, ' '); + if (!end) + end =3D par + strlen(par); + + val =3D strchr(par, '=3D'); + if (val > end) + val =3D NULL; + if (!val && !strncmp(par, "no", 2)) { + path =3D libxl__sprintf(gc, "/params/%s", par + 2); + path[end - par - 2 + 8] =3D 0; + val =3D "no"; + par +=3D 2; + } else { + path =3D libxl__sprintf(gc, "/params/%s", par); + path[val - par + 8] =3D 0; + val =3D libxl__strndup(gc, val + 1, end - val - 1); + } + + LOG(DEBUG, "setting node \"%s\" to value \"%s\"", path, val); + ret =3D xenhypfs_write(hypfs, path, val); + if (ret < 0) { + LOGE(ERROR, "setting parameters"); + ret =3D ERROR_FAIL; + goto out; + } + + while (isblank(*end)) + end++; + } + + ret =3D 0; + +out: + xenhypfs_close(hypfs); GC_FREE; - return 0; + return ret; } =20 static int fd_set_flags(libxl_ctx *ctx, int fd, diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 43e5885d1e..d970e91ca0 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -56,6 +56,7 @@ #define XC_WANT_COMPAT_MAP_FOREIGN_API #include #include +#include #include =20 #include diff --git a/tools/libxl/xenlight.pc.in b/tools/libxl/xenlight.pc.in index c0f769fd20..6b351ba096 100644 --- a/tools/libxl/xenlight.pc.in +++ b/tools/libxl/xenlight.pc.in @@ -9,4 +9,4 @@ Description: The Xenlight library for Xen hypervisor Version: @@version@@ Cflags: -I${includedir} Libs: @@libsflag@@${libdir} -lxenlight -Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore +Requires.private: xentoollog,xenevtchn,xencontrol,xenguest,xenstore,xenhyp= fs diff --git a/tools/xl/xl_misc.c b/tools/xl/xl_misc.c index 20ed605f4f..08f0fb6dc9 100644 --- a/tools/xl/xl_misc.c +++ b/tools/xl/xl_misc.c @@ -168,7 +168,6 @@ int main_set_parameters(int argc, char **argv) =20 if (libxl_set_parameters(ctx, params)) { fprintf(stderr, "cannot set parameters: %s\n", params); - fprintf(stderr, "Use \"xl dmesg\" to look for possible reason.\n"); return EXIT_FAILURE; } =20 --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel