diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-08-27 16:02:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:01:59 -0700 |
commit | 8dc0a06ad1f192ea0c8dbe4d2090206c7d880281 (patch) | |
tree | 66ef85cce144630b8ab83db95236ef3fd576e84a | |
parent | 4bedd6be8b9e9a24f48792c1bef82f521a01db2a (diff) |
Staging: hv: remove typedefs from VmbusPacketFormat.h
All spiffied up now, shines like a brass button on the bump of a barge's
bilge.
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/staging/hv/Channel.c | 28 | ||||
-rw-r--r-- | drivers/staging/hv/Channel.h | 6 | ||||
-rw-r--r-- | drivers/staging/hv/NetVsc.c | 20 | ||||
-rw-r--r-- | drivers/staging/hv/include/ChannelMessages.h | 2 | ||||
-rw-r--r-- | drivers/staging/hv/include/VmbusPacketFormat.h | 108 | ||||
-rw-r--r-- | drivers/staging/hv/vstorage.h | 2 |
6 files changed, 79 insertions, 87 deletions
diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index cd3b0b028f17..8849e23065f1 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -395,13 +395,13 @@ VmbusChannelCreateGpadlHeader( pfn = virt_to_phys(Kbuffer) >> PAGE_SHIFT; /* do we need a gpadl body msg */ - pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_header) - sizeof(GPA_RANGE); + pfnSize = MAX_SIZE_CHANNEL_MESSAGE - sizeof(struct vmbus_channel_gpadl_header) - sizeof(struct 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(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pfnCount*sizeof(u64); + msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(struct gpa_range) + pfnCount*sizeof(u64); msgHeader = kzalloc(msgSize, GFP_KERNEL); INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList); @@ -409,7 +409,7 @@ VmbusChannelCreateGpadlHeader( gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg; gpaHeader->RangeCount = 1; - gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64); + gpaHeader->RangeBufLen = sizeof(struct gpa_range) + pageCount*sizeof(u64); gpaHeader->Range[0].ByteOffset = 0; gpaHeader->Range[0].ByteCount = Size; for (i=0; i<pfnCount; i++) @@ -461,13 +461,13 @@ VmbusChannelCreateGpadlHeader( else { /* everything fits in a header */ - msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(GPA_RANGE) + pageCount*sizeof(u64); + msgSize = sizeof(struct vmbus_channel_msginfo) + sizeof(struct vmbus_channel_gpadl_header) + sizeof(struct gpa_range) + pageCount*sizeof(u64); msgHeader = kzalloc(msgSize, GFP_KERNEL); msgHeader->MessageSize=msgSize; gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg; gpaHeader->RangeCount = 1; - gpaHeader->RangeBufLen = sizeof(GPA_RANGE) + pageCount*sizeof(u64); + gpaHeader->RangeBufLen = sizeof(struct gpa_range) + pageCount*sizeof(u64); gpaHeader->Range[0].ByteOffset = 0; gpaHeader->Range[0].ByteCount = Size; for (i=0; i<pageCount; i++) @@ -730,13 +730,13 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, const void * Buffer, u32 BufferLen, u64 RequestId, - VMBUS_PACKET_TYPE Type, + enum vmbus_packet_type Type, u32 Flags ) { int ret=0; - VMPACKET_DESCRIPTOR desc; - u32 packetLen = sizeof(VMPACKET_DESCRIPTOR) + BufferLen; + struct vmpacket_descriptor desc; + u32 packetLen = sizeof(struct vmpacket_descriptor) + BufferLen; u32 packetLenAligned = ALIGN_UP(packetLen, sizeof(u64)); struct scatterlist bufferList[3]; u64 alignedData=0; @@ -751,12 +751,12 @@ int VmbusChannelSendPacket(struct vmbus_channel *Channel, /* Setup the descriptor */ desc.Type = Type; /* VmbusPacketTypeDataInBand; */ desc.Flags = Flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */ - desc.DataOffset8 = sizeof(VMPACKET_DESCRIPTOR) >> 3; /* in 8-bytes granularity */ + desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3; /* in 8-bytes granularity */ desc.Length8 = (u16)(packetLenAligned >> 3); desc.TransactionId = RequestId; sg_init_table(bufferList,3); - sg_set_buf(&bufferList[0], &desc, sizeof(VMPACKET_DESCRIPTOR)); + sg_set_buf(&bufferList[0], &desc, sizeof(struct vmpacket_descriptor)); sg_set_buf(&bufferList[1], Buffer, BufferLen); sg_set_buf(&bufferList[2], &alignedData, packetLenAligned - packetLen); @@ -946,7 +946,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, u32 *BufferActualLen, u64 *RequestId) { - VMPACKET_DESCRIPTOR desc; + struct vmpacket_descriptor desc; u32 packetLen; u32 userLen; int ret; @@ -959,7 +959,7 @@ int VmbusChannelRecvPacket(struct vmbus_channel *Channel, spin_lock_irqsave(&Channel->inbound_lock, flags); - ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR)); + ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&Channel->inbound_lock, flags); @@ -1022,7 +1022,7 @@ int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel, u64* RequestId ) { - VMPACKET_DESCRIPTOR desc; + struct vmpacket_descriptor desc; u32 packetLen; u32 userLen; int ret; @@ -1035,7 +1035,7 @@ int VmbusChannelRecvPacketRaw(struct vmbus_channel *Channel, spin_lock_irqsave(&Channel->inbound_lock, flags); - ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(VMPACKET_DESCRIPTOR)); + ret = RingBufferPeek(&Channel->Inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&Channel->inbound_lock, flags); diff --git a/drivers/staging/hv/Channel.h b/drivers/staging/hv/Channel.h index 7fde5cb23857..2fa28259ed0e 100644 --- a/drivers/staging/hv/Channel.h +++ b/drivers/staging/hv/Channel.h @@ -27,7 +27,7 @@ #include "ChannelMgmt.h" -/* The format must be the same as VMDATA_GPA_DIRECT */ +/* The format must be the same as struct vmdata_gpa_direct */ struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { u16 Type; u16 DataOffset8; @@ -39,7 +39,7 @@ struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER { struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT]; } __attribute__((packed)); -/* The format must be the same as VMDATA_GPA_DIRECT */ +/* The format must be the same as struct vmdata_gpa_direct */ struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER { u16 Type; u16 DataOffset8; @@ -66,7 +66,7 @@ extern int VmbusChannelSendPacket(struct vmbus_channel *channel, const void *Buffer, u32 BufferLen, u64 RequestId, - VMBUS_PACKET_TYPE Type, + enum vmbus_packet_type Type, u32 Flags); extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel, diff --git a/drivers/staging/hv/NetVsc.c b/drivers/staging/hv/NetVsc.c index a7363a17536c..36f98ebfaeac 100644 --- a/drivers/staging/hv/NetVsc.c +++ b/drivers/staging/hv/NetVsc.c @@ -92,7 +92,7 @@ NetVscConnectToVsp( static void NetVscOnSendCompletion( struct hv_device *Device, - VMPACKET_DESCRIPTOR *Packet + struct vmpacket_descriptor *Packet ); static int @@ -104,7 +104,7 @@ NetVscOnSend( static void NetVscOnReceive( struct hv_device *Device, - VMPACKET_DESCRIPTOR *Packet + struct vmpacket_descriptor *Packet ); static void @@ -236,8 +236,8 @@ NetVscInitialize( DPRINT_ENTER(NETVSC); - DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(VMTRANSFER_PAGE_PACKET_HEADER)=%zd", - sizeof(struct hv_netvsc_packet), sizeof(NVSP_MESSAGE), sizeof(VMTRANSFER_PAGE_PACKET_HEADER)); + DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(struct vmtransfer_page_packet_header)=%zd", + sizeof(struct hv_netvsc_packet), sizeof(NVSP_MESSAGE), sizeof(struct vmtransfer_page_packet_header)); /* Make sure we are at least 2 pages since 1 page is used for control */ ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1)); @@ -991,7 +991,7 @@ NetVscOnCleanup( static void NetVscOnSendCompletion( struct hv_device *Device, - VMPACKET_DESCRIPTOR *Packet + struct vmpacket_descriptor *Packet ) { struct NETVSC_DEVICE *netDevice; @@ -1109,11 +1109,11 @@ NetVscOnSend( static void NetVscOnReceive( struct hv_device *Device, - VMPACKET_DESCRIPTOR *Packet + struct vmpacket_descriptor *Packet ) { struct NETVSC_DEVICE *netDevice; - VMTRANSFER_PAGE_PACKET_HEADER *vmxferpagePacket; + struct vmtransfer_page_packet_header *vmxferpagePacket; NVSP_MESSAGE *nvspPacket; struct hv_netvsc_packet *netvscPacket=NULL; LIST_ENTRY* entry; @@ -1157,7 +1157,7 @@ NetVscOnReceive( DPRINT_DBG(NETVSC, "NVSP packet received - type %d", nvspPacket->Header.MessageType); - vmxferpagePacket = (VMTRANSFER_PAGE_PACKET_HEADER*)Packet; + vmxferpagePacket = (struct vmtransfer_page_packet_header *)Packet; if (vmxferpagePacket->TransferPageSetId != NETVSC_RECEIVE_BUFFER_ID) { @@ -1420,7 +1420,7 @@ NetVscOnChannelCallback( u32 bytesRecvd; u64 requestId; unsigned char packet[netPacketSize]; - VMPACKET_DESCRIPTOR *desc; + struct vmpacket_descriptor *desc; unsigned char *buffer=packet; int bufferlen=netPacketSize; @@ -1451,7 +1451,7 @@ NetVscOnChannelCallback( { DPRINT_DBG(NETVSC, "receive %d bytes, tid %llx", bytesRecvd, requestId); - desc = (VMPACKET_DESCRIPTOR*)buffer; + desc = (struct vmpacket_descriptor*)buffer; switch (desc->Type) { case VmbusPacketTypeCompletion: diff --git a/drivers/staging/hv/include/ChannelMessages.h b/drivers/staging/hv/include/ChannelMessages.h index a59b7fc1b4f4..4e1f407c3e24 100644 --- a/drivers/staging/hv/include/ChannelMessages.h +++ b/drivers/staging/hv/include/ChannelMessages.h @@ -151,7 +151,7 @@ struct vmbus_channel_gpadl_header { u32 Gpadl; u16 RangeBufLen; u16 RangeCount; - GPA_RANGE Range[0]; + struct gpa_range Range[0]; } __attribute__((packed)); /* This is the followup packet that contains more PFNs. */ diff --git a/drivers/staging/hv/include/VmbusPacketFormat.h b/drivers/staging/hv/include/VmbusPacketFormat.h index d7f65de31bbc..79120bc742dc 100644 --- a/drivers/staging/hv/include/VmbusPacketFormat.h +++ b/drivers/staging/hv/include/VmbusPacketFormat.h @@ -23,57 +23,55 @@ #ifndef _VMBUSPACKETFORMAT_H_ -typedef struct { +struct vmpacket_descriptor { u16 Type; u16 DataOffset8; u16 Length8; u16 Flags; u64 TransactionId; -} __attribute__((packed)) VMPACKET_DESCRIPTOR, *PVMPACKET_DESCRIPTOR; +} __attribute__((packed)); -typedef u32 PREVIOUS_PACKET_OFFSET, *PPREVIOUS_PACKET_OFFSET; +struct vmpacket_header { + u32 PreviousPacketStartOffset; + struct vmpacket_descriptor Descriptor; +} __attribute__((packed)); -typedef struct { - PREVIOUS_PACKET_OFFSET PreviousPacketStartOffset; - VMPACKET_DESCRIPTOR Descriptor; -} __attribute__((packed)) VMPACKET_HEADER, *PVMPACKET_HEADER; - -typedef struct { +struct vmtransfer_page_range { u32 ByteCount; u32 ByteOffset; -} __attribute__((packed)) VMTRANSFER_PAGE_RANGE, *PVMTRANSFER_PAGE_RANGE; +} __attribute__((packed)); -typedef struct VMTRANSFER_PAGE_PACKET_HEADER { - VMPACKET_DESCRIPTOR d; +struct vmtransfer_page_packet_header { + struct vmpacket_descriptor d; u16 TransferPageSetId; bool SenderOwnsSet; u8 Reserved; u32 RangeCount; - VMTRANSFER_PAGE_RANGE Ranges[1]; -} __attribute__((packed)) VMTRANSFER_PAGE_PACKET_HEADER, *PVMTRANSFER_PAGE_PACKET_HEADER; + struct vmtransfer_page_range Ranges[1]; +} __attribute__((packed)); -typedef struct _VMGPADL_PACKET_HEADER { - VMPACKET_DESCRIPTOR d; +struct vmgpadl_packet_header { + struct vmpacket_descriptor d; u32 Gpadl; u32 Reserved; -} __attribute__((packed)) VMGPADL_PACKET_HEADER, *PVMGPADL_PACKET_HEADER; +} __attribute__((packed)); -typedef struct _VMADD_REMOVE_TRANSFER_PAGE_SET { - VMPACKET_DESCRIPTOR d; +struct vmadd_remove_transfer_page_set { + struct vmpacket_descriptor d; u32 Gpadl; u16 TransferPageSetId; u16 Reserved; -} __attribute__((packed)) VMADD_REMOVE_TRANSFER_PAGE_SET, *PVMADD_REMOVE_TRANSFER_PAGE_SET; +} __attribute__((packed)); /* * This structure defines a range in guest physical space that can be made to * look virtually contiguous. */ -typedef struct _GPA_RANGE { +struct gpa_range { u32 ByteCount; u32 ByteOffset; u64 PfnArray[0]; -} GPA_RANGE, *PGPA_RANGE; +}; /* * This is the format for an Establish Gpadl packet, which contains a handle by @@ -82,71 +80,65 @@ typedef struct _GPA_RANGE { * ranges, then the resulting MDL will be "chained," representing multiple VA * ranges. */ -typedef struct _VMESTABLISH_GPADL { - VMPACKET_DESCRIPTOR d; +struct vmestablish_gpadl { + struct vmpacket_descriptor d; u32 Gpadl; u32 RangeCount; - GPA_RANGE Range[1]; -} __attribute__((packed)) VMESTABLISH_GPADL, *PVMESTABLISH_GPADL; + struct gpa_range Range[1]; +} __attribute__((packed)); /* * This is the format for a Teardown Gpadl packet, which indicates that the * GPADL handle in the Establish Gpadl packet will never be referenced again. */ -typedef struct _VMTEARDOWN_GPADL { - VMPACKET_DESCRIPTOR d; +struct vmteardown_gpadl { + struct vmpacket_descriptor d; u32 Gpadl; u32 Reserved; /* for alignment to a 8-byte boundary */ -} __attribute__((packed)) VMTEARDOWN_GPADL, *PVMTEARDOWN_GPADL; +} __attribute__((packed)); /* * This is the format for a GPA-Direct packet, which contains a set of GPA * ranges, in addition to commands and/or data. */ -typedef struct _VMDATA_GPA_DIRECT { - VMPACKET_DESCRIPTOR d; +struct vmdata_gpa_direct { + struct vmpacket_descriptor d; u32 Reserved; u32 RangeCount; - GPA_RANGE Range[1]; -} __attribute__((packed)) VMDATA_GPA_DIRECT, *PVMDATA_GPA_DIRECT; + struct gpa_range Range[1]; +} __attribute__((packed)); /* This is the format for a Additional Data Packet. */ -typedef struct _VMADDITIONAL_DATA { - VMPACKET_DESCRIPTOR d; +struct vmadditional_data { + struct vmpacket_descriptor d; u64 TotalBytes; u32 ByteOffset; u32 ByteCount; unsigned char Data[1]; -} __attribute__((packed)) VMADDITIONAL_DATA, *PVMADDITIONAL_DATA; - -typedef union { - VMPACKET_DESCRIPTOR SimpleHeader; - VMTRANSFER_PAGE_PACKET_HEADER TransferPageHeader; - VMGPADL_PACKET_HEADER GpadlHeader; - VMADD_REMOVE_TRANSFER_PAGE_SET AddRemoveTransferPageHeader; - VMESTABLISH_GPADL EstablishGpadlHeader; - VMTEARDOWN_GPADL TeardownGpadlHeader; - VMDATA_GPA_DIRECT DataGpaDirectHeader; -} VMPACKET_LARGEST_POSSIBLE_HEADER, *PVMPACKET_LARGEST_POSSIBLE_HEADER; +} __attribute__((packed)); + +union vmpacket_largest_possible_header { + struct vmpacket_descriptor SimpleHeader; + struct vmtransfer_page_packet_header TransferPageHeader; + struct vmgpadl_packet_header GpadlHeader; + struct vmadd_remove_transfer_page_set AddRemoveTransferPageHeader; + struct vmestablish_gpadl EstablishGpadlHeader; + struct vmteardown_gpadl TeardownGpadlHeader; + struct vmdata_gpa_direct DataGpaDirectHeader; +}; #define VMPACKET_DATA_START_ADDRESS(__packet) \ (void *)(((unsigned char *)__packet) + \ - ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8 * 8) + ((struct vmpacket_descriptor)__packet)->DataOffset8 * 8) #define VMPACKET_DATA_LENGTH(__packet) \ - ((((PVMPACKET_DESCRIPTOR)__packet)->Length8 - \ - ((PVMPACKET_DESCRIPTOR)__packet)->DataOffset8) * 8) + ((((struct vmpacket_descriptor)__packet)->Length8 - \ + ((struct vmpacket_descriptor)__packet)->DataOffset8) * 8) #define VMPACKET_TRANSFER_MODE(__packet) \ - (((PVMPACKET_DESCRIPTOR)__packet)->Type) - -typedef enum { - VmbusServerEndpoint = 0, - VmbusClientEndpoint, - VmbusEndpointMaximum -} ENDPOINT_TYPE, *PENDPOINT_TYPE; + (((struct IMPACT)__packet)->Type) -typedef enum { +enum vmbus_packet_type { VmbusPacketTypeInvalid = 0x0, VmbusPacketTypeSynch = 0x1, VmbusPacketTypeAddTransferPageSet = 0x2, @@ -161,7 +153,7 @@ typedef enum { VmbusPacketTypeCompletion = 0xb, VmbusPacketTypeDataUsingAdditionalPackets = 0xc, VmbusPacketTypeAdditionalData = 0xd -} VMBUS_PACKET_TYPE, *PVMBUS_PACKET_TYPE; +}; #define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1 diff --git a/drivers/staging/hv/vstorage.h b/drivers/staging/hv/vstorage.h index 264cf4adb07c..6d160a53914e 100644 --- a/drivers/staging/hv/vstorage.h +++ b/drivers/staging/hv/vstorage.h @@ -58,7 +58,7 @@ /* the host adapter. */ /* The max transfer length will be published when we offer a vmbus channel. */ #define MAX_TRANSFER_LENGTH 0x40000 -#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \ +#define DEFAULT_PACKET_SIZE (sizeof(struct vmdata_gpa_direct) + \ sizeof(struct vstor_packet) + \ sizesizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE))) |