ChannelMessages.h is now coding style clean.
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
)
{
int ret=0;
- VMBUS_CHANNEL_OPEN_CHANNEL* openMsg;
+ struct vmbus_channel_open_channel *openMsg;
struct vmbus_channel_msginfo *openInfo;
void *in, *out;
unsigned long flags;
SendRingBufferSize);
/* Create and init the channel open message */
- openInfo = kmalloc(sizeof(*openInfo) + sizeof(VMBUS_CHANNEL_OPEN_CHANNEL), GFP_KERNEL);
+ openInfo = kmalloc(sizeof(*openInfo) + sizeof(struct vmbus_channel_open_channel), GFP_KERNEL);
ASSERT(openInfo != NULL);
openInfo->WaitEvent = osd_WaitEventCreate();
- openMsg = (VMBUS_CHANNEL_OPEN_CHANNEL*)openInfo->Msg;
+ openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg;
openMsg->Header.MessageType = ChannelMessageOpenChannel;
openMsg->OpenId = NewChannel->OfferMsg.ChildRelId; /* FIXME */
openMsg->ChildRelId = NewChannel->OfferMsg.ChildRelId;
DPRINT_DBG(VMBUS, "Sending channel open msg...");
- ret = VmbusPostMessage(openMsg, sizeof(VMBUS_CHANNEL_OPEN_CHANNEL));
+ ret = VmbusPostMessage(openMsg, sizeof(struct vmbus_channel_open_channel));
if (ret != 0)
{
DPRINT_ERR(VMBUS, "unable to open channel - %d", ret);
Dump the gpadl body message to the console for debugging purposes.
--*/
-static void DumpGpadlBody(
- VMBUS_CHANNEL_GPADL_BODY *Gpadl,
- u32 Len)
+static void DumpGpadlBody(struct vmbus_channel_gpadl_body *Gpadl, u32 Len)
{
int i=0;
int pfnCount=0;
- pfnCount = (Len - sizeof(VMBUS_CHANNEL_GPADL_BODY))/ sizeof(u64);
+ pfnCount = (Len - sizeof(struct vmbus_channel_gpadl_body))/ sizeof(u64);
DPRINT_DBG(VMBUS, "gpadl body - len %d pfn count %d", Len, pfnCount);
for (i=0; i< pfnCount; i++)
Dump the gpadl header message to the console for debugging purposes.
--*/
-static void DumpGpadlHeader(
- VMBUS_CHANNEL_GPADL_HEADER *Gpadl
- )
+static void DumpGpadlHeader(struct vmbus_channel_gpadl_header *Gpadl)
{
int i=0,j=0;
int pageCount=0;
int i;
int pageCount;
unsigned long long pfn;
- VMBUS_CHANNEL_GPADL_HEADER* gpaHeader;
- VMBUS_CHANNEL_GPADL_BODY* gpadlBody;
+ struct vmbus_channel_gpadl_header *gpaHeader;
+ struct vmbus_channel_gpadl_body *gpadlBody;
struct vmbus_channel_msginfo *msgHeader;
struct vmbus_channel_msginfo *msgBody;
u32 msgSize;
pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT;
/* do we need a gpadl body msg */
- pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(VMBUS_CHANNEL_GPADL_HEADER) - sizeof(GPA_RANGE);
+ pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_header) - sizeof(GPA_RANGE);
pfnCount = pfnSize / sizeof(u64);
if (pageCount > pfnCount) /* we need a gpadl body */
{
/* fill in the header */
- msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL);
INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList);
msgHeader->MessageSize=msgSize;
- gpaHeader = (VMBUS_CHANNEL_GPADL_HEADER*)msgHeader->Msg;
+ gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
gpaHeader->RangeCount = 1;
gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64);
gpaHeader->Range[0].ByteOffset = 0;
pfnLeft = pageCount - pfnCount;
/* how many pfns can we fit */
- pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(VMBUS_CHANNEL_GPADL_BODY);
+ pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_body);
pfnCount = pfnSize / sizeof(u64);
/* fill in the body */
pfnCurr = pfnLeft;
}
- msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_BODY) + pfnCurr*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_body) + pfnCurr*sizeof(u64);
msgBody = kzalloc(msgSize, GFP_KERNEL);
ASSERT(msgBody);
msgBody->MessageSize = msgSize;
(*MessageCount)++;
- gpadlBody = (VMBUS_CHANNEL_GPADL_BODY*)msgBody->Msg;
+ gpadlBody = (struct vmbus_channel_gpadl_body *)msgBody->Msg;
/* FIXME: Gpadl is u32 and we are using a pointer which could be 64-bit */
/* gpadlBody->Gpadl = kbuffer; */
else
{
/* everything fits in a header */
- msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(VMBUS_CHANNEL_GPADL_HEADER) + sizeof(GPA_RANGE) + pageCount*sizeof(u64);
+ msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pageCount*sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL);
msgHeader->MessageSize=msgSize;
- gpaHeader = (VMBUS_CHANNEL_GPADL_HEADER*)msgHeader->Msg;
+ gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
gpaHeader->RangeCount = 1;
gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64);
gpaHeader->Range[0].ByteOffset = 0;
)
{
int ret=0;
- VMBUS_CHANNEL_GPADL_HEADER* gpadlMsg;
- VMBUS_CHANNEL_GPADL_BODY* gpadlBody;
- /* VMBUS_CHANNEL_GPADL_CREATED* gpadlCreated; */
+ struct vmbus_channel_gpadl_header *gpadlMsg;
+ struct vmbus_channel_gpadl_body *gpadlBody;
+ /* struct vmbus_channel_gpadl_created *gpadlCreated; */
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_msginfo *subMsgInfo;
ASSERT(msgCount >0);
msgInfo->WaitEvent = osd_WaitEventCreate();
- gpadlMsg = (VMBUS_CHANNEL_GPADL_HEADER*)msgInfo->Msg;
+ gpadlMsg = (struct vmbus_channel_gpadl_header *)msgInfo->Msg;
gpadlMsg->Header.MessageType = ChannelMessageGpadlHeader;
gpadlMsg->ChildRelId = Channel->OfferMsg.ChildRelId;
gpadlMsg->Gpadl = nextGpadlHandle;
{
ITERATE_LIST_ENTRIES(anchor, curr, &msgInfo->SubMsgList)
{
- subMsgInfo = (struct vmbus_channel_msginfo*)curr;
- gpadlBody = (VMBUS_CHANNEL_GPADL_BODY*)subMsgInfo->Msg;
+ subMsgInfo = (struct vmbus_channel_msginfo *)curr;
+ gpadlBody = (struct vmbus_channel_gpadl_body *)subMsgInfo->Msg;
gpadlBody->Header.MessageType = ChannelMessageGpadlBody;
gpadlBody->Gpadl = nextGpadlHandle;
int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
{
int ret=0;
- VMBUS_CHANNEL_GPADL_TEARDOWN *msg;
+ struct vmbus_channel_gpadl_teardown *msg;
struct vmbus_channel_msginfo *info;
unsigned long flags;
ASSERT(GpadlHandle != 0);
- info = kmalloc(sizeof(*info) + sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN), GFP_KERNEL);
+ info = kmalloc(sizeof(*info) + sizeof(struct vmbus_channel_gpadl_teardown), GFP_KERNEL);
ASSERT(info != NULL);
info->WaitEvent = osd_WaitEventCreate();
- msg = (VMBUS_CHANNEL_GPADL_TEARDOWN*)info->Msg;
+ msg = (struct vmbus_channel_gpadl_teardown *)info->Msg;
msg->Header.MessageType = ChannelMessageGpadlTeardown;
msg->ChildRelId = Channel->OfferMsg.ChildRelId;
INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, &info->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
- ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_GPADL_TEARDOWN));
+ ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_gpadl_teardown));
if (ret != 0)
{
/* TODO: */
void VmbusChannelClose(struct vmbus_channel *Channel)
{
int ret=0;
- VMBUS_CHANNEL_CLOSE_CHANNEL* msg;
+ struct vmbus_channel_close_channel *msg;
struct vmbus_channel_msginfo *info;
unsigned long flags;
del_timer(&Channel->poll_timer);
/* Send a closing message */
- info = kmalloc(sizeof(*info) + sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL), GFP_KERNEL);
+ info = kmalloc(sizeof(*info) + sizeof(struct vmbus_channel_close_channel), GFP_KERNEL);
ASSERT(info != NULL);
/* info->waitEvent = osd_WaitEventCreate(); */
- msg = (VMBUS_CHANNEL_CLOSE_CHANNEL*)info->Msg;
+ msg = (struct vmbus_channel_close_channel *)info->Msg;
msg->Header.MessageType = ChannelMessageCloseChannel;
msg->ChildRelId = Channel->OfferMsg.ChildRelId;
- ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_CLOSE_CHANNEL));
+ ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
if (ret != 0)
{
/* TODO: */
/* Data types */
-typedef void (*PFN_CHANNEL_MESSAGE_HANDLER)(VMBUS_CHANNEL_MESSAGE_HEADER* msg);
+typedef void (*PFN_CHANNEL_MESSAGE_HANDLER)(struct vmbus_channel_message_header *msg);
typedef struct _VMBUS_CHANNEL_MESSAGE_TABLE_ENTRY {
- VMBUS_CHANNEL_MESSAGE_TYPE messageType;
+ enum vmbus_channel_message_type messageType;
PFN_CHANNEL_MESSAGE_HANDLER messageHandler;
} VMBUS_CHANNEL_MESSAGE_TABLE_ENTRY;
/* Internal routines */
-
-static void
-VmbusChannelOnOffer(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-static void
-VmbusChannelOnOpenResult(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelOnOfferRescind(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelOnGpadlCreated(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelOnGpadlTorndown(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelOnOffersDelivered(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelOnVersionResponse(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- );
-
-static void
-VmbusChannelProcessOffer(
- void * context
- );
-
-static void
-VmbusChannelProcessRescindOffer(
- void * context
- );
+static void VmbusChannelOnOffer(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnOfferRescind(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnGpadlTorndown(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnOffersDelivered(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelOnVersionResponse(struct vmbus_channel_message_header *hdr);
+static void VmbusChannelProcessOffer(void * context);
+static void VmbusChannelProcessRescindOffer(void * context);
/* Globals */
and queue a work item to the channel object to process the offer synchronously
--*/
-static void
-VmbusChannelOnOffer(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnOffer(struct vmbus_channel_message_header *hdr)
{
- VMBUS_CHANNEL_OFFER_CHANNEL* offer = (VMBUS_CHANNEL_OFFER_CHANNEL*)hdr;
+ struct vmbus_channel_offer_channel *offer = (struct vmbus_channel_offer_channel *)hdr;
struct vmbus_channel *newChannel;
struct hv_guid *guidType;
DPRINT_DBG(VMBUS, "channel object allocated - %p", newChannel);
- memcpy(&newChannel->OfferMsg, offer, sizeof(VMBUS_CHANNEL_OFFER_CHANNEL));
+ memcpy(&newChannel->OfferMsg, offer, sizeof(struct vmbus_channel_offer_channel));
newChannel->MonitorGroup = (u8)offer->MonitorId / 32;
newChannel->MonitorBit = (u8)offer->MonitorId % 32;
synchronously
--*/
-static void
-VmbusChannelOnOfferRescind(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnOfferRescind(struct vmbus_channel_message_header *hdr)
{
- VMBUS_CHANNEL_RESCIND_OFFER* rescind = (VMBUS_CHANNEL_RESCIND_OFFER*)hdr;
+ struct vmbus_channel_rescind_offer *rescind = (struct vmbus_channel_rescind_offer *)hdr;
struct vmbus_channel *channel;
DPRINT_ENTER(VMBUS);
Nothing to do here.
--*/
-static void
-VmbusChannelOnOffersDelivered(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnOffersDelivered(struct vmbus_channel_message_header *hdr)
{
DPRINT_ENTER(VMBUS);
DPRINT_EXIT(VMBUS);
response and signal the requesting thread.
--*/
-static void
-VmbusChannelOnOpenResult(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr)
{
- VMBUS_CHANNEL_OPEN_RESULT* result = (VMBUS_CHANNEL_OPEN_RESULT*)hdr;
+ struct vmbus_channel_open_result *result = (struct vmbus_channel_open_result *)hdr;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
struct vmbus_channel_msginfo *msgInfo;
- VMBUS_CHANNEL_MESSAGE_HEADER* requestHeader;
- VMBUS_CHANNEL_OPEN_CHANNEL* openMsg;
+ struct vmbus_channel_message_header *requestHeader;
+ struct vmbus_channel_open_channel *openMsg;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
msgInfo = (struct vmbus_channel_msginfo *)curr;
- requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
+ requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageOpenChannel)
{
- openMsg = (VMBUS_CHANNEL_OPEN_CHANNEL*)msgInfo->Msg;
+ openMsg = (struct vmbus_channel_open_channel *)msgInfo->Msg;
if (openMsg->ChildRelId == result->ChildRelId &&
openMsg->OpenId == result->OpenId)
{
- memcpy(&msgInfo->Response.OpenResult, result, sizeof(VMBUS_CHANNEL_OPEN_RESULT));
+ memcpy(&msgInfo->Response.OpenResult, result, sizeof(struct vmbus_channel_open_result));
osd_WaitEventSet(msgInfo->WaitEvent);
break;
}
response and signal the requesting thread.
--*/
-static void
-VmbusChannelOnGpadlCreated(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr)
{
- VMBUS_CHANNEL_GPADL_CREATED *gpadlCreated = (VMBUS_CHANNEL_GPADL_CREATED*)hdr;
+ struct vmbus_channel_gpadl_created *gpadlCreated = (struct vmbus_channel_gpadl_created *)hdr;
LIST_ENTRY *anchor;
LIST_ENTRY *curr;
struct vmbus_channel_msginfo *msgInfo;
- VMBUS_CHANNEL_MESSAGE_HEADER *requestHeader;
- VMBUS_CHANNEL_GPADL_HEADER *gpadlHeader;
+ struct vmbus_channel_message_header *requestHeader;
+ struct vmbus_channel_gpadl_header *gpadlHeader;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
msgInfo = (struct vmbus_channel_msginfo *)curr;
- requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
+ requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageGpadlHeader)
{
- gpadlHeader = (VMBUS_CHANNEL_GPADL_HEADER*)requestHeader;
+ gpadlHeader = (struct vmbus_channel_gpadl_header *)requestHeader;
if ((gpadlCreated->ChildRelId == gpadlHeader->ChildRelId) &&
(gpadlCreated->Gpadl == gpadlHeader->Gpadl))
{
- memcpy(&msgInfo->Response.GpadlCreated, gpadlCreated, sizeof(VMBUS_CHANNEL_GPADL_CREATED));
+ memcpy(&msgInfo->Response.GpadlCreated, gpadlCreated, sizeof(struct vmbus_channel_gpadl_created));
osd_WaitEventSet(msgInfo->WaitEvent);
break;
}
response and signal the requesting thread.
--*/
-static void
-VmbusChannelOnGpadlTorndown(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnGpadlTorndown(struct vmbus_channel_message_header *hdr)
{
- VMBUS_CHANNEL_GPADL_TORNDOWN* gpadlTorndown = (VMBUS_CHANNEL_GPADL_TORNDOWN*)hdr;
+ struct vmbus_channel_gpadl_torndown* gpadlTorndown = (struct vmbus_channel_gpadl_torndown *)hdr;
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
struct vmbus_channel_msginfo *msgInfo;
- VMBUS_CHANNEL_MESSAGE_HEADER *requestHeader;
- VMBUS_CHANNEL_GPADL_TEARDOWN *gpadlTeardown;
+ struct vmbus_channel_message_header *requestHeader;
+ struct vmbus_channel_gpadl_teardown *gpadlTeardown;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
msgInfo = (struct vmbus_channel_msginfo *)curr;
- requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
+ requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageGpadlTeardown)
{
- gpadlTeardown = (VMBUS_CHANNEL_GPADL_TEARDOWN*)requestHeader;
+ gpadlTeardown = (struct vmbus_channel_gpadl_teardown *)requestHeader;
if (gpadlTorndown->Gpadl == gpadlTeardown->Gpadl)
{
- memcpy(&msgInfo->Response.GpadlTorndown, gpadlTorndown, sizeof(VMBUS_CHANNEL_GPADL_TORNDOWN));
+ memcpy(&msgInfo->Response.GpadlTorndown, gpadlTorndown, sizeof(struct vmbus_channel_gpadl_torndown));
osd_WaitEventSet(msgInfo->WaitEvent);
break;
}
response and signal the requesting thread.
--*/
-static void
-VmbusChannelOnVersionResponse(
- PVMBUS_CHANNEL_MESSAGE_HEADER hdr
- )
+static void VmbusChannelOnVersionResponse(struct vmbus_channel_message_header *hdr)
{
LIST_ENTRY* anchor;
LIST_ENTRY* curr;
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;
+ struct vmbus_channel_message_header *requestHeader;
+ struct vmbus_channel_initiate_contact *initiate;
+ struct vmbus_channel_version_response *versionResponse = (struct vmbus_channel_version_response *)hdr;
unsigned long flags;
DPRINT_ENTER(VMBUS);
ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList)
{
msgInfo = (struct vmbus_channel_msginfo *)curr;
- requestHeader = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
+ requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
if (requestHeader->MessageType == ChannelMessageInitiateContact)
{
- initiate = (VMBUS_CHANNEL_INITIATE_CONTACT*)requestHeader;
- memcpy(&msgInfo->Response.VersionResponse, versionResponse, sizeof(VMBUS_CHANNEL_VERSION_RESPONSE));
+ initiate = (struct vmbus_channel_initiate_contact *)requestHeader;
+ memcpy(&msgInfo->Response.VersionResponse, versionResponse, sizeof(struct vmbus_channel_version_response));
osd_WaitEventSet(msgInfo->WaitEvent);
}
}
void VmbusOnChannelMessage(void *Context)
{
struct hv_message *msg = Context;
- VMBUS_CHANNEL_MESSAGE_HEADER* hdr;
+ struct vmbus_channel_message_header *hdr;
int size;
DPRINT_ENTER(VMBUS);
- hdr = (VMBUS_CHANNEL_MESSAGE_HEADER*)msg->u.Payload;
+ hdr = (struct vmbus_channel_message_header *)msg->u.Payload;
size=msg->Header.PayloadSize;
DPRINT_DBG(VMBUS, "message type %d size %d", hdr->MessageType, size);
int VmbusChannelRequestOffers(void)
{
int ret=0;
- VMBUS_CHANNEL_MESSAGE_HEADER* msg;
+ struct vmbus_channel_message_header *msg;
struct vmbus_channel_msginfo *msgInfo;
DPRINT_ENTER(VMBUS);
- msgInfo = kmalloc(sizeof(*msgInfo) + sizeof(VMBUS_CHANNEL_MESSAGE_HEADER), GFP_KERNEL);
+ msgInfo = kmalloc(sizeof(*msgInfo) + sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
ASSERT(msgInfo != NULL);
msgInfo->WaitEvent = osd_WaitEventCreate();
- msg = (VMBUS_CHANNEL_MESSAGE_HEADER*)msgInfo->Msg;
+ msg = (struct vmbus_channel_message_header *)msgInfo->Msg;
msg->MessageType = ChannelMessageRequestOffers;
INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList, &msgInfo->msgListEntry);
SpinlockRelease(gVmbusConnection.channelMsgLock);*/
- ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_MESSAGE_HEADER));
+ ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_message_header));
if (ret != 0)
{
DPRINT_ERR(VMBUS, "Unable to request offers - %d", ret);
enum vmbus_channel_state State;
- VMBUS_CHANNEL_OFFER_CHANNEL OfferMsg;
+ struct vmbus_channel_offer_channel OfferMsg;
/*
* These are based on the OfferMsg.MonitorId.
* Save it here for easy access.
struct osd_waitevent *WaitEvent;
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;
+ struct vmbus_channel_version_supported VersionSupported;
+ struct vmbus_channel_open_result OpenResult;
+ struct vmbus_channel_gpadl_torndown GpadlTorndown;
+ struct vmbus_channel_gpadl_created GpadlCreated;
+ struct vmbus_channel_version_response VersionResponse;
} Response;
u32 MessageSize;
{
int ret=0;
struct vmbus_channel_msginfo *msgInfo = NULL;
- VMBUS_CHANNEL_INITIATE_CONTACT *msg;
+ struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
DPRINT_ENTER(VMBUS);
goto Cleanup;
}
- msgInfo = kzalloc(sizeof(*msgInfo) + sizeof(VMBUS_CHANNEL_INITIATE_CONTACT), GFP_KERNEL);
+ msgInfo = kzalloc(sizeof(*msgInfo) + sizeof(struct vmbus_channel_initiate_contact), GFP_KERNEL);
if (msgInfo == NULL)
{
ret = -1;
}
msgInfo->WaitEvent = osd_WaitEventCreate();
- msg = (VMBUS_CHANNEL_INITIATE_CONTACT*)msgInfo->Msg;
+ msg = (struct vmbus_channel_initiate_contact *)msgInfo->Msg;
msg->Header.MessageType = ChannelMessageInitiateContact;
msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER;
DPRINT_DBG(VMBUS, "Sending channel initiate msg...");
- ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_INITIATE_CONTACT));
+ ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0)
{
REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry);
int VmbusDisconnect(void)
{
int ret=0;
- VMBUS_CHANNEL_UNLOAD *msg;
+ struct vmbus_channel_message_header *msg;
DPRINT_ENTER(VMBUS);
if (gVmbusConnection.ConnectState != Connected)
return -1;
- msg = kzalloc(sizeof(VMBUS_CHANNEL_UNLOAD), GFP_KERNEL);
+ msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
msg->MessageType = ChannelMessageUnload;
- ret = VmbusPostMessage(msg, sizeof(VMBUS_CHANNEL_UNLOAD));
+ ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_message_header));
if (ret != 0)
{
#include "VmbusPacketFormat.h"
/* Version 1 messages */
-typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE {
+enum vmbus_channel_message_type {
ChannelMessageInvalid = 0,
ChannelMessageOfferChannel = 1,
ChannelMessageRescindChannelOffer = 2,
ChannelMessageViewRangeRemove = 18,
#endif
ChannelMessageCount
-} __attribute__((packed)) VMBUS_CHANNEL_MESSAGE_TYPE, *PVMBUS_CHANNEL_MESSAGE_TYPE;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_MESSAGE_HEADER {
- VMBUS_CHANNEL_MESSAGE_TYPE MessageType;
+struct vmbus_channel_message_header {
+ enum vmbus_channel_message_type MessageType;
u32 Padding;
-} __attribute__((packed)) VMBUS_CHANNEL_MESSAGE_HEADER, *PVMBUS_CHANNEL_MESSAGE_HEADER;
+} __attribute__((packed));
/* Query VMBus Version parameters */
-typedef struct _VMBUS_CHANNEL_QUERY_VMBUS_VERSION {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_query_vmbus_version {
+ struct vmbus_channel_message_header Header;
u32 Version;
-} __attribute__((packed)) VMBUS_CHANNEL_QUERY_VMBUS_VERSION, *PVMBUS_CHANNEL_QUERY_VMBUS_VERSION;
+} __attribute__((packed));
/* VMBus Version Supported parameters */
-typedef struct _VMBUS_CHANNEL_VERSION_SUPPORTED {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_version_supported {
+ struct vmbus_channel_message_header Header;
bool VersionSupported;
-} __attribute__((packed)) VMBUS_CHANNEL_VERSION_SUPPORTED, *PVMBUS_CHANNEL_VERSION_SUPPORTED;
+} __attribute__((packed));
/* Offer Channel parameters */
-typedef struct _VMBUS_CHANNEL_OFFER_CHANNEL {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_offer_channel {
+ struct vmbus_channel_message_header Header;
struct vmbus_channel_offer Offer;
u32 ChildRelId;
u8 MonitorId;
bool MonitorAllocated;
-} __attribute__((packed)) VMBUS_CHANNEL_OFFER_CHANNEL, *PVMBUS_CHANNEL_OFFER_CHANNEL;
+} __attribute__((packed));
/* Rescind Offer parameters */
-typedef struct _VMBUS_CHANNEL_RESCIND_OFFER {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_rescind_offer {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
-} __attribute__((packed)) VMBUS_CHANNEL_RESCIND_OFFER, *PVMBUS_CHANNEL_RESCIND_OFFER;
+} __attribute__((packed));
/*
* Request Offer -- no parameters, SynIC message contains the partition ID
*/
/* Open Channel parameters */
-typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_open_channel {
+ struct vmbus_channel_message_header Header;
/* Identifies the specific VMBus channel that is being opened. */
u32 ChildRelId;
/* User-specific data to be passed along to the server endpoint. */
unsigned char UserData[MAX_USER_DEFINED_BYTES];
-} __attribute__((packed)) VMBUS_CHANNEL_OPEN_CHANNEL, *PVMBUS_CHANNEL_OPEN_CHANNEL;
-
-/* Reopen Channel parameters; */
-typedef VMBUS_CHANNEL_OPEN_CHANNEL VMBUS_CHANNEL_REOPEN_CHANNEL, *PVMBUS_CHANNEL_REOPEN_CHANNEL;
+} __attribute__((packed));
/* Open Channel Result parameters */
-typedef struct _VMBUS_CHANNEL_OPEN_RESULT {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_open_result {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
u32 OpenId;
u32 Status;
-} __attribute__((packed)) VMBUS_CHANNEL_OPEN_RESULT, *PVMBUS_CHANNEL_OPEN_RESULT;
+} __attribute__((packed));
/* Close channel parameters; */
-typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_close_channel {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
-} __attribute__((packed)) VMBUS_CHANNEL_CLOSE_CHANNEL, *PVMBUS_CHANNEL_CLOSE_CHANNEL;
+} __attribute__((packed));
/* Channel Message GPADL */
#define GPADL_TYPE_RING_BUFFER 1
* implied number of PFNs won't fit in this packet, there will be a
* follow-up packet that contains more.
*/
-typedef struct _VMBUS_CHANNEL_GPADL_HEADER {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_gpadl_header {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
u32 Gpadl;
u16 RangeBufLen;
u16 RangeCount;
GPA_RANGE Range[0];
-} __attribute__((packed)) VMBUS_CHANNEL_GPADL_HEADER, *PVMBUS_CHANNEL_GPADL_HEADER;
+} __attribute__((packed));
/* This is the followup packet that contains more PFNs. */
-typedef struct _VMBUS_CHANNEL_GPADL_BODY {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_gpadl_body {
+ struct vmbus_channel_message_header Header;
u32 MessageNumber;
u32 Gpadl;
u64 Pfn[0];
-} __attribute__((packed)) VMBUS_CHANNEL_GPADL_BODY, *PVMBUS_CHANNEL_GPADL_BODY;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_GPADL_CREATED {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_gpadl_created {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
u32 Gpadl;
u32 CreationStatus;
-} __attribute__((packed)) VMBUS_CHANNEL_GPADL_CREATED, *PVMBUS_CHANNEL_GPADL_CREATED;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_GPADL_TEARDOWN {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_gpadl_teardown {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
u32 Gpadl;
-} __attribute__((packed)) VMBUS_CHANNEL_GPADL_TEARDOWN, *PVMBUS_CHANNEL_GPADL_TEARDOWN;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_GPADL_TORNDOWN {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_gpadl_torndown {
+ struct vmbus_channel_message_header Header;
u32 Gpadl;
-} __attribute__((packed)) VMBUS_CHANNEL_GPADL_TORNDOWN, *PVMBUS_CHANNEL_GPADL_TORNDOWN;
+} __attribute__((packed));
#ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD
-typedef struct _VMBUS_CHANNEL_VIEW_RANGE_ADD {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_view_range_add {
+ struct vmbus_channel_message_header Header;
PHYSICAL_ADDRESS ViewRangeBase;
u64 ViewRangeLength;
u32 ChildRelId;
-} __attribute__((packed)) VMBUS_CHANNEL_VIEW_RANGE_ADD, *PVMBUS_CHANNEL_VIEW_RANGE_ADD;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_VIEW_RANGE_REMOVE {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_view_range_remove {
+ struct vmbus_channel_message_header Header;
PHYSICAL_ADDRESS ViewRangeBase;
u32 ChildRelId;
-} __attribute__((packed)) VMBUS_CHANNEL_VIEW_RANGE_REMOVE, *PVMBUS_CHANNEL_VIEW_RANGE_REMOVE;
+} __attribute__((packed));
#endif
-typedef struct _VMBUS_CHANNEL_RELID_RELEASED {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_relid_released {
+ struct vmbus_channel_message_header Header;
u32 ChildRelId;
-} __attribute__((packed)) VMBUS_CHANNEL_RELID_RELEASED, *PVMBUS_CHANNEL_RELID_RELEASED;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_INITIATE_CONTACT {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_initiate_contact {
+ struct vmbus_channel_message_header Header;
u32 VMBusVersionRequested;
u32 Padding2;
u64 InterruptPage;
u64 MonitorPage1;
u64 MonitorPage2;
-} __attribute__((packed)) VMBUS_CHANNEL_INITIATE_CONTACT, *PVMBUS_CHANNEL_INITIATE_CONTACT;
+} __attribute__((packed));
-typedef struct _VMBUS_CHANNEL_VERSION_RESPONSE {
- VMBUS_CHANNEL_MESSAGE_HEADER Header;
+struct vmbus_channel_version_response {
+ struct vmbus_channel_message_header Header;
bool VersionSupported;
-} __attribute__((packed)) VMBUS_CHANNEL_VERSION_RESPONSE, *PVMBUS_CHANNEL_VERSION_RESPONSE;
-
-typedef VMBUS_CHANNEL_MESSAGE_HEADER VMBUS_CHANNEL_UNLOAD, *PVMBUS_CHANNEL_UNLOAD;
+} __attribute__((packed));
#endif