a288b70b13c089f2290d9c330868528bbe84286f
[pandora-kernel.git] / drivers / staging / hv / channel_interface.c
1 /*
2  *
3  * Copyright (c) 2009, Microsoft Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16  * Place - Suite 330, Boston, MA 02111-1307 USA.
17  *
18  * Authors:
19  *   Haiyang Zhang <haiyangz@microsoft.com>
20  *   Hank Janssen  <hjanssen@microsoft.com>
21  *
22  */
23 #include <linux/kernel.h>
24 #include <linux/mm.h>
25 #include "osd.h"
26 #include "vmbus_private.h"
27
28 static int ivmbus_open(struct hv_device *device, u32 sendbuffer_size,
29                              u32 recv_ringbuffer_size, void *userdata,
30                              u32 userdatalen,
31                              void (*channel_callback)(void *context),
32                              void *context)
33 {
34         return vmbus_open(device->channel, sendbuffer_size,
35                                 recv_ringbuffer_size, userdata, userdatalen,
36                                 channel_callback, context);
37 }
38
39 static void ivmbus_close(struct hv_device *device)
40 {
41         vmbus_close(device->channel);
42 }
43
44 static int ivmbus_sendpacket(struct hv_device *device, const void *buffer,
45                                    u32 bufferlen, u64 requestid, u32 type,
46                                    u32 flags)
47 {
48         return vmbus_sendpacket(device->channel, buffer, bufferlen,
49                                       requestid, type, flags);
50 }
51
52 /* vmbus interface function pointer table */
53 const struct vmbus_channel_interface vmbus_ops = {
54         .Open = ivmbus_open,
55         .Close = ivmbus_close,
56         .SendPacket = ivmbus_sendpacket,
57 };