int xc_tbuf_enable(xc_interface *xch, unsigned long pages, unsigned long *mfn, unsigned long *size) { DECLARE_SYSCTL; int rc; /* * Ignore errors (at least for now) as we get an error if size is already * set (since trace buffers cannot be reallocated). If we really have no * buffers at all then tbuf_enable() will fail, so this is safe. */ (void)xc_tbuf_set_size(xch, pages); if ( tbuf_enable(xch, 1) != 0 ) return -1; sysctl.cmd = XEN_SYSCTL_tbuf_op; sysctl.interface_version = XEN_SYSCTL_INTERFACE_VERSION; sysctl.u.tbuf_op.cmd = XEN_SYSCTL_TBUFOP_get_info; rc = xc_sysctl(xch, &sysctl); if ( rc == 0 ) { *size = sysctl.u.tbuf_op.size; *mfn = sysctl.u.tbuf_op.buffer_mfn; } return 0; }
int xc_tbuf_disable(xc_interface *xch) { return tbuf_enable(xch, 0); }
int xc_tbuf_disable(int xc_handle) { return tbuf_enable(xc_handle, 0); }