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) {