Staging: hv: typedef removal for ChannelMessages.h

ChannelMessages.h is now coding style clean.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2009-08-26 15:16:04 -07:00
parent 314b1c8b10
commit 82250213d0
5 changed files with 151 additions and 216 deletions

View File

@ -195,7 +195,7 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel,
)
{
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;
@ -245,12 +245,12 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel,
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;
@ -271,7 +271,7 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel,
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);
@ -312,14 +312,12 @@ Description:
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++)
@ -338,9 +336,7 @@ Description:
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;
@ -384,8 +380,8 @@ VmbusChannelCreateGpadlHeader(
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;
@ -399,19 +395,19 @@ VmbusChannelCreateGpadlHeader(
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;
@ -427,7 +423,7 @@ VmbusChannelCreateGpadlHeader(
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 */
@ -442,12 +438,12 @@ VmbusChannelCreateGpadlHeader(
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; */
@ -465,11 +461,11 @@ VmbusChannelCreateGpadlHeader(
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;
@ -503,9 +499,9 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel,
)
{
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;
@ -526,7 +522,7 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel,
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;
@ -552,8 +548,8 @@ int VmbusChannelEstablishGpadl(struct vmbus_channel *Channel,
{
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;
@ -602,7 +598,7 @@ Description:
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;
@ -610,12 +606,12 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
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;
@ -625,7 +621,7 @@ int VmbusChannelTeardownGpadl(struct vmbus_channel *Channel, u32 GpadlHandle)
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: */
@ -659,7 +655,7 @@ Description:
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;
@ -670,16 +666,16 @@ void VmbusChannelClose(struct vmbus_channel *Channel)
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: */

View File

@ -31,58 +31,23 @@
/* 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 */
@ -355,12 +320,9 @@ Description:
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;
@ -415,7 +377,7 @@ VmbusChannelOnOffer(
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;
@ -437,12 +399,9 @@ Description:
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);
@ -472,10 +431,7 @@ Description:
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);
@ -493,17 +449,14 @@ Description:
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);
@ -516,15 +469,15 @@ VmbusChannelOnOpenResult(
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;
}
@ -547,17 +500,14 @@ Description:
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);
@ -570,16 +520,16 @@ VmbusChannelOnGpadlCreated(
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;
}
@ -602,17 +552,14 @@ Description:
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);
@ -623,15 +570,15 @@ VmbusChannelOnGpadlTorndown(
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;
}
@ -654,17 +601,14 @@ Description:
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);
@ -674,12 +618,12 @@ VmbusChannelOnVersionResponse(
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);
}
}
@ -702,12 +646,12 @@ Description:
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);
@ -748,16 +692,16 @@ Description:
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;
@ -765,7 +709,7 @@ int VmbusChannelRequestOffers(void)
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);

View File

@ -50,7 +50,7 @@ struct vmbus_channel {
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.
@ -107,11 +107,11 @@ struct vmbus_channel_msginfo {
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;

View File

@ -51,7 +51,7 @@ int VmbusConnect(void)
{
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);
@ -100,7 +100,7 @@ int VmbusConnect(void)
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;
@ -108,7 +108,7 @@ int VmbusConnect(void)
}
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;
@ -129,7 +129,7 @@ int VmbusConnect(void)
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);
@ -208,7 +208,7 @@ Description:
int VmbusDisconnect(void)
{
int ret=0;
VMBUS_CHANNEL_UNLOAD *msg;
struct vmbus_channel_message_header *msg;
DPRINT_ENTER(VMBUS);
@ -216,11 +216,11 @@ int VmbusDisconnect(void)
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)
{

View File

@ -27,7 +27,7 @@
#include "VmbusPacketFormat.h"
/* Version 1 messages */
typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE {
enum vmbus_channel_message_type {
ChannelMessageInvalid = 0,
ChannelMessageOfferChannel = 1,
ChannelMessageRescindChannelOffer = 2,
@ -50,39 +50,39 @@ typedef enum _VMBUS_CHANNEL_MESSAGE_TYPE {
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
@ -94,8 +94,8 @@ typedef struct _VMBUS_CHANNEL_RESCIND_OFFER {
*/
/* 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;
@ -118,24 +118,21 @@ typedef struct _VMBUS_CHANNEL_OPEN_CHANNEL {
/* 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
@ -148,75 +145,73 @@ typedef struct _VMBUS_CHANNEL_CLOSE_CHANNEL {
* 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