debuggers.hg

view linux-2.6.10-xen-sparse/drivers/xen/blktap/blktap.c @ 3370:72b23176fb04

bitkeeper revision 1.1159.1.506 (41d00f89OifvQoN_EcnO5XuQN0RRjA)

Update to Linux 2.6.10.
author cl349@arcadians.cl.cam.ac.uk
date Mon Dec 27 13:35:05 2004 +0000 (2004-12-27)
parents
children 70b803ca7d24 671aaec9d333 9e77c2678efa
line source
1 /******************************************************************************
2 * blktap.c
3 *
4 * XenLinux virtual block-device tap.
5 *
6 * Copyright (c) 2004, Andrew Warfield
7 *
8 * Based on the original split block driver:
9 * Copyright (c) 2003-2004, Keir Fraser & Steve Hand
10 * Modifications by Mark A. Williamson are (c) Intel Research Cambridge
11 * Copyright (c) 2004, Christian Limpach
12 *
13 * Note that unlike the split block driver code, this driver has been developed
14 * strictly for Linux 2.6
15 */
17 #include "blktap.h"
19 int __init xlblk_init(void)
20 {
21 ctrl_msg_t cmsg;
22 blkif_fe_driver_status_t fe_st;
23 blkif_be_driver_status_t be_st;
25 printk(KERN_INFO "Initialising Xen block tap device\n");
27 DPRINTK(" tap - Backend connection init:\n");
30 (void)ctrl_if_register_receiver(CMSG_BLKIF_FE, blkif_ctrlif_rx,
31 CALLBACK_IN_BLOCKING_CONTEXT);
33 /* Send a driver-UP notification to the domain controller. */
34 cmsg.type = CMSG_BLKIF_FE;
35 cmsg.subtype = CMSG_BLKIF_FE_DRIVER_STATUS;
36 cmsg.length = sizeof(blkif_fe_driver_status_t);
37 fe_st.status = BLKIF_DRIVER_STATUS_UP;
38 memcpy(cmsg.msg, &fe_st, sizeof(fe_st));
39 ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
41 DPRINTK(" tap - Frontend connection init:\n");
43 active_reqs_init();
45 ptfe_blkif.status = DISCONNECTED;
47 (void)ctrl_if_register_receiver(CMSG_BLKIF_BE, blkif_ctrlif_rx,
48 CALLBACK_IN_BLOCKING_CONTEXT);
50 /* Send a driver-UP notification to the domain controller. */
51 cmsg.type = CMSG_BLKIF_BE;
52 cmsg.subtype = CMSG_BLKIF_BE_DRIVER_STATUS;
53 cmsg.length = sizeof(blkif_be_driver_status_t);
54 be_st.status = BLKIF_DRIVER_STATUS_UP;
55 memcpy(cmsg.msg, &be_st, sizeof(be_st));
56 ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
58 DPRINTK(" tap - Userland channel init:\n");
60 blktap_init();
62 DPRINTK("Blkif tap device initialized.\n");
64 return 0;
65 }
67 void blkdev_suspend(void)
68 {
69 }
71 void blkdev_resume(void)
72 {
73 ctrl_msg_t cmsg;
74 blkif_fe_driver_status_t st;
76 /* Send a driver-UP notification to the domain controller. */
77 cmsg.type = CMSG_BLKIF_FE;
78 cmsg.subtype = CMSG_BLKIF_FE_DRIVER_STATUS;
79 cmsg.length = sizeof(blkif_fe_driver_status_t);
80 st.status = BLKIF_DRIVER_STATUS_UP;
81 memcpy(cmsg.msg, &st, sizeof(st));
82 ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
83 }
86 __initcall(xlblk_init);