ia64/xen-unstable

view tools/blktap/blkdump.c @ 6946:e703abaf6e3d

Add behaviour to the remove methods to remove the transaction's path itself. This allows us to write Remove(path) to remove the specified path rather than having to slice the path ourselves.
author emellor@ewan
date Sun Sep 18 14:42:13 2005 +0100 (2005-09-18)
parents 3233e7ecfa9f
children 06d84bf87159
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 }