direct-io.hg
changeset 10155:1a18ca9a4a0b
Fix xc_tbuf.c indentation and stop turning failure to change
trace-buffer size into a fatal error.
Signed-off-by: Keir Fraser <keir@xensource.com>
trace-buffer size into a fatal error.
Signed-off-by: Keir Fraser <keir@xensource.com>
author | kaf24@firebug.cl.cam.ac.uk |
---|---|
date | Thu May 25 14:42:07 2006 +0100 (2006-05-25) |
parents | 0f162a135140 |
children | b36697ed766c |
files | tools/libxc/xc_tbuf.c |
line diff
1.1 --- a/tools/libxc/xc_tbuf.c Thu May 25 14:37:55 2006 +0100 1.2 +++ b/tools/libxc/xc_tbuf.c Thu May 25 14:42:07 2006 +0100 1.3 @@ -18,53 +18,57 @@ 1.4 1.5 static int tbuf_enable(int xc_handle, int enable) 1.6 { 1.7 - DECLARE_DOM0_OP; 1.8 + DECLARE_DOM0_OP; 1.9 1.10 - op.cmd = DOM0_TBUFCONTROL; 1.11 - op.interface_version = DOM0_INTERFACE_VERSION; 1.12 - if (enable) 1.13 - op.u.tbufcontrol.op = DOM0_TBUF_ENABLE; 1.14 - else 1.15 - op.u.tbufcontrol.op = DOM0_TBUF_DISABLE; 1.16 + op.cmd = DOM0_TBUFCONTROL; 1.17 + op.interface_version = DOM0_INTERFACE_VERSION; 1.18 + if (enable) 1.19 + op.u.tbufcontrol.op = DOM0_TBUF_ENABLE; 1.20 + else 1.21 + op.u.tbufcontrol.op = DOM0_TBUF_DISABLE; 1.22 1.23 - return xc_dom0_op(xc_handle, &op); 1.24 + return xc_dom0_op(xc_handle, &op); 1.25 } 1.26 1.27 int xc_tbuf_set_size(int xc_handle, unsigned long size) 1.28 { 1.29 - DECLARE_DOM0_OP; 1.30 + DECLARE_DOM0_OP; 1.31 1.32 - op.cmd = DOM0_TBUFCONTROL; 1.33 - op.interface_version = DOM0_INTERFACE_VERSION; 1.34 - op.u.tbufcontrol.op = DOM0_TBUF_SET_SIZE; 1.35 - op.u.tbufcontrol.size = size; 1.36 + op.cmd = DOM0_TBUFCONTROL; 1.37 + op.interface_version = DOM0_INTERFACE_VERSION; 1.38 + op.u.tbufcontrol.op = DOM0_TBUF_SET_SIZE; 1.39 + op.u.tbufcontrol.size = size; 1.40 1.41 - return xc_dom0_op(xc_handle, &op); 1.42 + return xc_dom0_op(xc_handle, &op); 1.43 } 1.44 1.45 int xc_tbuf_get_size(int xc_handle, unsigned long *size) 1.46 { 1.47 - int rc; 1.48 - DECLARE_DOM0_OP; 1.49 + int rc; 1.50 + DECLARE_DOM0_OP; 1.51 1.52 - op.cmd = DOM0_TBUFCONTROL; 1.53 - op.interface_version = DOM0_INTERFACE_VERSION; 1.54 - op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO; 1.55 + op.cmd = DOM0_TBUFCONTROL; 1.56 + op.interface_version = DOM0_INTERFACE_VERSION; 1.57 + op.u.tbufcontrol.op = DOM0_TBUF_GET_INFO; 1.58 1.59 - rc = xc_dom0_op(xc_handle, &op); 1.60 - if (rc == 0) 1.61 - *size = op.u.tbufcontrol.size; 1.62 - return rc; 1.63 + rc = xc_dom0_op(xc_handle, &op); 1.64 + if (rc == 0) 1.65 + *size = op.u.tbufcontrol.size; 1.66 + return rc; 1.67 } 1.68 1.69 int xc_tbuf_enable(int xc_handle, size_t cnt, unsigned long *mfn, 1.70 - unsigned long *size) 1.71 + unsigned long *size) 1.72 { 1.73 DECLARE_DOM0_OP; 1.74 int rc; 1.75 1.76 - if ( xc_tbuf_set_size(xc_handle, cnt) != 0 ) 1.77 - return -1; 1.78 + /* 1.79 + * Ignore errors (at least for now) as we get an error if size is already 1.80 + * set (since trace buffers cannot be reallocated). If we really have no 1.81 + * buffers at all then tbuf_enable() will fail, so this is safe. 1.82 + */ 1.83 + (void)xc_tbuf_set_size(xc_handle, cnt); 1.84 1.85 if ( tbuf_enable(xc_handle, 1) != 0 ) 1.86 return -1;