1 /******************************************************************************
4 * XenLinux virtual block-device tap.
6 * Copyright (c) 2004, Andrew Warfield
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
13 * Note that unlike the split block driver code, this driver has been developed
14 * strictly for Linux 2.6
19 int __init xlblktap_init(void)
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");
44 blkif_interface_init();
45 blkdev_schedule_init();
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");
62 DPRINTK("Blkif tap device initialized.\n");
67 #if 0 /* tap doesn't handle suspend/resume */
68 void blkdev_suspend(void)
72 void blkdev_resume(void)
75 blkif_fe_driver_status_t st;
77 /* Send a driver-UP notification to the domain controller. */
78 cmsg.type = CMSG_BLKIF_FE;
79 cmsg.subtype = CMSG_BLKIF_FE_DRIVER_STATUS;
80 cmsg.length = sizeof(blkif_fe_driver_status_t);
81 st.status = BLKIF_DRIVER_STATUS_UP;
82 memcpy(cmsg.msg, &st, sizeof(st));
83 ctrl_if_send_message_block(&cmsg, NULL, 0, TASK_UNINTERRUPTIBLE);
87 __initcall(xlblktap_init);