Commit aded7165 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: clean up typedefs in ChannelMgmt.h

This removes the typedefs from ChannelMgmt.h, it's now clean from a
codingstyle.pl standpoint.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent af248e1f
This diff is collapsed.
......@@ -53,7 +53,7 @@ struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
} __attribute__((packed));
extern int VmbusChannelOpen(VMBUS_CHANNEL *Channel,
extern int VmbusChannelOpen(struct vmbus_channel *channel,
u32 SendRingBufferSize,
u32 RecvRingBufferSize,
void *UserData,
......@@ -61,52 +61,52 @@ extern int VmbusChannelOpen(VMBUS_CHANNEL *Channel,
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);
......
......@@ -38,7 +38,7 @@ IVmbusChannelOpen(
void * Context
)
{
return VmbusChannelOpen( (VMBUS_CHANNEL*)Device->context,
return VmbusChannelOpen((struct vmbus_channel *)Device->context,
SendBufferSize,
RecvRingBufferSize,
UserData,
......@@ -53,7 +53,7 @@ IVmbusChannelClose(
struct hv_device *Device
)
{
VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
VmbusChannelClose((struct vmbus_channel *)Device->context);
}
......@@ -67,7 +67,7 @@ IVmbusChannelSendPacket(
u32 Flags
)
{
return VmbusChannelSendPacket((VMBUS_CHANNEL*)Device->context,
return VmbusChannelSendPacket((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
RequestId,
......@@ -85,7 +85,7 @@ IVmbusChannelSendPacketPageBuffer(
u64 RequestId
)
{
return VmbusChannelSendPacketPageBuffer((VMBUS_CHANNEL*)Device->context,
return VmbusChannelSendPacketPageBuffer((struct vmbus_channel *)Device->context,
PageBuffers,
PageCount,
Buffer,
......@@ -102,7 +102,7 @@ IVmbusChannelSendPacketMultiPageBuffer(
u64 RequestId
)
{
return VmbusChannelSendPacketMultiPageBuffer((VMBUS_CHANNEL*)Device->context,
return VmbusChannelSendPacketMultiPageBuffer((struct vmbus_channel *)Device->context,
MultiPageBuffer,
Buffer,
BufferLen,
......@@ -118,7 +118,7 @@ IVmbusChannelRecvPacket (
u64* RequestId
)
{
return VmbusChannelRecvPacket((VMBUS_CHANNEL*)Device->context,
return VmbusChannelRecvPacket((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
BufferActualLen,
......@@ -134,7 +134,7 @@ IVmbusChannelRecvPacketRaw(
u64* RequestId
)
{
return VmbusChannelRecvPacketRaw((VMBUS_CHANNEL*)Device->context,
return VmbusChannelRecvPacketRaw((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
BufferActualLen,
......@@ -149,7 +149,7 @@ IVmbusChannelEstablishGpadl(
u32* GpadlHandle
)
{
return VmbusChannelEstablishGpadl((VMBUS_CHANNEL*)Device->context,
return VmbusChannelEstablishGpadl((struct vmbus_channel *)Device->context,
Buffer,
BufferLen,
GpadlHandle);
......@@ -161,7 +161,7 @@ IVmbusChannelTeardownGpadl(
u32 GpadlHandle
)
{
return VmbusChannelTeardownGpadl((VMBUS_CHANNEL*)Device->context,
return VmbusChannelTeardownGpadl((struct vmbus_channel *)Device->context,
GpadlHandle);
}
......@@ -183,11 +183,11 @@ void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface)
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;
......
......@@ -131,11 +131,11 @@ static VMBUS_CHANNEL_MESSAGE_TABLE_ENTRY gChannelMessageTable[ChannelMessageCoun
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;
......@@ -169,7 +169,7 @@ VMBUS_CHANNEL* AllocVmbusChannel(void)
--*/
static inline void ReleaseVmbusChannel(void* Context)
{
VMBUS_CHANNEL* channel = (VMBUS_CHANNEL*)Context;
struct vmbus_channel *channel = Context;
DPRINT_ENTER(VMBUS);
......@@ -191,7 +191,7 @@ static inline void ReleaseVmbusChannel(void* Context)
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);
......@@ -217,11 +217,11 @@ VmbusChannelProcessOffer(
)
{
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);
......@@ -231,7 +231,7 @@ VmbusChannelProcessOffer(
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)))
......@@ -308,7 +308,7 @@ VmbusChannelProcessRescindOffer(
void * context
)
{
VMBUS_CHANNEL* channel=(VMBUS_CHANNEL*)context;
struct vmbus_channel *channel = context;
DPRINT_ENTER(VMBUS);
......@@ -335,7 +335,7 @@ VmbusChannelOnOffer(
)
{
VMBUS_CHANNEL_OFFER_CHANNEL* offer = (VMBUS_CHANNEL_OFFER_CHANNEL*)hdr;
VMBUS_CHANNEL* newChannel;
struct vmbus_channel *newChannel;
GUID *guidType;
GUID *guidInstance;
......@@ -411,7 +411,7 @@ VmbusChannelOnOfferRescind(
)
{
VMBUS_CHANNEL_RESCIND_OFFER* rescind = (VMBUS_CHANNEL_RESCIND_OFFER*)hdr;
VMBUS_CHANNEL* channel;
struct vmbus_channel *channel;
DPRINT_ENTER(VMBUS);
......@@ -469,7 +469,7 @@ VmbusChannelOnOpenResult(
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;
......@@ -483,7 +483,7 @@ VmbusChannelOnOpenResult(
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)
......@@ -523,7 +523,7 @@ VmbusChannelOnGpadlCreated(
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;
......@@ -537,7 +537,7 @@ VmbusChannelOnGpadlCreated(
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)
......@@ -578,7 +578,7 @@ VmbusChannelOnGpadlTorndown(
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;
......@@ -590,7 +590,7 @@ VmbusChannelOnGpadlTorndown(
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)
......@@ -629,7 +629,7 @@ VmbusChannelOnVersionResponse(
{
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;
......@@ -641,7 +641,7 @@ VmbusChannelOnVersionResponse(
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)
......@@ -717,11 +717,11 @@ int VmbusChannelRequestOffers(void)
{
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();
......@@ -775,8 +775,8 @@ int VmbusChannelRequestOffers(void)
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);
......@@ -784,7 +784,7 @@ void VmbusChannelReleaseUnattachedChannels(void)
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;
......
......@@ -36,20 +36,20 @@
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;
/*
......@@ -74,12 +74,11 @@ typedef struct _VMBUS_CHANNEL {
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;
......@@ -92,23 +91,13 @@ typedef struct _VMBUS_CHANNEL_DEBUG_INFO {
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;
......@@ -118,7 +107,13 @@ typedef struct _VMBUS_CHANNEL_MSGINFO {
/* 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;
/*
......@@ -126,12 +121,12 @@ typedef struct _VMBUS_CHANNEL_MSGINFO {
* 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);
......
......@@ -49,7 +49,7 @@ struct VMBUS_CONNECTION gVmbusConnection = {
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;
......@@ -99,7 +99,7 @@ int VmbusConnect(void)
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;
......@@ -257,10 +257,10 @@ int VmbusDisconnect(void)
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;
......@@ -268,7 +268,7 @@ VMBUS_CHANNEL *GetChannelFromRelId(u32 relId)
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)
{
......@@ -297,7 +297,7 @@ VmbusProcessChannelEvent(
void * context
)
{
VMBUS_CHANNEL* channel;
struct vmbus_channel *channel;
u32 relId = (u32)(unsigned long)context;
ASSERT(relId > 0);
......
......@@ -115,7 +115,7 @@ void VmbusChildDeviceRemove(struct hv_device *Device);
/* VmbusChildDeviceDestroy( */
/* struct hv_device *); */
VMBUS_CHANNEL *GetChannelFromRelId(u32 relId);
struct vmbus_channel *GetChannelFromRelId(u32 relId);
/* Connection interface */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment