ia64/xen-unstable
changeset 930:5e91938ceb1b
bitkeeper revision 1.591 (3fb01fdfj4CR6YQAASBrZd-6TBRWAQ)
Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/smh22/xeno.bk
Merge labyrinth.cl.cam.ac.uk:/auto/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/auto/anfs/scratch/labyrinth/smh22/xeno.bk
author | iap10@labyrinth.cl.cam.ac.uk |
---|---|
date | Mon Nov 10 23:31:43 2003 +0000 (2003-11-10) |
parents | 8dd462437867 d684fdc4329e |
children | f1177a48a360 |
files | .rootkeys tools/internal/xi_vbd_add.c tools/internal/xi_vbd_create.c tools/internal/xi_vbd_info.c tools/internal/xi_vbd_list.c |
line diff
1.1 --- a/.rootkeys Mon Nov 10 22:49:02 2003 +0000 1.2 +++ b/.rootkeys Mon Nov 10 23:31:43 2003 +0000 1.3 @@ -177,6 +177,10 @@ 3f108ade1v8weyh1sKx890VTd240Hw tools/int 1.4 3eb781fd8oRfPgH7qTh7xvgmwD6NgA tools/internal/xi_start.c 1.5 3eb781fd0Eo9K1jEFCSAVzO51i_ngg tools/internal/xi_stop.c 1.6 3f108ae2to5nHRRXfvUK7oxgjcW_yA tools/internal/xi_usage.c 1.7 +3fb01fd5CGkDlZddcIlPxLwrquLqKA tools/internal/xi_vbd_add.c 1.8 +3fb01fd5MoGCWdylPicf4UinUjYfDg tools/internal/xi_vbd_create.c 1.9 +3fb01fd54I4P44vZDb1CtDt1BytDtA tools/internal/xi_vbd_info.c 1.10 +3fb01fd5B-UeibZkmSCOUZckNyNFYA tools/internal/xi_vbd_list.c 1.11 3f86be322bd0h9jG3krZFOUgCDoxZg tools/internal/xi_vif_params.c 1.12 3eb781fd7211MZsLxJSiuy7W4KnJXg tools/internal/xi_vifinit 1.13 3f776bd2Xd-dUcPKlPN2vG89VGtfvQ tools/misc/Makefile
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/tools/internal/xi_vbd_add.c Mon Nov 10 23:31:43 2003 +0000 2.3 @@ -0,0 +1,44 @@ 2.4 + 2.5 +#define _GNU_SOURCE 2.6 +#include "dom0_defs.h" 2.7 + 2.8 +/* 2.9 +** Add an extent to a VBD; the VBD must have been created previously. 2.10 +*/ 2.11 +int main(int argc, char *argv[]) 2.12 +{ 2.13 + block_io_op_t op; 2.14 + unsigned int domain; 2.15 + unsigned short vdevice, device; 2.16 + int ret; 2.17 + 2.18 + if ( argc != 6 ) 2.19 + { 2.20 + fprintf(stderr, "Usage: xi_vbd_add <domain> <vdevice> <device>" 2.21 + "<start sector> <nr_sectors>\n"); 2.22 + return 1; 2.23 + } 2.24 + 2.25 + 2.26 + domain = atoi(argv[1]); 2.27 + device = atoi(argv[2]); 2.28 + vdevice = atoi(argv[3]); 2.29 + 2.30 + op.cmd = BLOCK_IO_OP_VBD_ADD; 2.31 + op.u.add_params.domain = domain; 2.32 + op.u.add_params.vdevice = vdevice; 2.33 + 2.34 + op.u.add_params.extent.device = device; 2.35 + op.u.add_params.extent.start_sector = atol(argv[4]); 2.36 + op.u.add_params.extent.nr_sectors = atol(argv[5]); 2.37 + 2.38 + ret = do_block_io_op(&op); 2.39 + 2.40 + if(ret < 0) { 2.41 + fprintf(stderr, "error %d attempting to add extent to VBD %04x\n", 2.42 + ret, atoi(argv[2])); 2.43 + return ret; 2.44 + } 2.45 + 2.46 + return 0; 2.47 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/internal/xi_vbd_create.c Mon Nov 10 23:31:43 2003 +0000 3.3 @@ -0,0 +1,43 @@ 3.4 + 3.5 +#define _GNU_SOURCE 3.6 +#include "dom0_defs.h" 3.7 + 3.8 +/* 3.9 +** Create a new VBD for a given domain; the VBD can be read-only or 3.10 +** read/write, and will be referred to by the relevant domain as 'vdevice'. 3.11 +*/ 3.12 +int main(int argc, char *argv[]) 3.13 +{ 3.14 + block_io_op_t op; 3.15 + unsigned int domain; 3.16 + unsigned short vdevice; 3.17 + int ret; 3.18 + 3.19 + if ( argc != 4 ) 3.20 + { 3.21 + fprintf(stderr, "Usage: xi_vbd_create <domain> <vdevice> <r/rw>\n"); 3.22 + return 1; 3.23 + } 3.24 + 3.25 + domain = atoi(argv[1]); 3.26 + vdevice = atoi(argv[2]); 3.27 + 3.28 + op.cmd = BLOCK_IO_OP_VBD_CREATE; 3.29 + op.u.create_params.domain = domain; 3.30 + op.u.create_params.vdevice = vdevice; 3.31 + op.u.create_params.mode = 0; 3.32 + if ( strchr(argv[3], 'r') ) 3.33 + op.u.create_params.mode |= VBD_MODE_R; 3.34 + if ( strchr(argv[3], 'w') ) 3.35 + op.u.create_params.mode |= VBD_MODE_W; 3.36 + 3.37 + ret = do_block_io_op(&op); 3.38 + 3.39 + if(ret < 0) { 3.40 + fprintf(stderr, "error %d attempting to create VBD %04x\n", ret, 3.41 + atoi(argv[2])); 3.42 + return ret; 3.43 + } 3.44 + 3.45 + return 0; 3.46 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/internal/xi_vbd_info.c Mon Nov 10 23:31:43 2003 +0000 4.3 @@ -0,0 +1,13 @@ 4.4 + 4.5 +#define _GNU_SOURCE 4.6 +#include "dom0_defs.h" 4.7 + 4.8 + 4.9 +int main(int argc, char *argv[]) 4.10 +{ 4.11 +// block_io_op_t op; 4.12 + 4.13 + // XXX SMH: writeme 4.14 + 4.15 + return 0; 4.16 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/tools/internal/xi_vbd_list.c Mon Nov 10 23:31:43 2003 +0000 5.3 @@ -0,0 +1,65 @@ 5.4 + 5.5 +#define _GNU_SOURCE 5.6 +#include "dom0_defs.h" 5.7 + 5.8 + 5.9 +#define MAX_DISKS 32 5.10 +#define XDA_SIZE (MAX_DISKS * sizeof(xen_disk_t)) 5.11 + 5.12 +/* 5.13 +** List VBDs for oneself or a given domain, or list all VBDs in the system. 5.14 +*/ 5.15 +int main(int argc, char *argv[]) 5.16 +{ 5.17 + block_io_op_t op; 5.18 + unsigned int domain; 5.19 + xen_disk_info_t *xdi; 5.20 + int i, ret; 5.21 + 5.22 + if ( argc > 2 ) { 5.23 + fprintf(stderr, "Usage: xi_vbd_list [ <domain> | all ]\n"); 5.24 + return 1; 5.25 + } 5.26 + 5.27 + /* the default (domain == 0) is to probe for own VBDs */ 5.28 + domain = 0; 5.29 + 5.30 + if ( argc == 2) { 5.31 + if (!strcmp(argv[1], "all")) 5.32 + domain = VBD_PROBE_ALL; 5.33 + else 5.34 + domain = atoi(argv[1]); 5.35 + } 5.36 + 5.37 + /* allocate some space for the result */ 5.38 + op.cmd = BLOCK_IO_OP_VBD_PROBE; 5.39 + op.u.probe_params.domain = domain; 5.40 + op.u.probe_params.xdi.max = MAX_DISKS; 5.41 + op.u.probe_params.xdi.disks = malloc(XDA_SIZE); 5.42 + op.u.probe_params.xdi.count = 0; 5.43 + 5.44 + xdi = &op.u.probe_params.xdi; // convenience 5.45 + 5.46 + if(mlock(xdi->disks, XDA_SIZE) != 0 ) { 5.47 + PERROR("Could not lock memory for Xen hypercall"); 5.48 + return -1; 5.49 + } 5.50 + 5.51 + ret = do_block_io_op(&op); 5.52 + 5.53 + if(ret < 0) 5.54 + fprintf(stderr, "error %d attempting to probe VBDs\n", ret); 5.55 + 5.56 + (void)munlock(xdi->disks, XDA_SIZE); 5.57 + 5.58 + for(i = 0; i < xdi->count; i++) { 5.59 + fprintf(stderr, 5.60 + "Domain %02d %cBD: [R/%c] device %04x capacity %ldkB\n", 5.61 + xdi->disks[i].domain, XD_VIRTUAL(xdi->disks[i].info) ? 'V' : 5.62 + 'P', XD_READONLY(xdi->disks[i].info) ? 'O' : 'W', 5.63 + xdi->disks[i].device, xdi->disks[i].capacity >> 1); 5.64 + } 5.65 + 5.66 + 5.67 + return ret; 5.68 +}