Staging: hv: clean up typedefs in ChannelMgmt.h
authorGreg Kroah-Hartman <gregkh@suse.de>
Tue, 18 Aug 2009 22:21:19 +0000 (15:21 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 15 Sep 2009 19:01:56 +0000 (12:01 -0700)
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: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/hv/Channel.c
drivers/staging/hv/Channel.h
drivers/staging/hv/ChannelInterface.c
drivers/staging/hv/ChannelMgmt.c
drivers/staging/hv/ChannelMgmt.h
drivers/staging/hv/Connection.c
drivers/staging/hv/VmbusPrivate.h

index a8398a2168489f6089f904a9d4b4afd18236c64f..78850f3a32cfd7620be20527ac1265c5013105ad 100644 (file)
 #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
@@ -93,10 +83,7 @@ Description:
        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;
 
@@ -125,10 +112,7 @@ VmbusChannelSetEvent(
 }
 
 #if 0
-static void
-VmbusChannelClearEvent(
-       VMBUS_CHANNEL                   *Channel
-       )
+static void VmbusChannelClearEvent(struct vmbus_channel *channel)
 {
        HV_MONITOR_PAGE *monitorPage;
 
@@ -160,11 +144,8 @@ Description:
        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;
@@ -204,9 +185,7 @@ Description:
        Open the specified channel.
 
 --*/
-int
-VmbusChannelOpen(
-       VMBUS_CHANNEL                   *NewChannel,
+int VmbusChannelOpen(struct vmbus_channel *NewChannel,
        u32                                     SendRingBufferSize,
        u32                                     RecvRingBufferSize,
        void *                                  UserData,
@@ -217,7 +196,7 @@ VmbusChannelOpen(
 {
        int ret=0;
        VMBUS_CHANNEL_OPEN_CHANNEL* openMsg;
-       VMBUS_CHANNEL_MSGINFO* openInfo;
+       struct vmbus_channel_msginfo *openInfo;
        void *in, *out;
        unsigned long flags;
 
@@ -266,7 +245,7 @@ VmbusChannelOpen(
                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();
@@ -399,7 +378,7 @@ static int
 VmbusChannelCreateGpadlHeader(
        void *                                  Kbuffer,        /* from kmalloc() */
        u32                                     Size,           /* page-size multiple */
-       VMBUS_CHANNEL_MSGINFO   **MsgInfo,
+       struct vmbus_channel_msginfo **MsgInfo,
        u32                                     *MessageCount)
 {
        int i;
@@ -407,8 +386,8 @@ VmbusChannelCreateGpadlHeader(
     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;
@@ -426,7 +405,7 @@ VmbusChannelCreateGpadlHeader(
        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);
@@ -463,7 +442,7 @@ VmbusChannelCreateGpadlHeader(
                                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;
@@ -486,7 +465,7 @@ VmbusChannelCreateGpadlHeader(
        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;
 
@@ -517,9 +496,7 @@ Description:
        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
@@ -530,8 +507,8 @@ VmbusChannelEstablishGpadl(
        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;
@@ -562,9 +539,9 @@ VmbusChannelEstablishGpadl(
 
        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);
@@ -575,16 +552,16 @@ VmbusChannelEstablishGpadl(
        {
                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);
                }
        }
@@ -622,22 +599,18 @@ Description:
        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();
@@ -683,14 +656,11 @@ Description:
        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);
@@ -700,7 +670,7 @@ VmbusChannelClose(
        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(); */
@@ -760,9 +730,7 @@ Description:
        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,
@@ -822,9 +790,7 @@ Description:
        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,
@@ -901,9 +867,7 @@ Description:
        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,
@@ -980,7 +944,7 @@ Description:
 
 --*/
 /* 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,
@@ -1055,9 +1019,7 @@ Description:
        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,
@@ -1132,7 +1094,7 @@ Description:
        Channel event callback
 
 --*/
-void VmbusChannelOnChannelEvent(VMBUS_CHANNEL *Channel)
+void VmbusChannelOnChannelEvent(struct vmbus_channel *Channel)
 {
        DumpVmbusChannel(Channel);
        ASSERT(Channel->OnChannelCallback);
@@ -1157,7 +1119,7 @@ Description:
 --*/
 void VmbusChannelOnTimer(unsigned long data)
 {
-       VMBUS_CHANNEL *channel = (VMBUS_CHANNEL*)data;
+       struct vmbus_channel *channel = (struct vmbus_channel *)data;
 
        if (channel->OnChannelCallback)
        {
@@ -1179,10 +1141,7 @@ Description:
        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 ");
index 4fc5baf297d1cf5f9aeca5ef9d1f988e157318c7..c741dc1373f51373872d52b0426622c89cec280c 100644 (file)
@@ -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);
 
index 23a1e179ba1c2d91c616d6a7029a168ea1ba2b96..451a1a5306547c2759be0c03f9c650c887671bd2 100644 (file)
@@ -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;
index 4680e14e6797ea7173491eb9724c648aee902736..ebf4f7e8847ac28ea2b19421c6035b62b7933c37 100644 (file)
@@ -131,11 +131,11 @@ Description:
        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 @@ Description:
 --*/
 static inline void ReleaseVmbusChannel(void* Context)
 {
-       VMBUS_CHANNEL* channel = (VMBUS_CHANNEL*)Context;
+       struct vmbus_channel *channel = Context;
 
        DPRINT_ENTER(VMBUS);
 
@@ -191,7 +191,7 @@ Description:
        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 @@ Description:
 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;
index 6a7bc4c63699784247d8af8a408d0057d79a1f5e..8b81d59b69dbecb7b7842863f098bcc99015ab85 100644 (file)
 
 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);
 
index 01aa669006ae0c1bde7f13eb2cf6d20dbc2a6352..6b726894b31bebd44901e84dba72ebcf2f48e9a1 100644 (file)
@@ -49,7 +49,7 @@ Description:
 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 @@ Description:
        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);
index 6b2841866936e29d396f0302dcb5c0cc78bedf6b..81e28f4339311dbae8cfc913a0674be486f96ab8 100644 (file)
@@ -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 */