xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>
Subject: [PATCH v2 4/5] libxl: introduce APIs to get and set log level
Date: Mon, 4 Jul 2016 16:13:25 +0100	[thread overview]
Message-ID: <1467645206-28142-5-git-send-email-wei.liu2@citrix.com> (raw)
In-Reply-To: <1467645206-28142-1-git-send-email-wei.liu2@citrix.com>

Signed-off-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <JBeulich@suse.com>
---
 tools/libxl/libxl.c | 40 ++++++++++++++++++++++++++++++++++++++++
 tools/libxl/libxl.h | 11 +++++++++++
 2 files changed, 51 insertions(+)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 1c81239..ff70af7 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -6599,6 +6599,46 @@ int libxl_send_debug_keys(libxl_ctx *ctx, char *keys)
     return 0;
 }
 
+int libxl_set_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, char *upper_thresh)
+{
+    int rc, ret;
+    GC_INIT(ctx);
+
+    ret = xc_set_log_level(ctx->xch, guest, lower_thresh, upper_thresh);
+    if (ret) {
+        LOGE(ERROR, "unable to set log level");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = 0;
+out:
+    GC_FREE;
+    return rc;
+}
+
+int libxl_get_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, unsigned int *lower_thresh_bufsize,
+                        char *upper_thresh, unsigned int *upper_thresh_bufsize)
+{
+    int rc, ret;
+    GC_INIT(ctx);
+
+    ret = xc_get_log_level(ctx->xch, guest, lower_thresh, lower_thresh_bufsize,
+                           upper_thresh, upper_thresh_bufsize);
+    if (ret) {
+        LOGE(ERROR, "unable to get log level");
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    rc = 0;
+out:
+    GC_FREE;
+    return rc;
+}
+
 libxl_xen_console_reader *
     libxl_xen_console_read_start(libxl_ctx *ctx, int clear)
 {
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
index 2c0f868..c460d11 100644
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -67,6 +67,12 @@
  * the same $(XEN_VERSION) (e.g. throughout a major release).
  */
 
+/* LIBXL_HAVE_GET_SET_LOG_LEVEL
+ *
+ * If this is defined libxl has a pair of APIs to get and set log levels
+ */
+#define LIBXL_HAVE_GET_SET_LOG_LEVEL 1
+
 /* LIBXL_HAVE_VNUMA
  *
  * If this is defined the type libxl_vnode_info exists, and a
@@ -1951,6 +1957,11 @@ int libxl_send_trigger(libxl_ctx *ctx, uint32_t domid,
                        libxl_trigger trigger, uint32_t vcpuid);
 int libxl_send_sysrq(libxl_ctx *ctx, uint32_t domid, char sysrq);
 int libxl_send_debug_keys(libxl_ctx *ctx, char *keys);
+int libxl_set_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, char *upper_thresh);
+int libxl_get_log_level(libxl_ctx *ctx, bool guest,
+                        char *lower_thresh, unsigned int *lower_thresh_bufsize,
+                        char *upper_thresh, unsigned int *upper_thresh_bufsize);
 
 typedef struct libxl__xen_console_reader libxl_xen_console_reader;
 
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-07-04 15:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04 15:13 [PATCH v2 0/5] Allow runtime adjustment to log level thresholds Wei Liu
2016-07-04 15:13 ` [PATCH v2 1/5] xen/console: consolidate log levels to an array Wei Liu
2016-07-04 15:28   ` Wei Liu
2016-07-07 10:39   ` Jan Beulich
2016-07-04 15:13 ` [PATCH v2 2/5] xen/console: allow log level threshold adjustments Wei Liu
2016-07-05 17:52   ` Daniel De Graaf
2016-07-06 11:14   ` Ian Jackson
2016-07-07 11:51   ` Jan Beulich
2016-07-04 15:13 ` [PATCH v2 3/5] libxc: wrapper for log level sysctl Wei Liu
2016-07-06 11:11   ` Ian Jackson
2016-07-04 15:13 ` Wei Liu [this message]
2016-07-06 11:15   ` [PATCH v2 4/5] libxl: introduce APIs to get and set log level Ian Jackson
2016-07-04 15:13 ` [PATCH v2 5/5] xl: new loglvl command 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=1467645206-28142-5-git-send-email-wei.liu2@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.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).