From patchwork Fri Mar 4 16:47:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 8506301 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 833889F7CA for ; Fri, 4 Mar 2016 16:50:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9BDF52013A for ; Fri, 4 Mar 2016 16:50:19 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2AF920125 for ; Fri, 4 Mar 2016 16:50:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abst8-000336-1N; Fri, 04 Mar 2016 16:47:38 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1abst6-00032s-Ih for xen-devel@lists.xenproject.org; Fri, 04 Mar 2016 16:47:36 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id D3/FB-25882-72CB9D65; Fri, 04 Mar 2016 16:47:35 +0000 X-Env-Sender: JBeulich@suse.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1457110052!10860577!1 X-Originating-IP: [137.65.248.74] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 60229 invoked from network); 4 Mar 2016 16:47:34 -0000 Received: from prv-mh.provo.novell.com (HELO prv-mh.provo.novell.com) (137.65.248.74) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 4 Mar 2016 16:47:34 -0000 Received: from INET-PRV-MTA by prv-mh.provo.novell.com with Novell_GroupWise; Fri, 04 Mar 2016 09:47:32 -0700 Message-Id: <56D9CA3402000078000D9931@prv-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 14.2.0 Date: Fri, 04 Mar 2016 09:47:32 -0700 From: "Jan Beulich" To: "xen-devel" References: <56D9C80702000078000D9910@prv-mh.provo.novell.com> In-Reply-To: <56D9C80702000078000D9910@prv-mh.provo.novell.com> Mime-Version: 1.0 Cc: Ian Jackson , Wei Liu , Stefano Stabellini Subject: [Xen-devel] [PATCH v2 2/3] libxc: wrapper for log level sysctl X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Jan Beulich libxc: wrapper for log level sysctl Signed-off-by: Jan Beulich --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1120,6 +1120,11 @@ int xc_readconsolering(xc_interface *xch int xc_send_debug_keys(xc_interface *xch, char *keys); +int xc_get_log_level(xc_interface *xch, bool guest, + int *lower_thresh, int *upper_thresh); +int xc_set_log_level(xc_interface *xch, bool guest, + int lower_thresh, int upper_thresh); + typedef xen_sysctl_physinfo_t xc_physinfo_t; typedef xen_sysctl_cputopo_t xc_cputopo_t; typedef xen_sysctl_numainfo_t xc_numainfo_t; --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -184,6 +184,55 @@ int xc_send_debug_keys(xc_interface *xch return ret; } +int xc_get_log_level(xc_interface *xch, bool guest, + int *lower_thresh, int *upper_thresh) +{ + int ret; + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_loglvl_op; + sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_get; + ret = do_sysctl(xch, &sysctl); + + if ( guest ) + { + *lower_thresh = sysctl.u.loglvl.guest.lower_thresh; + *upper_thresh = sysctl.u.loglvl.guest.upper_thresh; + } + else + { + *lower_thresh = sysctl.u.loglvl.host.lower_thresh; + *upper_thresh = sysctl.u.loglvl.host.upper_thresh; + } + + return ret; +} + +int xc_set_log_level(xc_interface *xch, bool guest, + int lower_thresh, int upper_thresh) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_loglvl_op; + sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_set; + if ( guest ) + { + sysctl.u.loglvl.host.lower_thresh = -1; + sysctl.u.loglvl.host.upper_thresh = -1; + sysctl.u.loglvl.guest.lower_thresh = lower_thresh; + sysctl.u.loglvl.guest.upper_thresh = upper_thresh; + } + else + { + sysctl.u.loglvl.host.lower_thresh = lower_thresh; + sysctl.u.loglvl.host.upper_thresh = upper_thresh; + sysctl.u.loglvl.guest.lower_thresh = -1; + sysctl.u.loglvl.guest.upper_thresh = -1; + } + + return do_sysctl(xch, &sysctl); +} + int xc_physinfo(xc_interface *xch, xc_physinfo_t *put_info) { Reviewed-by: Dario Faggioli Acked-by: Wei Liu --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -1120,6 +1120,11 @@ int xc_readconsolering(xc_interface *xch int xc_send_debug_keys(xc_interface *xch, char *keys); +int xc_get_log_level(xc_interface *xch, bool guest, + int *lower_thresh, int *upper_thresh); +int xc_set_log_level(xc_interface *xch, bool guest, + int lower_thresh, int upper_thresh); + typedef xen_sysctl_physinfo_t xc_physinfo_t; typedef xen_sysctl_cputopo_t xc_cputopo_t; typedef xen_sysctl_numainfo_t xc_numainfo_t; --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -184,6 +184,55 @@ int xc_send_debug_keys(xc_interface *xch return ret; } +int xc_get_log_level(xc_interface *xch, bool guest, + int *lower_thresh, int *upper_thresh) +{ + int ret; + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_loglvl_op; + sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_get; + ret = do_sysctl(xch, &sysctl); + + if ( guest ) + { + *lower_thresh = sysctl.u.loglvl.guest.lower_thresh; + *upper_thresh = sysctl.u.loglvl.guest.upper_thresh; + } + else + { + *lower_thresh = sysctl.u.loglvl.host.lower_thresh; + *upper_thresh = sysctl.u.loglvl.host.upper_thresh; + } + + return ret; +} + +int xc_set_log_level(xc_interface *xch, bool guest, + int lower_thresh, int upper_thresh) +{ + DECLARE_SYSCTL; + + sysctl.cmd = XEN_SYSCTL_loglvl_op; + sysctl.u.loglvl.cmd = XEN_SYSCTL_LOGLVL_set; + if ( guest ) + { + sysctl.u.loglvl.host.lower_thresh = -1; + sysctl.u.loglvl.host.upper_thresh = -1; + sysctl.u.loglvl.guest.lower_thresh = lower_thresh; + sysctl.u.loglvl.guest.upper_thresh = upper_thresh; + } + else + { + sysctl.u.loglvl.host.lower_thresh = lower_thresh; + sysctl.u.loglvl.host.upper_thresh = upper_thresh; + sysctl.u.loglvl.guest.lower_thresh = -1; + sysctl.u.loglvl.guest.upper_thresh = -1; + } + + return do_sysctl(xch, &sysctl); +} + int xc_physinfo(xc_interface *xch, xc_physinfo_t *put_info) {