[PATCH 1/8] staging/hv: remove typedef VSTOR_PACKET

Bill Pemberton wfp5p at virginia.edu
Fri Aug 7 19:52:14 UTC 2009


The VSTOR_PACKET typedef is removed.  The struct it defines is now
named hv_vstor_packet

Signed-off-by: Bill Pemberton <wfp5p at virginia.edu>
---
 drivers/staging/hv/BlkVsc.c           |    4 +-
 drivers/staging/hv/StorVsc.c          |   58 ++++++++++++++++----------------
 drivers/staging/hv/include/vstorage.h |   10 +++---
 3 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/hv/BlkVsc.c b/drivers/staging/hv/BlkVsc.c
index 526a0ab..8bc15b4 100644
--- a/drivers/staging/hv/BlkVsc.c
+++ b/drivers/staging/hv/BlkVsc.c
@@ -57,9 +57,9 @@ BlkVscInitialize(
 
 	storDriver->RequestExtSize			= sizeof(STORVSC_REQUEST_EXTENSION);
 	/* Divide the ring buffer data size (which is 1 page less than the ring buffer size since that page is reserved for the ring buffer indices) */
-	/* by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + VSTOR_PACKET + u64) */
+	/* by the max request size (which is VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + struct hv_vstor_packet + u64) */
 	storDriver->MaxOutstandingRequestsPerChannel =
-		((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(u64),sizeof(u64)));
+		((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct hv_vstor_packet) + sizeof(u64),sizeof(u64)));
 
 	DPRINT_INFO(BLKVSC, "max io outstd %u", storDriver->MaxOutstandingRequestsPerChannel);
 
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c
index 47de70b..87885ce 100644
--- a/drivers/staging/hv/StorVsc.c
+++ b/drivers/staging/hv/StorVsc.c
@@ -49,7 +49,7 @@ typedef struct _STORVSC_REQUEST_EXTENSION {
 	/* Synchronize the request/response if needed */
 	struct osd_waitevent *WaitEvent;
 
-	VSTOR_PACKET					VStorPacket;
+	struct hv_vstor_packet VStorPacket;
 } STORVSC_REQUEST_EXTENSION;
 
 
@@ -129,14 +129,14 @@ StorVscOnChannelCallback(
 static void
 StorVscOnIOCompletion(
 	struct hv_device *Device,
-	VSTOR_PACKET	*VStorPacket,
+	struct hv_vstor_packet *VStorPacket,
 	STORVSC_REQUEST_EXTENSION *RequestExt
 	);
 
 static void
 StorVscOnReceive(
 	struct hv_device *Device,
-	VSTOR_PACKET	*VStorPacket,
+	struct hv_vstor_packet *VStorPacket,
 	STORVSC_REQUEST_EXTENSION *RequestExt
 	);
 
@@ -263,8 +263,8 @@ StorVscInitialize(
 
 	DPRINT_ENTER(STORVSC);
 
-	DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd sizeof(STORVSC_REQUEST_EXTENSION)=%zd sizeof(VSTOR_PACKET)=%zd, sizeof(VMSCSI_REQUEST)=%zd",
-		sizeof(struct hv_storvsc_request), sizeof(STORVSC_REQUEST_EXTENSION), sizeof(VSTOR_PACKET), sizeof(VMSCSI_REQUEST));
+	DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd sizeof(STORVSC_REQUEST_EXTENSION)=%zd sizeof(struct hv_vstor_packet)=%zd, sizeof(VMSCSI_REQUEST)=%zd",
+		sizeof(struct hv_storvsc_request), sizeof(STORVSC_REQUEST_EXTENSION), sizeof(struct hv_vstor_packet), sizeof(VMSCSI_REQUEST));
 
 	/* Make sure we are at least 2 pages since 1 page is used for control */
 	ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1));
@@ -278,10 +278,10 @@ StorVscInitialize(
 	 * Divide the ring buffer data size (which is 1 page less
 	 * than the ring buffer size since that page is reserved for
 	 * the ring buffer indices) by the max request size (which is
-	 * VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + VSTOR_PACKET + u64)
+	 * VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER + hv_vstor_packet + u64)
 	 */
 	storDriver->MaxOutstandingRequestsPerChannel =
-		((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(u64),sizeof(u64)));
+		((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(struct hv_vstor_packet) + sizeof(u64),sizeof(u64)));
 
 	DPRINT_INFO(STORVSC, "max io %u, currently %u\n", storDriver->MaxOutstandingRequestsPerChannel, STORVSC_MAX_IO_REQUESTS);
 
@@ -362,7 +362,7 @@ static int StorVscChannelInit(struct hv_device *Device)
 	int ret=0;
 	STORVSC_DEVICE *storDevice;
 	STORVSC_REQUEST_EXTENSION *request;
-	VSTOR_PACKET *vstorPacket;
+	struct hv_vstor_packet *vstorPacket;
 
 	storDevice = GetStorDevice(Device);
 	if (!storDevice)
@@ -391,7 +391,7 @@ static int StorVscChannelInit(struct hv_device *Device)
 
 	ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(*vstorPacket),
 															(unsigned long)request,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -412,7 +412,7 @@ static int StorVscChannelInit(struct hv_device *Device)
 	DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION...");
 
 	/* reuse the packet for version range supported */
-	memset(vstorPacket, sizeof(VSTOR_PACKET), 0);
+	memset(vstorPacket, sizeof(*vstorPacket), 0);
 	vstorPacket->Operation = VStorOperationQueryProtocolVersion;
 	vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
 
@@ -421,7 +421,7 @@ static int StorVscChannelInit(struct hv_device *Device)
 
 	ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(*vstorPacket),
 															(unsigned long)request,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -443,14 +443,14 @@ static int StorVscChannelInit(struct hv_device *Device)
 	/* Query channel properties */
 	DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");
 
-	memset(vstorPacket, sizeof(VSTOR_PACKET), 0);
+	memset(vstorPacket, sizeof(*vstorPacket), 0);
     vstorPacket->Operation = VStorOperationQueryProperties;
 	vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
     vstorPacket->StorageChannelProperties.PortNumber = storDevice->PortNumber;
 
 	ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(*vstorPacket),
 															(unsigned long)request,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -478,13 +478,13 @@ static int StorVscChannelInit(struct hv_device *Device)
 
 	DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION...");
 
-	memset(vstorPacket, sizeof(VSTOR_PACKET), 0);
+	memset(vstorPacket, sizeof(*vstorPacket), 0);
     vstorPacket->Operation = VStorOperationEndInitialization;
 	vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
 
 	ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(*vstorPacket),
 															(unsigned long)request,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -632,7 +632,7 @@ StorVscOnHostReset(
 
 	STORVSC_DEVICE *storDevice;
 	STORVSC_REQUEST_EXTENSION *request;
-	VSTOR_PACKET *vstorPacket;
+	struct hv_vstor_packet *vstorPacket;
 
 	DPRINT_ENTER(STORVSC);
 
@@ -657,7 +657,7 @@ StorVscOnHostReset(
 
 	ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(*vstorPacket),
 															(unsigned long)&storDevice->ResetRequest,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -701,7 +701,7 @@ StorVscOnIORequest(
 {
 	STORVSC_DEVICE *storDevice;
 	STORVSC_REQUEST_EXTENSION* requestExtension = (STORVSC_REQUEST_EXTENSION*) Request->Extension;
-	VSTOR_PACKET* vstorPacket =&requestExtension->VStorPacket;
+	struct hv_vstor_packet *vstorPacket = &requestExtension->VStorPacket;
 	int ret=0;
 
 	DPRINT_ENTER(STORVSC);
@@ -726,11 +726,11 @@ StorVscOnIORequest(
 	requestExtension->Request = Request;
 	requestExtension->Device  = Device;
 
-	memset(vstorPacket, 0 , sizeof(VSTOR_PACKET));
+	memset(vstorPacket, 0 , sizeof(*vstorPacket));
 
 	vstorPacket->Flags |= REQUEST_COMPLETION_FLAG;
 
-    vstorPacket->VmSrb.Length = sizeof(VMSCSI_REQUEST);
+	vstorPacket->VmSrb.Length = sizeof(VMSCSI_REQUEST);
 
 	vstorPacket->VmSrb.PortNumber = Request->Host;
     vstorPacket->VmSrb.PathId = Request->Bus;
@@ -762,14 +762,14 @@ StorVscOnIORequest(
 		ret = Device->Driver->VmbusChannelInterface.SendPacketMultiPageBuffer(Device,
 				&requestExtension->Request->DataBuffer,
 				vstorPacket,
-				sizeof(VSTOR_PACKET),
+				sizeof(vstorPacket),
 				(unsigned long)requestExtension);
 	}
 	else
 	{
 		ret = Device->Driver->VmbusChannelInterface.SendPacket(Device,
 															vstorPacket,
-															sizeof(VSTOR_PACKET),
+															sizeof(vstorPacket),
 															(unsigned long)requestExtension,
 															VmbusPacketTypeDataInBand,
 															VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
@@ -810,7 +810,7 @@ StorVscOnCleanup(
 static void
 StorVscOnIOCompletion(
 	struct hv_device *Device,
-	VSTOR_PACKET	*VStorPacket,
+	struct hv_vstor_packet *VStorPacket,
 	STORVSC_REQUEST_EXTENSION *RequestExt
 	)
 {
@@ -880,7 +880,7 @@ StorVscOnIOCompletion(
 static void
 StorVscOnReceive(
 	struct hv_device *Device,
-	VSTOR_PACKET	*VStorPacket,
+	struct hv_vstor_packet *VStorPacket,
 	STORVSC_REQUEST_EXTENSION *RequestExt
 	)
 {
@@ -921,7 +921,7 @@ StorVscOnChannelCallback(
 	STORVSC_DEVICE *storDevice;
 	u32 bytesRecvd;
 	u64 requestId;
-	unsigned char packet[ALIGN_UP(sizeof(VSTOR_PACKET),8)];
+	unsigned char packet[ALIGN_UP(sizeof(struct hv_vstor_packet),8)];
 	STORVSC_REQUEST_EXTENSION *request;
 
 	DPRINT_ENTER(STORVSC);
@@ -940,14 +940,14 @@ StorVscOnChannelCallback(
 	{
 		ret = device->Driver->VmbusChannelInterface.RecvPacket(device,
 																packet,
-																ALIGN_UP(sizeof(VSTOR_PACKET),8),
+																ALIGN_UP(sizeof(struct hv_vstor_packet),8),
 																&bytesRecvd,
 																&requestId);
 		if (ret == 0 && bytesRecvd > 0)
 		{
 			DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", bytesRecvd, requestId);
 
-			/* ASSERT(bytesRecvd == sizeof(VSTOR_PACKET)); */
+			/* ASSERT(bytesRecvd == sizeof(struct hv_vstor_packet)); */
 
 			request = (STORVSC_REQUEST_EXTENSION*)(unsigned long)requestId;
 			ASSERT(request);
@@ -957,13 +957,13 @@ StorVscOnChannelCallback(
 			{
 				/* DPRINT_INFO(STORVSC, "reset completion - operation %u status %u", vstorPacket.Operation, vstorPacket.Status); */
 
-				memcpy(&request->VStorPacket, packet, sizeof(VSTOR_PACKET));
+				memcpy(&request->VStorPacket, packet, sizeof(struct hv_vstor_packet));
 
 				osd_WaitEventSet(request->WaitEvent);
 			}
 			else
 			{
-				StorVscOnReceive(device, (VSTOR_PACKET*)packet, request);
+				StorVscOnReceive(device, (struct hv_vstor_packet *)packet, request);
 			}
 		}
 		else
diff --git a/drivers/staging/hv/include/vstorage.h b/drivers/staging/hv/include/vstorage.h
index 33646e7..99968b8 100644
--- a/drivers/staging/hv/include/vstorage.h
+++ b/drivers/staging/hv/include/vstorage.h
@@ -92,8 +92,8 @@
 
 
 #define MAX_TRANSFER_LENGTH 0x40000
-#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) +                            \
-			     sizeof(VSTOR_PACKET) +                                 \
+#define DEFAULT_PACKET_SIZE (sizeof(VMDATA_GPA_DIRECT) + \
+			     sizeof(struct hv_vstor_packet) + \
 			     (sizeof(u64) * (MAX_TRANSFER_LENGTH / PAGE_SIZE)))
 
 
@@ -237,7 +237,7 @@ C_ASSERT((sizeof(VMSTORAGE_PROTOCOL_VERSION) % 4) == 0);
 #define STORAGE_CHANNEL_EMULATED_IDE_FLAG               0x2
 
 
-typedef struct _VSTOR_PACKET
+struct hv_vstor_packet
 {
 
     /* Requested operation type */
@@ -282,9 +282,9 @@ typedef struct _VSTOR_PACKET
 	VMSTORAGE_PROTOCOL_VERSION Version;
     };
 
-} VSTOR_PACKET, *PVSTOR_PACKET;
+};
 
-C_ASSERT((sizeof(VSTOR_PACKET) % 4) == 0);
+C_ASSERT((sizeof(struc hv_vstor_packet) % 4) == 0);
 
 
 /*  Packet flags */
-- 
1.6.2.5




More information about the devel mailing list