#include "VmbusPrivate.h"
/* Internal routines */
-static int
-VmbusChannelCreateGpadlHeader(
+static int VmbusChannelCreateGpadlHeader(
void * Kbuffer, /* must be phys and virt contiguous */
u32 Size, /* page-size multiple */
- VMBUS_CHANNEL_MSGINFO **msgInfo,
+ struct vmbus_channel_msginfo **msgInfo,
u32 *MessageCount
);
-
-static void
-DumpVmbusChannel(
- VMBUS_CHANNEL *Channel
- );
-
-
-static void
-VmbusChannelSetEvent(
- VMBUS_CHANNEL *Channel
- );
+static void DumpVmbusChannel(struct vmbus_channel *channel);
+static void VmbusChannelSetEvent(struct vmbus_channel *channel);
#if 0
Trigger an event notification on the specified channel.
--*/
-static void
-VmbusChannelSetEvent(
- VMBUS_CHANNEL *Channel
- )
+static void VmbusChannelSetEvent(struct vmbus_channel *Channel)
{
HV_MONITOR_PAGE *monitorPage;
}
#if 0
-static void
-VmbusChannelClearEvent(
- VMBUS_CHANNEL *Channel
- )
+static void VmbusChannelClearEvent(struct vmbus_channel *channel)
{
HV_MONITOR_PAGE *monitorPage;
Retrieve various channel debug info
--*/
-void
-VmbusChannelGetDebugInfo(
- VMBUS_CHANNEL *Channel,
- VMBUS_CHANNEL_DEBUG_INFO *DebugInfo
- )
+void VmbusChannelGetDebugInfo(struct vmbus_channel *Channel,
+ struct vmbus_channel_debug_info *DebugInfo)
{
HV_MONITOR_PAGE *monitorPage;
u8 monitorGroup = (u8)Channel->OfferMsg.MonitorId / 32;
Open the specified channel.
--*/
-int
-VmbusChannelOpen(
- VMBUS_CHANNEL *NewChannel,
+int VmbusChannelOpen(struct vmbus_channel *NewChannel,
u32 SendRingBufferSize,
u32 RecvRingBufferSize,
void * UserData,
{
int ret=0;
VMBUS_CHANNEL_OPEN_CHANNEL* openMsg;
- VMBUS_CHANNEL_MSGINFO* openInfo;
+ struct vmbus_channel_msginfo *openInfo;
void *in, *out;
unsigned long flags;
SendRingBufferSize);
/* Create and init the channel open message */
- openInfo = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_OPEN_CHANNEL), GFP_KERNEL);
+ openInfo = kmalloc(sizeof(*openInfo) + sizeof(VMBUS_CHANNEL_OPEN_CHANNEL), GFP_KERNEL);
ASSERT(openInfo != NULL);
openInfo->WaitEvent = osd_WaitEventCreate();
VmbusChannelCreateGpadlHeader(
void * Kbuffer, /* from kmalloc() */
u32 Size, /* page-size multiple */
- VMBUS_CHANNEL_MSGINFO **MsgInfo,
+ struct vmbus_channel_msginfo **MsgInfo,
u32 *MessageCount)
{
int i;
unsigned long long pfn;
VMBUS_CHANNEL_GPADL_HEADER* gpaHeader;
VMBUS_CHANNEL_GPADL_BODY* gpadlBody;
- VMBUS_CHANNEL_MSGINFO* msgHeader;
- VMBUS_CHANNEL_MSGINFO* msgBody;
+ struct vmbus_channel_msginfo *msgHeader;
+ struct vmbus_channel_msginfo *msgBody;
u32 msgSize;
int pfnSum, pfnCount, pfnLeft, pfnCurr, pfnSize;
if (pageCount > pfnCount) /* we need a gpadl body */
{
/* fill in the header */
- msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL);
INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList);
pfnCurr = pfnLeft;
}
- msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_BODY) + pfnCurr*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_BODY) + pfnCurr*sizeof(u64);
msgBody = kzalloc(msgSize, GFP_KERNEL);
ASSERT(msgBody);
msgBody->MessageSize = msgSize;
else
{
/* everything fits in a header */
- msgSize = sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pageCount*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pageCount*sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL);
msgHeader->MessageSize=msgSize;
Estabish a GPADL for the specified buffer
--*/
-int
-VmbusChannelEstablishGpadl(
- VMBUS_CHANNEL *Channel,
+int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel,
void * Kbuffer, /* from kmalloc() */
u32 Size, /* page-size multiple */
u32 *GpadlHandle
VMBUS_CHANNEL_GPADL_BODY* gpadlBody;
/* VMBUS_CHANNEL_GPADL_CREATED* gpadlCreated; */
- VMBUS_CHANNEL_MSGINFO *msgInfo;
- VMBUS_CHANNEL_MSGINFO *subMsgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
+ struct vmbus_channel_msginfo *subMsgInfo;
u32 msgCount;
LIST_ENTRY* anchor;
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d", Kbuffer, Size, msgCount);
- DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", msgInfo->MessageSize - sizeof(VMBUS_CHANNEL_MSGINFO));
+ DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", msgInfo->MessageSize - sizeof(*msgInfo));
- ret = VmbusPostMessage(gpadlMsg, msgInfo->MessageSize - sizeof(VMBUS_CHANNEL_MSGINFO));
+ ret = VmbusPostMessage(gpadlMsg, msgInfo->MessageSize - sizeof(*msgInfo));
if (ret != 0)
{
DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret);
{
ITERATE_LIST_ENTRIES(anchor, curr, &msgInfo->SubMsgList)
{
- subMsgInfo = (VMBUS_CHANNEL_MSGINFO*) curr;
+ subMsgInfo = (struct vmbus_channel_msginfo*)curr;
gpadlBody = (VMBUS_CHANNEL_GPADL_BODY*)subMsgInfo->Msg;
gpadlBody->Header.MessageType = ChannelMessageGpadlBody;
gpadlBody->Gpadl = nextGpadlHandle;
- DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", subMsgInfo->MessageSize - sizeof(VMBUS_CHANNEL_MSGINFO));
+ DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", subMsgInfo->MessageSize - sizeof(*subMsgInfo));
- DumpGpadlBody(gpadlBody, subMsgInfo->MessageSize - sizeof(VMBUS_CHANNEL_MSGINFO));
- ret = VmbusPostMessage(gpadlBody, subMsgInfo->MessageSize - sizeof(VMBUS_CHANNEL_MSGINFO));
+ DumpGpadlBody(gpadlBody, subMsgInfo->MessageSize - sizeof(*subMsgInfo));
+ ret = VmbusPostMessage(gpadlBody, subMsgInfo->MessageSize - sizeof(*subMsgInfo));
ASSERT(ret == 0);
}
}
Teardown the specified GPADL handle
--*/
-int
-VmbusChannelTeardownGpadl(
- VMBUS_CHANNEL *Channel,
- u32 GpadlHandle
- )
+int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
{
int ret=0;
VMBUS_CHANNEL_GPADL_TEARDOWN *msg;
- VMBUS_CHANNEL_MSGINFO* info;
+ struct vmbus_channel_msginfo *info;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ASSERT(GpadlHandle != 0);
- info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN), GFP_KERNEL);
+ info = kmalloc(sizeof(*info) + sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN), GFP_KERNEL);
ASSERT(info != NULL);
info->WaitEvent = osd_WaitEventCreate();
Close the specified channel
--*/
-void
-VmbusChannelClose(
- VMBUS_CHANNEL *Channel
- )
+void VmbusChannelClose(struct vmbus_channel *Channel)
{
int ret=0;
VMBUS_CHANNEL_CLOSE_CHANNEL* msg;
- VMBUS_CHANNEL_MSGINFO* info;
+ struct vmbus_channel_msginfo *info;
unsigned long flags;
DPRINT_ENTER(VMBUS);
del_timer(&Channel->poll_timer);
/* Send a closing message */
- info = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL);
+ info = kmalloc(sizeof(*info) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL);
ASSERT(info != NULL);
/* info->waitEvent = osd_WaitEventCreate(); */
Send the specified buffer on the given channel
--*/
-int
-VmbusChannelSendPacket(
- VMBUS_CHANNEL *Channel,
+int VmbusChannelSendPacket(struct vmbus_channel *Channel,
const void * Buffer,
u32 BufferLen,
u64 RequestId,
Send a range of single-page buffer packets using a GPADL Direct packet type.
--*/
-int
-VmbusChannelSendPacketPageBuffer(
- VMBUS_CHANNEL *Channel,
+int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
PAGE_BUFFER PageBuffers[],
u32 PageCount,
void * Buffer,
Send a multi-page buffer packet using a GPADL Direct packet type.
--*/
-int
-VmbusChannelSendPacketMultiPageBuffer(
- VMBUS_CHANNEL *Channel,
+int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,
MULTIPAGE_BUFFER *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
--*/
/* TODO: Do we ever receive a gpa direct packet other than the ones we send ? */
-int VmbusChannelRecvPacket(VMBUS_CHANNEL *Channel,
+int VmbusChannelRecvPacket(struct vmbus_channel *Channel,
void *Buffer,
u32 BufferLen,
u32 *BufferActualLen,
Retrieve the raw packet on the specified channel
--*/
-int
-VmbusChannelRecvPacketRaw(
- VMBUS_CHANNEL *Channel,
+int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel,
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
Channel event callback
--*/
-void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel)
+void VmbusChannelOnChannelEvent(struct vmbus_channel *Channel)
{
DumpVmbusChannel(Channel);
ASSERT(Channel->OnChannelCallback);
--*/
void VmbusChannelOnTimer(unsigned long data)
{
- VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)data;
+ struct vmbus_channel *channel = (struct vmbus_channel *)data;
if (channel->OnChannelCallback)
{
Dump vmbus channel info to the console
--*/
-static void
-DumpVmbusChannel(
- VMBUS_CHANNEL *Channel
- )
+static void DumpVmbusChannel(struct vmbus_channel *Channel)
{
DPRINT_DBG(VMBUS, "Channel (%d)", Channel->OfferMsg.ChildRelId);
DumpRingInfo(&Channel->Outbound, "Outbound ");
} __attribute__((packed));
-extern int VmbusChannelOpen(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelOpen(struct vmbus_channel *channel,
u32 SendRingBufferSize,
u32 RecvRingBufferSize,
void *UserData,
PFN_CHANNEL_CALLBACK pfnOnChannelCallback,
void *Context);
-extern void VmbusChannelClose(VMBUS_CHANNEL *Channel);
+extern void VmbusChannelClose(struct vmbus_channel *channel);
-extern int VmbusChannelSendPacket(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
const void *Buffer,
u32 BufferLen,
u64 RequestId,
VMBUS_PACKET_TYPE Type,
u32 Flags);
-extern int VmbusChannelSendPacketPageBuffer(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
PAGE_BUFFER PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
-extern int VmbusChannelSendPacketMultiPageBuffer(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
MULTIPAGE_BUFFER *MultiPageBuffer,
void *Buffer,
u32 BufferLen,
u64 RequestId);
-extern int VmbusChannelEstablishGpadl(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelEstablishGpadl(struct vmbus_channel *channel,
void *Kbuffer,
u32 Size,
u32 *GpadlHandle);
-extern int VmbusChannelTeardownGpadl(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelTeardownGpadl(struct vmbus_channel *channel,
u32 GpadlHandle);
-extern int VmbusChannelRecvPacket(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelRecvPacket(struct vmbus_channel *channel,
void *Buffer,
u32 BufferLen,
u32 *BufferActualLen,
u64 *RequestId);
-extern int VmbusChannelRecvPacketRaw(VMBUS_CHANNEL *Channel,
+extern int VmbusChannelRecvPacketRaw(struct vmbus_channel *channel,
void *Buffer,
u32 BufferLen,
u32 *BufferActualLen,
u64 *RequestId);
-extern void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel);
+extern void VmbusChannelOnChannelEvent(struct vmbus_channel *channel);
-extern void VmbusChannelGetDebugInfo(VMBUS_CHANNEL *Channel,
- VMBUS_CHANNEL_DEBUG_INFO *DebugInfo);
+extern void VmbusChannelGetDebugInfo(struct vmbus_channel *channel,
+ struct vmbus_channel_debug_info *debug);
extern void VmbusChannelOnTimer(unsigned long data);
void * Context
)
{
- return VmbusChannelOpen( (VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelOpen((struct vmbus_channel *)Device->context,
SendBufferSize,
RecvRingBufferSize,
UserData,
struct hv_device *Device
)
{
- VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
+ VmbusChannelClose((struct vmbus_channel *)Device->context);
}
u32 Flags
)
{
- return VmbusChannelSendPacket((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelSendPacket((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
RequestId,
u64 RequestId
)
{
- return VmbusChannelSendPacketPageBuffer((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelSendPacketPageBuffer((struct vmbus_channel *)Device->context,
PageBuffers,
PageCount,
Buffer,
u64 RequestId
)
{
- return VmbusChannelSendPacketMultiPageBuffer((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelSendPacketMultiPageBuffer((struct vmbus_channel *)Device->context,
MultiPageBuffer,
Buffer,
BufferLen,
u64* RequestId
)
{
- return VmbusChannelRecvPacket((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelRecvPacket((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
BufferActualLen,
u64* RequestId
)
{
- return VmbusChannelRecvPacketRaw((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelRecvPacketRaw((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
BufferActualLen,
u32* GpadlHandle
)
{
- return VmbusChannelEstablishGpadl((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelEstablishGpadl((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
GpadlHandle);
u32 GpadlHandle
)
{
- return VmbusChannelTeardownGpadl((VMBUS_CHANNEL*)Device->context,
+ return VmbusChannelTeardownGpadl((struct vmbus_channel *)Device->context,
GpadlHandle);
}
void GetChannelInfo(struct hv_device *Device, DEVICE_INFO *DeviceInfo)
{
- VMBUS_CHANNEL_DEBUG_INFO debugInfo;
+ struct vmbus_channel_debug_info debugInfo;
if (Device->context)
{
- VmbusChannelGetDebugInfo((VMBUS_CHANNEL*)Device->context, &debugInfo);
+ VmbusChannelGetDebugInfo((struct vmbus_channel *)Device->context, &debugInfo);
DeviceInfo->ChannelId = debugInfo.RelId;
DeviceInfo->ChannelState = debugInfo.State;
Allocate and initialize a vmbus channel object
--*/
-VMBUS_CHANNEL* AllocVmbusChannel(void)
+struct vmbus_channel *AllocVmbusChannel(void)
{
- VMBUS_CHANNEL* channel;
+ struct vmbus_channel *channel;
- channel = kzalloc(sizeof(VMBUS_CHANNEL), GFP_ATOMIC);
+ channel = kzalloc(sizeof(*channel), GFP_ATOMIC);
if (!channel)
{
return NULL;
--*/
static inline void ReleaseVmbusChannel(void* Context)
{
- VMBUS_CHANNEL* channel = (VMBUS_CHANNEL*)Context;
+ struct vmbus_channel *channel = Context;
DPRINT_ENTER(VMBUS);
Release the resources used by the vmbus channel object
--*/
-void FreeVmbusChannel(VMBUS_CHANNEL* Channel)
+void FreeVmbusChannel(struct vmbus_channel *Channel)
{
del_timer(&Channel->poll_timer);
)
{
int ret=0;
- VMBUS_CHANNEL* newChannel=(VMBUS_CHANNEL*)context;
+ struct vmbus_channel *newChannel = context;
+ struct vmbus_channel *channel;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
bool fNew = true;
- VMBUS_CHANNEL* channel;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList)
{
- channel = CONTAINING_RECORD(curr, VMBUS_CHANNEL, ListEntry);
+ channel = CONTAINING_RECORD(curr, struct vmbus_channel, ListEntry);
if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, &newChannel->OfferMsg.Offer.InterfaceType,sizeof(GUID)) &&
!memcmp(&channel->OfferMsg.Offer.InterfaceInstance, &newChannel->OfferMsg.Offer.InterfaceInstance, sizeof(GUID)))
void * context
)
{
- VMBUS_CHANNEL* channel=(VMBUS_CHANNEL*)context;
+ struct vmbus_channel *channel = context;
DPRINT_ENTER(VMBUS);
)
{
VMBUS_CHANNEL_OFFER_CHANNEL* offer = (VMBUS_CHANNEL_OFFER_CHANNEL*)hdr;
- VMBUS_CHANNEL* newChannel;
+ struct vmbus_channel *newChannel;
GUID *guidType;
GUID *guidInstance;
)
{
VMBUS_CHANNEL_RESCIND_OFFER* rescind = (VMBUS_CHANNEL_RESCIND_OFFER*)hdr;
- VMBUS_CHANNEL* channel;
+ struct vmbus_channel *channel;
DPRINT_ENTER(VMBUS);
VMBUS_CHANNEL_OPEN_RESULT* result = (VMBUS_CHANNEL_OPEN_RESULT*)hdr;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
- VMBUS_CHANNEL_MSGINFO* msgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
VMBUS_CHANNEL_MESSAGE_HEADER* requestHeader;
VMBUS_CHANNEL_OPEN_CHANNEL* openMsg;
unsigned long flags;
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
- msgInfo = (VMBUS_CHANNEL_MSGINFO*) curr;
+ msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageOpenChannel)
VMBUS_CHANNEL_GPADL_CREATED *gpadlCreated = (VMBUS_CHANNEL_GPADL_CREATED*)hdr;
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
- VMBUS_CHANNEL_MSGINFO *msgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
VMBUS_CHANNEL_MESSAGE_HEADER *requestHeader;
VMBUS_CHANNEL_GPADL_HEADER *gpadlHeader;
unsigned long flags;
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
- msgInfo = (VMBUS_CHANNEL_MSGINFO*) curr;
+ msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageGpadlHeader)
VMBUS_CHANNEL_GPADL_TORNDOWN* gpadlTorndown = (VMBUS_CHANNEL_GPADL_TORNDOWN*)hdr;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
- VMBUS_CHANNEL_MSGINFO* msgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
VMBUS_CHANNEL_MESSAGE_HEADER *requestHeader;
VMBUS_CHANNEL_GPADL_TEARDOWN *gpadlTeardown;
unsigned long flags;
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
- msgInfo = (VMBUS_CHANNEL_MSGINFO*) curr;
+ msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageGpadlTeardown)
{
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
- VMBUS_CHANNEL_MSGINFO *msgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
VMBUS_CHANNEL_MESSAGE_HEADER *requestHeader;
VMBUS_CHANNEL_INITIATE_CONTACT *initiate;
VMBUS_CHANNEL_VERSION_RESPONSE *versionResponse = (VMBUS_CHANNEL_VERSION_RESPONSE*)hdr;
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
- msgInfo = (VMBUS_CHANNEL_MSGINFO*) curr;
+ msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageInitiateContact)
{
int ret=0;
VMBUS_CHANNEL_MESSAGE_HEADER* msg;
- VMBUS_CHANNEL_MSGINFO* msgInfo;
+ struct vmbus_channel_msginfo *msgInfo;
DPRINT_ENTER(VMBUS);
- msgInfo = kmalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_MESSAGE_HEADER), GFP_KERNEL);
+ msgInfo = kmalloc(sizeof(*msgInfo) + sizeof(VMBUS_CHANNEL_MESSAGE_HEADER), GFP_KERNEL);
ASSERT(msgInfo != NULL);
msgInfo->WaitEvent = osd_WaitEventCreate();
void VmbusChannelReleaseUnattachedChannels(void)
{
LIST_ENTRY *entry;
- VMBUS_CHANNEL *channel;
- VMBUS_CHANNEL *start=NULL;
+ struct vmbus_channel *channel;
+ struct vmbus_channel *start = NULL;
unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
while (!IsListEmpty(&gVmbusConnection.ChannelList))
{
entry = TOP_LIST_ENTRY(&gVmbusConnection.ChannelList);
- channel = CONTAINING_RECORD(entry, VMBUS_CHANNEL, ListEntry);
+ channel = CONTAINING_RECORD(entry, struct vmbus_channel, ListEntry);
if (channel == start)
break;
typedef void (*PFN_CHANNEL_CALLBACK)(void *context);
-typedef enum {
+enum vmbus_channel_state {
CHANNEL_OFFER_STATE,
CHANNEL_OPENING_STATE,
CHANNEL_OPEN_STATE,
-} VMBUS_CHANNEL_STATE;
+};
-typedef struct _VMBUS_CHANNEL {
+struct vmbus_channel {
LIST_ENTRY ListEntry;
struct hv_device *DeviceObject;
struct timer_list poll_timer; /* SA-111 workaround */
- VMBUS_CHANNEL_STATE State;
+ enum vmbus_channel_state State;
VMBUS_CHANNEL_OFFER_CHANNEL OfferMsg;
/*
PFN_CHANNEL_CALLBACK OnChannelCallback;
void *ChannelCallbackContext;
-} VMBUS_CHANNEL;
+};
-
-typedef struct _VMBUS_CHANNEL_DEBUG_INFO {
+struct vmbus_channel_debug_info {
u32 RelId;
- VMBUS_CHANNEL_STATE State;
+ enum vmbus_channel_state State;
GUID InterfaceType;
GUID InterfaceInstance;
u32 MonitorId;
RING_BUFFER_DEBUG_INFO Inbound;
RING_BUFFER_DEBUG_INFO Outbound;
-} VMBUS_CHANNEL_DEBUG_INFO;
-
-
-typedef union {
- VMBUS_CHANNEL_VERSION_SUPPORTED VersionSupported;
- VMBUS_CHANNEL_OPEN_RESULT OpenResult;
- VMBUS_CHANNEL_GPADL_TORNDOWN GpadlTorndown;
- VMBUS_CHANNEL_GPADL_CREATED GpadlCreated;
- VMBUS_CHANNEL_VERSION_RESPONSE VersionResponse;
-} VMBUS_CHANNEL_MESSAGE_RESPONSE;
-
+};
/*
* Represents each channel msg on the vmbus connection This is a
* variable-size data structure depending on the msg type itself
*/
-typedef struct _VMBUS_CHANNEL_MSGINFO {
+struct vmbus_channel_msginfo {
/* Bookkeeping stuff */
LIST_ENTRY MsgListEntry;
/* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent;
- VMBUS_CHANNEL_MESSAGE_RESPONSE Response;
+ union {
+ VMBUS_CHANNEL_VERSION_SUPPORTED VersionSupported;
+ VMBUS_CHANNEL_OPEN_RESULT OpenResult;
+ VMBUS_CHANNEL_GPADL_TORNDOWN GpadlTorndown;
+ VMBUS_CHANNEL_GPADL_CREATED GpadlCreated;
+ VMBUS_CHANNEL_VERSION_RESPONSE VersionResponse;
+ } Response;
u32 MessageSize;
/*
* It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header
*/
unsigned char Msg[0];
-} VMBUS_CHANNEL_MSGINFO;
+};
-VMBUS_CHANNEL *AllocVmbusChannel(void);
+struct vmbus_channel *AllocVmbusChannel(void);
-void FreeVmbusChannel(VMBUS_CHANNEL *Channel);
+void FreeVmbusChannel(struct vmbus_channel *Channel);
void VmbusOnChannelMessage(void *Context);
int VmbusConnect(void)
{
int ret=0;
- VMBUS_CHANNEL_MSGINFO *msgInfo=NULL;
+ struct vmbus_channel_msginfo *msgInfo = NULL;
VMBUS_CHANNEL_INITIATE_CONTACT *msg;
unsigned long flags;
goto Cleanup;
}
- msgInfo = kzalloc(sizeof(VMBUS_CHANNEL_MSGINFO) + sizeof(VMBUS_CHANNEL_INITIATE_CONTACT), GFP_KERNEL);
+ msgInfo = kzalloc(sizeof(*msgInfo) + sizeof(VMBUS_CHANNEL_INITIATE_CONTACT), GFP_KERNEL);
if (msgInfo == NULL)
{
ret = -1;
Get the channel object given its child relative id (ie channel id)
--*/
-VMBUS_CHANNEL *GetChannelFromRelId(u32 relId)
+struct vmbus_channel *GetChannelFromRelId(u32 relId)
{
- VMBUS_CHANNEL* channel;
- VMBUS_CHANNEL* foundChannel=NULL;
+ struct vmbus_channel *channel;
+ struct vmbus_channel *foundChannel = NULL;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList)
{
- channel = CONTAINING_RECORD(curr, VMBUS_CHANNEL, ListEntry);
+ channel = CONTAINING_RECORD(curr, struct vmbus_channel, ListEntry);
if (channel->OfferMsg.ChildRelId == relId)
{
void * context
)
{
- VMBUS_CHANNEL* channel;
+ struct vmbus_channel *channel;
u32 relId = (u32)(unsigned long)context;
ASSERT(relId > 0);
/* VmbusChildDeviceDestroy( */
/* struct hv_device *); */
-VMBUS_CHANNEL *GetChannelFromRelId(u32 relId);
+struct vmbus_channel *GetChannelFromRelId(u32 relId);
/* Connection interface */