2010-12-06 20:31:05

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 1/8] staging: hv: Convert camel case struct fields in vstorage.h to lowercase

From: Hank Janssen <[email protected]>

Convert camel case struct fields in vstorage.h to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/storvsc.c | 133 +++++++++++++++++++++--------------------
drivers/staging/hv/vstorage.h | 106 ++++++++++++++++----------------
2 files changed, 120 insertions(+), 119 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 525c8ee..96b4ed9 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -204,8 +204,8 @@ static int StorVscChannelInit(struct hv_device *Device)
goto nomem;
}

- vstorPacket->Operation = VStorOperationBeginInitialization;
- vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
+ vstorPacket->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
+ vstorPacket->flags = REQUEST_COMPLETION_FLAG;

/*SpinlockAcquire(gDriverExt.packetListLock);
INSERT_TAIL_LIST(&gDriverExt.packetList, &packet->listEntry.entry);
@@ -226,11 +226,11 @@ static int StorVscChannelInit(struct hv_device *Device)

osd_waitevent_wait(request->WaitEvent);

- if (vstorPacket->Operation != VStorOperationCompleteIo ||
- vstorPacket->Status != 0) {
+ if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstorPacket->status != 0) {
DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->Operation, vstorPacket->Status);
+ vstorPacket->operation, vstorPacket->status);
goto Cleanup;
}

@@ -238,11 +238,11 @@ static int StorVscChannelInit(struct hv_device *Device)

/* reuse the packet for version range supported */
memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->Operation = VStorOperationQueryProtocolVersion;
- vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
+ vstorPacket->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION;
+ vstorPacket->flags = REQUEST_COMPLETION_FLAG;

- vstorPacket->Version.MajorMinor = VMSTOR_PROTOCOL_VERSION_CURRENT;
- FILL_VMSTOR_REVISION(vstorPacket->Version.Revision);
+ vstorPacket->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT;
+ FILL_VMSTOR_REVISION(vstorPacket->version.revision);

ret = vmbus_sendpacket(Device->channel, vstorPacket,
sizeof(struct vstor_packet),
@@ -258,11 +258,11 @@ static int StorVscChannelInit(struct hv_device *Device)
osd_waitevent_wait(request->WaitEvent);

/* TODO: Check returned version */
- if (vstorPacket->Operation != VStorOperationCompleteIo ||
- vstorPacket->Status != 0) {
+ if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstorPacket->status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->Operation, vstorPacket->Status);
+ vstorPacket->operation, vstorPacket->status);
goto Cleanup;
}

@@ -270,9 +270,9 @@ static int StorVscChannelInit(struct hv_device *Device)
DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");

memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->Operation = VStorOperationQueryProperties;
- vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
- vstorPacket->StorageChannelProperties.PortNumber =
+ vstorPacket->operation = VSTOR_OPERATION_QUERY_PROPERTIES;
+ vstorPacket->flags = REQUEST_COMPLETION_FLAG;
+ vstorPacket->storage_channel_properties.port_number =
storDevice->PortNumber;

ret = vmbus_sendpacket(Device->channel, vstorPacket,
@@ -290,26 +290,27 @@ static int StorVscChannelInit(struct hv_device *Device)
osd_waitevent_wait(request->WaitEvent);

/* TODO: Check returned version */
- if (vstorPacket->Operation != VStorOperationCompleteIo ||
- vstorPacket->Status != 0) {
+ if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstorPacket->status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->Operation, vstorPacket->Status);
+ vstorPacket->operation, vstorPacket->status);
goto Cleanup;
}

- storDevice->PathId = vstorPacket->StorageChannelProperties.PathId;
- storDevice->TargetId = vstorPacket->StorageChannelProperties.TargetId;
+ storDevice->PathId = vstorPacket->storage_channel_properties.path_id;
+ storDevice->TargetId
+ = vstorPacket->storage_channel_properties.target_id;

DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x",
- vstorPacket->StorageChannelProperties.Flags,
- vstorPacket->StorageChannelProperties.MaxTransferBytes);
+ vstorPacket->storage_channel_properties.flags,
+ vstorPacket->storage_channel_properties.max_transfer_bytes);

DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION...");

memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->Operation = VStorOperationEndInitialization;
- vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
+ vstorPacket->operation = VSTOR_OPERATION_END_INITIALIZATION;
+ vstorPacket->flags = REQUEST_COMPLETION_FLAG;

ret = vmbus_sendpacket(Device->channel, vstorPacket,
sizeof(struct vstor_packet),
@@ -325,11 +326,11 @@ static int StorVscChannelInit(struct hv_device *Device)

osd_waitevent_wait(request->WaitEvent);

- if (vstorPacket->Operation != VStorOperationCompleteIo ||
- vstorPacket->Status != 0) {
+ if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstorPacket->status != 0) {
DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->Operation, vstorPacket->Status);
+ vstorPacket->operation, vstorPacket->status);
goto Cleanup;
}

@@ -359,7 +360,7 @@ static void StorVscOnIOCompletion(struct hv_device *Device,

DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p "
"completed bytes xfer %u", RequestExt,
- VStorPacket->VmSrb.DataTransferLength);
+ VStorPacket->vm_srb.data_transfer_length);

/* ASSERT(RequestExt != NULL); */
/* ASSERT(RequestExt->Request != NULL); */
@@ -369,36 +370,36 @@ static void StorVscOnIOCompletion(struct hv_device *Device,
/* ASSERT(request->OnIOCompletion != NULL); */

/* Copy over the status...etc */
- request->Status = VStorPacket->VmSrb.ScsiStatus;
+ request->Status = VStorPacket->vm_srb.scsi_status;

- if (request->Status != 0 || VStorPacket->VmSrb.SrbStatus != 1) {
+ if (request->Status != 0 || VStorPacket->vm_srb.srb_status != 1) {
DPRINT_WARN(STORVSC,
"cmd 0x%x scsi status 0x%x srb status 0x%x\n",
- request->Cdb[0], VStorPacket->VmSrb.ScsiStatus,
- VStorPacket->VmSrb.SrbStatus);
+ request->Cdb[0], VStorPacket->vm_srb.scsi_status,
+ VStorPacket->vm_srb.srb_status);
}

if ((request->Status & 0xFF) == 0x02) {
/* CHECK_CONDITION */
- if (VStorPacket->VmSrb.SrbStatus & 0x80) {
+ if (VStorPacket->vm_srb.srb_status & 0x80) {
/* autosense data available */
DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data "
"valid - len %d\n", RequestExt,
- VStorPacket->VmSrb.SenseInfoLength);
+ VStorPacket->vm_srb.sense_info_length);

- /* ASSERT(VStorPacket->VmSrb.SenseInfoLength <= */
+ /* ASSERT(VStorPacket->vm_srb.sense_info_length <= */
/* request->SenseBufferSize); */
memcpy(request->SenseBuffer,
- VStorPacket->VmSrb.SenseData,
- VStorPacket->VmSrb.SenseInfoLength);
+ VStorPacket->vm_srb.sense_data,
+ VStorPacket->vm_srb.sense_info_length);

request->SenseBufferSize =
- VStorPacket->VmSrb.SenseInfoLength;
+ VStorPacket->vm_srb.sense_info_length;
}
}

/* TODO: */
- request->BytesXfer = VStorPacket->VmSrb.DataTransferLength;
+ request->BytesXfer = VStorPacket->vm_srb.data_transfer_length;

request->OnIOCompletion(request);

@@ -411,19 +412,19 @@ static void StorVscOnReceive(struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt)
{
- switch (VStorPacket->Operation) {
- case VStorOperationCompleteIo:
+ switch (VStorPacket->operation) {
+ case VSTOR_OPERATION_COMPLETE_IO:
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
StorVscOnIOCompletion(Device, VStorPacket, RequestExt);
break;
- case VStorOperationRemoveDevice:
+ case VSTOR_OPERATION_REMOVE_DEVICE:
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION");
/* TODO: */
break;

default:
DPRINT_INFO(STORVSC, "Unknown operation received - %d",
- VStorPacket->Operation);
+ VStorPacket->operation);
break;
}
}
@@ -506,7 +507,7 @@ static int StorVscConnectToVsp(struct hv_device *Device)
StorVscOnChannelCallback, Device);

DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
- props.PathId, props.TargetId, props.MaxTransferBytes);
+ props.path_id, props.target_id, props.max_transfer_bytes);

if (ret != 0) {
DPRINT_ERR(STORVSC, "unable to open channel: %d", ret);
@@ -628,9 +629,9 @@ int StorVscOnHostReset(struct hv_device *Device)
goto Cleanup;
}

- vstorPacket->Operation = VStorOperationResetBus;
- vstorPacket->Flags = REQUEST_COMPLETION_FLAG;
- vstorPacket->VmSrb.PathId = storDevice->PathId;
+ vstorPacket->operation = VSTOR_OPERATION_RESET_BUS;
+ vstorPacket->flags = REQUEST_COMPLETION_FLAG;
+ vstorPacket->vm_srb.path_id = storDevice->PathId;

ret = vmbus_sendpacket(Device->channel, vstorPacket,
sizeof(struct vstor_packet),
@@ -697,35 +698,35 @@ static int StorVscOnIORequest(struct hv_device *Device,

memset(vstorPacket, 0 , sizeof(struct vstor_packet));

- vstorPacket->Flags |= REQUEST_COMPLETION_FLAG;
+ vstorPacket->flags |= REQUEST_COMPLETION_FLAG;

- vstorPacket->VmSrb.Length = sizeof(struct vmscsi_request);
+ vstorPacket->vm_srb.length = sizeof(struct vmscsi_request);

- vstorPacket->VmSrb.PortNumber = Request->Host;
- vstorPacket->VmSrb.PathId = Request->Bus;
- vstorPacket->VmSrb.TargetId = Request->TargetId;
- vstorPacket->VmSrb.Lun = Request->LunId;
+ vstorPacket->vm_srb.port_number = Request->Host;
+ vstorPacket->vm_srb.path_id = Request->Bus;
+ vstorPacket->vm_srb.target_id = Request->TargetId;
+ vstorPacket->vm_srb.lun = Request->LunId;

- vstorPacket->VmSrb.SenseInfoLength = SENSE_BUFFER_SIZE;
+ vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;

/* Copy over the scsi command descriptor block */
- vstorPacket->VmSrb.CdbLength = Request->CdbLen;
- memcpy(&vstorPacket->VmSrb.Cdb, Request->Cdb, Request->CdbLen);
+ vstorPacket->vm_srb.cdb_length = Request->CdbLen;
+ memcpy(&vstorPacket->vm_srb.cdb, Request->Cdb, Request->CdbLen);

- vstorPacket->VmSrb.DataIn = Request->Type;
- vstorPacket->VmSrb.DataTransferLength = Request->DataBuffer.Length;
+ vstorPacket->vm_srb.data_in = Request->Type;
+ vstorPacket->vm_srb.data_transfer_length = Request->DataBuffer.Length;

- vstorPacket->Operation = VStorOperationExecuteSRB;
+ vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB;

DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, "
"lun %d senselen %d cdblen %d",
- vstorPacket->VmSrb.Length,
- vstorPacket->VmSrb.PortNumber,
- vstorPacket->VmSrb.PathId,
- vstorPacket->VmSrb.TargetId,
- vstorPacket->VmSrb.Lun,
- vstorPacket->VmSrb.SenseInfoLength,
- vstorPacket->VmSrb.CdbLength);
+ vstorPacket->vm_srb.length,
+ vstorPacket->vm_srb.port_number,
+ vstorPacket->vm_srb.path_id,
+ vstorPacket->vm_srb.target_id,
+ vstorPacket->vm_srb.lun,
+ vstorPacket->vm_srb.sense_info_length,
+ vstorPacket->vm_srb.cdb_length);

if (requestExtension->Request->DataBuffer.Length) {
ret = vmbus_sendpacket_multipagebuffer(Device->channel,
diff --git a/drivers/staging/hv/vstorage.h b/drivers/staging/hv/vstorage.h
index 4ea597d..ae8be84 100644
--- a/drivers/staging/hv/vstorage.h
+++ b/drivers/staging/hv/vstorage.h
@@ -27,15 +27,17 @@

#define REVISION_STRING(REVISION_) #REVISION_
#define FILL_VMSTOR_REVISION(RESULT_LVALUE_) \
-{ \
- char *revisionString = REVISION_STRING($Revision : 6 $) + 11; \
- RESULT_LVALUE_ = 0; \
- while (*revisionString >= '0' && *revisionString <= '9') { \
- RESULT_LVALUE_ *= 10; \
- RESULT_LVALUE_ += *revisionString - '0'; \
- revisionString++; \
- } \
-}
+ do { \
+ char *revision_string \
+ = REVISION_STRING($Rev : 6 $) + 6; \
+ RESULT_LVALUE_ = 0; \
+ while (*revision_string >= '0' \
+ && *revision_string <= '9') { \
+ RESULT_LVALUE_ *= 10; \
+ RESULT_LVALUE_ += *revision_string - '0'; \
+ revision_string++; \
+ } \
+ } while (0)

/* Major/minor macros. Minor version is in LSB, meaning that earlier flat */
/* version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). */
@@ -65,17 +67,17 @@

/* Packet structure describing virtual storage requests. */
enum vstor_packet_operation {
- VStorOperationCompleteIo = 1,
- VStorOperationRemoveDevice = 2,
- VStorOperationExecuteSRB = 3,
- VStorOperationResetLun = 4,
- VStorOperationResetAdapter = 5,
- VStorOperationResetBus = 6,
- VStorOperationBeginInitialization = 7,
- VStorOperationEndInitialization = 8,
- VStorOperationQueryProtocolVersion = 9,
- VStorOperationQueryProperties = 10,
- VStorOperationMaximum = 10
+ VSTOR_OPERATION_COMPLETE_IO = 1,
+ VSTOR_OPERATION_REMOVE_DEVICE = 2,
+ VSTOR_OPERATION_EXECUTE_SRB = 3,
+ VSTOR_OPERATION_RESET_LUN = 4,
+ VSTOR_OPERATION_RESET_ADAPTER = 5,
+ VSTOR_OPERATION_RESET_BUS = 6,
+ VSTOR_OPERATION_BEGIN_INITIALIZATION = 7,
+ VSTOR_OPERATION_END_INITIALIZATION = 8,
+ VSTOR_OPERATION_QUERY_PROTOCOL_VERSION = 9,
+ VSTOR_OPERATION_QUERY_PROPERTIES = 10,
+ VSTOR_OPERATION_MAXIMUM = 10
};

/*
@@ -89,31 +91,29 @@ enum vstor_packet_operation {
#define SENSE_BUFFER_SIZE 0x12
#endif

-#define MAX_DATA_BUFFER_LENGTH_WITH_PADDING 0x14
+#define MAX_DATA_BUF_LEN_WITH_PADDING 0x14

struct vmscsi_request {
- unsigned short Length;
- unsigned char SrbStatus;
- unsigned char ScsiStatus;
+ unsigned short length;
+ unsigned char srb_status;
+ unsigned char scsi_status;

- unsigned char PortNumber;
- unsigned char PathId;
- unsigned char TargetId;
- unsigned char Lun;
+ unsigned char port_number;
+ unsigned char path_id;
+ unsigned char target_id;
+ unsigned char lun;

- unsigned char CdbLength;
- unsigned char SenseInfoLength;
- unsigned char DataIn;
- unsigned char Reserved;
+ unsigned char cdb_length;
+ unsigned char sense_info_length;
+ unsigned char data_in;
+ unsigned char reserved;

- unsigned int DataTransferLength;
+ unsigned int data_transfer_length;

union {
- unsigned char Cdb[CDB16GENERIC_LENGTH];
-
- unsigned char SenseData[SENSE_BUFFER_SIZE];
-
- unsigned char ReservedArray[MAX_DATA_BUFFER_LENGTH_WITH_PADDING];
+ unsigned char cdb[CDB16GENERIC_LENGTH];
+ unsigned char sense_data[SENSE_BUFFER_SIZE];
+ unsigned char reserved_array[MAX_DATA_BUF_LEN_WITH_PADDING];
};
} __attribute((packed));

@@ -123,24 +123,24 @@ struct vmscsi_request {
* properties of the channel.
*/
struct vmstorage_channel_properties {
- unsigned short ProtocolVersion;
- unsigned char PathId;
- unsigned char TargetId;
+ unsigned short protocol_version;
+ unsigned char path_id;
+ unsigned char target_id;

/* Note: port number is only really known on the client side */
- unsigned int PortNumber;
- unsigned int Flags;
- unsigned int MaxTransferBytes;
+ unsigned int port_number;
+ unsigned int flags;
+ unsigned int max_transfer_bytes;

/* This id is unique for each channel and will correspond with */
/* vendor specific data in the inquirydata */
- unsigned long long UniqueId;
+ unsigned long long unique_id;
} __attribute__((packed));

/* This structure is sent during the storage protocol negotiations. */
struct vmstorage_protocol_version {
/* Major (MSW) and minor (LSW) version numbers. */
- unsigned short MajorMinor;
+ unsigned short major_minor;

/*
* Revision number is auto-incremented whenever this file is changed
@@ -148,7 +148,7 @@ struct vmstorage_protocol_version {
* definitely indicate incompatibility--but it does indicate mismatched
* builds.
*/
- unsigned short Revision;
+ unsigned short revision;
} __attribute__((packed));

/* Channel Property Flags */
@@ -157,13 +157,13 @@ struct vmstorage_protocol_version {

struct vstor_packet {
/* Requested operation type */
- enum vstor_packet_operation Operation;
+ enum vstor_packet_operation operation;

/* Flags - see below for values */
- unsigned int Flags;
+ unsigned int flags;

/* Status of the request returned from the server side. */
- unsigned int Status;
+ unsigned int status;

/* Data payload area */
union {
@@ -171,13 +171,13 @@ struct vstor_packet {
* Structure used to forward SCSI commands from the
* client to the server.
*/
- struct vmscsi_request VmSrb;
+ struct vmscsi_request vm_srb;

/* Structure used to query channel properties. */
- struct vmstorage_channel_properties StorageChannelProperties;
+ struct vmstorage_channel_properties storage_channel_properties;

/* Used during version negotiations. */
- struct vmstorage_protocol_version Version;
+ struct vmstorage_protocol_version version;
};
} __attribute__((packed));

--
1.6.0.2


2010-12-06 20:30:01

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 8/8] staging: hv: Convert camel case local variables in blkvsc.c to lowercase

From: Hank Janssen <[email protected]>

Convert camel case local variables in blkvsc.c to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/blkvsc.c | 52 +++++++++++++++++++++---------------------
1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 4f4a65c..bc16d91 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -25,24 +25,24 @@
#include "osd.h"
#include "storvsc.c"

-static const char *gBlkDriverName = "blkvsc";
+static const char *g_blk_driver_name = "blkvsc";

/* {32412632-86cb-44a2-9b5c-50d1417354f5} */
-static const struct hv_guid gBlkVscDeviceType = {
+static const struct hv_guid g_blk_device_type = {
.data = {
0x32, 0x26, 0x41, 0x32, 0xcb, 0x86, 0xa2, 0x44,
0x9b, 0x5c, 0x50, 0xd1, 0x41, 0x73, 0x54, 0xf5
}
};

-static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo)
+static int blk_vsc_on_device_add(struct hv_device *device, void *additional_info)
{
- struct storvsc_device_info *deviceInfo;
+ struct storvsc_device_info *device_info;
int ret = 0;

- deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
+ device_info = (struct storvsc_device_info *)additional_info;

- ret = stor_vsc_on_device_add(Device, AdditionalInfo);
+ ret = stor_vsc_on_device_add(device, additional_info);
if (ret != 0)
return ret;

@@ -51,31 +51,31 @@ static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo)
* id. For IDE devices, the device instance id is formatted as
* <bus id> * - <device id> - 8899 - 000000000000.
*/
- deviceInfo->path_id = Device->deviceInstance.data[3] << 24 |
- Device->deviceInstance.data[2] << 16 |
- Device->deviceInstance.data[1] << 8 |
- Device->deviceInstance.data[0];
+ device_info->path_id = device->deviceInstance.data[3] << 24 |
+ device->deviceInstance.data[2] << 16 |
+ device->deviceInstance.data[1] << 8 |
+ device->deviceInstance.data[0];

- deviceInfo->target_id = Device->deviceInstance.data[5] << 8 |
- Device->deviceInstance.data[4];
+ device_info->target_id = device->deviceInstance.data[5] << 8 |
+ device->deviceInstance.data[4];

return ret;
}

-int blk_vsc_initialize(struct hv_driver *Driver)
+int blk_vsc_initialize(struct hv_driver *driver)
{
- struct storvsc_driver_object *storDriver;
+ struct storvsc_driver_object *stor_driver;
int ret = 0;

- storDriver = (struct storvsc_driver_object *)Driver;
+ stor_driver = (struct storvsc_driver_object *)driver;

/* Make sure we are at least 2 pages since 1 page is used for control */
- /* ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); */
+ /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */

- Driver->name = gBlkDriverName;
- memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid));
+ driver->name = g_blk_driver_name;
+ memcpy(&driver->deviceType, &g_blk_device_type, sizeof(struct hv_guid));

- storDriver->request_ext_size = sizeof(struct storvsc_request_extension);
+ stor_driver->request_ext_size = sizeof(struct storvsc_request_extension);

/*
* Divide the ring buffer data size (which is 1 page less than the ring
@@ -83,20 +83,20 @@ int blk_vsc_initialize(struct hv_driver *Driver)
* by the max request size (which is
* vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
*/
- storDriver->max_outstanding_req_per_channel =
- ((storDriver->ring_buffer_size - PAGE_SIZE) /
+ stor_driver->max_outstanding_req_per_channel =
+ ((stor_driver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

DPRINT_INFO(BLKVSC, "max io outstd %u",
- storDriver->max_outstanding_req_per_channel);
+ stor_driver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- storDriver->base.OnDeviceAdd = blk_vsc_on_device_add;
- storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove;
- storDriver->base.OnCleanup = stor_vsc_on_cleanup;
- storDriver->on_io_request = stor_vsc_on_io_request;
+ stor_driver->base.OnDeviceAdd = blk_vsc_on_device_add;
+ stor_driver->base.OnDeviceRemove = stor_vsc_on_device_remove;
+ stor_driver->base.OnCleanup = stor_vsc_on_cleanup;
+ stor_driver->on_io_request = stor_vsc_on_io_request;

return ret;
}
--
1.6.0.2

2010-12-06 20:29:58

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 3/8] staging: hv: Convert camel case functions in storvsc_api.h to lowercase

From: Hank Janssen <[email protected]>

Convert camel case functions in storvsc_api.h to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/blkvsc.c | 2 +-
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/storvsc.c | 6 +++---
drivers/staging/hv/storvsc_api.h | 6 +++---
drivers/staging/hv/storvsc_drv.c | 4 ++--
5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 9ac04c3..e62c922 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -62,7 +62,7 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
return ret;
}

-int BlkVscInitialize(struct hv_driver *Driver)
+int blk_vsc_initialize(struct hv_driver *Driver)
{
struct storvsc_driver_object *storDriver;
int ret = 0;
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index d65d69e..b3d05fc 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -1487,7 +1487,7 @@ static int __init blkvsc_init(void)

DPRINT_INFO(BLKVSC_DRV, "Blkvsc initializing....");

- ret = blkvsc_drv_init(BlkVscInitialize);
+ ret = blkvsc_drv_init(blk_vsc_initialize);

return ret;
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index c4346c6..7704131 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -605,7 +605,7 @@ static int StorVscOnDeviceRemove(struct hv_device *Device)
return 0;
}

-int StorVscOnHostReset(struct hv_device *Device)
+int stor_vsc_on_host_reset(struct hv_device *Device)
{
struct storvsc_device *storDevice;
struct storvsc_request_extension *request;
@@ -762,9 +762,9 @@ static void StorVscOnCleanup(struct hv_driver *Driver)
}

/*
- * StorVscInitialize - Main entry point
+ * stor_vsc_initialize - Main entry point
*/
-int StorVscInitialize(struct hv_driver *Driver)
+int stor_vsc_initialize(struct hv_driver *Driver)
{
struct storvsc_driver_object *storDriver;

diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 46f031e..fbf5755 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -103,8 +103,8 @@ struct storvsc_device_info {
};

/* Interface */
-int StorVscInitialize(struct hv_driver *driver);
-int StorVscOnHostReset(struct hv_device *device);
-int BlkVscInitialize(struct hv_driver *driver);
+int stor_vsc_initialize(struct hv_driver *driver);
+int stor_vsc_on_host_reset(struct hv_device *device);
+int blk_vsc_initialize(struct hv_driver *driver);

#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index 03695ce..0d96878 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -846,7 +846,7 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd)
scmnd->device, &device_ctx->device_obj);

/* Invokes the vsc to reset the host/bus */
- ret = StorVscOnHostReset(&device_ctx->device_obj);
+ ret = stor_vsc_on_host_reset(&device_ctx->device_obj);
if (ret != 0)
return ret;

@@ -941,7 +941,7 @@ static int __init storvsc_init(void)
int ret;

DPRINT_INFO(STORVSC_DRV, "Storvsc initializing....");
- ret = storvsc_drv_init(StorVscInitialize);
+ ret = storvsc_drv_init(stor_vsc_initialize);
return ret;
}

--
1.6.0.2

2010-12-06 20:30:00

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 4/8] staging: hv: Convert camel case struct fields in storvsc.c to lowercase

From: Hank Janssen <[email protected]>

Convert camel cased struct fields in storvsc.c to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/storvsc.c | 133 +++++++++++++++++++++---------------------
1 files changed, 67 insertions(+), 66 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 7704131..3b6e63a 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -34,43 +34,43 @@
struct storvsc_request_extension {
/* LIST_ENTRY ListEntry; */

- struct hv_storvsc_request *Request;
- struct hv_device *Device;
+ struct hv_storvsc_request *request;
+ struct hv_device *device;

/* Synchronize the request/response if needed */
- struct osd_waitevent *WaitEvent;
+ struct osd_waitevent *wait_event;

- struct vstor_packet VStorPacket;
+ struct vstor_packet vstor_packet;
};

/* A storvsc device is a device object that contains a vmbus channel */
struct storvsc_device {
- struct hv_device *Device;
+ struct hv_device *device;

/* 0 indicates the device is being destroyed */
- atomic_t RefCount;
+ atomic_t ref_count;

- atomic_t NumOutstandingRequests;
+ atomic_t num_outstanding_requests;

/*
* 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;
+ unsigned int port_number;
+ unsigned char path_id;
+ unsigned char target_id;

/* LIST_ENTRY OutstandingRequestList; */
/* HANDLE OutstandingRequestLock; */

/* Used for vsc/vsp channel reset process */
- struct storvsc_request_extension InitRequest;
- struct storvsc_request_extension ResetRequest;
+ struct storvsc_request_extension init_request;
+ struct storvsc_request_extension reset_request;
};


-static const char *gDriverName = "storvsc";
+static const char *g_driver_name = "storvsc";

/* {ba6163d9-04a1-4d29-b605-72e2ffb1dc7f} */
static const struct hv_guid gStorVscDeviceType = {
@@ -90,10 +90,10 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)
return NULL;

/* Set to 2 to allow both inbound and outbound traffics */
- /* (ie GetStorDevice() and MustGetStorDevice()) to proceed. */
- atomic_cmpxchg(&storDevice->RefCount, 0, 2);
+ /* (ie get_stor_device() and must_get_stor_device()) to proceed. */
+ atomic_cmpxchg(&storDevice->ref_count, 0, 2);

- storDevice->Device = Device;
+ storDevice->device = Device;
Device->Extension = storDevice;

return storDevice;
@@ -101,7 +101,7 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)

static inline void FreeStorDevice(struct storvsc_device *Device)
{
- /* ASSERT(atomic_read(&Device->RefCount) == 0); */
+ /* ASSERT(atomic_read(&Device->ref_count) == 0); */
kfree(Device);
}

@@ -111,8 +111,8 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device)
struct storvsc_device *storDevice;

storDevice = (struct storvsc_device *)Device->Extension;
- if (storDevice && atomic_read(&storDevice->RefCount) > 1)
- atomic_inc(&storDevice->RefCount);
+ if (storDevice && atomic_read(&storDevice->ref_count) > 1)
+ atomic_inc(&storDevice->ref_count);
else
storDevice = NULL;

@@ -125,8 +125,8 @@ static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device)
struct storvsc_device *storDevice;

storDevice = (struct storvsc_device *)Device->Extension;
- if (storDevice && atomic_read(&storDevice->RefCount))
- atomic_inc(&storDevice->RefCount);
+ if (storDevice && atomic_read(&storDevice->ref_count))
+ atomic_inc(&storDevice->ref_count);
else
storDevice = NULL;

@@ -140,8 +140,8 @@ static inline void PutStorDevice(struct hv_device *Device)
storDevice = (struct storvsc_device *)Device->Extension;
/* ASSERT(storDevice); */

- atomic_dec(&storDevice->RefCount);
- /* ASSERT(atomic_read(&storDevice->RefCount)); */
+ atomic_dec(&storDevice->ref_count);
+ /* ASSERT(atomic_read(&storDevice->ref_count)); */
}

/* Drop ref count to 1 to effectively disable GetStorDevice() */
@@ -153,7 +153,7 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device)
/* ASSERT(storDevice); */

/* Busy wait until the ref drop to 2, then set it to 1 */
- while (atomic_cmpxchg(&storDevice->RefCount, 2, 1) != 2)
+ while (atomic_cmpxchg(&storDevice->ref_count, 2, 1) != 2)
udelay(100);

return storDevice;
@@ -169,7 +169,7 @@ static inline struct storvsc_device *FinalReleaseStorDevice(
/* ASSERT(storDevice); */

/* Busy wait until the ref drop to 1, then set it to 0 */
- while (atomic_cmpxchg(&storDevice->RefCount, 1, 0) != 1)
+ while (atomic_cmpxchg(&storDevice->ref_count, 1, 0) != 1)
udelay(100);

Device->Extension = NULL;
@@ -190,16 +190,16 @@ static int StorVscChannelInit(struct hv_device *Device)
return -1;
}

- request = &storDevice->InitRequest;
- vstorPacket = &request->VStorPacket;
+ request = &storDevice->init_request;
+ vstorPacket = &request->vstor_packet;

/*
* Now, initiate the vsc/vsp initialization protocol on the open
* channel
*/
memset(request, 0, sizeof(struct storvsc_request_extension));
- request->WaitEvent = osd_waitevent_create();
- if (!request->WaitEvent) {
+ request->wait_event = osd_waitevent_create();
+ if (!request->wait_event) {
ret = -ENOMEM;
goto nomem;
}
@@ -224,7 +224,7 @@ static int StorVscChannelInit(struct hv_device *Device)
goto Cleanup;
}

- osd_waitevent_wait(request->WaitEvent);
+ osd_waitevent_wait(request->wait_event);

if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstorPacket->status != 0) {
@@ -255,7 +255,7 @@ static int StorVscChannelInit(struct hv_device *Device)
goto Cleanup;
}

- osd_waitevent_wait(request->WaitEvent);
+ osd_waitevent_wait(request->wait_event);

/* TODO: Check returned version */
if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
@@ -273,7 +273,7 @@ static int StorVscChannelInit(struct hv_device *Device)
vstorPacket->operation = VSTOR_OPERATION_QUERY_PROPERTIES;
vstorPacket->flags = REQUEST_COMPLETION_FLAG;
vstorPacket->storage_channel_properties.port_number =
- storDevice->PortNumber;
+ storDevice->port_number;

ret = vmbus_sendpacket(Device->channel, vstorPacket,
sizeof(struct vstor_packet),
@@ -287,7 +287,7 @@ static int StorVscChannelInit(struct hv_device *Device)
goto Cleanup;
}

- osd_waitevent_wait(request->WaitEvent);
+ osd_waitevent_wait(request->wait_event);

/* TODO: Check returned version */
if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
@@ -298,8 +298,8 @@ static int StorVscChannelInit(struct hv_device *Device)
goto Cleanup;
}

- storDevice->PathId = vstorPacket->storage_channel_properties.path_id;
- storDevice->TargetId
+ storDevice->path_id = vstorPacket->storage_channel_properties.path_id;
+ storDevice->target_id
= vstorPacket->storage_channel_properties.target_id;

DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x",
@@ -324,7 +324,7 @@ static int StorVscChannelInit(struct hv_device *Device)
goto Cleanup;
}

- osd_waitevent_wait(request->WaitEvent);
+ osd_waitevent_wait(request->wait_event);

if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstorPacket->status != 0) {
@@ -337,8 +337,8 @@ static int StorVscChannelInit(struct hv_device *Device)
DPRINT_INFO(STORVSC, "**** storage channel up and running!! ****");

Cleanup:
- kfree(request->WaitEvent);
- request->WaitEvent = NULL;
+ kfree(request->wait_event);
+ request->wait_event = NULL;
nomem:
PutStorDevice(Device);
return ret;
@@ -365,7 +365,7 @@ static void StorVscOnIOCompletion(struct hv_device *Device,
/* ASSERT(RequestExt != NULL); */
/* ASSERT(RequestExt->Request != NULL); */

- request = RequestExt->Request;
+ request = RequestExt->request;

/* ASSERT(request->OnIOCompletion != NULL); */

@@ -403,7 +403,7 @@ static void StorVscOnIOCompletion(struct hv_device *Device,

request->on_io_completion(request);

- atomic_dec(&storDevice->NumOutstandingRequests);
+ atomic_dec(&storDevice->num_outstanding_requests);

PutStorDevice(Device);
}
@@ -463,18 +463,18 @@ static void StorVscOnChannelCallback(void *context)
/* ASSERT(request);c */

/* if (vstorPacket.Flags & SYNTHETIC_FLAG) */
- if ((request == &storDevice->InitRequest) ||
- (request == &storDevice->ResetRequest)) {
+ if ((request == &storDevice->init_request) ||
+ (request == &storDevice->reset_request)) {
/* DPRINT_INFO(STORVSC,
* "reset completion - operation "
* "%u status %u",
* vstorPacket.Operation,
* vstorPacket.Status); */

- memcpy(&request->VStorPacket, packet,
+ memcpy(&request->vstor_packet, packet,
sizeof(struct vstor_packet));

- osd_waitevent_set(request->WaitEvent);
+ osd_waitevent_set(request->wait_event);
} else {
StorVscOnReceive(device,
(struct vstor_packet *)packet,
@@ -522,6 +522,7 @@ static int StorVscConnectToVsp(struct hv_device *Device)

/*
* StorVscOnDeviceAdd - Callback when the device belonging to this driver is added
+ * is added
*/
static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
{
@@ -552,17 +553,17 @@ static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
storChannel->PathId = props->PathId;
storChannel->TargetId = props->TargetId; */

- storDevice->PortNumber = deviceInfo->port_number;
+ storDevice->port_number = deviceInfo->port_number;
/* Send it back up */
ret = StorVscConnectToVsp(Device);

/* deviceInfo->PortNumber = storDevice->PortNumber; */
- deviceInfo->path_id = storDevice->PathId;
- deviceInfo->target_id = storDevice->TargetId;
+ deviceInfo->path_id = storDevice->path_id;
+ deviceInfo->target_id = storDevice->target_id;

DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
- storDevice->PortNumber, storDevice->PathId,
- storDevice->TargetId);
+ storDevice->port_number, storDevice->path_id,
+ storDevice->target_id);

Cleanup:
return ret;
@@ -585,9 +586,9 @@ static int StorVscOnDeviceRemove(struct hv_device *Device)
* only allow inbound traffic (responses) to proceed so that
* outstanding requests can be completed.
*/
- while (atomic_read(&storDevice->NumOutstandingRequests)) {
+ while (atomic_read(&storDevice->num_outstanding_requests)) {
DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
- atomic_read(&storDevice->NumOutstandingRequests));
+ atomic_read(&storDevice->num_outstanding_requests));
udelay(100);
}

@@ -621,22 +622,22 @@ int stor_vsc_on_host_reset(struct hv_device *Device)
return -1;
}

- request = &storDevice->ResetRequest;
- vstorPacket = &request->VStorPacket;
+ request = &storDevice->reset_request;
+ vstorPacket = &request->vstor_packet;

- request->WaitEvent = osd_waitevent_create();
- if (!request->WaitEvent) {
+ request->wait_event = osd_waitevent_create();
+ if (!request->wait_event) {
ret = -ENOMEM;
goto Cleanup;
}

vstorPacket->operation = VSTOR_OPERATION_RESET_BUS;
vstorPacket->flags = REQUEST_COMPLETION_FLAG;
- vstorPacket->vm_srb.path_id = storDevice->PathId;
+ vstorPacket->vm_srb.path_id = storDevice->path_id;

ret = vmbus_sendpacket(Device->channel, vstorPacket,
sizeof(struct vstor_packet),
- (unsigned long)&storDevice->ResetRequest,
+ (unsigned long)&storDevice->reset_request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -646,9 +647,9 @@ int stor_vsc_on_host_reset(struct hv_device *Device)
}

/* FIXME: Add a timeout */
- osd_waitevent_wait(request->WaitEvent);
+ osd_waitevent_wait(request->wait_event);

- kfree(request->WaitEvent);
+ kfree(request->wait_event);
DPRINT_INFO(STORVSC, "host adapter reset completed");

/*
@@ -674,7 +675,7 @@ static int StorVscOnIORequest(struct hv_device *Device,

requestExtension =
(struct storvsc_request_extension *)Request->extension;
- vstorPacket = &requestExtension->VStorPacket;
+ vstorPacket = &requestExtension->vstor_packet;
storDevice = GetStorDevice(Device);

DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, "
@@ -694,8 +695,8 @@ static int StorVscOnIORequest(struct hv_device *Device,
/* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb,
* Request->CdbLen); */

- requestExtension->Request = Request;
- requestExtension->Device = Device;
+ requestExtension->request = Request;
+ requestExtension->device = Device;

memset(vstorPacket, 0 , sizeof(struct vstor_packet));

@@ -729,9 +730,9 @@ static int StorVscOnIORequest(struct hv_device *Device,
vstorPacket->vm_srb.sense_info_length,
vstorPacket->vm_srb.cdb_length);

- if (requestExtension->Request->data_buffer.Length) {
+ if (requestExtension->request->data_buffer.Length) {
ret = vmbus_sendpacket_multipagebuffer(Device->channel,
- &requestExtension->Request->data_buffer,
+ &requestExtension->request->data_buffer,
vstorPacket,
sizeof(struct vstor_packet),
(unsigned long)requestExtension);
@@ -748,7 +749,7 @@ static int StorVscOnIORequest(struct hv_device *Device,
vstorPacket, ret);
}

- atomic_inc(&storDevice->NumOutstandingRequests);
+ atomic_inc(&storDevice->num_outstanding_requests);

PutStorDevice(Device);
return ret;
@@ -782,7 +783,7 @@ int stor_vsc_initialize(struct hv_driver *Driver)
/* Make sure we are at least 2 pages since 1 page is used for control */
/* ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); */

- Driver->name = gDriverName;
+ Driver->name = g_driver_name;
memcpy(&Driver->deviceType, &gStorVscDeviceType,
sizeof(struct hv_guid));

--
1.6.0.2

2010-12-06 20:30:44

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 5/8] staging: hv: Convert camel case function names in storvsc.c to lowercase

From: Hank Janssen <[email protected]>

Convert camel case function names in storvsc.c to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/blkvsc.c | 8 ++--
drivers/staging/hv/storvsc.c | 91 +++++++++++++++++++++--------------------
2 files changed, 51 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index e62c922..208492c 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -42,7 +42,7 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)

deviceInfo = (struct storvsc_device_info *)AdditionalInfo;

- ret = StorVscOnDeviceAdd(Device, AdditionalInfo);
+ ret = stor_vsc_on_device_add(Device, AdditionalInfo);
if (ret != 0)
return ret;

@@ -94,9 +94,9 @@ int blk_vsc_initialize(struct hv_driver *Driver)

/* Setup the dispatch table */
storDriver->base.OnDeviceAdd = BlkVscOnDeviceAdd;
- storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
- storDriver->base.OnCleanup = StorVscOnCleanup;
- storDriver->on_io_request = StorVscOnIORequest;
+ storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove;
+ storDriver->base.OnCleanup = stor_vsc_on_cleanup;
+ storDriver->on_io_request = stor_vsc_on_io_request;

return ret;
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 3b6e63a..6643038 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -81,7 +81,7 @@ static const struct hv_guid gStorVscDeviceType = {
};


-static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)
+static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device)
{
struct storvsc_device *storDevice;

@@ -99,14 +99,14 @@ static inline struct storvsc_device *AllocStorDevice(struct hv_device *Device)
return storDevice;
}

-static inline void FreeStorDevice(struct storvsc_device *Device)
+static inline void free_stor_device(struct storvsc_device *Device)
{
/* ASSERT(atomic_read(&Device->ref_count) == 0); */
kfree(Device);
}

/* Get the stordevice object iff exists and its refcount > 1 */
-static inline struct storvsc_device *GetStorDevice(struct hv_device *Device)
+static inline struct storvsc_device *get_stor_device(struct hv_device *Device)
{
struct storvsc_device *storDevice;

@@ -120,7 +120,8 @@ static inline struct storvsc_device *GetStorDevice(struct hv_device *Device)
}

/* Get the stordevice object iff exists and its refcount > 0 */
-static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device)
+static inline struct storvsc_device *must_get_stor_device(
+ struct hv_device *Device)
{
struct storvsc_device *storDevice;

@@ -133,7 +134,7 @@ static inline struct storvsc_device *MustGetStorDevice(struct hv_device *Device)
return storDevice;
}

-static inline void PutStorDevice(struct hv_device *Device)
+static inline void put_stor_device(struct hv_device *Device)
{
struct storvsc_device *storDevice;

@@ -144,8 +145,9 @@ static inline void PutStorDevice(struct hv_device *Device)
/* ASSERT(atomic_read(&storDevice->ref_count)); */
}

-/* Drop ref count to 1 to effectively disable GetStorDevice() */
-static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device)
+/* Drop ref count to 1 to effectively disable get_stor_device() */
+static inline struct storvsc_device *release_stor_device(
+ struct hv_device *Device)
{
struct storvsc_device *storDevice;

@@ -160,7 +162,7 @@ static inline struct storvsc_device *ReleaseStorDevice(struct hv_device *Device)
}

/* Drop ref count to 0. No one can use StorDevice object. */
-static inline struct storvsc_device *FinalReleaseStorDevice(
+static inline struct storvsc_device *final_release_stor_device(
struct hv_device *Device)
{
struct storvsc_device *storDevice;
@@ -176,14 +178,14 @@ static inline struct storvsc_device *FinalReleaseStorDevice(
return storDevice;
}

-static int StorVscChannelInit(struct hv_device *Device)
+static int stor_vsc_channel_init(struct hv_device *Device)
{
struct storvsc_device *storDevice;
struct storvsc_request_extension *request;
struct vstor_packet *vstorPacket;
int ret;

- storDevice = GetStorDevice(Device);
+ storDevice = get_stor_device(Device);
if (!storDevice) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
@@ -340,18 +342,18 @@ Cleanup:
kfree(request->wait_event);
request->wait_event = NULL;
nomem:
- PutStorDevice(Device);
+ put_stor_device(Device);
return ret;
}

-static void StorVscOnIOCompletion(struct hv_device *Device,
+static void stor_vsc_on_io_completion(struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt)
{
struct hv_storvsc_request *request;
struct storvsc_device *storDevice;

- storDevice = MustGetStorDevice(Device);
+ storDevice = must_get_stor_device(Device);
if (!storDevice) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
@@ -405,17 +407,17 @@ static void StorVscOnIOCompletion(struct hv_device *Device,

atomic_dec(&storDevice->num_outstanding_requests);

- PutStorDevice(Device);
+ put_stor_device(Device);
}

-static void StorVscOnReceive(struct hv_device *Device,
+static void stor_vsc_on_receive(struct hv_device *Device,
struct vstor_packet *VStorPacket,
struct storvsc_request_extension *RequestExt)
{
switch (VStorPacket->operation) {
case VSTOR_OPERATION_COMPLETE_IO:
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
- StorVscOnIOCompletion(Device, VStorPacket, RequestExt);
+ stor_vsc_on_io_completion(Device, VStorPacket, RequestExt);
break;
case VSTOR_OPERATION_REMOVE_DEVICE:
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION");
@@ -429,7 +431,7 @@ static void StorVscOnReceive(struct hv_device *Device,
}
}

-static void StorVscOnChannelCallback(void *context)
+static void stor_vsc_on_channel_callback(void *context)
{
struct hv_device *device = (struct hv_device *)context;
struct storvsc_device *storDevice;
@@ -441,7 +443,7 @@ static void StorVscOnChannelCallback(void *context)

/* ASSERT(device); */

- storDevice = MustGetStorDevice(device);
+ storDevice = must_get_stor_device(device);
if (!storDevice) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
@@ -476,7 +478,7 @@ static void StorVscOnChannelCallback(void *context)

osd_waitevent_set(request->wait_event);
} else {
- StorVscOnReceive(device,
+ stor_vsc_on_receive(device,
(struct vstor_packet *)packet,
request);
}
@@ -486,11 +488,11 @@ static void StorVscOnChannelCallback(void *context)
}
} while (1);

- PutStorDevice(device);
+ put_stor_device(device);
return;
}

-static int StorVscConnectToVsp(struct hv_device *Device)
+static int stor_vsc_connect_to_vsp(struct hv_device *Device)
{
struct vmstorage_channel_properties props;
struct storvsc_driver_object *storDriver;
@@ -505,7 +507,7 @@ static int StorVscConnectToVsp(struct hv_device *Device)
storDriver->ring_buffer_size,
(void *)&props,
sizeof(struct vmstorage_channel_properties),
- StorVscOnChannelCallback, Device);
+ stor_vsc_on_channel_callback, Device);

DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
props.path_id, props.target_id, props.max_transfer_bytes);
@@ -515,16 +517,17 @@ static int StorVscConnectToVsp(struct hv_device *Device)
return -1;
}

- ret = StorVscChannelInit(Device);
+ ret = stor_vsc_channel_init(Device);

return ret;
}

/*
- * StorVscOnDeviceAdd - Callback when the device belonging to this driver is added
+ * stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
+static int stor_vsc_on_device_add(struct hv_device *Device,
+ void *AdditionalInfo)
{
struct storvsc_device *storDevice;
/* struct vmstorage_channel_properties *props; */
@@ -532,7 +535,7 @@ static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
int ret = 0;

deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
- storDevice = AllocStorDevice(Device);
+ storDevice = alloc_stor_device(Device);
if (!storDevice) {
ret = -1;
goto Cleanup;
@@ -555,7 +558,7 @@ static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)

storDevice->port_number = deviceInfo->port_number;
/* Send it back up */
- ret = StorVscConnectToVsp(Device);
+ ret = stor_vsc_connect_to_vsp(Device);

/* deviceInfo->PortNumber = storDevice->PortNumber; */
deviceInfo->path_id = storDevice->path_id;
@@ -570,16 +573,16 @@ Cleanup:
}

/*
- * StorVscOnDeviceRemove - Callback when the our device is being removed
+ * stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-static int StorVscOnDeviceRemove(struct hv_device *Device)
+static int stor_vsc_on_device_remove(struct hv_device *Device)
{
struct storvsc_device *storDevice;

DPRINT_INFO(STORVSC, "disabling storage device (%p)...",
Device->Extension);

- storDevice = ReleaseStorDevice(Device);
+ storDevice = release_stor_device(Device);

/*
* At this point, all outbound traffic should be disable. We
@@ -595,14 +598,14 @@ static int StorVscOnDeviceRemove(struct hv_device *Device)
DPRINT_INFO(STORVSC, "removing storage device (%p)...",
Device->Extension);

- storDevice = FinalReleaseStorDevice(Device);
+ storDevice = final_release_stor_device(Device);

DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice);

/* Close the channel */
vmbus_close(Device->channel);

- FreeStorDevice(storDevice);
+ free_stor_device(storDevice);
return 0;
}

@@ -615,7 +618,7 @@ int stor_vsc_on_host_reset(struct hv_device *Device)

DPRINT_INFO(STORVSC, "resetting host adapter...");

- storDevice = GetStorDevice(Device);
+ storDevice = get_stor_device(Device);
if (!storDevice) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
@@ -658,14 +661,14 @@ int stor_vsc_on_host_reset(struct hv_device *Device)
*/

Cleanup:
- PutStorDevice(Device);
+ put_stor_device(Device);
return ret;
}

/*
- * StorVscOnIORequest - Callback to initiate an I/O request
+ * stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-static int StorVscOnIORequest(struct hv_device *Device,
+static int stor_vsc_on_io_request(struct hv_device *Device,
struct hv_storvsc_request *Request)
{
struct storvsc_device *storDevice;
@@ -676,7 +679,7 @@ static int StorVscOnIORequest(struct hv_device *Device,
requestExtension =
(struct storvsc_request_extension *)Request->extension;
vstorPacket = &requestExtension->vstor_packet;
- storDevice = GetStorDevice(Device);
+ storDevice = get_stor_device(Device);

DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, "
"Extension %p", Device, storDevice, Request,
@@ -751,14 +754,14 @@ static int StorVscOnIORequest(struct hv_device *Device,

atomic_inc(&storDevice->num_outstanding_requests);

- PutStorDevice(Device);
+ put_stor_device(Device);
return ret;
}

/*
- * StorVscOnCleanup - Perform any cleanup when the driver is removed
+ * stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-static void StorVscOnCleanup(struct hv_driver *Driver)
+static void stor_vsc_on_cleanup(struct hv_driver *Driver)
{
}

@@ -806,11 +809,11 @@ int stor_vsc_initialize(struct hv_driver *Driver)
STORVSC_MAX_IO_REQUESTS);

/* Setup the dispatch table */
- storDriver->base.OnDeviceAdd = StorVscOnDeviceAdd;
- storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
- storDriver->base.OnCleanup = StorVscOnCleanup;
+ storDriver->base.OnDeviceAdd = stor_vsc_on_device_add;
+ storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove;
+ storDriver->base.OnCleanup = stor_vsc_on_cleanup;

- storDriver->on_io_request = StorVscOnIORequest;
+ storDriver->on_io_request = stor_vsc_on_io_request;

return 0;
}
--
1.6.0.2

2010-12-06 20:30:43

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 6/8] staging: hv: Convert camel case local variables in storvsc.c to lowercase

From: Hank Janssen <[email protected]>

Convert camel case local variables in storvsc.c to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/storvsc.c | 496 +++++++++++++++++++++---------------------
1 files changed, 249 insertions(+), 247 deletions(-)

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 6643038..9295113 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -50,7 +50,7 @@ struct storvsc_device {
/* 0 indicates the device is being destroyed */
atomic_t ref_count;

- atomic_t num_outstanding_requests;
+ atomic_t num_outstanding_req;

/*
* Each unique Port/Path/Target represents 1 channel ie scsi
@@ -81,119 +81,119 @@ static const struct hv_guid gStorVscDeviceType = {
};


-static inline struct storvsc_device *alloc_stor_device(struct hv_device *Device)
+static inline struct storvsc_device *alloc_stor_device(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);
- if (!storDevice)
+ stor_device = kzalloc(sizeof(struct storvsc_device), GFP_KERNEL);
+ if (!stor_device)
return NULL;

/* Set to 2 to allow both inbound and outbound traffics */
/* (ie get_stor_device() and must_get_stor_device()) to proceed. */
- atomic_cmpxchg(&storDevice->ref_count, 0, 2);
+ atomic_cmpxchg(&stor_device->ref_count, 0, 2);

- storDevice->device = Device;
- Device->Extension = storDevice;
+ stor_device->device = device;
+ device->Extension = stor_device;

- return storDevice;
+ return stor_device;
}

-static inline void free_stor_device(struct storvsc_device *Device)
+static inline void free_stor_device(struct storvsc_device *device)
{
- /* ASSERT(atomic_read(&Device->ref_count) == 0); */
- kfree(Device);
+ /* ASSERT(atomic_read(&device->ref_count) == 0); */
+ kfree(device);
}

/* Get the stordevice object iff exists and its refcount > 1 */
-static inline struct storvsc_device *get_stor_device(struct hv_device *Device)
+static inline struct storvsc_device *get_stor_device(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = (struct storvsc_device *)Device->Extension;
- if (storDevice && atomic_read(&storDevice->ref_count) > 1)
- atomic_inc(&storDevice->ref_count);
+ stor_device = (struct storvsc_device *)device->Extension;
+ if (stor_device && atomic_read(&stor_device->ref_count) > 1)
+ atomic_inc(&stor_device->ref_count);
else
- storDevice = NULL;
+ stor_device = NULL;

- return storDevice;
+ return stor_device;
}

/* Get the stordevice object iff exists and its refcount > 0 */
static inline struct storvsc_device *must_get_stor_device(
- struct hv_device *Device)
+ struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = (struct storvsc_device *)Device->Extension;
- if (storDevice && atomic_read(&storDevice->ref_count))
- atomic_inc(&storDevice->ref_count);
+ stor_device = (struct storvsc_device *)device->Extension;
+ if (stor_device && atomic_read(&stor_device->ref_count))
+ atomic_inc(&stor_device->ref_count);
else
- storDevice = NULL;
+ stor_device = NULL;

- return storDevice;
+ return stor_device;
}

-static inline void put_stor_device(struct hv_device *Device)
+static inline void put_stor_device(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = (struct storvsc_device *)Device->Extension;
- /* ASSERT(storDevice); */
+ stor_device = (struct storvsc_device *)device->Extension;
+ /* ASSERT(stor_device); */

- atomic_dec(&storDevice->ref_count);
- /* ASSERT(atomic_read(&storDevice->ref_count)); */
+ atomic_dec(&stor_device->ref_count);
+ /* ASSERT(atomic_read(&stor_device->ref_count)); */
}

/* Drop ref count to 1 to effectively disable get_stor_device() */
static inline struct storvsc_device *release_stor_device(
- struct hv_device *Device)
+ struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = (struct storvsc_device *)Device->Extension;
- /* ASSERT(storDevice); */
+ stor_device = (struct storvsc_device *)device->Extension;
+ /* ASSERT(stor_device); */

/* Busy wait until the ref drop to 2, then set it to 1 */
- while (atomic_cmpxchg(&storDevice->ref_count, 2, 1) != 2)
+ while (atomic_cmpxchg(&stor_device->ref_count, 2, 1) != 2)
udelay(100);

- return storDevice;
+ return stor_device;
}

-/* Drop ref count to 0. No one can use StorDevice object. */
+/* Drop ref count to 0. No one can use stor_device object. */
static inline struct storvsc_device *final_release_stor_device(
- struct hv_device *Device)
+ struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = (struct storvsc_device *)Device->Extension;
- /* ASSERT(storDevice); */
+ stor_device = (struct storvsc_device *)device->Extension;
+ /* ASSERT(stor_device); */

/* Busy wait until the ref drop to 1, then set it to 0 */
- while (atomic_cmpxchg(&storDevice->ref_count, 1, 0) != 1)
+ while (atomic_cmpxchg(&stor_device->ref_count, 1, 0) != 1)
udelay(100);

- Device->Extension = NULL;
- return storDevice;
+ device->Extension = NULL;
+ return stor_device;
}

-static int stor_vsc_channel_init(struct hv_device *Device)
+static int stor_vsc_channel_init(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
- struct vstor_packet *vstorPacket;
+ struct vstor_packet *vstor_packet;
int ret;

- storDevice = get_stor_device(Device);
- if (!storDevice) {
+ stor_device = get_stor_device(device);
+ if (!stor_device) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
return -1;
}

- request = &storDevice->init_request;
- vstorPacket = &request->vstor_packet;
+ request = &stor_device->init_request;
+ vstor_packet = &request->vstor_packet;

/*
* Now, initiate the vsc/vsp initialization protocol on the open
@@ -206,8 +206,8 @@ static int stor_vsc_channel_init(struct hv_device *Device)
goto nomem;
}

- vstorPacket->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
- vstorPacket->flags = REQUEST_COMPLETION_FLAG;
+ vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;

/*SpinlockAcquire(gDriverExt.packetListLock);
INSERT_TAIL_LIST(&gDriverExt.packetList, &packet->listEntry.entry);
@@ -215,7 +215,7 @@ static int stor_vsc_channel_init(struct hv_device *Device)

DPRINT_INFO(STORVSC, "BEGIN_INITIALIZATION_OPERATION...");

- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
VmbusPacketTypeDataInBand,
@@ -228,25 +228,25 @@ static int stor_vsc_channel_init(struct hv_device *Device)

osd_waitevent_wait(request->wait_event);

- if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstorPacket->status != 0) {
+ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstor_packet->status != 0) {
DPRINT_ERR(STORVSC, "BEGIN_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->operation, vstorPacket->status);
+ vstor_packet->operation, vstor_packet->status);
goto Cleanup;
}

DPRINT_INFO(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION...");

/* reuse the packet for version range supported */
- memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION;
- vstorPacket->flags = REQUEST_COMPLETION_FLAG;
+ memset(vstor_packet, 0, sizeof(struct vstor_packet));
+ vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;

- vstorPacket->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT;
- FILL_VMSTOR_REVISION(vstorPacket->version.revision);
+ vstor_packet->version.major_minor = VMSTOR_PROTOCOL_VERSION_CURRENT;
+ FILL_VMSTOR_REVISION(vstor_packet->version.revision);

- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
VmbusPacketTypeDataInBand,
@@ -260,24 +260,24 @@ static int stor_vsc_channel_init(struct hv_device *Device)
osd_waitevent_wait(request->wait_event);

/* TODO: Check returned version */
- if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstorPacket->status != 0) {
+ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstor_packet->status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROTOCOL_VERSION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->operation, vstorPacket->status);
+ vstor_packet->operation, vstor_packet->status);
goto Cleanup;
}

/* Query channel properties */
DPRINT_INFO(STORVSC, "QUERY_PROPERTIES_OPERATION...");

- memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->operation = VSTOR_OPERATION_QUERY_PROPERTIES;
- vstorPacket->flags = REQUEST_COMPLETION_FLAG;
- vstorPacket->storage_channel_properties.port_number =
- storDevice->port_number;
+ memset(vstor_packet, 0, sizeof(struct vstor_packet));
+ vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;
+ vstor_packet->storage_channel_properties.port_number =
+ stor_device->port_number;

- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
VmbusPacketTypeDataInBand,
@@ -292,29 +292,29 @@ static int stor_vsc_channel_init(struct hv_device *Device)
osd_waitevent_wait(request->wait_event);

/* TODO: Check returned version */
- if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstorPacket->status != 0) {
+ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstor_packet->status != 0) {
DPRINT_ERR(STORVSC, "QUERY_PROPERTIES_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->operation, vstorPacket->status);
+ vstor_packet->operation, vstor_packet->status);
goto Cleanup;
}

- storDevice->path_id = vstorPacket->storage_channel_properties.path_id;
- storDevice->target_id
- = vstorPacket->storage_channel_properties.target_id;
+ stor_device->path_id = vstor_packet->storage_channel_properties.path_id;
+ stor_device->target_id
+ = vstor_packet->storage_channel_properties.target_id;

DPRINT_DBG(STORVSC, "channel flag 0x%x, max xfer len 0x%x",
- vstorPacket->storage_channel_properties.flags,
- vstorPacket->storage_channel_properties.max_transfer_bytes);
+ vstor_packet->storage_channel_properties.flags,
+ vstor_packet->storage_channel_properties.max_transfer_bytes);

DPRINT_INFO(STORVSC, "END_INITIALIZATION_OPERATION...");

- memset(vstorPacket, 0, sizeof(struct vstor_packet));
- vstorPacket->operation = VSTOR_OPERATION_END_INITIALIZATION;
- vstorPacket->flags = REQUEST_COMPLETION_FLAG;
+ memset(vstor_packet, 0, sizeof(struct vstor_packet));
+ vstor_packet->operation = VSTOR_OPERATION_END_INITIALIZATION;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;

- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
VmbusPacketTypeDataInBand,
@@ -328,11 +328,11 @@ static int stor_vsc_channel_init(struct hv_device *Device)

osd_waitevent_wait(request->wait_event);

- if (vstorPacket->operation != VSTOR_OPERATION_COMPLETE_IO ||
- vstorPacket->status != 0) {
+ if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
+ vstor_packet->status != 0) {
DPRINT_ERR(STORVSC, "END_INITIALIZATION_OPERATION failed "
"(op %d status 0x%x)",
- vstorPacket->operation, vstorPacket->status);
+ vstor_packet->operation, vstor_packet->status);
goto Cleanup;
}

@@ -342,82 +342,82 @@ Cleanup:
kfree(request->wait_event);
request->wait_event = NULL;
nomem:
- put_stor_device(Device);
+ put_stor_device(device);
return ret;
}

-static void stor_vsc_on_io_completion(struct hv_device *Device,
- struct vstor_packet *VStorPacket,
- struct storvsc_request_extension *RequestExt)
+static void stor_vsc_on_io_completion(struct hv_device *device,
+ struct vstor_packet *vstor_packet,
+ struct storvsc_request_extension *request_ext)
{
struct hv_storvsc_request *request;
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

- storDevice = must_get_stor_device(Device);
- if (!storDevice) {
+ stor_device = must_get_stor_device(device);
+ if (!stor_device) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
return;
}

DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION - request extension %p "
- "completed bytes xfer %u", RequestExt,
- VStorPacket->vm_srb.data_transfer_length);
+ "completed bytes xfer %u", request_ext,
+ vstor_packet->vm_srb.data_transfer_length);

- /* ASSERT(RequestExt != NULL); */
- /* ASSERT(RequestExt->Request != NULL); */
+ /* ASSERT(request_ext != NULL); */
+ /* ASSERT(request_ext->request != NULL); */

- request = RequestExt->request;
+ request = request_ext->request;

/* ASSERT(request->OnIOCompletion != NULL); */

/* Copy over the status...etc */
- request->status = VStorPacket->vm_srb.scsi_status;
+ request->status = vstor_packet->vm_srb.scsi_status;

- if (request->status != 0 || VStorPacket->vm_srb.srb_status != 1) {
+ if (request->status != 0 || vstor_packet->vm_srb.srb_status != 1) {
DPRINT_WARN(STORVSC,
"cmd 0x%x scsi status 0x%x srb status 0x%x\n",
- request->cdb[0], VStorPacket->vm_srb.scsi_status,
- VStorPacket->vm_srb.srb_status);
+ request->cdb[0], vstor_packet->vm_srb.scsi_status,
+ vstor_packet->vm_srb.srb_status);
}

if ((request->status & 0xFF) == 0x02) {
/* CHECK_CONDITION */
- if (VStorPacket->vm_srb.srb_status & 0x80) {
+ if (vstor_packet->vm_srb.srb_status & 0x80) {
/* autosense data available */
DPRINT_WARN(STORVSC, "storvsc pkt %p autosense data "
- "valid - len %d\n", RequestExt,
- VStorPacket->vm_srb.sense_info_length);
+ "valid - len %d\n", request_ext,
+ vstor_packet->vm_srb.sense_info_length);

- /* ASSERT(VStorPacket->vm_srb.sense_info_length <= */
+ /* ASSERT(vstor_packet->vm_srb.sense_info_length <= */
/* request->SenseBufferSize); */
memcpy(request->sense_buffer,
- VStorPacket->vm_srb.sense_data,
- VStorPacket->vm_srb.sense_info_length);
+ vstor_packet->vm_srb.sense_data,
+ vstor_packet->vm_srb.sense_info_length);

request->sense_buffer_size =
- VStorPacket->vm_srb.sense_info_length;
+ vstor_packet->vm_srb.sense_info_length;
}
}

/* TODO: */
- request->bytes_xfer = VStorPacket->vm_srb.data_transfer_length;
+ request->bytes_xfer = vstor_packet->vm_srb.data_transfer_length;

request->on_io_completion(request);

- atomic_dec(&storDevice->num_outstanding_requests);
+ atomic_dec(&stor_device->num_outstanding_req);

- put_stor_device(Device);
+ put_stor_device(device);
}

-static void stor_vsc_on_receive(struct hv_device *Device,
- struct vstor_packet *VStorPacket,
- struct storvsc_request_extension *RequestExt)
+static void stor_vsc_on_receive(struct hv_device *device,
+ struct vstor_packet *vstor_packet,
+ struct storvsc_request_extension *request_ext)
{
- switch (VStorPacket->operation) {
+ switch (vstor_packet->operation) {
case VSTOR_OPERATION_COMPLETE_IO:
DPRINT_DBG(STORVSC, "IO_COMPLETE_OPERATION");
- stor_vsc_on_io_completion(Device, VStorPacket, RequestExt);
+ stor_vsc_on_io_completion(device, vstor_packet, request_ext);
break;
case VSTOR_OPERATION_REMOVE_DEVICE:
DPRINT_INFO(STORVSC, "REMOVE_DEVICE_OPERATION");
@@ -426,7 +426,7 @@ static void stor_vsc_on_receive(struct hv_device *Device,

default:
DPRINT_INFO(STORVSC, "Unknown operation received - %d",
- VStorPacket->operation);
+ vstor_packet->operation);
break;
}
}
@@ -434,17 +434,17 @@ static void stor_vsc_on_receive(struct hv_device *Device,
static void stor_vsc_on_channel_callback(void *context)
{
struct hv_device *device = (struct hv_device *)context;
- struct storvsc_device *storDevice;
- u32 bytesRecvd;
- u64 requestId;
+ struct storvsc_device *stor_device;
+ u32 bytes_recvd;
+ u64 request_id;
unsigned char packet[ALIGN_UP(sizeof(struct vstor_packet), 8)];
struct storvsc_request_extension *request;
int ret;

/* ASSERT(device); */

- storDevice = must_get_stor_device(device);
- if (!storDevice) {
+ stor_device = must_get_stor_device(device);
+ if (!stor_device) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
return;
@@ -453,25 +453,26 @@ static void stor_vsc_on_channel_callback(void *context)
do {
ret = vmbus_recvpacket(device->channel, packet,
ALIGN_UP(sizeof(struct vstor_packet), 8),
- &bytesRecvd, &requestId);
- if (ret == 0 && bytesRecvd > 0) {
+ &bytes_recvd, &request_id);
+ if (ret == 0 && bytes_recvd > 0) {
DPRINT_DBG(STORVSC, "receive %d bytes - tid %llx",
- bytesRecvd, requestId);
+ bytes_recvd, request_id);

- /* ASSERT(bytesRecvd == sizeof(struct vstor_packet)); */
+ /* ASSERT(bytes_recvd ==
+ sizeof(struct vstor_packet)); */

request = (struct storvsc_request_extension *)
- (unsigned long)requestId;
+ (unsigned long)request_id;
/* ASSERT(request);c */

- /* if (vstorPacket.Flags & SYNTHETIC_FLAG) */
- if ((request == &storDevice->init_request) ||
- (request == &storDevice->reset_request)) {
+ /* if (vstor_packet.Flags & SYNTHETIC_FLAG) */
+ if ((request == &stor_device->init_request) ||
+ (request == &stor_device->reset_request)) {
/* DPRINT_INFO(STORVSC,
* "reset completion - operation "
* "%u status %u",
- * vstorPacket.Operation,
- * vstorPacket.Status); */
+ * vstor_packet.Operation,
+ * vstor_packet.Status); */

memcpy(&request->vstor_packet, packet,
sizeof(struct vstor_packet));
@@ -492,22 +493,22 @@ static void stor_vsc_on_channel_callback(void *context)
return;
}

-static int stor_vsc_connect_to_vsp(struct hv_device *Device)
+static int stor_vsc_connect_to_vsp(struct hv_device *device)
{
struct vmstorage_channel_properties props;
- struct storvsc_driver_object *storDriver;
+ struct storvsc_driver_object *stor_driver;
int ret;

- storDriver = (struct storvsc_driver_object *)Device->Driver;
+ stor_driver = (struct storvsc_driver_object *)device->Driver;
memset(&props, 0, sizeof(struct vmstorage_channel_properties));

/* Open the channel */
- ret = vmbus_open(Device->channel,
- storDriver->ring_buffer_size,
- storDriver->ring_buffer_size,
+ ret = vmbus_open(device->channel,
+ stor_driver->ring_buffer_size,
+ stor_driver->ring_buffer_size,
(void *)&props,
sizeof(struct vmstorage_channel_properties),
- stor_vsc_on_channel_callback, Device);
+ stor_vsc_on_channel_callback, device);

DPRINT_DBG(STORVSC, "storage props: path id %d, tgt id %d, max xfer %d",
props.path_id, props.target_id, props.max_transfer_bytes);
@@ -517,7 +518,7 @@ static int stor_vsc_connect_to_vsp(struct hv_device *Device)
return -1;
}

- ret = stor_vsc_channel_init(Device);
+ ret = stor_vsc_channel_init(device);

return ret;
}
@@ -526,17 +527,17 @@ static int stor_vsc_connect_to_vsp(struct hv_device *Device)
* stor_vsc_on_device_add - Callback when the device belonging to this driver
* is added
*/
-static int stor_vsc_on_device_add(struct hv_device *Device,
- void *AdditionalInfo)
+static int stor_vsc_on_device_add(struct hv_device *device,
+ void *additional_info)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;
/* struct vmstorage_channel_properties *props; */
- struct storvsc_device_info *deviceInfo;
+ struct storvsc_device_info *device_info;
int ret = 0;

- deviceInfo = (struct storvsc_device_info *)AdditionalInfo;
- storDevice = alloc_stor_device(Device);
- if (!storDevice) {
+ device_info = (struct storvsc_device_info *)additional_info;
+ stor_device = alloc_stor_device(device);
+ if (!stor_device) {
ret = -1;
goto Cleanup;
}
@@ -556,17 +557,17 @@ static int stor_vsc_on_device_add(struct hv_device *Device,
storChannel->PathId = props->PathId;
storChannel->TargetId = props->TargetId; */

- storDevice->port_number = deviceInfo->port_number;
+ stor_device->port_number = device_info->port_number;
/* Send it back up */
- ret = stor_vsc_connect_to_vsp(Device);
+ ret = stor_vsc_connect_to_vsp(device);

- /* deviceInfo->PortNumber = storDevice->PortNumber; */
- deviceInfo->path_id = storDevice->path_id;
- deviceInfo->target_id = storDevice->target_id;
+ /* device_info->PortNumber = stor_device->PortNumber; */
+ device_info->path_id = stor_device->path_id;
+ device_info->target_id = stor_device->target_id;

DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
- storDevice->port_number, storDevice->path_id,
- storDevice->target_id);
+ stor_device->port_number, stor_device->path_id,
+ stor_device->target_id);

Cleanup:
return ret;
@@ -575,58 +576,58 @@ Cleanup:
/*
* stor_vsc_on_device_remove - Callback when the our device is being removed
*/
-static int stor_vsc_on_device_remove(struct hv_device *Device)
+static int stor_vsc_on_device_remove(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;

DPRINT_INFO(STORVSC, "disabling storage device (%p)...",
- Device->Extension);
+ device->Extension);

- storDevice = release_stor_device(Device);
+ stor_device = release_stor_device(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.
*/
- while (atomic_read(&storDevice->num_outstanding_requests)) {
+ while (atomic_read(&stor_device->num_outstanding_req)) {
DPRINT_INFO(STORVSC, "waiting for %d requests to complete...",
- atomic_read(&storDevice->num_outstanding_requests));
+ atomic_read(&stor_device->num_outstanding_req));
udelay(100);
}

DPRINT_INFO(STORVSC, "removing storage device (%p)...",
- Device->Extension);
+ device->Extension);

- storDevice = final_release_stor_device(Device);
+ stor_device = final_release_stor_device(device);

- DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", storDevice);
+ DPRINT_INFO(STORVSC, "storage device (%p) safe to remove", stor_device);

/* Close the channel */
- vmbus_close(Device->channel);
+ vmbus_close(device->channel);

- free_stor_device(storDevice);
+ free_stor_device(stor_device);
return 0;
}

-int stor_vsc_on_host_reset(struct hv_device *Device)
+int stor_vsc_on_host_reset(struct hv_device *device)
{
- struct storvsc_device *storDevice;
+ struct storvsc_device *stor_device;
struct storvsc_request_extension *request;
- struct vstor_packet *vstorPacket;
+ struct vstor_packet *vstor_packet;
int ret;

DPRINT_INFO(STORVSC, "resetting host adapter...");

- storDevice = get_stor_device(Device);
- if (!storDevice) {
+ stor_device = get_stor_device(device);
+ if (!stor_device) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
return -1;
}

- request = &storDevice->reset_request;
- vstorPacket = &request->vstor_packet;
+ request = &stor_device->reset_request;
+ vstor_packet = &request->vstor_packet;

request->wait_event = osd_waitevent_create();
if (!request->wait_event) {
@@ -634,18 +635,18 @@ int stor_vsc_on_host_reset(struct hv_device *Device)
goto Cleanup;
}

- vstorPacket->operation = VSTOR_OPERATION_RESET_BUS;
- vstorPacket->flags = REQUEST_COMPLETION_FLAG;
- vstorPacket->vm_srb.path_id = storDevice->path_id;
+ vstor_packet->operation = VSTOR_OPERATION_RESET_BUS;
+ vstor_packet->flags = REQUEST_COMPLETION_FLAG;
+ vstor_packet->vm_srb.path_id = stor_device->path_id;

- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
- (unsigned long)&storDevice->reset_request,
+ (unsigned long)&stor_device->reset_request,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d",
- vstorPacket, ret);
+ vstor_packet, ret);
goto Cleanup;
}

@@ -661,118 +662,118 @@ int stor_vsc_on_host_reset(struct hv_device *Device)
*/

Cleanup:
- put_stor_device(Device);
+ put_stor_device(device);
return ret;
}

/*
* stor_vsc_on_io_request - Callback to initiate an I/O request
*/
-static int stor_vsc_on_io_request(struct hv_device *Device,
- struct hv_storvsc_request *Request)
+static int stor_vsc_on_io_request(struct hv_device *device,
+ struct hv_storvsc_request *request)
{
- struct storvsc_device *storDevice;
- struct storvsc_request_extension *requestExtension;
- struct vstor_packet *vstorPacket;
+ struct storvsc_device *stor_device;
+ struct storvsc_request_extension *request_extension;
+ struct vstor_packet *vstor_packet;
int ret = 0;

- requestExtension =
- (struct storvsc_request_extension *)Request->extension;
- vstorPacket = &requestExtension->vstor_packet;
- storDevice = get_stor_device(Device);
+ request_extension =
+ (struct storvsc_request_extension *)request->extension;
+ vstor_packet = &request_extension->vstor_packet;
+ stor_device = get_stor_device(device);

DPRINT_DBG(STORVSC, "enter - Device %p, DeviceExt %p, Request %p, "
- "Extension %p", Device, storDevice, Request,
- requestExtension);
+ "Extension %p", device, stor_device, request,
+ request_extension);

DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d",
- Request, Request->data_buffer.Length, Request->bus,
- Request->target_id, Request->lun_id, Request->cdb_len);
+ request, request->data_buffer.Length, request->bus,
+ request->target_id, request->lun_id, request->cdb_len);

- if (!storDevice) {
+ if (!stor_device) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
"device being destroyed?");
return -2;
}

- /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, Request->Cdb,
- * Request->CdbLen); */
+ /* print_hex_dump_bytes("", DUMP_PREFIX_NONE, request->Cdb,
+ * request->CdbLen); */

- requestExtension->request = Request;
- requestExtension->device = Device;
+ request_extension->request = request;
+ request_extension->device = device;

- memset(vstorPacket, 0 , sizeof(struct vstor_packet));
+ memset(vstor_packet, 0 , sizeof(struct vstor_packet));

- vstorPacket->flags |= REQUEST_COMPLETION_FLAG;
+ vstor_packet->flags |= REQUEST_COMPLETION_FLAG;

- vstorPacket->vm_srb.length = sizeof(struct vmscsi_request);
+ vstor_packet->vm_srb.length = sizeof(struct vmscsi_request);

- vstorPacket->vm_srb.port_number = Request->host;
- vstorPacket->vm_srb.path_id = Request->bus;
- vstorPacket->vm_srb.target_id = Request->target_id;
- vstorPacket->vm_srb.lun = Request->lun_id;
+ vstor_packet->vm_srb.port_number = request->host;
+ vstor_packet->vm_srb.path_id = request->bus;
+ vstor_packet->vm_srb.target_id = request->target_id;
+ vstor_packet->vm_srb.lun = request->lun_id;

- vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
+ vstor_packet->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;

/* Copy over the scsi command descriptor block */
- vstorPacket->vm_srb.cdb_length = Request->cdb_len;
- memcpy(&vstorPacket->vm_srb.cdb, Request->cdb, Request->cdb_len);
+ vstor_packet->vm_srb.cdb_length = request->cdb_len;
+ memcpy(&vstor_packet->vm_srb.cdb, request->cdb, request->cdb_len);

- vstorPacket->vm_srb.data_in = Request->type;
- vstorPacket->vm_srb.data_transfer_length = Request->data_buffer.Length;
+ vstor_packet->vm_srb.data_in = request->type;
+ vstor_packet->vm_srb.data_transfer_length = request->data_buffer.Length;

- vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB;
+ vstor_packet->operation = VSTOR_OPERATION_EXECUTE_SRB;

DPRINT_DBG(STORVSC, "srb - len %d port %d, path %d, target %d, "
"lun %d senselen %d cdblen %d",
- vstorPacket->vm_srb.length,
- vstorPacket->vm_srb.port_number,
- vstorPacket->vm_srb.path_id,
- vstorPacket->vm_srb.target_id,
- vstorPacket->vm_srb.lun,
- vstorPacket->vm_srb.sense_info_length,
- vstorPacket->vm_srb.cdb_length);
-
- if (requestExtension->request->data_buffer.Length) {
- ret = vmbus_sendpacket_multipagebuffer(Device->channel,
- &requestExtension->request->data_buffer,
- vstorPacket,
+ vstor_packet->vm_srb.length,
+ vstor_packet->vm_srb.port_number,
+ vstor_packet->vm_srb.path_id,
+ vstor_packet->vm_srb.target_id,
+ vstor_packet->vm_srb.lun,
+ vstor_packet->vm_srb.sense_info_length,
+ vstor_packet->vm_srb.cdb_length);
+
+ if (request_extension->request->data_buffer.Length) {
+ ret = vmbus_sendpacket_multipagebuffer(device->channel,
+ &request_extension->request->data_buffer,
+ vstor_packet,
sizeof(struct vstor_packet),
- (unsigned long)requestExtension);
+ (unsigned long)request_extension);
} else {
- ret = vmbus_sendpacket(Device->channel, vstorPacket,
+ ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
- (unsigned long)requestExtension,
+ (unsigned long)request_extension,
VmbusPacketTypeDataInBand,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}

if (ret != 0) {
DPRINT_DBG(STORVSC, "Unable to send packet %p ret %d",
- vstorPacket, ret);
+ vstor_packet, ret);
}

- atomic_inc(&storDevice->num_outstanding_requests);
+ atomic_inc(&stor_device->num_outstanding_req);

- put_stor_device(Device);
+ put_stor_device(device);
return ret;
}

/*
* stor_vsc_on_cleanup - Perform any cleanup when the driver is removed
*/
-static void stor_vsc_on_cleanup(struct hv_driver *Driver)
+static void stor_vsc_on_cleanup(struct hv_driver *driver)
{
}

/*
* stor_vsc_initialize - Main entry point
*/
-int stor_vsc_initialize(struct hv_driver *Driver)
+int stor_vsc_initialize(struct hv_driver *driver)
{
- struct storvsc_driver_object *storDriver;
+ struct storvsc_driver_object *stor_driver;

- storDriver = (struct storvsc_driver_object *)Driver;
+ stor_driver = (struct storvsc_driver_object *)driver;

DPRINT_DBG(STORVSC, "sizeof(STORVSC_REQUEST)=%zd "
"sizeof(struct storvsc_request_extension)=%zd "
@@ -784,13 +785,14 @@ int stor_vsc_initialize(struct hv_driver *Driver)
sizeof(struct vmscsi_request));

/* Make sure we are at least 2 pages since 1 page is used for control */
- /* ASSERT(storDriver->RingBufferSize >= (PAGE_SIZE << 1)); */
+ /* ASSERT(stor_driver->RingBufferSize >= (PAGE_SIZE << 1)); */

- Driver->name = g_driver_name;
- memcpy(&Driver->deviceType, &gStorVscDeviceType,
+ driver->name = g_driver_name;
+ memcpy(&driver->deviceType, &gStorVscDeviceType,
sizeof(struct hv_guid));

- storDriver->request_ext_size = sizeof(struct storvsc_request_extension);
+ stor_driver->request_ext_size =
+ sizeof(struct storvsc_request_extension);

/*
* Divide the ring buffer data size (which is 1 page less
@@ -798,22 +800,22 @@ int stor_vsc_initialize(struct hv_driver *Driver)
* the ring buffer indices) by the max request size (which is
* vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
*/
- storDriver->max_outstanding_req_per_channel =
- ((storDriver->ring_buffer_size - PAGE_SIZE) /
+ stor_driver->max_outstanding_req_per_channel =
+ ((stor_driver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

DPRINT_INFO(STORVSC, "max io %u, currently %u\n",
- storDriver->max_outstanding_req_per_channel,
+ stor_driver->max_outstanding_req_per_channel,
STORVSC_MAX_IO_REQUESTS);

/* Setup the dispatch table */
- storDriver->base.OnDeviceAdd = stor_vsc_on_device_add;
- storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove;
- storDriver->base.OnCleanup = stor_vsc_on_cleanup;
+ stor_driver->base.OnDeviceAdd = stor_vsc_on_device_add;
+ stor_driver->base.OnDeviceRemove = stor_vsc_on_device_remove;
+ stor_driver->base.OnCleanup = stor_vsc_on_cleanup;

- storDriver->on_io_request = stor_vsc_on_io_request;
+ stor_driver->on_io_request = stor_vsc_on_io_request;

return 0;
}
--
1.6.0.2

2010-12-06 20:31:28

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 7/8] staging: hv: Convert camel case function names in blkvsc.c to lowercase

From: Hank Janssen <[email protected]>

Convert camel case function names in blkvsc.c to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/blkvsc.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index 208492c..4f4a65c 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -35,7 +35,7 @@ static const struct hv_guid gBlkVscDeviceType = {
}
};

-static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
+static int blk_vsc_on_device_add(struct hv_device *Device, void *AdditionalInfo)
{
struct storvsc_device_info *deviceInfo;
int ret = 0;
@@ -93,7 +93,7 @@ int blk_vsc_initialize(struct hv_driver *Driver)
storDriver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- storDriver->base.OnDeviceAdd = BlkVscOnDeviceAdd;
+ storDriver->base.OnDeviceAdd = blk_vsc_on_device_add;
storDriver->base.OnDeviceRemove = stor_vsc_on_device_remove;
storDriver->base.OnCleanup = stor_vsc_on_cleanup;
storDriver->on_io_request = stor_vsc_on_io_request;
--
1.6.0.2

2010-12-06 20:31:27

by Hank Janssen

[permalink] [raw]
Subject: [PATCH 2/8] staging: hv: Convert camel case struct fields in storvsc_api.h to lowercase

From: Hank Janssen <[email protected]>

Convert camel case struct fields in vstorage.h to lowercase

Signed-off-by: Abhishek Kane <[email protected]>
Signed-off-by: Haiyang Zhang <[email protected]>
Signed-off-by: Hank Janssen <[email protected]>

---
drivers/staging/hv/blkvsc.c | 20 +++---
drivers/staging/hv/blkvsc_drv.c | 115 ++++++++++++++++++++------------------
drivers/staging/hv/storvsc.c | 67 +++++++++++-----------
drivers/staging/hv/storvsc_api.h | 50 ++++++++--------
drivers/staging/hv/storvsc_drv.c | 91 +++++++++++++++---------------
5 files changed, 175 insertions(+), 168 deletions(-)

diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
index d5b0abd..9ac04c3 100644
--- a/drivers/staging/hv/blkvsc.c
+++ b/drivers/staging/hv/blkvsc.c
@@ -51,12 +51,12 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
* id. For IDE devices, the device instance id is formatted as
* <bus id> * - <device id> - 8899 - 000000000000.
*/
- deviceInfo->PathId = Device->deviceInstance.data[3] << 24 |
+ deviceInfo->path_id = Device->deviceInstance.data[3] << 24 |
Device->deviceInstance.data[2] << 16 |
Device->deviceInstance.data[1] << 8 |
Device->deviceInstance.data[0];

- deviceInfo->TargetId = Device->deviceInstance.data[5] << 8 |
+ deviceInfo->target_id = Device->deviceInstance.data[5] << 8 |
Device->deviceInstance.data[4];

return ret;
@@ -75,7 +75,7 @@ int BlkVscInitialize(struct hv_driver *Driver)
Driver->name = gBlkDriverName;
memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid));

- storDriver->RequestExtSize = sizeof(struct storvsc_request_extension);
+ storDriver->request_ext_size = sizeof(struct storvsc_request_extension);

/*
* Divide the ring buffer data size (which is 1 page less than the ring
@@ -83,20 +83,20 @@ int BlkVscInitialize(struct hv_driver *Driver)
* by the max request size (which is
* vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
*/
- storDriver->MaxOutstandingRequestsPerChannel =
- ((storDriver->RingBufferSize - PAGE_SIZE) /
+ storDriver->max_outstanding_req_per_channel =
+ ((storDriver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

DPRINT_INFO(BLKVSC, "max io outstd %u",
- storDriver->MaxOutstandingRequestsPerChannel);
+ storDriver->max_outstanding_req_per_channel);

/* Setup the dispatch table */
- storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd;
- storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
- storDriver->Base.OnCleanup = StorVscOnCleanup;
- storDriver->OnIORequest = StorVscOnIORequest;
+ storDriver->base.OnDeviceAdd = BlkVscOnDeviceAdd;
+ storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
+ storDriver->base.OnCleanup = StorVscOnCleanup;
+ storDriver->on_io_request = StorVscOnIORequest;

return ret;
}
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index 3f81ca5..d65d69e 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -177,13 +177,13 @@ static int blkvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
int ret;

- storvsc_drv_obj->RingBufferSize = blkvsc_ringbuffer_size;
+ storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;

/* Callback to client driver to complete the initialization */
- drv_init(&storvsc_drv_obj->Base);
+ drv_init(&storvsc_drv_obj->base);

- drv_ctx->driver.name = storvsc_drv_obj->Base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType,
+ drv_ctx->driver.name = storvsc_drv_obj->base.name;
+ memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.deviceType,
sizeof(struct hv_guid));

drv_ctx->probe = blkvsc_probe;
@@ -230,8 +230,8 @@ static void blkvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (storvsc_drv_obj->Base.OnCleanup)
- storvsc_drv_obj->Base.OnCleanup(&storvsc_drv_obj->Base);
+ if (storvsc_drv_obj->base.OnCleanup)
+ storvsc_drv_obj->base.OnCleanup(&storvsc_drv_obj->base);

vmbus_child_driver_unregister(drv_ctx);

@@ -262,7 +262,7 @@ static int blkvsc_probe(struct device *device)

DPRINT_DBG(BLKVSC_DRV, "blkvsc_probe - enter");

- if (!storvsc_drv_obj->Base.OnDeviceAdd) {
+ if (!storvsc_drv_obj->base.OnDeviceAdd) {
DPRINT_ERR(BLKVSC_DRV, "OnDeviceAdd() not set");
ret = -1;
goto Cleanup;
@@ -284,7 +284,7 @@ static int blkvsc_probe(struct device *device)

blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device),
sizeof(struct blkvsc_request) +
- storvsc_drv_obj->RequestExtSize, 0,
+ storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);
if (!blkdev->request_pool) {
ret = -ENOMEM;
@@ -293,7 +293,7 @@ static int blkvsc_probe(struct device *device)


/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->Base.OnDeviceAdd(device_obj, &device_info);
+ ret = storvsc_drv_obj->base.OnDeviceAdd(device_obj, &device_info);
if (ret != 0) {
DPRINT_ERR(BLKVSC_DRV, "unable to add blkvsc device");
goto Cleanup;
@@ -301,9 +301,9 @@ static int blkvsc_probe(struct device *device)

blkdev->device_ctx = device_ctx;
/* this identified the device 0 or 1 */
- blkdev->target = device_info.TargetId;
+ blkdev->target = device_info.target_id;
/* this identified the ide ctrl 0 or 1 */
- blkdev->path = device_info.PathId;
+ blkdev->path = device_info.path_id;

dev_set_drvdata(device, blkdev);

@@ -391,7 +391,7 @@ static int blkvsc_probe(struct device *device)
return ret;

Remove:
- storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
+ storvsc_drv_obj->base.OnDeviceRemove(device_obj);

Cleanup:
if (blkdev) {
@@ -459,9 +459,9 @@ static int blkvsc_do_flush(struct block_device_context *blkdev)
blkvsc_req->req = NULL;
blkvsc_req->write = 0;

- blkvsc_req->request.DataBuffer.PfnArray[0] = 0;
- blkvsc_req->request.DataBuffer.Offset = 0;
- blkvsc_req->request.DataBuffer.Length = 0;
+ blkvsc_req->request.data_buffer.PfnArray[0] = 0;
+ blkvsc_req->request.data_buffer.Offset = 0;
+ blkvsc_req->request.data_buffer.Length = 0;

blkvsc_req->cmnd[0] = SYNCHRONIZE_CACHE;
blkvsc_req->cmd_len = 10;
@@ -506,9 +506,9 @@ static int blkvsc_do_inquiry(struct block_device_context *blkdev)
blkvsc_req->req = NULL;
blkvsc_req->write = 0;

- blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
- blkvsc_req->request.DataBuffer.Offset = 0;
- blkvsc_req->request.DataBuffer.Length = 64;
+ blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
+ blkvsc_req->request.data_buffer.Offset = 0;
+ blkvsc_req->request.data_buffer.Length = 64;

blkvsc_req->cmnd[0] = INQUIRY;
blkvsc_req->cmnd[1] = 0x1; /* Get product data */
@@ -593,9 +593,9 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
blkvsc_req->req = NULL;
blkvsc_req->write = 0;

- blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
- blkvsc_req->request.DataBuffer.Offset = 0;
- blkvsc_req->request.DataBuffer.Length = 8;
+ blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
+ blkvsc_req->request.data_buffer.Offset = 0;
+ blkvsc_req->request.data_buffer.Length = 8;

blkvsc_req->cmnd[0] = READ_CAPACITY;
blkvsc_req->cmd_len = 16;
@@ -614,7 +614,7 @@ static int blkvsc_do_read_capacity(struct block_device_context *blkdev)
wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);

/* check error */
- if (blkvsc_req->request.Status) {
+ if (blkvsc_req->request.status) {
scsi_normalize_sense(blkvsc_req->sense_buffer,
SCSI_SENSE_BUFFERSIZE, &sense_hdr);

@@ -670,9 +670,9 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
blkvsc_req->req = NULL;
blkvsc_req->write = 0;

- blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
- blkvsc_req->request.DataBuffer.Offset = 0;
- blkvsc_req->request.DataBuffer.Length = 12;
+ blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
+ blkvsc_req->request.data_buffer.Offset = 0;
+ blkvsc_req->request.data_buffer.Length = 12;

blkvsc_req->cmnd[0] = 0x9E; /* READ_CAPACITY16; */
blkvsc_req->cmd_len = 16;
@@ -691,7 +691,7 @@ static int blkvsc_do_read_capacity16(struct block_device_context *blkdev)
wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);

/* check error */
- if (blkvsc_req->request.Status) {
+ if (blkvsc_req->request.status) {
scsi_normalize_sense(blkvsc_req->sense_buffer,
SCSI_SENSE_BUFFERSIZE, &sense_hdr);
if (sense_hdr.asc == 0x3A) {
@@ -741,14 +741,14 @@ static int blkvsc_remove(struct device *device)

DPRINT_DBG(BLKVSC_DRV, "blkvsc_remove()\n");

- if (!storvsc_drv_obj->Base.OnDeviceRemove)
+ if (!storvsc_drv_obj->base.OnDeviceRemove)
return -1;

/*
* Call to the vsc driver to let it know that the device is being
* removed
*/
- ret = storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
+ ret = storvsc_drv_obj->base.OnDeviceRemove(device_obj);
if (ret != 0) {
/* TODO: */
DPRINT_ERR(BLKVSC_DRV,
@@ -865,38 +865,38 @@ static int blkvsc_submit_request(struct blkvsc_request *blkvsc_req,
(blkvsc_req->write) ? "WRITE" : "READ",
(unsigned long) blkvsc_req->sector_start,
blkvsc_req->sector_count,
- blkvsc_req->request.DataBuffer.Offset,
- blkvsc_req->request.DataBuffer.Length);
+ blkvsc_req->request.data_buffer.Offset,
+ blkvsc_req->request.data_buffer.Length);
#if 0
- for (i = 0; i < (blkvsc_req->request.DataBuffer.Length >> 12); i++) {
+ for (i = 0; i < (blkvsc_req->request.data_buffer.Length >> 12); i++) {
DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
"req %p pfn[%d] %llx\n",
blkvsc_req, i,
- blkvsc_req->request.DataBuffer.PfnArray[i]);
+ blkvsc_req->request.data_buffer.PfnArray[i]);
}
#endif

storvsc_req = &blkvsc_req->request;
- storvsc_req->Extension = (void *)((unsigned long)blkvsc_req +
+ storvsc_req->extension = (void *)((unsigned long)blkvsc_req +
sizeof(struct blkvsc_request));

- storvsc_req->Type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
+ storvsc_req->type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;

- storvsc_req->OnIOCompletion = request_completion;
- storvsc_req->Context = blkvsc_req;
+ storvsc_req->on_io_completion = request_completion;
+ storvsc_req->context = blkvsc_req;

- storvsc_req->Host = blkdev->port;
- storvsc_req->Bus = blkdev->path;
- storvsc_req->TargetId = blkdev->target;
- storvsc_req->LunId = 0; /* this is not really used at all */
+ storvsc_req->host = blkdev->port;
+ storvsc_req->bus = blkdev->path;
+ storvsc_req->target_id = blkdev->target;
+ storvsc_req->lun_id = 0; /* this is not really used at all */

- storvsc_req->CdbLen = blkvsc_req->cmd_len;
- storvsc_req->Cdb = blkvsc_req->cmnd;
+ storvsc_req->cdb_len = blkvsc_req->cmd_len;
+ storvsc_req->cdb = blkvsc_req->cmnd;

- storvsc_req->SenseBuffer = blkvsc_req->sense_buffer;
- storvsc_req->SenseBufferSize = SCSI_SENSE_BUFFERSIZE;
+ storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
+ storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;

- ret = storvsc_drv_obj->OnIORequest(&blkdev->device_ctx->device_obj,
+ ret = storvsc_drv_obj->on_io_request(&blkdev->device_ctx->device_obj,
&blkvsc_req->request);
if (ret == 0)
blkdev->num_outstanding_reqs++;
@@ -992,8 +992,10 @@ static int blkvsc_do_request(struct block_device_context *blkdev,

blkvsc_req->dev = blkdev;
blkvsc_req->req = req;
- blkvsc_req->request.DataBuffer.Offset = bvec->bv_offset;
- blkvsc_req->request.DataBuffer.Length = 0;
+ blkvsc_req->request.data_buffer.Offset
+ = bvec->bv_offset;
+ blkvsc_req->request.data_buffer.Length
+ = 0;

/* Add to the group */
blkvsc_req->group = group;
@@ -1007,8 +1009,11 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
}

/* Add the curr bvec/segment to the curr blkvsc_req */
- blkvsc_req->request.DataBuffer.PfnArray[databuf_idx] = page_to_pfn(bvec->bv_page);
- blkvsc_req->request.DataBuffer.Length += bvec->bv_len;
+ blkvsc_req->request.data_buffer.
+ PfnArray[databuf_idx]
+ = page_to_pfn(bvec->bv_page);
+ blkvsc_req->request.data_buffer.Length
+ += bvec->bv_len;

prev_bvec = bvec;

@@ -1073,7 +1078,7 @@ static int blkvsc_do_request(struct block_device_context *blkdev,
static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
{
struct blkvsc_request *blkvsc_req =
- (struct blkvsc_request *)request->Context;
+ (struct blkvsc_request *)request->context;
struct block_device_context *blkdev =
(struct block_device_context *)blkvsc_req->dev;
struct scsi_sense_hdr sense_hdr;
@@ -1083,7 +1088,7 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)

blkdev->num_outstanding_reqs--;

- if (blkvsc_req->request.Status)
+ if (blkvsc_req->request.status)
if (scsi_normalize_sense(blkvsc_req->sense_buffer,
SCSI_SENSE_BUFFERSIZE, &sense_hdr))
scsi_print_sense_hdr("blkvsc", &sense_hdr);
@@ -1095,7 +1100,7 @@ static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
static void blkvsc_request_completion(struct hv_storvsc_request *request)
{
struct blkvsc_request *blkvsc_req =
- (struct blkvsc_request *)request->Context;
+ (struct blkvsc_request *)request->context;
struct block_device_context *blkdev =
(struct block_device_context *)blkvsc_req->dev;
unsigned long flags;
@@ -1110,7 +1115,7 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
(blkvsc_req->write) ? "WRITE" : "READ",
(unsigned long)blkvsc_req->sector_start,
blkvsc_req->sector_count,
- blkvsc_req->request.DataBuffer.Length,
+ blkvsc_req->request.data_buffer.Length,
blkvsc_req->group->outstanding,
blkdev->num_outstanding_reqs);

@@ -1137,7 +1142,7 @@ static void blkvsc_request_completion(struct hv_storvsc_request *request)
list_del(&comp_req->req_entry);

if (!__blk_end_request(comp_req->req,
- (!comp_req->request.Status ? 0 : -EIO),
+ (!comp_req->request.status ? 0 : -EIO),
comp_req->sector_count * blkdev->sector_size)) {
/*
* All the sectors have been xferred ie the
@@ -1195,7 +1200,7 @@ static int blkvsc_cancel_pending_reqs(struct block_device_context *blkdev)

if (comp_req->req) {
ret = __blk_end_request(comp_req->req,
- (!comp_req->request.Status ? 0 : -EIO),
+ (!comp_req->request.status ? 0 : -EIO),
comp_req->sector_count *
blkdev->sector_size);

diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index 96b4ed9..c4346c6 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -370,16 +370,16 @@ static void StorVscOnIOCompletion(struct hv_device *Device,
/* ASSERT(request->OnIOCompletion != NULL); */

/* Copy over the status...etc */
- request->Status = VStorPacket->vm_srb.scsi_status;
+ request->status = VStorPacket->vm_srb.scsi_status;

- if (request->Status != 0 || VStorPacket->vm_srb.srb_status != 1) {
+ if (request->status != 0 || VStorPacket->vm_srb.srb_status != 1) {
DPRINT_WARN(STORVSC,
"cmd 0x%x scsi status 0x%x srb status 0x%x\n",
- request->Cdb[0], VStorPacket->vm_srb.scsi_status,
+ request->cdb[0], VStorPacket->vm_srb.scsi_status,
VStorPacket->vm_srb.srb_status);
}

- if ((request->Status & 0xFF) == 0x02) {
+ if ((request->status & 0xFF) == 0x02) {
/* CHECK_CONDITION */
if (VStorPacket->vm_srb.srb_status & 0x80) {
/* autosense data available */
@@ -389,19 +389,19 @@ static void StorVscOnIOCompletion(struct hv_device *Device,

/* ASSERT(VStorPacket->vm_srb.sense_info_length <= */
/* request->SenseBufferSize); */
- memcpy(request->SenseBuffer,
+ memcpy(request->sense_buffer,
VStorPacket->vm_srb.sense_data,
VStorPacket->vm_srb.sense_info_length);

- request->SenseBufferSize =
+ request->sense_buffer_size =
VStorPacket->vm_srb.sense_info_length;
}
}

/* TODO: */
- request->BytesXfer = VStorPacket->vm_srb.data_transfer_length;
+ request->bytes_xfer = VStorPacket->vm_srb.data_transfer_length;

- request->OnIOCompletion(request);
+ request->on_io_completion(request);

atomic_dec(&storDevice->NumOutstandingRequests);

@@ -501,7 +501,8 @@ static int StorVscConnectToVsp(struct hv_device *Device)

/* Open the channel */
ret = vmbus_open(Device->channel,
- storDriver->RingBufferSize, storDriver->RingBufferSize,
+ storDriver->ring_buffer_size,
+ storDriver->ring_buffer_size,
(void *)&props,
sizeof(struct vmstorage_channel_properties),
StorVscOnChannelCallback, Device);
@@ -551,13 +552,13 @@ static int StorVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo)
storChannel->PathId = props->PathId;
storChannel->TargetId = props->TargetId; */

- storDevice->PortNumber = deviceInfo->PortNumber;
+ storDevice->PortNumber = deviceInfo->port_number;
/* Send it back up */
ret = StorVscConnectToVsp(Device);

/* deviceInfo->PortNumber = storDevice->PortNumber; */
- deviceInfo->PathId = storDevice->PathId;
- deviceInfo->TargetId = storDevice->TargetId;
+ deviceInfo->path_id = storDevice->PathId;
+ deviceInfo->target_id = storDevice->TargetId;

DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
storDevice->PortNumber, storDevice->PathId,
@@ -672,7 +673,7 @@ static int StorVscOnIORequest(struct hv_device *Device,
int ret = 0;

requestExtension =
- (struct storvsc_request_extension *)Request->Extension;
+ (struct storvsc_request_extension *)Request->extension;
vstorPacket = &requestExtension->VStorPacket;
storDevice = GetStorDevice(Device);

@@ -681,8 +682,8 @@ static int StorVscOnIORequest(struct hv_device *Device,
requestExtension);

DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d",
- Request, Request->DataBuffer.Length, Request->Bus,
- Request->TargetId, Request->LunId, Request->CdbLen);
+ Request, Request->data_buffer.Length, Request->bus,
+ Request->target_id, Request->lun_id, Request->cdb_len);

if (!storDevice) {
DPRINT_ERR(STORVSC, "unable to get stor device..."
@@ -702,19 +703,19 @@ static int StorVscOnIORequest(struct hv_device *Device,

vstorPacket->vm_srb.length = sizeof(struct vmscsi_request);

- vstorPacket->vm_srb.port_number = Request->Host;
- vstorPacket->vm_srb.path_id = Request->Bus;
- vstorPacket->vm_srb.target_id = Request->TargetId;
- vstorPacket->vm_srb.lun = Request->LunId;
+ vstorPacket->vm_srb.port_number = Request->host;
+ vstorPacket->vm_srb.path_id = Request->bus;
+ vstorPacket->vm_srb.target_id = Request->target_id;
+ vstorPacket->vm_srb.lun = Request->lun_id;

vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;

/* Copy over the scsi command descriptor block */
- vstorPacket->vm_srb.cdb_length = Request->CdbLen;
- memcpy(&vstorPacket->vm_srb.cdb, Request->Cdb, Request->CdbLen);
+ vstorPacket->vm_srb.cdb_length = Request->cdb_len;
+ memcpy(&vstorPacket->vm_srb.cdb, Request->cdb, Request->cdb_len);

- vstorPacket->vm_srb.data_in = Request->Type;
- vstorPacket->vm_srb.data_transfer_length = Request->DataBuffer.Length;
+ vstorPacket->vm_srb.data_in = Request->type;
+ vstorPacket->vm_srb.data_transfer_length = Request->data_buffer.Length;

vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB;

@@ -728,9 +729,9 @@ static int StorVscOnIORequest(struct hv_device *Device,
vstorPacket->vm_srb.sense_info_length,
vstorPacket->vm_srb.cdb_length);

- if (requestExtension->Request->DataBuffer.Length) {
+ if (requestExtension->Request->data_buffer.Length) {
ret = vmbus_sendpacket_multipagebuffer(Device->channel,
- &requestExtension->Request->DataBuffer,
+ &requestExtension->Request->data_buffer,
vstorPacket,
sizeof(struct vstor_packet),
(unsigned long)requestExtension);
@@ -785,7 +786,7 @@ int StorVscInitialize(struct hv_driver *Driver)
memcpy(&Driver->deviceType, &gStorVscDeviceType,
sizeof(struct hv_guid));

- storDriver->RequestExtSize = sizeof(struct storvsc_request_extension);
+ storDriver->request_ext_size = sizeof(struct storvsc_request_extension);

/*
* Divide the ring buffer data size (which is 1 page less
@@ -793,22 +794,22 @@ int StorVscInitialize(struct hv_driver *Driver)
* the ring buffer indices) by the max request size (which is
* vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
*/
- storDriver->MaxOutstandingRequestsPerChannel =
- ((storDriver->RingBufferSize - PAGE_SIZE) /
+ storDriver->max_outstanding_req_per_channel =
+ ((storDriver->ring_buffer_size - PAGE_SIZE) /
ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
sizeof(struct vstor_packet) + sizeof(u64),
sizeof(u64)));

DPRINT_INFO(STORVSC, "max io %u, currently %u\n",
- storDriver->MaxOutstandingRequestsPerChannel,
+ storDriver->max_outstanding_req_per_channel,
STORVSC_MAX_IO_REQUESTS);

/* Setup the dispatch table */
- storDriver->Base.OnDeviceAdd = StorVscOnDeviceAdd;
- storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
- storDriver->Base.OnCleanup = StorVscOnCleanup;
+ storDriver->base.OnDeviceAdd = StorVscOnDeviceAdd;
+ storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
+ storDriver->base.OnCleanup = StorVscOnCleanup;

- storDriver->OnIORequest = StorVscOnIORequest;
+ storDriver->on_io_request = StorVscOnIORequest;

return 0;
}
diff --git a/drivers/staging/hv/storvsc_api.h b/drivers/staging/hv/storvsc_api.h
index 8505a1c..46f031e 100644
--- a/drivers/staging/hv/storvsc_api.h
+++ b/drivers/staging/hv/storvsc_api.h
@@ -53,58 +53,58 @@ enum storvsc_request_type{
};

struct hv_storvsc_request {
- enum storvsc_request_type Type;
- u32 Host;
- u32 Bus;
- u32 TargetId;
- u32 LunId;
- u8 *Cdb;
- u32 CdbLen;
- u32 Status;
- u32 BytesXfer;
+ enum storvsc_request_type type;
+ u32 host;
+ u32 bus;
+ u32 target_id;
+ u32 lun_id;
+ u8 *cdb;
+ u32 cdb_len;
+ u32 status;
+ u32 bytes_xfer;

- unsigned char *SenseBuffer;
- u32 SenseBufferSize;
+ unsigned char *sense_buffer;
+ u32 sense_buffer_size;

- void *Context;
+ void *context;

- void (*OnIOCompletion)(struct hv_storvsc_request *Request);
+ void (*on_io_completion)(struct hv_storvsc_request *request);

/* This points to the memory after DataBuffer */
- void *Extension;
+ void *extension;

- struct hv_multipage_buffer DataBuffer;
+ struct hv_multipage_buffer data_buffer;
};

/* Represents the block vsc driver */
struct storvsc_driver_object {
/* Must be the first field */
/* Which is a bug FIXME! */
- struct hv_driver Base;
+ struct hv_driver base;

/* Set by caller (in bytes) */
- u32 RingBufferSize;
+ u32 ring_buffer_size;

/* Allocate this much private extension for each I/O request */
- u32 RequestExtSize;
+ u32 request_ext_size;

/* Maximum # of requests in flight per channel/device */
- u32 MaxOutstandingRequestsPerChannel;
+ u32 max_outstanding_req_per_channel;

/* Specific to this driver */
- int (*OnIORequest)(struct hv_device *Device,
- struct hv_storvsc_request *Request);
+ int (*on_io_request)(struct hv_device *device,
+ struct hv_storvsc_request *request);
};

struct storvsc_device_info {
- unsigned int PortNumber;
- unsigned char PathId;
- unsigned char TargetId;
+ unsigned int port_number;
+ unsigned char path_id;
+ unsigned char target_id;
};

/* Interface */
int StorVscInitialize(struct hv_driver *driver);
-int StorVscOnHostReset(struct hv_device *Device);
+int StorVscOnHostReset(struct hv_device *device);
int BlkVscInitialize(struct hv_driver *driver);

#endif /* _STORVSC_API_H_ */
diff --git a/drivers/staging/hv/storvsc_drv.c b/drivers/staging/hv/storvsc_drv.c
index defc34a..03695ce 100644
--- a/drivers/staging/hv/storvsc_drv.c
+++ b/drivers/staging/hv/storvsc_drv.c
@@ -141,28 +141,28 @@ static int storvsc_drv_init(int (*drv_init)(struct hv_driver *drv))
struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;

- storvsc_drv_obj->RingBufferSize = storvsc_ringbuffer_size;
+ storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;

/* Callback to client driver to complete the initialization */
- drv_init(&storvsc_drv_obj->Base);
+ drv_init(&storvsc_drv_obj->base);

DPRINT_INFO(STORVSC_DRV,
"request extension size %u, max outstanding reqs %u",
- storvsc_drv_obj->RequestExtSize,
- storvsc_drv_obj->MaxOutstandingRequestsPerChannel);
+ storvsc_drv_obj->request_ext_size,
+ storvsc_drv_obj->max_outstanding_req_per_channel);

- if (storvsc_drv_obj->MaxOutstandingRequestsPerChannel <
+ if (storvsc_drv_obj->max_outstanding_req_per_channel <
STORVSC_MAX_IO_REQUESTS) {
DPRINT_ERR(STORVSC_DRV,
"The number of outstanding io requests (%d) "
"is larger than that supported (%d) internally.",
STORVSC_MAX_IO_REQUESTS,
- storvsc_drv_obj->MaxOutstandingRequestsPerChannel);
+ storvsc_drv_obj->max_outstanding_req_per_channel);
return -1;
}

- drv_ctx->driver.name = storvsc_drv_obj->Base.name;
- memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType,
+ drv_ctx->driver.name = storvsc_drv_obj->base.name;
+ memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.deviceType,
sizeof(struct hv_guid));

drv_ctx->probe = storvsc_probe;
@@ -207,8 +207,8 @@ static void storvsc_drv_exit(void)
device_unregister(current_dev);
}

- if (storvsc_drv_obj->Base.OnCleanup)
- storvsc_drv_obj->Base.OnCleanup(&storvsc_drv_obj->Base);
+ if (storvsc_drv_obj->base.OnCleanup)
+ storvsc_drv_obj->base.OnCleanup(&storvsc_drv_obj->base);

vmbus_child_driver_unregister(drv_ctx);
return;
@@ -232,7 +232,7 @@ static int storvsc_probe(struct device *device)
struct host_device_context *host_device_ctx;
struct storvsc_device_info device_info;

- if (!storvsc_drv_obj->Base.OnDeviceAdd)
+ if (!storvsc_drv_obj->base.OnDeviceAdd)
return -1;

host = scsi_host_alloc(&scsi_driver,
@@ -253,7 +253,7 @@ static int storvsc_probe(struct device *device)
host_device_ctx->request_pool =
kmem_cache_create(dev_name(&device_ctx->device),
sizeof(struct storvsc_cmd_request) +
- storvsc_drv_obj->RequestExtSize, 0,
+ storvsc_drv_obj->request_ext_size, 0,
SLAB_HWCACHE_ALIGN, NULL);

if (!host_device_ctx->request_pool) {
@@ -261,9 +261,9 @@ static int storvsc_probe(struct device *device)
return -ENOMEM;
}

- device_info.PortNumber = host->host_no;
+ device_info.port_number = host->host_no;
/* Call to the vsc driver to add the device */
- ret = storvsc_drv_obj->Base.OnDeviceAdd(device_obj,
+ ret = storvsc_drv_obj->base.OnDeviceAdd(device_obj,
(void *)&device_info);
if (ret != 0) {
DPRINT_ERR(STORVSC_DRV, "unable to add scsi vsc device");
@@ -273,8 +273,8 @@ static int storvsc_probe(struct device *device)
}

/* host_device_ctx->port = device_info.PortNumber; */
- host_device_ctx->path = device_info.PathId;
- host_device_ctx->target = device_info.TargetId;
+ host_device_ctx->path = device_info.path_id;
+ host_device_ctx->target = device_info.target_id;

/* max # of devices per target */
host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
@@ -288,7 +288,7 @@ static int storvsc_probe(struct device *device)
if (ret != 0) {
DPRINT_ERR(STORVSC_DRV, "unable to add scsi host device");

- storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
+ storvsc_drv_obj->base.OnDeviceRemove(device_obj);

kmem_cache_destroy(host_device_ctx->request_pool);
scsi_host_put(host);
@@ -318,14 +318,14 @@ static int storvsc_remove(struct device *device)
(struct host_device_context *)host->hostdata;


- if (!storvsc_drv_obj->Base.OnDeviceRemove)
+ if (!storvsc_drv_obj->base.OnDeviceRemove)
return -1;

/*
* Call to the vsc driver to let it know that the device is being
* removed
*/
- ret = storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
+ ret = storvsc_drv_obj->base.OnDeviceRemove(device_obj);
if (ret != 0) {
/* TODO: */
DPRINT_ERR(STORVSC, "unable to remove vsc device (ret %d)",
@@ -351,7 +351,7 @@ static int storvsc_remove(struct device *device)
static void storvsc_commmand_completion(struct hv_storvsc_request *request)
{
struct storvsc_cmd_request *cmd_request =
- (struct storvsc_cmd_request *)request->Context;
+ (struct storvsc_cmd_request *)request->context;
struct scsi_cmnd *scmnd = cmd_request->cmd;
struct host_device_context *host_device_ctx =
(struct host_device_context *)scmnd->device->host->hostdata;
@@ -376,16 +376,17 @@ static void storvsc_commmand_completion(struct hv_storvsc_request *request)
cmd_request->bounce_sgl_count);
}

- scmnd->result = request->Status;
+ scmnd->result = request->status;

if (scmnd->result) {
if (scsi_normalize_sense(scmnd->sense_buffer,
- request->SenseBufferSize, &sense_hdr))
+ request->sense_buffer_size, &sense_hdr))
scsi_print_sense_hdr("storvsc", &sense_hdr);
}

- /* ASSERT(request->BytesXfer <= request->DataBuffer.Length); */
- scsi_set_resid(scmnd, request->DataBuffer.Length - request->BytesXfer);
+ /* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
+ scsi_set_resid(scmnd,
+ request->data_buffer.Length - request->bytes_xfer);

scsi_done_fn = scmnd->scsi_done;

@@ -658,42 +659,42 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,

request = &cmd_request->request;

- request->Extension =
+ request->extension =
(void *)((unsigned long)cmd_request + request_size);
DPRINT_DBG(STORVSC_DRV, "req %p size %d ext %d", request, request_size,
- storvsc_drv_obj->RequestExtSize);
+ storvsc_drv_obj->request_ext_size);

/* Build the SRB */
switch (scmnd->sc_data_direction) {
case DMA_TO_DEVICE:
- request->Type = WRITE_TYPE;
+ request->type = WRITE_TYPE;
break;
case DMA_FROM_DEVICE:
- request->Type = READ_TYPE;
+ request->type = READ_TYPE;
break;
default:
- request->Type = UNKNOWN_TYPE;
+ request->type = UNKNOWN_TYPE;
break;
}

- request->OnIOCompletion = storvsc_commmand_completion;
- request->Context = cmd_request;/* scmnd; */
+ request->on_io_completion = storvsc_commmand_completion;
+ request->context = cmd_request;/* scmnd; */

/* request->PortId = scmnd->device->channel; */
- request->Host = host_device_ctx->port;
- request->Bus = scmnd->device->channel;
- request->TargetId = scmnd->device->id;
- request->LunId = scmnd->device->lun;
+ request->host = host_device_ctx->port;
+ request->bus = scmnd->device->channel;
+ request->target_id = scmnd->device->id;
+ request->lun_id = scmnd->device->lun;

/* ASSERT(scmnd->cmd_len <= 16); */
- request->CdbLen = scmnd->cmd_len;
- request->Cdb = scmnd->cmnd;
+ request->cdb_len = scmnd->cmd_len;
+ request->cdb = scmnd->cmnd;

- request->SenseBuffer = scmnd->sense_buffer;
- request->SenseBufferSize = SCSI_SENSE_BUFFERSIZE;
+ request->sense_buffer = scmnd->sense_buffer;
+ request->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;


- request->DataBuffer.Length = scsi_bufflen(scmnd);
+ request->data_buffer.Length = scsi_bufflen(scmnd);
if (scsi_sg_count(scmnd)) {
sgl = (struct scatterlist *)scsi_sglist(scmnd);
sg_count = scsi_sg_count(scmnd);
@@ -734,25 +735,25 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd *scmnd,
sg_count = cmd_request->bounce_sgl_count;
}

- request->DataBuffer.Offset = sgl[0].offset;
+ request->data_buffer.Offset = sgl[0].offset;

for (i = 0; i < sg_count; i++) {
DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n",
i, sgl[i].length, sgl[i].offset);
- request->DataBuffer.PfnArray[i] =
+ request->data_buffer.PfnArray[i] =
page_to_pfn(sg_page((&sgl[i])));
}
} else if (scsi_sglist(scmnd)) {
/* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
- request->DataBuffer.Offset =
+ request->data_buffer.Offset =
virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
- request->DataBuffer.PfnArray[0] =
+ request->data_buffer.PfnArray[0] =
virt_to_phys(scsi_sglist(scmnd)) >> PAGE_SHIFT;
}

retry_request:
/* Invokes the vsc to start an IO */
- ret = storvsc_drv_obj->OnIORequest(&device_ctx->device_obj,
+ ret = storvsc_drv_obj->on_io_request(&device_ctx->device_obj,
&cmd_request->request);
if (ret == -1) {
/* no more space */
--
1.6.0.2

2010-12-07 01:19:42

by Ky Srinivasan

[permalink] [raw]
Subject: Re: [PATCH 2/8] staging: hv: Convert camel case struct fields in storvsc_api.h to lowercase

Greg,

My new KVP patches are ready to go. Should I wait for Hank's patches to be checked in before I send the KVP patches?

Regards

K. Y
>>> On 12/6/2010 at 3:26 PM, in message
<[email protected]>, Hank Janssen
<[email protected]> wrote:
> From: Hank Janssen <[email protected]>
>
> Convert camel case struct fields in vstorage.h to lowercase
>
> Signed-off-by: Abhishek Kane <[email protected]>
> Signed-off-by: Haiyang Zhang <[email protected]>
> Signed-off-by: Hank Janssen <[email protected]>
>
> ---
> drivers/staging/hv/blkvsc.c | 20 +++---
> drivers/staging/hv/blkvsc_drv.c | 115 ++++++++++++++++++++------------------
> drivers/staging/hv/storvsc.c | 67 +++++++++++-----------
> drivers/staging/hv/storvsc_api.h | 50 ++++++++--------
> drivers/staging/hv/storvsc_drv.c | 91 +++++++++++++++---------------
> 5 files changed, 175 insertions(+), 168 deletions(-)
>
> diff --git a/drivers/staging/hv/blkvsc.c b/drivers/staging/hv/blkvsc.c
> index d5b0abd..9ac04c3 100644
> --- a/drivers/staging/hv/blkvsc.c
> +++ b/drivers/staging/hv/blkvsc.c
> @@ -51,12 +51,12 @@ static int BlkVscOnDeviceAdd(struct hv_device *Device,
> void *AdditionalInfo)
> * id. For IDE devices, the device instance id is formatted as
> * <bus id> * - <device id> - 8899 - 000000000000.
> */
> - deviceInfo->PathId = Device->deviceInstance.data[3] << 24 |
> + deviceInfo->path_id = Device->deviceInstance.data[3] << 24 |
> Device->deviceInstance.data[2] << 16 |
> Device->deviceInstance.data[1] << 8 |
> Device->deviceInstance.data[0];
>
> - deviceInfo->TargetId = Device->deviceInstance.data[5] << 8 |
> + deviceInfo->target_id = Device->deviceInstance.data[5] << 8 |
> Device->deviceInstance.data[4];
>
> return ret;
> @@ -75,7 +75,7 @@ int BlkVscInitialize(struct hv_driver *Driver)
> Driver->name = gBlkDriverName;
> memcpy(&Driver->deviceType, &gBlkVscDeviceType, sizeof(struct hv_guid));
>
> - storDriver->RequestExtSize = sizeof(struct storvsc_request_extension);
> + storDriver->request_ext_size = sizeof(struct storvsc_request_extension);
>
> /*
> * Divide the ring buffer data size (which is 1 page less than the ring
> @@ -83,20 +83,20 @@ int BlkVscInitialize(struct hv_driver *Driver)
> * by the max request size (which is
> * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
> */
> - storDriver->MaxOutstandingRequestsPerChannel =
> - ((storDriver->RingBufferSize - PAGE_SIZE) /
> + storDriver->max_outstanding_req_per_channel =
> + ((storDriver->ring_buffer_size - PAGE_SIZE) /
> ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
> sizeof(struct vstor_packet) + sizeof(u64),
> sizeof(u64)));
>
> DPRINT_INFO(BLKVSC, "max io outstd %u",
> - storDriver->MaxOutstandingRequestsPerChannel);
> + storDriver->max_outstanding_req_per_channel);
>
> /* Setup the dispatch table */
> - storDriver->Base.OnDeviceAdd = BlkVscOnDeviceAdd;
> - storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
> - storDriver->Base.OnCleanup = StorVscOnCleanup;
> - storDriver->OnIORequest = StorVscOnIORequest;
> + storDriver->base.OnDeviceAdd = BlkVscOnDeviceAdd;
> + storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
> + storDriver->base.OnCleanup = StorVscOnCleanup;
> + storDriver->on_io_request = StorVscOnIORequest;
>
> return ret;
> }
> diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
> index 3f81ca5..d65d69e 100644
> --- a/drivers/staging/hv/blkvsc_drv.c
> +++ b/drivers/staging/hv/blkvsc_drv.c
> @@ -177,13 +177,13 @@ static int blkvsc_drv_init(int (*drv_init)(struct
> hv_driver *drv))
> struct driver_context *drv_ctx = &g_blkvsc_drv.drv_ctx;
> int ret;
>
> - storvsc_drv_obj->RingBufferSize = blkvsc_ringbuffer_size;
> + storvsc_drv_obj->ring_buffer_size = blkvsc_ringbuffer_size;
>
> /* Callback to client driver to complete the initialization */
> - drv_init(&storvsc_drv_obj->Base);
> + drv_init(&storvsc_drv_obj->base);
>
> - drv_ctx->driver.name = storvsc_drv_obj->Base.name;
> - memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType,
> + drv_ctx->driver.name = storvsc_drv_obj->base.name;
> + memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.deviceType,
> sizeof(struct hv_guid));
>
> drv_ctx->probe = blkvsc_probe;
> @@ -230,8 +230,8 @@ static void blkvsc_drv_exit(void)
> device_unregister(current_dev);
> }
>
> - if (storvsc_drv_obj->Base.OnCleanup)
> - storvsc_drv_obj->Base.OnCleanup(&storvsc_drv_obj->Base);
> + if (storvsc_drv_obj->base.OnCleanup)
> + storvsc_drv_obj->base.OnCleanup(&storvsc_drv_obj->base);
>
> vmbus_child_driver_unregister(drv_ctx);
>
> @@ -262,7 +262,7 @@ static int blkvsc_probe(struct device *device)
>
> DPRINT_DBG(BLKVSC_DRV, "blkvsc_probe - enter");
>
> - if (!storvsc_drv_obj->Base.OnDeviceAdd) {
> + if (!storvsc_drv_obj->base.OnDeviceAdd) {
> DPRINT_ERR(BLKVSC_DRV, "OnDeviceAdd() not set");
> ret = -1;
> goto Cleanup;
> @@ -284,7 +284,7 @@ static int blkvsc_probe(struct device *device)
>
> blkdev->request_pool = kmem_cache_create(dev_name(&device_ctx->device),
> sizeof(struct blkvsc_request) +
> - storvsc_drv_obj->RequestExtSize, 0,
> + storvsc_drv_obj->request_ext_size, 0,
> SLAB_HWCACHE_ALIGN, NULL);
> if (!blkdev->request_pool) {
> ret = -ENOMEM;
> @@ -293,7 +293,7 @@ static int blkvsc_probe(struct device *device)
>
>
> /* Call to the vsc driver to add the device */
> - ret = storvsc_drv_obj->Base.OnDeviceAdd(device_obj, &device_info);
> + ret = storvsc_drv_obj->base.OnDeviceAdd(device_obj, &device_info);
> if (ret != 0) {
> DPRINT_ERR(BLKVSC_DRV, "unable to add blkvsc device");
> goto Cleanup;
> @@ -301,9 +301,9 @@ static int blkvsc_probe(struct device *device)
>
> blkdev->device_ctx = device_ctx;
> /* this identified the device 0 or 1 */
> - blkdev->target = device_info.TargetId;
> + blkdev->target = device_info.target_id;
> /* this identified the ide ctrl 0 or 1 */
> - blkdev->path = device_info.PathId;
> + blkdev->path = device_info.path_id;
>
> dev_set_drvdata(device, blkdev);
>
> @@ -391,7 +391,7 @@ static int blkvsc_probe(struct device *device)
> return ret;
>
> Remove:
> - storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
> + storvsc_drv_obj->base.OnDeviceRemove(device_obj);
>
> Cleanup:
> if (blkdev) {
> @@ -459,9 +459,9 @@ static int blkvsc_do_flush(struct block_device_context
> *blkdev)
> blkvsc_req->req = NULL;
> blkvsc_req->write = 0;
>
> - blkvsc_req->request.DataBuffer.PfnArray[0] = 0;
> - blkvsc_req->request.DataBuffer.Offset = 0;
> - blkvsc_req->request.DataBuffer.Length = 0;
> + blkvsc_req->request.data_buffer.PfnArray[0] = 0;
> + blkvsc_req->request.data_buffer.Offset = 0;
> + blkvsc_req->request.data_buffer.Length = 0;
>
> blkvsc_req->cmnd[0] = SYNCHRONIZE_CACHE;
> blkvsc_req->cmd_len = 10;
> @@ -506,9 +506,9 @@ static int blkvsc_do_inquiry(struct block_device_context
> *blkdev)
> blkvsc_req->req = NULL;
> blkvsc_req->write = 0;
>
> - blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
> - blkvsc_req->request.DataBuffer.Offset = 0;
> - blkvsc_req->request.DataBuffer.Length = 64;
> + blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
> + blkvsc_req->request.data_buffer.Offset = 0;
> + blkvsc_req->request.data_buffer.Length = 64;
>
> blkvsc_req->cmnd[0] = INQUIRY;
> blkvsc_req->cmnd[1] = 0x1; /* Get product data */
> @@ -593,9 +593,9 @@ static int blkvsc_do_read_capacity(struct
> block_device_context *blkdev)
> blkvsc_req->req = NULL;
> blkvsc_req->write = 0;
>
> - blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
> - blkvsc_req->request.DataBuffer.Offset = 0;
> - blkvsc_req->request.DataBuffer.Length = 8;
> + blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
> + blkvsc_req->request.data_buffer.Offset = 0;
> + blkvsc_req->request.data_buffer.Length = 8;
>
> blkvsc_req->cmnd[0] = READ_CAPACITY;
> blkvsc_req->cmd_len = 16;
> @@ -614,7 +614,7 @@ static int blkvsc_do_read_capacity(struct
> block_device_context *blkdev)
> wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);
>
> /* check error */
> - if (blkvsc_req->request.Status) {
> + if (blkvsc_req->request.status) {
> scsi_normalize_sense(blkvsc_req->sense_buffer,
> SCSI_SENSE_BUFFERSIZE, &sense_hdr);
>
> @@ -670,9 +670,9 @@ static int blkvsc_do_read_capacity16(struct
> block_device_context *blkdev)
> blkvsc_req->req = NULL;
> blkvsc_req->write = 0;
>
> - blkvsc_req->request.DataBuffer.PfnArray[0] = page_to_pfn(page_buf);
> - blkvsc_req->request.DataBuffer.Offset = 0;
> - blkvsc_req->request.DataBuffer.Length = 12;
> + blkvsc_req->request.data_buffer.PfnArray[0] = page_to_pfn(page_buf);
> + blkvsc_req->request.data_buffer.Offset = 0;
> + blkvsc_req->request.data_buffer.Length = 12;
>
> blkvsc_req->cmnd[0] = 0x9E; /* READ_CAPACITY16; */
> blkvsc_req->cmd_len = 16;
> @@ -691,7 +691,7 @@ static int blkvsc_do_read_capacity16(struct
> block_device_context *blkdev)
> wait_event_interruptible(blkvsc_req->wevent, blkvsc_req->cond);
>
> /* check error */
> - if (blkvsc_req->request.Status) {
> + if (blkvsc_req->request.status) {
> scsi_normalize_sense(blkvsc_req->sense_buffer,
> SCSI_SENSE_BUFFERSIZE, &sense_hdr);
> if (sense_hdr.asc == 0x3A) {
> @@ -741,14 +741,14 @@ static int blkvsc_remove(struct device *device)
>
> DPRINT_DBG(BLKVSC_DRV, "blkvsc_remove()\n");
>
> - if (!storvsc_drv_obj->Base.OnDeviceRemove)
> + if (!storvsc_drv_obj->base.OnDeviceRemove)
> return -1;
>
> /*
> * Call to the vsc driver to let it know that the device is being
> * removed
> */
> - ret = storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
> + ret = storvsc_drv_obj->base.OnDeviceRemove(device_obj);
> if (ret != 0) {
> /* TODO: */
> DPRINT_ERR(BLKVSC_DRV,
> @@ -865,38 +865,38 @@ static int blkvsc_submit_request(struct blkvsc_request
> *blkvsc_req,
> (blkvsc_req->write) ? "WRITE" : "READ",
> (unsigned long) blkvsc_req->sector_start,
> blkvsc_req->sector_count,
> - blkvsc_req->request.DataBuffer.Offset,
> - blkvsc_req->request.DataBuffer.Length);
> + blkvsc_req->request.data_buffer.Offset,
> + blkvsc_req->request.data_buffer.Length);
> #if 0
> - for (i = 0; i < (blkvsc_req->request.DataBuffer.Length >> 12); i++) {
> + for (i = 0; i < (blkvsc_req->request.data_buffer.Length >> 12); i++) {
> DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
> "req %p pfn[%d] %llx\n",
> blkvsc_req, i,
> - blkvsc_req->request.DataBuffer.PfnArray[i]);
> + blkvsc_req->request.data_buffer.PfnArray[i]);
> }
> #endif
>
> storvsc_req = &blkvsc_req->request;
> - storvsc_req->Extension = (void *)((unsigned long)blkvsc_req +
> + storvsc_req->extension = (void *)((unsigned long)blkvsc_req +
> sizeof(struct blkvsc_request));
>
> - storvsc_req->Type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
> + storvsc_req->type = blkvsc_req->write ? WRITE_TYPE : READ_TYPE;
>
> - storvsc_req->OnIOCompletion = request_completion;
> - storvsc_req->Context = blkvsc_req;
> + storvsc_req->on_io_completion = request_completion;
> + storvsc_req->context = blkvsc_req;
>
> - storvsc_req->Host = blkdev->port;
> - storvsc_req->Bus = blkdev->path;
> - storvsc_req->TargetId = blkdev->target;
> - storvsc_req->LunId = 0; /* this is not really used at all */
> + storvsc_req->host = blkdev->port;
> + storvsc_req->bus = blkdev->path;
> + storvsc_req->target_id = blkdev->target;
> + storvsc_req->lun_id = 0; /* this is not really used at all */
>
> - storvsc_req->CdbLen = blkvsc_req->cmd_len;
> - storvsc_req->Cdb = blkvsc_req->cmnd;
> + storvsc_req->cdb_len = blkvsc_req->cmd_len;
> + storvsc_req->cdb = blkvsc_req->cmnd;
>
> - storvsc_req->SenseBuffer = blkvsc_req->sense_buffer;
> - storvsc_req->SenseBufferSize = SCSI_SENSE_BUFFERSIZE;
> + storvsc_req->sense_buffer = blkvsc_req->sense_buffer;
> + storvsc_req->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
>
> - ret = storvsc_drv_obj->OnIORequest(&blkdev->device_ctx->device_obj,
> + ret = storvsc_drv_obj->on_io_request(&blkdev->device_ctx->device_obj,
> &blkvsc_req->request);
> if (ret == 0)
> blkdev->num_outstanding_reqs++;
> @@ -992,8 +992,10 @@ static int blkvsc_do_request(struct block_device_context
> *blkdev,
>
> blkvsc_req->dev = blkdev;
> blkvsc_req->req = req;
> - blkvsc_req->request.DataBuffer.Offset = bvec->bv_offset;
> - blkvsc_req->request.DataBuffer.Length = 0;
> + blkvsc_req->request.data_buffer.Offset
> + = bvec->bv_offset;
> + blkvsc_req->request.data_buffer.Length
> + = 0;
>
> /* Add to the group */
> blkvsc_req->group = group;
> @@ -1007,8 +1009,11 @@ static int blkvsc_do_request(struct
> block_device_context *blkdev,
> }
>
> /* Add the curr bvec/segment to the curr blkvsc_req */
> - blkvsc_req->request.DataBuffer.PfnArray[databuf_idx] =
> page_to_pfn(bvec->bv_page);
> - blkvsc_req->request.DataBuffer.Length += bvec->bv_len;
> + blkvsc_req->request.data_buffer.
> + PfnArray[databuf_idx]
> + = page_to_pfn(bvec->bv_page);
> + blkvsc_req->request.data_buffer.Length
> + += bvec->bv_len;
>
> prev_bvec = bvec;
>
> @@ -1073,7 +1078,7 @@ static int blkvsc_do_request(struct
> block_device_context *blkdev,
> static void blkvsc_cmd_completion(struct hv_storvsc_request *request)
> {
> struct blkvsc_request *blkvsc_req =
> - (struct blkvsc_request *)request->Context;
> + (struct blkvsc_request *)request->context;
> struct block_device_context *blkdev =
> (struct block_device_context *)blkvsc_req->dev;
> struct scsi_sense_hdr sense_hdr;
> @@ -1083,7 +1088,7 @@ static void blkvsc_cmd_completion(struct
> hv_storvsc_request *request)
>
> blkdev->num_outstanding_reqs--;
>
> - if (blkvsc_req->request.Status)
> + if (blkvsc_req->request.status)
> if (scsi_normalize_sense(blkvsc_req->sense_buffer,
> SCSI_SENSE_BUFFERSIZE, &sense_hdr))
> scsi_print_sense_hdr("blkvsc", &sense_hdr);
> @@ -1095,7 +1100,7 @@ static void blkvsc_cmd_completion(struct
> hv_storvsc_request *request)
> static void blkvsc_request_completion(struct hv_storvsc_request *request)
> {
> struct blkvsc_request *blkvsc_req =
> - (struct blkvsc_request *)request->Context;
> + (struct blkvsc_request *)request->context;
> struct block_device_context *blkdev =
> (struct block_device_context *)blkvsc_req->dev;
> unsigned long flags;
> @@ -1110,7 +1115,7 @@ static void blkvsc_request_completion(struct
> hv_storvsc_request *request)
> (blkvsc_req->write) ? "WRITE" : "READ",
> (unsigned long)blkvsc_req->sector_start,
> blkvsc_req->sector_count,
> - blkvsc_req->request.DataBuffer.Length,
> + blkvsc_req->request.data_buffer.Length,
> blkvsc_req->group->outstanding,
> blkdev->num_outstanding_reqs);
>
> @@ -1137,7 +1142,7 @@ static void blkvsc_request_completion(struct
> hv_storvsc_request *request)
> list_del(&comp_req->req_entry);
>
> if (!__blk_end_request(comp_req->req,
> - (!comp_req->request.Status ? 0 : -EIO),
> + (!comp_req->request.status ? 0 : -EIO),
> comp_req->sector_count * blkdev->sector_size)) {
> /*
> * All the sectors have been xferred ie the
> @@ -1195,7 +1200,7 @@ static int blkvsc_cancel_pending_reqs(struct
> block_device_context *blkdev)
>
> if (comp_req->req) {
> ret = __blk_end_request(comp_req->req,
> - (!comp_req->request.Status ? 0 : -EIO),
> + (!comp_req->request.status ? 0 : -EIO),
> comp_req->sector_count *
> blkdev->sector_size);
>
> diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
> index 96b4ed9..c4346c6 100644
> --- a/drivers/staging/hv/storvsc.c
> +++ b/drivers/staging/hv/storvsc.c
> @@ -370,16 +370,16 @@ static void StorVscOnIOCompletion(struct hv_device
> *Device,
> /* ASSERT(request->OnIOCompletion != NULL); */
>
> /* Copy over the status...etc */
> - request->Status = VStorPacket->vm_srb.scsi_status;
> + request->status = VStorPacket->vm_srb.scsi_status;
>
> - if (request->Status != 0 || VStorPacket->vm_srb.srb_status != 1) {
> + if (request->status != 0 || VStorPacket->vm_srb.srb_status != 1) {
> DPRINT_WARN(STORVSC,
> "cmd 0x%x scsi status 0x%x srb status 0x%x\n",
> - request->Cdb[0], VStorPacket->vm_srb.scsi_status,
> + request->cdb[0], VStorPacket->vm_srb.scsi_status,
> VStorPacket->vm_srb.srb_status);
> }
>
> - if ((request->Status & 0xFF) == 0x02) {
> + if ((request->status & 0xFF) == 0x02) {
> /* CHECK_CONDITION */
> if (VStorPacket->vm_srb.srb_status & 0x80) {
> /* autosense data available */
> @@ -389,19 +389,19 @@ static void StorVscOnIOCompletion(struct hv_device
> *Device,
>
> /* ASSERT(VStorPacket->vm_srb.sense_info_length <= */
> /* request->SenseBufferSize); */
> - memcpy(request->SenseBuffer,
> + memcpy(request->sense_buffer,
> VStorPacket->vm_srb.sense_data,
> VStorPacket->vm_srb.sense_info_length);
>
> - request->SenseBufferSize =
> + request->sense_buffer_size =
> VStorPacket->vm_srb.sense_info_length;
> }
> }
>
> /* TODO: */
> - request->BytesXfer = VStorPacket->vm_srb.data_transfer_length;
> + request->bytes_xfer = VStorPacket->vm_srb.data_transfer_length;
>
> - request->OnIOCompletion(request);
> + request->on_io_completion(request);
>
> atomic_dec(&storDevice->NumOutstandingRequests);
>
> @@ -501,7 +501,8 @@ static int StorVscConnectToVsp(struct hv_device *Device)
>
> /* Open the channel */
> ret = vmbus_open(Device->channel,
> - storDriver->RingBufferSize, storDriver->RingBufferSize,
> + storDriver->ring_buffer_size,
> + storDriver->ring_buffer_size,
> (void *)&props,
> sizeof(struct vmstorage_channel_properties),
> StorVscOnChannelCallback, Device);
> @@ -551,13 +552,13 @@ static int StorVscOnDeviceAdd(struct hv_device *Device,
> void *AdditionalInfo)
> storChannel->PathId = props->PathId;
> storChannel->TargetId = props->TargetId; */
>
> - storDevice->PortNumber = deviceInfo->PortNumber;
> + storDevice->PortNumber = deviceInfo->port_number;
> /* Send it back up */
> ret = StorVscConnectToVsp(Device);
>
> /* deviceInfo->PortNumber = storDevice->PortNumber; */
> - deviceInfo->PathId = storDevice->PathId;
> - deviceInfo->TargetId = storDevice->TargetId;
> + deviceInfo->path_id = storDevice->PathId;
> + deviceInfo->target_id = storDevice->TargetId;
>
> DPRINT_DBG(STORVSC, "assigned port %u, path %u target %u\n",
> storDevice->PortNumber, storDevice->PathId,
> @@ -672,7 +673,7 @@ static int StorVscOnIORequest(struct hv_device *Device,
> int ret = 0;
>
> requestExtension =
> - (struct storvsc_request_extension *)Request->Extension;
> + (struct storvsc_request_extension *)Request->extension;
> vstorPacket = &requestExtension->VStorPacket;
> storDevice = GetStorDevice(Device);
>
> @@ -681,8 +682,8 @@ static int StorVscOnIORequest(struct hv_device *Device,
> requestExtension);
>
> DPRINT_DBG(STORVSC, "req %p len %d bus %d, target %d, lun %d cdblen %d",
> - Request, Request->DataBuffer.Length, Request->Bus,
> - Request->TargetId, Request->LunId, Request->CdbLen);
> + Request, Request->data_buffer.Length, Request->bus,
> + Request->target_id, Request->lun_id, Request->cdb_len);
>
> if (!storDevice) {
> DPRINT_ERR(STORVSC, "unable to get stor device..."
> @@ -702,19 +703,19 @@ static int StorVscOnIORequest(struct hv_device *Device,
>
> vstorPacket->vm_srb.length = sizeof(struct vmscsi_request);
>
> - vstorPacket->vm_srb.port_number = Request->Host;
> - vstorPacket->vm_srb.path_id = Request->Bus;
> - vstorPacket->vm_srb.target_id = Request->TargetId;
> - vstorPacket->vm_srb.lun = Request->LunId;
> + vstorPacket->vm_srb.port_number = Request->host;
> + vstorPacket->vm_srb.path_id = Request->bus;
> + vstorPacket->vm_srb.target_id = Request->target_id;
> + vstorPacket->vm_srb.lun = Request->lun_id;
>
> vstorPacket->vm_srb.sense_info_length = SENSE_BUFFER_SIZE;
>
> /* Copy over the scsi command descriptor block */
> - vstorPacket->vm_srb.cdb_length = Request->CdbLen;
> - memcpy(&vstorPacket->vm_srb.cdb, Request->Cdb, Request->CdbLen);
> + vstorPacket->vm_srb.cdb_length = Request->cdb_len;
> + memcpy(&vstorPacket->vm_srb.cdb, Request->cdb, Request->cdb_len);
>
> - vstorPacket->vm_srb.data_in = Request->Type;
> - vstorPacket->vm_srb.data_transfer_length = Request->DataBuffer.Length;
> + vstorPacket->vm_srb.data_in = Request->type;
> + vstorPacket->vm_srb.data_transfer_length = Request->data_buffer.Length;
>
> vstorPacket->operation = VSTOR_OPERATION_EXECUTE_SRB;
>
> @@ -728,9 +729,9 @@ static int StorVscOnIORequest(struct hv_device *Device,
> vstorPacket->vm_srb.sense_info_length,
> vstorPacket->vm_srb.cdb_length);
>
> - if (requestExtension->Request->DataBuffer.Length) {
> + if (requestExtension->Request->data_buffer.Length) {
> ret = vmbus_sendpacket_multipagebuffer(Device->channel,
> - &requestExtension->Request->DataBuffer,
> + &requestExtension->Request->data_buffer,
> vstorPacket,
> sizeof(struct vstor_packet),
> (unsigned long)requestExtension);
> @@ -785,7 +786,7 @@ int StorVscInitialize(struct hv_driver *Driver)
> memcpy(&Driver->deviceType, &gStorVscDeviceType,
> sizeof(struct hv_guid));
>
> - storDriver->RequestExtSize = sizeof(struct storvsc_request_extension);
> + storDriver->request_ext_size = sizeof(struct storvsc_request_extension);
>
> /*
> * Divide the ring buffer data size (which is 1 page less
> @@ -793,22 +794,22 @@ int StorVscInitialize(struct hv_driver *Driver)
> * the ring buffer indices) by the max request size (which is
> * vmbus_channel_packet_multipage_buffer + struct vstor_packet + u64)
> */
> - storDriver->MaxOutstandingRequestsPerChannel =
> - ((storDriver->RingBufferSize - PAGE_SIZE) /
> + storDriver->max_outstanding_req_per_channel =
> + ((storDriver->ring_buffer_size - PAGE_SIZE) /
> ALIGN_UP(MAX_MULTIPAGE_BUFFER_PACKET +
> sizeof(struct vstor_packet) + sizeof(u64),
> sizeof(u64)));
>
> DPRINT_INFO(STORVSC, "max io %u, currently %u\n",
> - storDriver->MaxOutstandingRequestsPerChannel,
> + storDriver->max_outstanding_req_per_channel,
> STORVSC_MAX_IO_REQUESTS);
>
> /* Setup the dispatch table */
> - storDriver->Base.OnDeviceAdd = StorVscOnDeviceAdd;
> - storDriver->Base.OnDeviceRemove = StorVscOnDeviceRemove;
> - storDriver->Base.OnCleanup = StorVscOnCleanup;
> + storDriver->base.OnDeviceAdd = StorVscOnDeviceAdd;
> + storDriver->base.OnDeviceRemove = StorVscOnDeviceRemove;
> + storDriver->base.OnCleanup = StorVscOnCleanup;
>
> - storDriver->OnIORequest = StorVscOnIORequest;
> + storDriver->on_io_request = StorVscOnIORequest;
>
> return 0;
> }
> diff --git a/drivers/staging/hv/storvsc_api.h
> b/drivers/staging/hv/storvsc_api.h
> index 8505a1c..46f031e 100644
> --- a/drivers/staging/hv/storvsc_api.h
> +++ b/drivers/staging/hv/storvsc_api.h
> @@ -53,58 +53,58 @@ enum storvsc_request_type{
> };
>
> struct hv_storvsc_request {
> - enum storvsc_request_type Type;
> - u32 Host;
> - u32 Bus;
> - u32 TargetId;
> - u32 LunId;
> - u8 *Cdb;
> - u32 CdbLen;
> - u32 Status;
> - u32 BytesXfer;
> + enum storvsc_request_type type;
> + u32 host;
> + u32 bus;
> + u32 target_id;
> + u32 lun_id;
> + u8 *cdb;
> + u32 cdb_len;
> + u32 status;
> + u32 bytes_xfer;
>
> - unsigned char *SenseBuffer;
> - u32 SenseBufferSize;
> + unsigned char *sense_buffer;
> + u32 sense_buffer_size;
>
> - void *Context;
> + void *context;
>
> - void (*OnIOCompletion)(struct hv_storvsc_request *Request);
> + void (*on_io_completion)(struct hv_storvsc_request *request);
>
> /* This points to the memory after DataBuffer */
> - void *Extension;
> + void *extension;
>
> - struct hv_multipage_buffer DataBuffer;
> + struct hv_multipage_buffer data_buffer;
> };
>
> /* Represents the block vsc driver */
> struct storvsc_driver_object {
> /* Must be the first field */
> /* Which is a bug FIXME! */
> - struct hv_driver Base;
> + struct hv_driver base;
>
> /* Set by caller (in bytes) */
> - u32 RingBufferSize;
> + u32 ring_buffer_size;
>
> /* Allocate this much private extension for each I/O request */
> - u32 RequestExtSize;
> + u32 request_ext_size;
>
> /* Maximum # of requests in flight per channel/device */
> - u32 MaxOutstandingRequestsPerChannel;
> + u32 max_outstanding_req_per_channel;
>
> /* Specific to this driver */
> - int (*OnIORequest)(struct hv_device *Device,
> - struct hv_storvsc_request *Request);
> + int (*on_io_request)(struct hv_device *device,
> + struct hv_storvsc_request *request);
> };
>
> struct storvsc_device_info {
> - unsigned int PortNumber;
> - unsigned char PathId;
> - unsigned char TargetId;
> + unsigned int port_number;
> + unsigned char path_id;
> + unsigned char target_id;
> };
>
> /* Interface */
> int StorVscInitialize(struct hv_driver *driver);
> -int StorVscOnHostReset(struct hv_device *Device);
> +int StorVscOnHostReset(struct hv_device *device);
> int BlkVscInitialize(struct hv_driver *driver);
>
> #endif /* _STORVSC_API_H_ */
> diff --git a/drivers/staging/hv/storvsc_drv.c
> b/drivers/staging/hv/storvsc_drv.c
> index defc34a..03695ce 100644
> --- a/drivers/staging/hv/storvsc_drv.c
> +++ b/drivers/staging/hv/storvsc_drv.c
> @@ -141,28 +141,28 @@ static int storvsc_drv_init(int (*drv_init)(struct
> hv_driver *drv))
> struct storvsc_driver_object *storvsc_drv_obj = &g_storvsc_drv.drv_obj;
> struct driver_context *drv_ctx = &g_storvsc_drv.drv_ctx;
>
> - storvsc_drv_obj->RingBufferSize = storvsc_ringbuffer_size;
> + storvsc_drv_obj->ring_buffer_size = storvsc_ringbuffer_size;
>
> /* Callback to client driver to complete the initialization */
> - drv_init(&storvsc_drv_obj->Base);
> + drv_init(&storvsc_drv_obj->base);
>
> DPRINT_INFO(STORVSC_DRV,
> "request extension size %u, max outstanding reqs %u",
> - storvsc_drv_obj->RequestExtSize,
> - storvsc_drv_obj->MaxOutstandingRequestsPerChannel);
> + storvsc_drv_obj->request_ext_size,
> + storvsc_drv_obj->max_outstanding_req_per_channel);
>
> - if (storvsc_drv_obj->MaxOutstandingRequestsPerChannel <
> + if (storvsc_drv_obj->max_outstanding_req_per_channel <
> STORVSC_MAX_IO_REQUESTS) {
> DPRINT_ERR(STORVSC_DRV,
> "The number of outstanding io requests (%d) "
> "is larger than that supported (%d) internally.",
> STORVSC_MAX_IO_REQUESTS,
> - storvsc_drv_obj->MaxOutstandingRequestsPerChannel);
> + storvsc_drv_obj->max_outstanding_req_per_channel);
> return -1;
> }
>
> - drv_ctx->driver.name = storvsc_drv_obj->Base.name;
> - memcpy(&drv_ctx->class_id, &storvsc_drv_obj->Base.deviceType,
> + drv_ctx->driver.name = storvsc_drv_obj->base.name;
> + memcpy(&drv_ctx->class_id, &storvsc_drv_obj->base.deviceType,
> sizeof(struct hv_guid));
>
> drv_ctx->probe = storvsc_probe;
> @@ -207,8 +207,8 @@ static void storvsc_drv_exit(void)
> device_unregister(current_dev);
> }
>
> - if (storvsc_drv_obj->Base.OnCleanup)
> - storvsc_drv_obj->Base.OnCleanup(&storvsc_drv_obj->Base);
> + if (storvsc_drv_obj->base.OnCleanup)
> + storvsc_drv_obj->base.OnCleanup(&storvsc_drv_obj->base);
>
> vmbus_child_driver_unregister(drv_ctx);
> return;
> @@ -232,7 +232,7 @@ static int storvsc_probe(struct device *device)
> struct host_device_context *host_device_ctx;
> struct storvsc_device_info device_info;
>
> - if (!storvsc_drv_obj->Base.OnDeviceAdd)
> + if (!storvsc_drv_obj->base.OnDeviceAdd)
> return -1;
>
> host = scsi_host_alloc(&scsi_driver,
> @@ -253,7 +253,7 @@ static int storvsc_probe(struct device *device)
> host_device_ctx->request_pool =
> kmem_cache_create(dev_name(&device_ctx->device),
> sizeof(struct storvsc_cmd_request) +
> - storvsc_drv_obj->RequestExtSize, 0,
> + storvsc_drv_obj->request_ext_size, 0,
> SLAB_HWCACHE_ALIGN, NULL);
>
> if (!host_device_ctx->request_pool) {
> @@ -261,9 +261,9 @@ static int storvsc_probe(struct device *device)
> return -ENOMEM;
> }
>
> - device_info.PortNumber = host->host_no;
> + device_info.port_number = host->host_no;
> /* Call to the vsc driver to add the device */
> - ret = storvsc_drv_obj->Base.OnDeviceAdd(device_obj,
> + ret = storvsc_drv_obj->base.OnDeviceAdd(device_obj,
> (void *)&device_info);
> if (ret != 0) {
> DPRINT_ERR(STORVSC_DRV, "unable to add scsi vsc device");
> @@ -273,8 +273,8 @@ static int storvsc_probe(struct device *device)
> }
>
> /* host_device_ctx->port = device_info.PortNumber; */
> - host_device_ctx->path = device_info.PathId;
> - host_device_ctx->target = device_info.TargetId;
> + host_device_ctx->path = device_info.path_id;
> + host_device_ctx->target = device_info.target_id;
>
> /* max # of devices per target */
> host->max_lun = STORVSC_MAX_LUNS_PER_TARGET;
> @@ -288,7 +288,7 @@ static int storvsc_probe(struct device *device)
> if (ret != 0) {
> DPRINT_ERR(STORVSC_DRV, "unable to add scsi host device");
>
> - storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
> + storvsc_drv_obj->base.OnDeviceRemove(device_obj);
>
> kmem_cache_destroy(host_device_ctx->request_pool);
> scsi_host_put(host);
> @@ -318,14 +318,14 @@ static int storvsc_remove(struct device *device)
> (struct host_device_context *)host->hostdata;
>
>
> - if (!storvsc_drv_obj->Base.OnDeviceRemove)
> + if (!storvsc_drv_obj->base.OnDeviceRemove)
> return -1;
>
> /*
> * Call to the vsc driver to let it know that the device is being
> * removed
> */
> - ret = storvsc_drv_obj->Base.OnDeviceRemove(device_obj);
> + ret = storvsc_drv_obj->base.OnDeviceRemove(device_obj);
> if (ret != 0) {
> /* TODO: */
> DPRINT_ERR(STORVSC, "unable to remove vsc device (ret %d)",
> @@ -351,7 +351,7 @@ static int storvsc_remove(struct device *device)
> static void storvsc_commmand_completion(struct hv_storvsc_request *request)
> {
> struct storvsc_cmd_request *cmd_request =
> - (struct storvsc_cmd_request *)request->Context;
> + (struct storvsc_cmd_request *)request->context;
> struct scsi_cmnd *scmnd = cmd_request->cmd;
> struct host_device_context *host_device_ctx =
> (struct host_device_context *)scmnd->device->host->hostdata;
> @@ -376,16 +376,17 @@ static void storvsc_commmand_completion(struct
> hv_storvsc_request *request)
> cmd_request->bounce_sgl_count);
> }
>
> - scmnd->result = request->Status;
> + scmnd->result = request->status;
>
> if (scmnd->result) {
> if (scsi_normalize_sense(scmnd->sense_buffer,
> - request->SenseBufferSize, &sense_hdr))
> + request->sense_buffer_size, &sense_hdr))
> scsi_print_sense_hdr("storvsc", &sense_hdr);
> }
>
> - /* ASSERT(request->BytesXfer <= request->DataBuffer.Length); */
> - scsi_set_resid(scmnd, request->DataBuffer.Length - request->BytesXfer);
> + /* ASSERT(request->BytesXfer <= request->data_buffer.Length); */
> + scsi_set_resid(scmnd,
> + request->data_buffer.Length - request->bytes_xfer);
>
> scsi_done_fn = scmnd->scsi_done;
>
> @@ -658,42 +659,42 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd
> *scmnd,
>
> request = &cmd_request->request;
>
> - request->Extension =
> + request->extension =
> (void *)((unsigned long)cmd_request + request_size);
> DPRINT_DBG(STORVSC_DRV, "req %p size %d ext %d", request, request_size,
> - storvsc_drv_obj->RequestExtSize);
> + storvsc_drv_obj->request_ext_size);
>
> /* Build the SRB */
> switch (scmnd->sc_data_direction) {
> case DMA_TO_DEVICE:
> - request->Type = WRITE_TYPE;
> + request->type = WRITE_TYPE;
> break;
> case DMA_FROM_DEVICE:
> - request->Type = READ_TYPE;
> + request->type = READ_TYPE;
> break;
> default:
> - request->Type = UNKNOWN_TYPE;
> + request->type = UNKNOWN_TYPE;
> break;
> }
>
> - request->OnIOCompletion = storvsc_commmand_completion;
> - request->Context = cmd_request;/* scmnd; */
> + request->on_io_completion = storvsc_commmand_completion;
> + request->context = cmd_request;/* scmnd; */
>
> /* request->PortId = scmnd->device->channel; */
> - request->Host = host_device_ctx->port;
> - request->Bus = scmnd->device->channel;
> - request->TargetId = scmnd->device->id;
> - request->LunId = scmnd->device->lun;
> + request->host = host_device_ctx->port;
> + request->bus = scmnd->device->channel;
> + request->target_id = scmnd->device->id;
> + request->lun_id = scmnd->device->lun;
>
> /* ASSERT(scmnd->cmd_len <= 16); */
> - request->CdbLen = scmnd->cmd_len;
> - request->Cdb = scmnd->cmnd;
> + request->cdb_len = scmnd->cmd_len;
> + request->cdb = scmnd->cmnd;
>
> - request->SenseBuffer = scmnd->sense_buffer;
> - request->SenseBufferSize = SCSI_SENSE_BUFFERSIZE;
> + request->sense_buffer = scmnd->sense_buffer;
> + request->sense_buffer_size = SCSI_SENSE_BUFFERSIZE;
>
>
> - request->DataBuffer.Length = scsi_bufflen(scmnd);
> + request->data_buffer.Length = scsi_bufflen(scmnd);
> if (scsi_sg_count(scmnd)) {
> sgl = (struct scatterlist *)scsi_sglist(scmnd);
> sg_count = scsi_sg_count(scmnd);
> @@ -734,25 +735,25 @@ static int storvsc_queuecommand_lck(struct scsi_cmnd
> *scmnd,
> sg_count = cmd_request->bounce_sgl_count;
> }
>
> - request->DataBuffer.Offset = sgl[0].offset;
> + request->data_buffer.Offset = sgl[0].offset;
>
> for (i = 0; i < sg_count; i++) {
> DPRINT_DBG(STORVSC_DRV, "sgl[%d] len %d offset %d\n",
> i, sgl[i].length, sgl[i].offset);
> - request->DataBuffer.PfnArray[i] =
> + request->data_buffer.PfnArray[i] =
> page_to_pfn(sg_page((&sgl[i])));
> }
> } else if (scsi_sglist(scmnd)) {
> /* ASSERT(scsi_bufflen(scmnd) <= PAGE_SIZE); */
> - request->DataBuffer.Offset =
> + request->data_buffer.Offset =
> virt_to_phys(scsi_sglist(scmnd)) & (PAGE_SIZE-1);
> - request->DataBuffer.PfnArray[0] =
> + request->data_buffer.PfnArray[0] =
> virt_to_phys(scsi_sglist(scmnd)) >> PAGE_SHIFT;
> }
>
> retry_request:
> /* Invokes the vsc to start an IO */
> - ret = storvsc_drv_obj->OnIORequest(&device_ctx->device_obj,
> + ret = storvsc_drv_obj->on_io_request(&device_ctx->device_obj,
> &cmd_request->request);
> if (ret == -1) {
> /* no more space */

2010-12-07 02:02:20

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 2/8] staging: hv: Convert camel case struct fields in storvsc_api.h to lowercase

On Mon, Dec 06, 2010 at 05:59:30PM -0700, Ky Srinivasan wrote:
> Greg,
>
> My new KVP patches are ready to go. Should I wait for Hank's patches
> to be checked in before I send the KVP patches?

Hank's patches went in a few hours ago :)

thanks,

greg k-h