debuggers.hg

view tools/blktap/blkdump.c @ 6649:f59e0163540e

Updates to blktap driver and user code.

Mostly this makes the tap code work again with all of the changes that
have happened to the block drivers recently. We now use a shared page
per VBD (to the driver), and handle control information through the
store. The taplib interfaces have changed to be based around per-vbd
data structures that you can attach arbitrary handlers for.

There is also initial code for a user-level blockback driver, which
aims to get around the use of loopbacks for file-based vbds. Still
plenty of work to do here -- this is a working incremental checkin and
I'm away from this for the next four weeks.

Signed-off-by: Andrew Warfield <andrew.warfield@cl.cam.ac.uk>
author akw27@arcadians.cl.cam.ac.uk
date Sun Sep 04 21:19:44 2005 +0000 (2005-09-04)
parents 45a82b5f9fbe
children b2f4823b6ff0 b35215021b32 9af349b055e5 3233e7ecfa9f
line source
1 /* blkdump.c
2 *
3 * show a running trace of block requests as they fly by.
4 *
5 * (c) 2004 Andrew Warfield.
6 */
8 #include <stdio.h>
9 #include "blktaplib.h"
11 int request_print(blkif_request_t *req)
12 {
13 int i;
14 unsigned long fas;
16 if ( (req->operation == BLKIF_OP_READ) ||
17 (req->operation == BLKIF_OP_WRITE) )
18 {
19 printf("[%2u:%2u<%5s] (nr_segs: %03u, dev: %03u, %010llu)\n",
20 ID_TO_DOM(req->id), ID_TO_IDX(req->id),
21 blkif_op_name[req->operation],
22 req->nr_segments, req->handle,
23 req->sector_number);
26 for (i=0; i < req->nr_segments; i++) {
27 fas = req->frame_and_sects[i];
28 printf(" (pf: 0x%8lx start: %lu stop: %lu)\n",
29 (fas & PAGE_MASK),
30 blkif_first_sect(fas),
31 blkif_last_sect(fas)
32 );
33 }
35 } else {
36 printf("Unknown request message type.\n");
37 }
39 return BLKTAP_PASS;
40 }
42 int response_print(blkif_response_t *rsp)
43 {
44 if ( (rsp->operation == BLKIF_OP_READ) ||
45 (rsp->operation == BLKIF_OP_WRITE) )
46 {
47 printf("[%2u:%2u>%5s] (status: %d)\n",
48 ID_TO_DOM(rsp->id), ID_TO_IDX(rsp->id),
49 blkif_op_name[rsp->operation],
50 rsp->status);
52 } else {
53 printf("Unknown request message type.\n");
54 }
55 return BLKTAP_PASS;
56 }
58 int main(int argc, char *argv[])
59 {
60 blktap_register_request_hook("request_print", request_print);
61 blktap_register_response_hook("response_print", response_print);
62 blktap_listen();
64 return 0;
65 }