diff options
author | Bill Pemberton | 2009-07-27 22:47:24 +0200 |
---|---|---|
committer | Greg Kroah-Hartman | 2009-09-15 21:01:50 +0200 |
commit | 454f18a963cf6519bf317e74e6b9781ffef8d253 (patch) | |
tree | 67b206b51dfa5590f3fbdc3db094df1ba5194c6d /drivers/staging/hv/StorVsc.c | |
parent | Staging: hv: Use %ld instead of %d for a long ints (diff) | |
download | kernel-qcow2-linux-454f18a963cf6519bf317e74e6b9781ffef8d253.tar.gz kernel-qcow2-linux-454f18a963cf6519bf317e74e6b9781ffef8d253.tar.xz kernel-qcow2-linux-454f18a963cf6519bf317e74e6b9781ffef8d253.zip |
Staging: hv: Remove C99 comments
Remove C99 // comments with traditional /* */ comments
Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/hv/StorVsc.c')
-rw-r--r-- | drivers/staging/hv/StorVsc.c | 190 |
1 files changed, 104 insertions, 86 deletions
diff --git a/drivers/staging/hv/StorVsc.c b/drivers/staging/hv/StorVsc.c index 439c447d2246..ee6d88e16d6c 100644 --- a/drivers/staging/hv/StorVsc.c +++ b/drivers/staging/hv/StorVsc.c @@ -32,45 +32,48 @@ #include "include/vstorage.h" -// -// #defines -// -// -// Data types -// +/* #defines */ + + + +/* Data types */ + typedef struct _STORVSC_REQUEST_EXTENSION { - //LIST_ENTRY ListEntry; + /* LIST_ENTRY ListEntry; */ STORVSC_REQUEST *Request; DEVICE_OBJECT *Device; - // Synchronize the request/response if needed + /* Synchronize the request/response if needed */ HANDLE WaitEvent; VSTOR_PACKET VStorPacket; } STORVSC_REQUEST_EXTENSION; -// A storvsc device is a device object that contains a vmbus channel +/* A storvsc device is a device object that contains a vmbus channel */ typedef struct _STORVSC_DEVICE{ DEVICE_OBJECT *Device; - int RefCount; // 0 indicates the device is being destroyed + int RefCount; /* 0 indicates the device is being destroyed */ int NumOutstandingRequests; - // Each unique Port/Path/Target represents 1 channel ie scsi controller. In reality, the pathid, targetid is always 0 - // and the port is set by us + /* + * Each unique Port/Path/Target represents 1 channel ie scsi + * controller. In reality, the pathid, targetid is always 0 + * and the port is set by us + */ unsigned int PortNumber; unsigned char PathId; unsigned char TargetId; - //LIST_ENTRY OutstandingRequestList; - //HANDLE OutstandingRequestLock; + /* LIST_ENTRY OutstandingRequestList; */ + /* HANDLE OutstandingRequestLock; */ - // Used for vsc/vsp channel reset process + /* Used for vsc/vsp channel reset process */ STORVSC_REQUEST_EXTENSION InitRequest; STORVSC_REQUEST_EXTENSION ResetRequest; @@ -78,19 +81,19 @@ typedef struct _STORVSC_DEVICE{ } STORVSC_DEVICE; -// -// Globals -// + +/* Globals */ + static const char* gDriverName="storvsc"; -//{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} +/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */ static const GUID gStorVscDeviceType={ .Data = {0xd9, 0x63, 0x61, 0xba, 0xa1, 0x04, 0x29, 0x4d, 0xb6, 0x05, 0x72, 0xe2, 0xff, 0xb1, 0xdc, 0x7f} }; -// -// Internal routines -// + +/* Internal routines */ + static int StorVscOnDeviceAdd( DEVICE_OBJECT *Device, @@ -150,8 +153,8 @@ static inline STORVSC_DEVICE* AllocStorDevice(DEVICE_OBJECT *Device) if (!storDevice) return NULL; - // Set to 2 to allow both inbound and outbound traffics - // (ie GetStorDevice() and MustGetStorDevice()) to proceed. + /* Set to 2 to allow both inbound and outbound traffics */ + /* (ie GetStorDevice() and MustGetStorDevice()) to proceed. */ InterlockedCompareExchange(&storDevice->RefCount, 2, 0); storDevice->Device = Device; @@ -166,7 +169,7 @@ static inline void FreeStorDevice(STORVSC_DEVICE *Device) kfree(Device); } -// Get the stordevice object iff exists and its refcount > 1 +/* Get the stordevice object iff exists and its refcount > 1 */ static inline STORVSC_DEVICE* GetStorDevice(DEVICE_OBJECT *Device) { STORVSC_DEVICE *storDevice; @@ -184,7 +187,7 @@ static inline STORVSC_DEVICE* GetStorDevice(DEVICE_OBJECT *Device) return storDevice; } -// Get the stordevice object iff exists and its refcount > 0 +/* Get the stordevice object iff exists and its refcount > 0 */ static inline STORVSC_DEVICE* MustGetStorDevice(DEVICE_OBJECT *Device) { STORVSC_DEVICE *storDevice; @@ -213,7 +216,7 @@ static inline void PutStorDevice(DEVICE_OBJECT *Device) ASSERT(storDevice->RefCount); } -// Drop ref count to 1 to effectively disable GetStorDevice() +/* Drop ref count to 1 to effectively disable GetStorDevice() */ static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device) { STORVSC_DEVICE *storDevice; @@ -221,7 +224,7 @@ static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device) storDevice = (STORVSC_DEVICE*)Device->Extension; ASSERT(storDevice); - // Busy wait until the ref drop to 2, then set it to 1 + /* Busy wait until the ref drop to 2, then set it to 1 */ while (InterlockedCompareExchange(&storDevice->RefCount, 1, 2) != 2) { udelay(100); @@ -230,7 +233,7 @@ static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device) return storDevice; } -// Drop ref count to 0. No one can use StorDevice object. +/* Drop ref count to 0. No one can use StorDevice object. */ static inline STORVSC_DEVICE* FinalReleaseStorDevice(DEVICE_OBJECT *Device) { STORVSC_DEVICE *storDevice; @@ -238,7 +241,7 @@ static inline STORVSC_DEVICE* FinalReleaseStorDevice(DEVICE_OBJECT *Device) storDevice = (STORVSC_DEVICE*)Device->Extension; ASSERT(storDevice); - // Busy wait until the ref drop to 1, then set it to 0 + /* Busy wait until the ref drop to 1, then set it to 0 */ while (InterlockedCompareExchange(&storDevice->RefCount, 0, 1) != 1) { udelay(100); @@ -271,7 +274,7 @@ StorVscInitialize( DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%d sizeof(STORVSC_REQUEST_EXTENSION)=%d sizeof(VSTOR_PACKET)=%d, sizeof(VMSCSI_REQUEST)=%d", sizeof(STORVSC_REQUEST), sizeof(STORVSC_REQUEST_EXTENSION), sizeof(VSTOR_PACKET), sizeof(VMSCSI_REQUEST)); - // Make sure we are at least 2 pages since 1 page is used for control + /* Make sure we are at least 2 pages since 1 page is used for control */ ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); Driver->name = gDriverName; @@ -279,14 +282,18 @@ StorVscInitialize( 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) + /* + * 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) + */ storDriver->MaxOutstandingRequestsPerChannel = ((storDriver->RingBufferSize - PAGE_SIZE) / ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET + sizeof(VSTOR_PACKET) + sizeof(u64),sizeof(u64))); DPRINT_INFO(STORVSC, "max io %u, currently %u\n", storDriver->MaxOutstandingRequestsPerChannel, STORVSC_MAX_IO_REQUESTS); - // Setup the dispatch table + /* Setup the dispatch table */ storDriver->Base.OnDeviceAdd = StorVscOnDeviceAdd; storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove; storDriver->Base.OnCleanup = StorVscOnCleanup; @@ -316,7 +323,7 @@ StorVscOnDeviceAdd( { int ret=0; STORVSC_DEVICE *storDevice; - //VMSTORAGE_CHANNEL_PROPERTIES *props; + /* VMSTORAGE_CHANNEL_PROPERTIES *props; */ STORVSC_DEVICE_INFO *deviceInfo = (STORVSC_DEVICE_INFO*)AdditionalInfo; DPRINT_ENTER(STORVSC); @@ -328,21 +335,25 @@ StorVscOnDeviceAdd( goto Cleanup; } - // Save the channel properties to our storvsc channel - //props = (VMSTORAGE_CHANNEL_PROPERTIES*) channel->offerMsg.Offer.u.Standard.UserDefined; + /* Save the channel properties to our storvsc channel */ + /* props = (VMSTORAGE_CHANNEL_PROPERTIES*) channel->offerMsg.Offer.u.Standard.UserDefined; */ + + /* FIXME: */ + /* + * If we support more than 1 scsi channel, we need to set the + * port number here to the scsi channel but how do we get the + * scsi channel prior to the bus scan + */ - // FIXME: - // If we support more than 1 scsi channel, we need to set the port number here - // to the scsi channel but how do we get the scsi channel prior to the bus scan - /*storChannel->PortNumber = 0; + /* storChannel->PortNumber = 0; storChannel->PathId = props->PathId; - storChannel->TargetId = props->TargetId;*/ + storChannel->TargetId = props->TargetId; */ storDevice->PortNumber = deviceInfo->PortNumber; - // Send it back up + /* Send it back up */ ret = StorVscConnectToVsp(Device); - //deviceInfo->PortNumber = storDevice->PortNumber; + /* deviceInfo->PortNumber = storDevice->PortNumber; */ deviceInfo->PathId = storDevice->PathId; deviceInfo->TargetId = storDevice->TargetId; @@ -372,7 +383,7 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device) request = &storDevice->InitRequest; vstorPacket = &request->VStorPacket; - // Now, initiate the vsc/vsp initialization protocol on the open channel + /* Now, initiate the vsc/vsp initialization protocol on the open channel */ memset(request, sizeof(STORVSC_REQUEST_EXTENSION), 0); request->WaitEvent = WaitEventCreate(); @@ -408,7 +419,7 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device) DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION..."); - // reuse the packet for version range supported + /* reuse the packet for version range supported */ memset(vstorPacket, sizeof(VSTOR_PACKET), 0); vstorPacket->Operation = VStorOperationQueryProtocolVersion; vstorPacket->Flags = REQUEST_COMPLETION_FLAG; @@ -430,14 +441,14 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device) WaitEventWait(request->WaitEvent); - // TODO: Check returned version + /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed (op %d status 0x%lx)", vstorPacket->Operation, vstorPacket->Status); goto Cleanup; } - // Query channel properties + /* Query channel properties */ DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION..."); memset(vstorPacket, sizeof(VSTOR_PACKET), 0); @@ -460,14 +471,14 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device) WaitEventWait(request->WaitEvent); - // TODO: Check returned version + /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed (op %d status 0x%lx)", vstorPacket->Operation, vstorPacket->Status); goto Cleanup; } - //storDevice->PortNumber = vstorPacket->StorageChannelProperties.PortNumber; + /* storDevice->PortNumber = vstorPacket->StorageChannelProperties.PortNumber; */ storDevice->PathId = vstorPacket->StorageChannelProperties.PathId; storDevice->TargetId = vstorPacket->StorageChannelProperties.TargetId; @@ -528,7 +539,7 @@ StorVscConnectToVsp( memset(&props, sizeof(VMSTORAGE_CHANNEL_PROPERTIES), 0); - // Open the channel + /* Open the channel */ ret = Device->Driver->VmbusChannelInterface.Open(Device, storDriver->RingBufferSize, storDriver->RingBufferSize, @@ -575,8 +586,11 @@ StorVscOnDeviceRemove( storDevice = ReleaseStorDevice(Device); - // At this point, all outbound traffic should be disable. We only allow inbound traffic (responses) to proceed - // so that outstanding requests can be completed. + /* + * At this point, all outbound traffic should be disable. We + * only allow inbound traffic (responses) to proceed so that + * outstanding requests can be completed. + */ while (storDevice->NumOutstandingRequests) { DPRINT_INFO(STORVSC, "waiting for %d requests to complete...", storDevice->NumOutstandingRequests); @@ -590,7 +604,7 @@ StorVscOnDeviceRemove( DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice); - // Close the channel + /* Close the channel */ Device->Driver->VmbusChannelInterface.Close(Device); FreeStorDevice(storDevice); @@ -599,22 +613,23 @@ StorVscOnDeviceRemove( return ret; } +/* *************** +static void +StorVscOnTargetRescan( +void *Context +) +{ +DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context; +STORVSC_DRIVER_OBJECT *storDriver; -//static void -//StorVscOnTargetRescan( -// void *Context -// ) -//{ -// DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context; -// STORVSC_DRIVER_OBJECT *storDriver; -// -// DPRINT_ENTER(STORVSC); -// -// storDriver = (STORVSC_DRIVER_OBJECT*) device->Driver; -// storDriver->OnHostRescan(device); -// -// DPRINT_EXIT(STORVSC); -//} +DPRINT_ENTER(STORVSC); + +storDriver = (STORVSC_DRIVER_OBJECT*) device->Driver; +storDriver->OnHostRescan(device); + +DPRINT_EXIT(STORVSC); +} +*********** */ int StorVscOnHostReset( @@ -660,13 +675,16 @@ StorVscOnHostReset( goto Cleanup; } - // FIXME: Add a timeout + /* FIXME: Add a timeout */ WaitEventWait(request->WaitEvent); WaitEventClose(request->WaitEvent); DPRINT_INFO(STORVSC, "host adapter reset completed"); - // At this point, all outstanding requests in the adapter should have been flushed out and return to us + /* + * At this point, all outstanding requests in the adapter + * should have been flushed out and return to us + */ Cleanup: PutStorDevice(Device); @@ -729,7 +747,7 @@ StorVscOnIORequest( vstorPacket->VmSrb.SenseInfoLength = SENSE_BUFFER_SIZE; - // Copy over the scsi command descriptor block + /* Copy over the scsi command descriptor block */ vstorPacket->VmSrb.CdbLength = Request->CdbLen; memcpy(&vstorPacket->VmSrb.Cdb, Request->Cdb, Request->CdbLen); @@ -827,7 +845,7 @@ StorVscOnIOCompletion( ASSERT(request->OnIOCompletion != NULL); - // Copy over the status...etc + /* Copy over the status...etc */ request->Status = VStorPacket->VmSrb.ScsiStatus; if (request->Status != 0 || VStorPacket->VmSrb.SrbStatus != 1) @@ -838,9 +856,9 @@ StorVscOnIOCompletion( VStorPacket->VmSrb.SrbStatus); } - if ((request->Status & 0xFF) == 0x02) // CHECK_CONDITION + if ((request->Status & 0xFF) == 0x02) /* CHECK_CONDITION */ { - if (VStorPacket->VmSrb.SrbStatus & 0x80) // autosense data available + if (VStorPacket->VmSrb.SrbStatus & 0x80) /* autosense data available */ { DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data valid - len %d\n", RequestExt, VStorPacket->VmSrb.SenseInfoLength); @@ -854,7 +872,7 @@ StorVscOnIOCompletion( } } - // TODO: + /* TODO: */ request->BytesXfer = VStorPacket->VmSrb.DataTransferLength; request->OnIOCompletion(request); @@ -882,17 +900,17 @@ StorVscOnReceive( StorVscOnIOCompletion(Device, VStorPacket, RequestExt); break; - //case ENUMERATE_DEVICE_OPERATION: + /* case ENUMERATE_DEVICE_OPERATION: */ - // DPRINT_INFO(STORVSC, "ENUMERATE_DEVICE_OPERATION"); + /* DPRINT_INFO(STORVSC, "ENUMERATE_DEVICE_OPERATION"); */ - // StorVscOnTargetRescan(Device); - // break; + /* StorVscOnTargetRescan(Device); */ + /* break; */ - case VStorOperationRemoveDevice: + case VStorOperationRemoveDevice: DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION"); - // TODO: + /* TODO: */ break; default: @@ -937,15 +955,15 @@ StorVscOnChannelCallback( { DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx", bytesRecvd, requestId); - //ASSERT(bytesRecvd == sizeof(VSTOR_PACKET)); + /* ASSERT(bytesRecvd == sizeof(VSTOR_PACKET)); */ request = (STORVSC_REQUEST_EXTENSION*)(unsigned long)requestId; ASSERT(request); - //if (vstorPacket.Flags & SYNTHETIC_FLAG) + /* if (vstorPacket.Flags & SYNTHETIC_FLAG) */ if ((request == &storDevice->InitRequest) || (request == &storDevice->ResetRequest)) { - //DPRINT_INFO(STORVSC, "reset completion - operation %u status %u", vstorPacket.Operation, vstorPacket.Status); + /* DPRINT_INFO(STORVSC, "reset completion - operation %u status %u", vstorPacket.Operation, vstorPacket.Status); */ memcpy(&request->VStorPacket, packet, sizeof(VSTOR_PACKET)); @@ -958,7 +976,7 @@ StorVscOnChannelCallback( } else { - //DPRINT_DBG(STORVSC, "nothing else to read..."); + /* DPRINT_DBG(STORVSC, "nothing else to read..."); */ break; } } while (1); |