Haiyang Zhang
2011-Jan-26 17:49 UTC
[PATCH 1/8] staging: hv: Convert camel cased variables in connection.c to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 48 ++++++------
drivers/staging/hv/channel_mgmt.c | 48 ++++++------
drivers/staging/hv/connection.c | 154 ++++++++++++++++++------------------
drivers/staging/hv/vmbus_drv.c | 2 +-
drivers/staging/hv/vmbus_private.h | 2 +-
5 files changed, 128 insertions(+), 126 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 69e7856..99b2d2a 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -77,10 +77,10 @@ static void vmbus_setevent(struct vmbus_channel *channel)
if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
set_bit(channel->offermsg.child_relid & 31,
- (unsigned long *) gVmbusConnection.SendInterruptPage +
+ (unsigned long *) vmbus_connection.SendInterruptPage +
(channel->offermsg.child_relid >> 5));
- monitorpage = gVmbusConnection.MonitorPages;
+ monitorpage = vmbus_connection.MonitorPages;
monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->monitor_bit,
@@ -100,11 +100,11 @@ static void VmbusChannelClearEvent(struct vmbus_channel
*channel)
if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
clear_bit(Channel->offermsg.child_relid & 31,
- (unsigned long *)gVmbusConnection.SendInterruptPage +
+ (unsigned long *)vmbus_connection.SendInterruptPage +
(Channel->offermsg.child_relid >> 5));
monitorPage - (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
+ (struct hv_monitor_page *)vmbus_connection.MonitorPages;
monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->monitor_bit,
@@ -133,7 +133,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
&channel->offermsg.offer.InterfaceInstance,
sizeof(struct hv_guid));
- monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
+ monitorpage = (struct hv_monitor_page *)vmbus_connection.MonitorPages;
debuginfo->monitorid = channel->offermsg.monitorid;
@@ -265,10 +265,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
if (userdatalen)
memcpy(openMsg->userdata, userdata, userdatalen);
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&openInfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ &vmbus_connection.ChannelMsgList);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg...");
@@ -289,9 +289,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
newchannel, openInfo->response.open_result.status);
Cleanup:
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&openInfo->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(openInfo->waitevent);
kfree(openInfo);
@@ -501,8 +501,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
unsigned long flags;
int ret = 0;
- next_gpadl_handle = atomic_read(&gVmbusConnection.NextGpadlHandle);
- atomic_inc(&gVmbusConnection.NextGpadlHandle);
+ next_gpadl_handle = atomic_read(&vmbus_connection.NextGpadlHandle);
+ atomic_inc(&vmbus_connection.NextGpadlHandle);
ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
@@ -521,11 +521,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
dump_gpadl_header(gpadlmsg);
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msginfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
+ &vmbus_connection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
kbuffer, size, msgcount);
@@ -577,9 +577,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
*gpadl_handle = gpadlmsg->gpadl;
Cleanup:
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&msginfo->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(msginfo->waitevent);
kfree(msginfo);
@@ -616,10 +616,10 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel,
u32 gpadl_handle)
msg->child_relid = channel->offermsg.child_relid;
msg->gpadl = gpadl_handle;
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&info->msglistentry,
- &gVmbusConnection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ &vmbus_connection.ChannelMsgList);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
@@ -631,9 +631,9 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32
gpadl_handle)
osd_waitevent_wait(info->waitevent);
/* Received a torndown response */
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&info->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(info->waitevent);
kfree(info);
@@ -697,9 +697,9 @@ void vmbus_close(struct vmbus_channel *channel)
*/
if (channel->state == CHANNEL_OPEN_STATE) {
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&channel->listentry);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(channel);
}
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index fb71f88..351ebeb 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -308,7 +308,7 @@ void free_channel(struct vmbus_channel *channel)
* ie we can't destroy ourselves.
*/
INIT_WORK(&channel->work, release_channel);
- queue_work(gVmbusConnection.WorkQueue, &channel->work);
+ queue_work(vmbus_connection.WorkQueue, &channel->work);
}
@@ -323,10 +323,10 @@ static void count_hv_channel(void)
static int counter;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
if (++counter == MAX_MSG_TYPES)
complete(&hv_channel_ready);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
}
/*
@@ -361,9 +361,9 @@ static void vmbus_process_offer(struct work_struct *work)
INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
/* Make sure this is a new offer */
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
+ list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
if (!memcmp(&channel->offermsg.offer.InterfaceType,
&newchannel->offermsg.offer.InterfaceType,
sizeof(struct hv_guid)) &&
@@ -377,9 +377,9 @@ static void vmbus_process_offer(struct work_struct *work)
if (fnew)
list_add_tail(&newchannel->listentry,
- &gVmbusConnection.ChannelList);
+ &vmbus_connection.ChannelList);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
if (!fnew) {
DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)",
@@ -412,9 +412,9 @@ static void vmbus_process_offer(struct work_struct *work)
"unable to add child device object (relid %d)",
newchannel->offermsg.child_relid);
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&newchannel->listentry);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(newchannel);
} else {
@@ -577,9 +577,9 @@ static void vmbus_onopen_result(struct
vmbus_channel_message_header *hdr)
/*
* Find the open msg, copy the result and signal/unblock the wait event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -598,7 +598,7 @@ static void vmbus_onopen_result(struct
vmbus_channel_message_header *hdr)
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -625,9 +625,9 @@ static void vmbus_ongpadl_created(struct
vmbus_channel_message_header *hdr)
* Find the establish msg, copy the result and signal/unblock the wait
* event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -648,7 +648,7 @@ static void vmbus_ongpadl_created(struct
vmbus_channel_message_header *hdr)
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -673,9 +673,9 @@ static void vmbus_ongpadl_torndown(
/*
* Find the open msg, copy the result and signal/unblock the wait event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -694,7 +694,7 @@ static void vmbus_ongpadl_torndown(
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -715,9 +715,9 @@ static void vmbus_onversion_response(
unsigned long flags;
version_response = (struct vmbus_channel_version_response *)hdr;
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -733,7 +733,7 @@ static void vmbus_onversion_response(
osd_waitevent_set(msginfo->waitevent);
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/* Channel message dispatch table */
@@ -857,9 +857,9 @@ void vmbus_release_unattached_channels(void)
struct vmbus_channel *start = NULL;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList,
+ list_for_each_entry_safe(channel, pos, &vmbus_connection.ChannelList,
listentry) {
if (channel == start)
break;
@@ -878,7 +878,7 @@ void vmbus_release_unattached_channels(void)
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
}
/* eof */
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index c2e298f..a30b98d 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -29,7 +29,7 @@
#include "vmbus_private.h"
-struct VMBUS_CONNECTION gVmbusConnection = {
+struct VMBUS_CONNECTION vmbus_connection = {
.ConnectState = Disconnected,
.NextGpadlHandle = ATOMIC_INIT(0xE1E10),
};
@@ -40,86 +40,86 @@ struct VMBUS_CONNECTION gVmbusConnection = {
int VmbusConnect(void)
{
int ret = 0;
- struct vmbus_channel_msginfo *msgInfo = NULL;
+ struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
/* Make sure we are not connecting or connected */
- if (gVmbusConnection.ConnectState != Disconnected)
+ if (vmbus_connection.ConnectState != Disconnected)
return -1;
/* Initialize the vmbus connection */
- gVmbusConnection.ConnectState = Connecting;
- gVmbusConnection.WorkQueue = create_workqueue("hv_vmbus_con");
- if (!gVmbusConnection.WorkQueue) {
+ vmbus_connection.ConnectState = Connecting;
+ vmbus_connection.WorkQueue = create_workqueue("hv_vmbus_con");
+ if (!vmbus_connection.WorkQueue) {
ret = -1;
goto Cleanup;
}
- INIT_LIST_HEAD(&gVmbusConnection.ChannelMsgList);
- spin_lock_init(&gVmbusConnection.channelmsg_lock);
+ INIT_LIST_HEAD(&vmbus_connection.ChannelMsgList);
+ spin_lock_init(&vmbus_connection.channelmsg_lock);
- INIT_LIST_HEAD(&gVmbusConnection.ChannelList);
- spin_lock_init(&gVmbusConnection.channel_lock);
+ INIT_LIST_HEAD(&vmbus_connection.ChannelList);
+ spin_lock_init(&vmbus_connection.channel_lock);
/*
* Setup the vmbus event connection for channel interrupt
* abstraction stuff
*/
- gVmbusConnection.InterruptPage = osd_page_alloc(1);
- if (gVmbusConnection.InterruptPage == NULL) {
+ vmbus_connection.InterruptPage = osd_page_alloc(1);
+ if (vmbus_connection.InterruptPage == NULL) {
ret = -1;
goto Cleanup;
}
- gVmbusConnection.RecvInterruptPage = gVmbusConnection.InterruptPage;
- gVmbusConnection.SendInterruptPage - (void *)((unsigned
long)gVmbusConnection.InterruptPage +
+ vmbus_connection.RecvInterruptPage = vmbus_connection.InterruptPage;
+ vmbus_connection.SendInterruptPage + (void *)((unsigned
long)vmbus_connection.InterruptPage +
(PAGE_SIZE >> 1));
/*
* Setup the monitor notification facility. The 1st page for
* parent->child and the 2nd page for child->parent
*/
- gVmbusConnection.MonitorPages = osd_page_alloc(2);
- if (gVmbusConnection.MonitorPages == NULL) {
+ vmbus_connection.MonitorPages = osd_page_alloc(2);
+ if (vmbus_connection.MonitorPages == NULL) {
ret = -1;
goto Cleanup;
}
- msgInfo = kzalloc(sizeof(*msgInfo) +
+ msginfo = kzalloc(sizeof(*msginfo) +
sizeof(struct vmbus_channel_initiate_contact),
GFP_KERNEL);
- if (msgInfo == NULL) {
+ if (msginfo == NULL) {
ret = -ENOMEM;
goto Cleanup;
}
- msgInfo->waitevent = osd_waitevent_create();
- if (!msgInfo->waitevent) {
+ msginfo->waitevent = osd_waitevent_create();
+ if (!msginfo->waitevent) {
ret = -ENOMEM;
goto Cleanup;
}
- msg = (struct vmbus_channel_initiate_contact *)msgInfo->msg;
+ msg = (struct vmbus_channel_initiate_contact *)msginfo->msg;
msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
- msg->interrupt_page = virt_to_phys(gVmbusConnection.InterruptPage);
- msg->monitor_page1 = virt_to_phys(gVmbusConnection.MonitorPages);
+ msg->interrupt_page = virt_to_phys(vmbus_connection.InterruptPage);
+ msg->monitor_page1 = virt_to_phys(vmbus_connection.MonitorPages);
msg->monitor_page2 = virt_to_phys(
- (void *)((unsigned long)gVmbusConnection.MonitorPages +
+ (void *)((unsigned long)vmbus_connection.MonitorPages +
PAGE_SIZE));
/*
* Add to list before we send the request since we may
* receive the response before returning from this routine
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- list_add_tail(&msgInfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
+ list_add_tail(&msginfo->msglistentry,
+ &vmbus_connection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
"monitor1 pfn %llx,, monitor2 pfn %llx",
@@ -129,19 +129,19 @@ int VmbusConnect(void)
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) {
- list_del(&msgInfo->msglistentry);
+ list_del(&msginfo->msglistentry);
goto Cleanup;
}
/* Wait for the connection response */
- osd_waitevent_wait(msgInfo->waitevent);
+ osd_waitevent_wait(msginfo->waitevent);
- list_del(&msgInfo->msglistentry);
+ list_del(&msginfo->msglistentry);
/* Check if successful */
- if (msgInfo->response.version_response.version_supported) {
+ if (msginfo->response.version_response.version_supported) {
DPRINT_INFO(VMBUS, "Vmbus connected!!");
- gVmbusConnection.ConnectState = Connected;
+ vmbus_connection.ConnectState = Connected;
} else {
DPRINT_ERR(VMBUS, "Vmbus connection failed!!..."
@@ -151,29 +151,29 @@ int VmbusConnect(void)
goto Cleanup;
}
- kfree(msgInfo->waitevent);
- kfree(msgInfo);
+ kfree(msginfo->waitevent);
+ kfree(msginfo);
return 0;
Cleanup:
- gVmbusConnection.ConnectState = Disconnected;
+ vmbus_connection.ConnectState = Disconnected;
- if (gVmbusConnection.WorkQueue)
- destroy_workqueue(gVmbusConnection.WorkQueue);
+ if (vmbus_connection.WorkQueue)
+ destroy_workqueue(vmbus_connection.WorkQueue);
- if (gVmbusConnection.InterruptPage) {
- osd_page_free(gVmbusConnection.InterruptPage, 1);
- gVmbusConnection.InterruptPage = NULL;
+ if (vmbus_connection.InterruptPage) {
+ osd_page_free(vmbus_connection.InterruptPage, 1);
+ vmbus_connection.InterruptPage = NULL;
}
- if (gVmbusConnection.MonitorPages) {
- osd_page_free(gVmbusConnection.MonitorPages, 2);
- gVmbusConnection.MonitorPages = NULL;
+ if (vmbus_connection.MonitorPages) {
+ osd_page_free(vmbus_connection.MonitorPages, 2);
+ vmbus_connection.MonitorPages = NULL;
}
- if (msgInfo) {
- kfree(msgInfo->waitevent);
- kfree(msgInfo);
+ if (msginfo) {
+ kfree(msginfo->waitevent);
+ kfree(msginfo);
}
return ret;
@@ -188,7 +188,7 @@ int VmbusDisconnect(void)
struct vmbus_channel_message_header *msg;
/* Make sure we are connected */
- if (gVmbusConnection.ConnectState != Connected)
+ if (vmbus_connection.ConnectState != Connected)
return -1;
msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
@@ -202,12 +202,12 @@ int VmbusDisconnect(void)
if (ret != 0)
goto Cleanup;
- osd_page_free(gVmbusConnection.InterruptPage, 1);
+ osd_page_free(vmbus_connection.InterruptPage, 1);
/* TODO: iterate thru the msg list and free up */
- destroy_workqueue(gVmbusConnection.WorkQueue);
+ destroy_workqueue(vmbus_connection.WorkQueue);
- gVmbusConnection.ConnectState = Disconnected;
+ vmbus_connection.ConnectState = Disconnected;
DPRINT_INFO(VMBUS, "Vmbus disconnected!!");
@@ -219,22 +219,22 @@ Cleanup:
/*
* GetChannelFromRelId - Get the channel object given its child relative id (ie
channel id)
*/
-struct vmbus_channel *GetChannelFromRelId(u32 relId)
+struct vmbus_channel *GetChannelFromRelId(u32 relid)
{
struct vmbus_channel *channel;
- struct vmbus_channel *foundChannel = NULL;
+ struct vmbus_channel *found_channel = NULL;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
- if (channel->offermsg.child_relid == relId) {
- foundChannel = channel;
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
+ if (channel->offermsg.child_relid == relid) {
+ found_channel = channel;
break;
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
- return foundChannel;
+ return found_channel;
}
/*
@@ -243,7 +243,7 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
static void VmbusProcessChannelEvent(void *context)
{
struct vmbus_channel *channel;
- u32 relId = (u32)(unsigned long)context;
+ u32 relid = (u32)(unsigned long)context;
/* ASSERT(relId > 0); */
@@ -251,7 +251,7 @@ static void VmbusProcessChannelEvent(void *context)
* Find the channel based on this relid and invokes the
* channel callback to process the event
*/
- channel = GetChannelFromRelId(relId);
+ channel = GetChannelFromRelId(relid);
if (channel) {
vmbus_onchannel_event(channel);
@@ -261,7 +261,7 @@ static void VmbusProcessChannelEvent(void *context)
* (void*)channel);
*/
} else {
- DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relId);
+ DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relid);
}
}
@@ -274,14 +274,16 @@ void VmbusOnEvents(void)
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
int bit;
int relid;
- u32 *recvInterruptPage = gVmbusConnection.RecvInterruptPage;
+ u32 *recv_int_page = vmbus_connection.RecvInterruptPage;
/* Check events */
- if (recvInterruptPage) {
+ if (recv_int_page) {
for (dword = 0; dword < maxdword; dword++) {
- if (recvInterruptPage[dword]) {
+ if (recv_int_page[dword]) {
for (bit = 0; bit < 32; bit++) {
- if (test_and_clear_bit(bit, (unsigned long
*)&recvInterruptPage[dword])) {
+ if (test_and_clear_bit(bit,
+ (unsigned long *)
+ &recv_int_page[dword])) {
relid = (dword << 5) + bit;
DPRINT_DBG(VMBUS, "event detected for relid - %d", relid);
@@ -305,24 +307,24 @@ void VmbusOnEvents(void)
/*
* VmbusPostMessage - Send a msg on the vmbus's message connection
*/
-int VmbusPostMessage(void *buffer, size_t bufferLen)
+int VmbusPostMessage(void *buffer, size_t buflen)
{
- union hv_connection_id connId;
+ union hv_connection_id conn_id;
- connId.asu32 = 0;
- connId.u.id = VMBUS_MESSAGE_CONNECTION_ID;
- return hv_post_message(connId, 1, buffer, bufferLen);
+ conn_id.asu32 = 0;
+ conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
+ return hv_post_message(conn_id, 1, buffer, buflen);
}
/*
* VmbusSetEvent - Send an event notification to the parent
*/
-int VmbusSetEvent(u32 childRelId)
+int VmbusSetEvent(u32 child_relid)
{
/* Each u32 represents 32 channels */
- set_bit(childRelId & 31,
- (unsigned long *)gVmbusConnection.SendInterruptPage +
- (childRelId >> 5));
+ set_bit(child_relid & 31,
+ (unsigned long *)vmbus_connection.SendInterruptPage +
+ (child_relid >> 5));
return hv_signal_event();
}
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 84fdb64..fd0881a 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -239,7 +239,7 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
continue;
INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg));
- queue_work(gVmbusConnection.WorkQueue, &ctx->work);
+ queue_work(vmbus_connection.WorkQueue, &ctx->work);
}
msg->header.message_type = HVMSG_NONE;
diff --git a/drivers/staging/hv/vmbus_private.h
b/drivers/staging/hv/vmbus_private.h
index 07f6d22..9b51ac1 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -98,7 +98,7 @@ struct VMBUS_MSGINFO {
};
-extern struct VMBUS_CONNECTION gVmbusConnection;
+extern struct VMBUS_CONNECTION vmbus_connection;
/* General vmbus interface */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 17:50 UTC
[PATCH 2/8] staging: hv: Convert camel cased functions in connection.c to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 12 +++++-----
drivers/staging/hv/channel_mgmt.c | 4 +-
drivers/staging/hv/connection.c | 39 +++++++++++++++++++----------------
drivers/staging/hv/vmbus_drv.c | 6 ++--
drivers/staging/hv/vmbus_private.h | 12 +++++-----
5 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 99b2d2a..ca76098 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -88,7 +88,7 @@ static void vmbus_setevent(struct vmbus_channel *channel)
[channel->monitor_grp].pending);
} else {
- VmbusSetEvent(channel->offermsg.child_relid);
+ vmbus_set_event(channel->offermsg.child_relid);
}
}
@@ -272,7 +272,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
DPRINT_DBG(VMBUS, "Sending channel open msg...");
- ret = VmbusPostMessage(openMsg,
+ ret = vmbus_post_msg(openMsg,
sizeof(struct vmbus_channel_open_channel));
if (ret != 0) {
DPRINT_ERR(VMBUS, "unable to open channel - %d", ret);
@@ -532,7 +532,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd",
msginfo->msgsize - sizeof(*msginfo));
- ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize -
+ ret = vmbus_post_msg(gpadlmsg, msginfo->msgsize -
sizeof(*msginfo));
if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret);
@@ -557,7 +557,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
dump_gpadl_body(gpadl_body, submsginfo->msgsize -
sizeof(*submsginfo));
- ret = VmbusPostMessage(gpadl_body,
+ ret = vmbus_post_msg(gpadl_body,
submsginfo->msgsize -
sizeof(*submsginfo));
if (ret != 0)
@@ -621,7 +621,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32
gpadl_handle)
&vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
if (ret != 0) {
/* TODO: */
@@ -669,7 +669,7 @@ void vmbus_close(struct vmbus_channel *channel)
msg->header.msgtype = CHANNELMSG_CLOSECHANNEL;
msg->child_relid = channel->offermsg.child_relid;
- ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
+ ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel));
if (ret != 0) {
/* TODO: */
/* something... */
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index 351ebeb..0ce8f54 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -532,7 +532,7 @@ static void vmbus_onoffer_rescind(struct
vmbus_channel_message_header *hdr)
struct vmbus_channel *channel;
rescind = (struct vmbus_channel_rescind_offer *)hdr;
- channel = GetChannelFromRelId(rescind->child_relid);
+ channel = relid2channel(rescind->child_relid);
if (channel == NULL) {
DPRINT_DBG(VMBUS, "channel not found for relId %d",
rescind->child_relid);
@@ -820,7 +820,7 @@ int vmbus_request_offers(void)
&msgInfo->msgListEntry);
SpinlockRelease(gVmbusConnection.channelMsgLock);*/
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to request offers - %d", ret);
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index a30b98d..002e86c 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -35,9 +35,9 @@ struct VMBUS_CONNECTION vmbus_connection = {
};
/*
- * VmbusConnect - Sends a connect request on the partition service connection
+ * vmbus_connect - Sends a connect request on the partition service connection
*/
-int VmbusConnect(void)
+int vmbus_connect(void)
{
int ret = 0;
struct vmbus_channel_msginfo *msginfo = NULL;
@@ -126,7 +126,7 @@ int VmbusConnect(void)
msg->interrupt_page, msg->monitor_page1, msg->monitor_page2);
DPRINT_DBG(VMBUS, "Sending channel initiate msg...");
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) {
list_del(&msginfo->msglistentry);
@@ -180,9 +180,10 @@ Cleanup:
}
/*
- * VmbusDisconnect - Sends a disconnect request on the partition service
connection
+ * vmbus_disconnect -
+ * Sends a disconnect request on the partition service connection
*/
-int VmbusDisconnect(void)
+int vmbus_disconnect(void)
{
int ret = 0;
struct vmbus_channel_message_header *msg;
@@ -197,7 +198,7 @@ int VmbusDisconnect(void)
msg->msgtype = CHANNELMSG_UNLOAD;
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0)
goto Cleanup;
@@ -217,9 +218,10 @@ Cleanup:
}
/*
- * GetChannelFromRelId - Get the channel object given its child relative id (ie
channel id)
+ * relid2channel - Get the channel object given its
+ * child relative id (ie channel id)
*/
-struct vmbus_channel *GetChannelFromRelId(u32 relid)
+struct vmbus_channel *relid2channel(u32 relid)
{
struct vmbus_channel *channel;
struct vmbus_channel *found_channel = NULL;
@@ -238,9 +240,9 @@ struct vmbus_channel *GetChannelFromRelId(u32 relid)
}
/*
- * VmbusProcessChannelEvent - Process a channel event notification
+ * process_chn_event - Process a channel event notification
*/
-static void VmbusProcessChannelEvent(void *context)
+static void process_chn_event(void *context)
{
struct vmbus_channel *channel;
u32 relid = (u32)(unsigned long)context;
@@ -251,7 +253,7 @@ static void VmbusProcessChannelEvent(void *context)
* Find the channel based on this relid and invokes the
* channel callback to process the event
*/
- channel = GetChannelFromRelId(relid);
+ channel = relid2channel(relid);
if (channel) {
vmbus_onchannel_event(channel);
@@ -266,9 +268,9 @@ static void VmbusProcessChannelEvent(void *context)
}
/*
- * VmbusOnEvents - Handler for events
+ * vmbus_on_event - Handler for events
*/
-void VmbusOnEvents(void)
+void vmbus_on_event(void)
{
int dword;
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
@@ -294,7 +296,8 @@ void VmbusOnEvents(void)
} else {
/* QueueWorkItem(VmbusProcessEvent, (void*)relid); */
/* ret = WorkQueueQueueWorkItem(gVmbusConnection.workQueue,
VmbusProcessChannelEvent, (void*)relid); */
- VmbusProcessChannelEvent((void *)(unsigned long)relid);
+ process_chn_event((void *)
+ (unsigned long)relid);
}
}
}
@@ -305,9 +308,9 @@ void VmbusOnEvents(void)
}
/*
- * VmbusPostMessage - Send a msg on the vmbus's message connection
+ * vmbus_post_msg - Send a msg on the vmbus's message connection
*/
-int VmbusPostMessage(void *buffer, size_t buflen)
+int vmbus_post_msg(void *buffer, size_t buflen)
{
union hv_connection_id conn_id;
@@ -317,9 +320,9 @@ int VmbusPostMessage(void *buffer, size_t buflen)
}
/*
- * VmbusSetEvent - Send an event notification to the parent
+ * vmbus_set_event - Send an event notification to the parent
*/
-int VmbusSetEvent(u32 child_relid)
+int vmbus_set_event(u32 child_relid)
{
/* Each u32 represents 32 channels */
set_bit(child_relid & 31,
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index fd0881a..b33f497 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -174,7 +174,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void
*AdditionalInfo)
on_each_cpu(hv_synic_init, (void *)irqvector, 1);
/* Connect to VMBus in the root partition */
- ret = VmbusConnect();
+ ret = vmbus_connect();
/* VmbusSendEvent(device->localPortId+1); */
return ret;
@@ -188,7 +188,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
int ret = 0;
vmbus_release_unattached_channels();
- VmbusDisconnect();
+ vmbus_disconnect();
on_each_cpu(hv_synic_cleanup, NULL, 1);
return ret;
}
@@ -1045,7 +1045,7 @@ static void vmbus_msg_dpc(unsigned long data)
static void vmbus_event_dpc(unsigned long data)
{
/* Call to bus driver to handle interrupt */
- VmbusOnEvents();
+ vmbus_on_event();
}
static irqreturn_t vmbus_isr(int irq, void *dev_id)
diff --git a/drivers/staging/hv/vmbus_private.h
b/drivers/staging/hv/vmbus_private.h
index 9b51ac1..e3b0663 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -115,20 +115,20 @@ void vmbus_child_device_unregister(struct hv_device
*device_obj);
/* VmbusChildDeviceDestroy( */
/* struct hv_device *); */
-struct vmbus_channel *GetChannelFromRelId(u32 relId);
+struct vmbus_channel *relid2channel(u32 relid);
/* Connection interface */
-int VmbusConnect(void);
+int vmbus_connect(void);
-int VmbusDisconnect(void);
+int vmbus_disconnect(void);
-int VmbusPostMessage(void *buffer, size_t bufSize);
+int vmbus_post_msg(void *buffer, size_t buflen);
-int VmbusSetEvent(u32 childRelId);
+int vmbus_set_event(u32 child_relid);
-void VmbusOnEvents(void);
+void vmbus_on_event(void);
#endif /* _VMBUS_PRIVATE_H_ */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 17:50 UTC
[PATCH 3/8] staging: hv: Convert camel cased variables in vmbus_drv.c to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/vmbus_drv.c | 50 ++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index b33f497..99686f0 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -113,7 +113,7 @@ static struct device_attribute vmbus_device_attrs[] = {
};
/* The one and only one */
-static struct vmbus_driver_context g_vmbus_drv = {
+static struct vmbus_driver_context vmbus_drv = {
.bus.name = "vmbus",
.bus.match = vmbus_match,
.bus.shutdown = vmbus_shutdown,
@@ -123,14 +123,14 @@ static struct vmbus_driver_context g_vmbus_drv = {
.bus.dev_attrs = vmbus_device_attrs,
};
-static const char *gDriverName = "hyperv";
+static const char *driver_name = "hyperv";
/*
* Windows vmbus does not defined this.
* We defined this to be consistent with other devices
*/
/* {c5295816-f63a-4d5f-8d1a-4daf999ca185} */
-static const struct hv_guid gVmbusDeviceType = {
+static const struct hv_guid device_type = {
.data = {
0x16, 0x58, 0x29, 0xc5, 0x3a, 0xf6, 0x5f, 0x4d,
0x8d, 0x1a, 0x4d, 0xaf, 0x99, 0x9c, 0xa1, 0x85
@@ -138,35 +138,35 @@ static const struct hv_guid gVmbusDeviceType = {
};
/* {ac3760fc-9adf-40aa-9427-a70ed6de95c5} */
-static const struct hv_guid gVmbusDeviceId = {
+static const struct hv_guid device_id = {
.data = {
0xfc, 0x60, 0x37, 0xac, 0xdf, 0x9a, 0xaa, 0x40,
0x94, 0x27, 0xa7, 0x0e, 0xd6, 0xde, 0x95, 0xc5
}
};
-static struct hv_device *gDevice; /* vmbus root device */
+static struct hv_device *vmbus_device; /* vmbus root device */
/*
* VmbusChildDeviceAdd - Registers the child device with the vmbus
*/
-int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
+int VmbusChildDeviceAdd(struct hv_device *child_dev)
{
- return vmbus_child_device_register(gDevice, ChildDevice);
+ return vmbus_child_device_register(vmbus_device, child_dev);
}
/*
* VmbusOnDeviceAdd - Callback when the root bus device is added
*/
-static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo)
+static int VmbusOnDeviceAdd(struct hv_device *dev, void *info)
{
- u32 *irqvector = AdditionalInfo;
+ u32 *irqvector = info;
int ret;
- gDevice = dev;
+ vmbus_device = dev;
- memcpy(&gDevice->deviceType, &gVmbusDeviceType, sizeof(struct
hv_guid));
- memcpy(&gDevice->deviceInstance, &gVmbusDeviceId,
+ memcpy(&vmbus_device->deviceType, &device_type, sizeof(struct
hv_guid));
+ memcpy(&vmbus_device->deviceInstance, &device_id,
sizeof(struct hv_guid));
/* strcpy(dev->name, "vmbus"); */
@@ -461,9 +461,9 @@ static ssize_t vmbus_show_device_attr(struct device *dev,
*/
static int vmbus_bus_init(void)
{
- struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
- struct hv_driver *driver = &g_vmbus_drv.drv_obj;
- struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
+ struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
+ struct hv_driver *driver = &vmbus_drv.drv_obj;
+ struct vm_device *dev_ctx = &vmbus_drv.device_ctx;
int ret;
unsigned int vector;
@@ -478,8 +478,8 @@ static int vmbus_bus_init(void)
sizeof(struct vmbus_channel_packet_page_buffer),
sizeof(struct vmbus_channel_packet_multipage_buffer));
- driver->name = gDriverName;
- memcpy(&driver->deviceType, &gVmbusDeviceType, sizeof(struct
hv_guid));
+ driver->name = driver_name;
+ memcpy(&driver->deviceType, &device_type, sizeof(struct hv_guid));
/* Setup dispatch table */
driver->OnDeviceAdd = VmbusOnDeviceAdd;
@@ -590,10 +590,10 @@ cleanup:
*/
static void vmbus_bus_exit(void)
{
- struct hv_driver *driver = &g_vmbus_drv.drv_obj;
- struct vmbus_driver_context *vmbus_drv_ctx = &g_vmbus_drv;
+ struct hv_driver *driver = &vmbus_drv.drv_obj;
+ struct vmbus_driver_context *vmbus_drv_ctx = &vmbus_drv;
- struct vm_device *dev_ctx = &g_vmbus_drv.device_ctx;
+ struct vm_device *dev_ctx = &vmbus_drv.device_ctx;
/* Remove the root device */
if (driver->OnDeviceRemove)
@@ -634,7 +634,7 @@ int vmbus_child_driver_register(struct driver_context
*driver_ctx)
driver_ctx, driver_ctx->driver.name);
/* The child driver on this vmbus */
- driver_ctx->driver.bus = &g_vmbus_drv.bus;
+ driver_ctx->driver.bus = &vmbus_drv.bus;
ret = driver_register(&driver_ctx->driver);
@@ -737,7 +737,7 @@ int vmbus_child_device_register(struct hv_device
*root_device_obj,
atomic_inc_return(&device_num));
/* The new device belongs to this bus */
- child_device_ctx->device.bus = &g_vmbus_drv.bus; /* device->dev.bus;
*/
+ child_device_ctx->device.bus = &vmbus_drv.bus; /* device->dev.bus;
*/
child_device_ctx->device.parent = &root_device_ctx->device;
child_device_ctx->device.release = vmbus_device_release;
@@ -1050,7 +1050,7 @@ static void vmbus_event_dpc(unsigned long data)
static irqreturn_t vmbus_isr(int irq, void *dev_id)
{
- struct hv_driver *driver = &g_vmbus_drv.drv_obj;
+ struct hv_driver *driver = &vmbus_drv.drv_obj;
int ret;
/* Call to bus driver to handle interrupt */
@@ -1059,10 +1059,10 @@ static irqreturn_t vmbus_isr(int irq, void *dev_id)
/* Schedules a dpc if necessary */
if (ret > 0) {
if (test_bit(0, (unsigned long *)&ret))
- tasklet_schedule(&g_vmbus_drv.msg_dpc);
+ tasklet_schedule(&vmbus_drv.msg_dpc);
if (test_bit(1, (unsigned long *)&ret))
- tasklet_schedule(&g_vmbus_drv.event_dpc);
+ tasklet_schedule(&vmbus_drv.event_dpc);
return IRQ_HANDLED;
} else {
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 17:50 UTC
[PATCH 6/8] staging: hv: Convert camel cased struct fields in vmbus_channel_interface.h to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/channel_mgmt.c | 20 ++++++++++----------
drivers/staging/hv/vmbus_channel_interface.h | 26 +++++++++++++-------------
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 960e155..711548f 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -128,9 +128,9 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
debuginfo->relid = channel->offermsg.child_relid;
debuginfo->state = channel->state;
memcpy(&debuginfo->interfacetype,
- &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid));
+ &channel->offermsg.offer.if_type, sizeof(struct hv_guid));
memcpy(&debuginfo->interface_instance,
- &channel->offermsg.offer.InterfaceInstance,
+ &channel->offermsg.offer.if_instance,
sizeof(struct hv_guid));
monitorpage = (struct hv_monitor_page *)vmbus_connection.MonitorPages;
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index b4a8561..3e229fa 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -364,11 +364,11 @@ static void vmbus_process_offer(struct work_struct *work)
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
- if (!memcmp(&channel->offermsg.offer.InterfaceType,
- &newchannel->offermsg.offer.InterfaceType,
+ if (!memcmp(&channel->offermsg.offer.if_type,
+ &newchannel->offermsg.offer.if_type,
sizeof(struct hv_guid)) &&
- !memcmp(&channel->offermsg.offer.InterfaceInstance,
- &newchannel->offermsg.offer.InterfaceInstance,
+ !memcmp(&channel->offermsg.offer.if_instance,
+ &newchannel->offermsg.offer.if_instance,
sizeof(struct hv_guid))) {
fnew = false;
break;
@@ -394,8 +394,8 @@ static void vmbus_process_offer(struct work_struct *work)
* vmbus_child_dev_add()
*/
newchannel->device_obj = vmbus_child_device_create(
- &newchannel->offermsg.offer.InterfaceType,
- &newchannel->offermsg.offer.InterfaceInstance,
+ &newchannel->offermsg.offer.if_type,
+ &newchannel->offermsg.offer.if_instance,
newchannel);
DPRINT_DBG(VMBUS, "child device object allocated - %p",
@@ -427,7 +427,7 @@ static void vmbus_process_offer(struct work_struct *work)
/* Open IC channels */
for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) {
- if (memcmp(&newchannel->offermsg.offer.InterfaceType,
+ if (memcmp(&newchannel->offermsg.offer.if_type,
&hv_cb_utils[cnt].data,
sizeof(struct hv_guid)) == 0 &&
vmbus_open(newchannel, 2 * PAGE_SIZE,
@@ -461,7 +461,7 @@ static void vmbus_onoffer(struct
vmbus_channel_message_header *hdr)
offer = (struct vmbus_channel_offer_channel *)hdr;
for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) {
- if (memcmp(&offer->offer.InterfaceType,
+ if (memcmp(&offer->offer.if_type,
&gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) {
fsupported = 1;
break;
@@ -474,8 +474,8 @@ static void vmbus_onoffer(struct
vmbus_channel_message_header *hdr)
return;
}
- guidtype = &offer->offer.InterfaceType;
- guidinstance = &offer->offer.InterfaceInstance;
+ guidtype = &offer->offer.if_type;
+ guidinstance = &offer->offer.if_instance;
DPRINT_INFO(VMBUS, "Channel offer notification - "
"child relid %d monitor id %d allocated %d, "
diff --git a/drivers/staging/hv/vmbus_channel_interface.h
b/drivers/staging/hv/vmbus_channel_interface.h
index 2674282..fbfad5e 100644
--- a/drivers/staging/hv/vmbus_channel_interface.h
+++ b/drivers/staging/hv/vmbus_channel_interface.h
@@ -48,19 +48,19 @@
* struct contains the fundamental information about an offer.
*/
struct vmbus_channel_offer {
- struct hv_guid InterfaceType;
- struct hv_guid InterfaceInstance;
- u64 InterruptLatencyIn100nsUnits;
- u32 InterfaceRevision;
- u32 ServerContextAreaSize; /* in bytes */
- u16 ChannelFlags;
- u16 MmioMegabytes; /* in bytes * 1024 * 1024 */
+ struct hv_guid if_type;
+ struct hv_guid if_instance;
+ u64 int_latency; /* in 100ns units */
+ u32 if_revision;
+ u32 server_ctx_size; /* in bytes */
+ u16 chn_flags;
+ u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
union {
/* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
struct {
- unsigned char UserDefined[MAX_USER_DEFINED_BYTES];
- } Standard;
+ unsigned char user_def[MAX_USER_DEFINED_BYTES];
+ } std;
/*
* Pipes:
@@ -70,11 +70,11 @@ struct vmbus_channel_offer {
* use.
*/
struct {
- u32 PipeMode;
- unsigned char UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
- } Pipe;
+ u32 pipe_mode;
+ unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
+ } pipe;
} u;
- u32 Padding;
+ u32 padding;
} __attribute__((packed));
/* Server Flags */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 17:50 UTC
[PATCH 7/8] staging: hv: Convert camel cased struct fields in vmbus_packet_format.h to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/channel.c | 56 +++++++-------
drivers/staging/hv/channel_mgmt.c | 2 +-
drivers/staging/hv/hv_kvp.c | 4 +-
drivers/staging/hv/hv_util.c | 6 +-
drivers/staging/hv/netvsc.c | 68 +++++++++---------
drivers/staging/hv/storvsc.c | 12 ++--
drivers/staging/hv/vmbus_packet_format.h | 118 +++++++++++++++---------------
8 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index cabadf0..58bbcd6 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -873,7 +873,7 @@ static int blkvsc_submit_request(struct blkvsc_request
*blkvsc_req,
DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
"req %p pfn[%d] %llx\n",
blkvsc_req, i,
- blkvsc_req->request.data_buffer.PfnArray[i]);
+ blkvsc_req->request.data_buffer.pfn_array[i]);
}
#endif
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 711548f..a8f5c38 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -338,16 +338,16 @@ static void dump_gpadl_header(struct
vmbus_channel_gpadl_header *gpadl)
"gpadl header - relid %d, range count %d, range buflen %d",
gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen);
for (i = 0; i < gpadl->rangecount; i++) {
- pagecount = gpadl->range[i].ByteCount >> PAGE_SHIFT;
+ pagecount = gpadl->range[i].byte_count >> PAGE_SHIFT;
pagecount = (pagecount > 26) ? 26 : pagecount;
DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d "
- "page count %d", i, gpadl->range[i].ByteCount,
- gpadl->range[i].ByteOffset, pagecount);
+ "page count %d", i, gpadl->range[i].byte_count,
+ gpadl->range[i].byte_offset, pagecount);
for (j = 0; j < pagecount; j++)
DPRINT_DBG(VMBUS, "%d) pfn %llu", j,
- gpadl->range[i].PfnArray[j]);
+ gpadl->range[i].pfn_array[j]);
}
}
@@ -399,10 +399,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->rangecount = 1;
gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64);
- gpadl_header->range[0].ByteOffset = 0;
- gpadl_header->range[0].ByteCount = size;
+ gpadl_header->range[0].byte_offset = 0;
+ gpadl_header->range[0].byte_count = size;
for (i = 0; i < pfncount; i++)
- gpadl_header->range[0].PfnArray[i] = pfn+i;
+ gpadl_header->range[0].pfn_array[i] = pfn+i;
*msginfo = msgheader;
*messagecount = 1;
@@ -463,10 +463,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->rangecount = 1;
gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64);
- gpadl_header->range[0].ByteOffset = 0;
- gpadl_header->range[0].ByteCount = size;
+ gpadl_header->range[0].byte_offset = 0;
+ gpadl_header->range[0].byte_count = size;
for (i = 0; i < pagecount; i++)
- gpadl_header->range[0].PfnArray[i] = pfn+i;
+ gpadl_header->range[0].pfn_array[i] = pfn+i;
*msginfo = msgheader;
*messagecount = 1;
@@ -739,12 +739,12 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const
void *buffer,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.Type = type; /* VmbusPacketTypeDataInBand; */
- desc.Flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
+ desc.type = type; /* VmbusPacketTypeDataInBand; */
+ desc.flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
/* in 8-bytes granularity */
- desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3;
- desc.Length8 = (u16)(packetlen_aligned >> 3);
- desc.TransactionId = requestid;
+ desc.offset8 = sizeof(struct vmpacket_descriptor) >> 3;
+ desc.len8 = (u16)(packetlen_aligned >> 3);
+ desc.trans_id = requestid;
sg_init_table(bufferlist, 3);
sg_set_buf(&bufferlist[0], &desc, sizeof(struct vmpacket_descriptor));
@@ -798,7 +798,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel
*channel,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.type = VmbusPacketTypeDataUsingGpaDirect;
+ desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
desc.length8 = (u16)(packetlen_aligned >> 3);
@@ -867,7 +867,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel
*channel,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.type = VmbusPacketTypeDataUsingGpaDirect;
+ desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
desc.length8 = (u16)(packetlen_aligned >> 3);
@@ -934,14 +934,14 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void
*buffer,
/* VmbusChannelClearEvent(Channel); */
- packetlen = desc.Length8 << 3;
- userlen = packetlen - (desc.DataOffset8 << 3);
+ packetlen = desc.len8 << 3;
+ userlen = packetlen - (desc.offset8 << 3);
/* ASSERT(userLen > 0); */
DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d
"
"flag %d tid %llx pktlen %d datalen %d> ",
- channel, channel->offermsg.child_relid, desc.Type,
- desc.Flags, desc.TransactionId, packetlen, userlen);
+ channel, channel->offermsg.child_relid, desc.type,
+ desc.flags, desc.trans_id, packetlen, userlen);
*buffer_actual_len = userlen;
@@ -953,11 +953,11 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void
*buffer,
return -1;
}
- *requestid = desc.TransactionId;
+ *requestid = desc.trans_id;
/* Copy over the packet to the user buffer */
ret = ringbuffer_read(&channel->inbound, buffer, userlen,
- (desc.DataOffset8 << 3));
+ (desc.offset8 << 3));
spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -994,13 +994,13 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel,
void *buffer,
/* VmbusChannelClearEvent(Channel); */
- packetlen = desc.Length8 << 3;
- userlen = packetlen - (desc.DataOffset8 << 3);
+ packetlen = desc.len8 << 3;
+ userlen = packetlen - (desc.offset8 << 3);
DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d
"
"flag %d tid %llx pktlen %d datalen %d> ",
- channel, channel->offermsg.child_relid, desc.Type,
- desc.Flags, desc.TransactionId, packetlen, userlen);
+ channel, channel->offermsg.child_relid, desc.type,
+ desc.flags, desc.trans_id, packetlen, userlen);
*buffer_actual_len = packetlen;
@@ -1012,7 +1012,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel,
void *buffer,
return -2;
}
- *requestid = desc.TransactionId;
+ *requestid = desc.trans_id;
/* Copy over the entire packet to the user buffer */
ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index 3e229fa..78c4f10 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -194,7 +194,7 @@ void chn_cb_negotiate(void *context)
vmbus_sendpacket(channel, buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
kfree(buf);
diff --git a/drivers/staging/hv/hv_kvp.c b/drivers/staging/hv/hv_kvp.c
index 5458631..bc1c20e 100644
--- a/drivers/staging/hv/hv_kvp.c
+++ b/drivers/staging/hv/hv_kvp.c
@@ -224,7 +224,7 @@ response_done:
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;
vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
kvp_transaction.active = false;
}
@@ -318,7 +318,7 @@ callback_done:
vmbus_sendpacket(channel, recv_buffer,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c
index dea0513..43c7ec0 100644
--- a/drivers/staging/hv/hv_util.c
+++ b/drivers/staging/hv/hv_util.c
@@ -97,7 +97,7 @@ static void shutdown_onchannelcallback(void *context)
vmbus_sendpacket(channel, shut_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
if (execute_shutdown == true)
@@ -179,7 +179,7 @@ static void timesync_onchannelcallback(void *context)
vmbus_sendpacket(channel, time_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
@@ -225,7 +225,7 @@ static void heartbeat_onchannelcallback(void *context)
vmbus_sendpacket(channel, hbeat_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 2d46528..4319363 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -270,7 +270,7 @@ static int netvsc_init_recv_buf(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(NETVSC,
@@ -404,7 +404,7 @@ static int netvsc_init_send_buf(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(NETVSC,
@@ -466,7 +466,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device
*net_device)
revoke_packet,
sizeof(struct nvsp_message),
(unsigned long)revoke_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
/*
* If we failed here, we might as well return and
* have a leak rather than continue and a bugchk
@@ -540,7 +540,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device
*net_device)
revoke_packet,
sizeof(struct nvsp_message),
(unsigned long)revoke_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
/*
* If we failed here, we might as well return and have a leak
* rather than continue and a bugchk
@@ -612,7 +612,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -666,7 +666,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
if (ret != 0) {
DPRINT_ERR(NETVSC,
"unable to send NvspMessage1TypeSendNdisVersion");
@@ -872,7 +872,7 @@ static void netvsc_send_completion(struct hv_device *device,
}
nvsp_packet = (struct nvsp_message *)((unsigned long)packet +
- (packet->DataOffset8 << 3));
+ (packet->offset8 << 3));
DPRINT_DBG(NETVSC, "send completion packet - type %d",
nvsp_packet->hdr.msg_type);
@@ -890,7 +890,7 @@ static void netvsc_send_completion(struct hv_device *device,
NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
/* Get the send context */
nvsc_packet = (struct hv_netvsc_packet *)(unsigned long)
- packet->TransactionId;
+ packet->trans_id;
/* ASSERT(nvscPacket); */
/* Notify the layer above us */
@@ -946,7 +946,7 @@ static int netvsc_send(struct hv_device *device,
ret = vmbus_sendpacket(device->channel, &sendMessage,
sizeof(struct nvsp_message),
(unsigned long)packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
@@ -987,15 +987,15 @@ static void netvsc_receive(struct hv_device *device,
* All inbound packets other than send completion should be xfer page
* packet
*/
- if (packet->Type != VmbusPacketTypeDataUsingTransferPages) {
+ if (packet->type != VM_PKT_DATA_USING_XFER_PAGES) {
DPRINT_ERR(NETVSC, "Unknown packet type received - %d",
- packet->Type);
+ packet->type);
put_net_device(device);
return;
}
nvsp_packet = (struct nvsp_message *)((unsigned long)packet +
- (packet->DataOffset8 << 3));
+ (packet->offset8 << 3));
/* Make sure this is a valid nvsp packet */
if (nvsp_packet->hdr.msg_type !@@ -1011,16 +1011,16 @@ static void
netvsc_receive(struct hv_device *device,
vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;
- if (vmxferpage_packet->TransferPageSetId != NETVSC_RECEIVE_BUFFER_ID) {
+ if (vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID) {
DPRINT_ERR(NETVSC, "Invalid xfer page set id - "
"expecting %x got %x", NETVSC_RECEIVE_BUFFER_ID,
- vmxferpage_packet->TransferPageSetId);
+ vmxferpage_packet->xfer_pageset_id);
put_net_device(device);
return;
}
DPRINT_DBG(NETVSC, "xfer page - range count %d",
- vmxferpage_packet->RangeCount);
+ vmxferpage_packet->range_cnt);
/*
* Grab free packets (range count + 1) to represent this xfer
@@ -1031,7 +1031,7 @@ static void netvsc_receive(struct hv_device *device,
spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
while (!list_empty(&net_device->recv_pkt_list)) {
list_move_tail(net_device->recv_pkt_list.next, &listHead);
- if (++count == vmxferpage_packet->RangeCount + 1)
+ if (++count == vmxferpage_packet->range_cnt + 1)
break;
}
spin_unlock_irqrestore(&net_device->recv_pkt_list_lock, flags);
@@ -1044,7 +1044,7 @@ static void netvsc_receive(struct hv_device *device,
if (count < 2) {
DPRINT_ERR(NETVSC, "Got only %d netvsc pkt...needed %d pkts. "
"Dropping this xfer page packet completely!",
- count, vmxferpage_packet->RangeCount + 1);
+ count, vmxferpage_packet->range_cnt + 1);
/* Return it to the freelist */
spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
@@ -1056,7 +1056,7 @@ static void netvsc_receive(struct hv_device *device,
flags);
netvsc_send_recv_completion(device,
- vmxferpage_packet->d.TransactionId);
+ vmxferpage_packet->d.trans_id);
put_net_device(device);
return;
@@ -1071,9 +1071,9 @@ static void netvsc_receive(struct hv_device *device,
/* ASSERT(xferpagePacket->Count > 0 && xferpagePacket->Count
<= */
/* vmxferpagePacket->RangeCount); */
- if (xferpage_packet->count != vmxferpage_packet->RangeCount) {
+ if (xferpage_packet->count != vmxferpage_packet->range_cnt) {
DPRINT_INFO(NETVSC, "Needed %d netvsc pkts to satisy this xfer "
- "page...got %d", vmxferpage_packet->RangeCount,
+ "page...got %d", vmxferpage_packet->range_cnt,
xferpage_packet->count);
}
@@ -1091,10 +1091,10 @@ static void netvsc_receive(struct hv_device *device,
netvsc_packet->device = device;
/* Save this so that we can send it back */
netvsc_packet->completion.recv.recv_completion_tid -
vmxferpage_packet->d.TransactionId;
+ vmxferpage_packet->d.trans_id;
netvsc_packet->total_data_buflen -
vmxferpage_packet->Ranges[i].ByteCount;
+ vmxferpage_packet->ranges[i].byte_count;
netvsc_packet->page_buf_cnt = 1;
/* ASSERT(vmxferpagePacket->Ranges[i].ByteOffset + */
@@ -1102,20 +1102,20 @@ static void netvsc_receive(struct hv_device *device,
/* netDevice->ReceiveBufferSize); */
netvsc_packet->page_buf[0].len -
vmxferpage_packet->Ranges[i].ByteCount;
+ vmxferpage_packet->ranges[i].byte_count;
start = virt_to_phys((void *)((unsigned long)net_device->
- recv_buf + vmxferpage_packet->Ranges[i].ByteOffset));
+ recv_buf + vmxferpage_packet->ranges[i].byte_offset));
netvsc_packet->page_buf[0].pfn = start >> PAGE_SHIFT;
end_virtual = (unsigned long)net_device->recv_buf
- + vmxferpage_packet->Ranges[i].ByteOffset
- + vmxferpage_packet->Ranges[i].ByteCount - 1;
+ + vmxferpage_packet->ranges[i].byte_offset
+ + vmxferpage_packet->ranges[i].byte_count - 1;
end = virt_to_phys((void *)end_virtual);
/* Calculate the page relative offset */
netvsc_packet->page_buf[0].offset -
vmxferpage_packet->Ranges[i].ByteOffset &
+ vmxferpage_packet->ranges[i].byte_offset &
(PAGE_SIZE - 1);
if ((end >> PAGE_SHIFT) != (start >> PAGE_SHIFT)) {
/* Handle frame across multiple pages: */
@@ -1147,8 +1147,8 @@ static void netvsc_receive(struct hv_device *device,
}
DPRINT_DBG(NETVSC, "[%d] - (abs offset %u len %u) => "
"(pfn %llx, offset %u, len %u)", i,
- vmxferpage_packet->Ranges[i].ByteOffset,
- vmxferpage_packet->Ranges[i].ByteCount,
+ vmxferpage_packet->ranges[i].byte_offset,
+ vmxferpage_packet->ranges[i].byte_count,
netvsc_packet->page_buf[0].pfn,
netvsc_packet->page_buf[0].offset,
netvsc_packet->page_buf[0].len);
@@ -1187,7 +1187,7 @@ retry_send_cmplt:
/* Send the completion */
ret = vmbus_sendpacket(device->channel, &recvcompMessage,
sizeof(struct nvsp_message), transaction_id,
- VmbusPacketTypeCompletion, 0);
+ VM_PKT_COMP, 0);
if (ret == 0) {
/* success */
/* no-op */
@@ -1300,12 +1300,12 @@ static void netvsc_channel_cb(void *context)
bytes_recvd, request_id);
desc = (struct vmpacket_descriptor *)buffer;
- switch (desc->Type) {
- case VmbusPacketTypeCompletion:
+ switch (desc->type) {
+ case VM_PKT_COMP:
netvsc_send_completion(device, desc);
break;
- case VmbusPacketTypeDataUsingTransferPages:
+ case VM_PKT_DATA_USING_XFER_PAGES:
netvsc_receive(device, desc);
break;
@@ -1313,7 +1313,7 @@ static void netvsc_channel_cb(void *context)
DPRINT_ERR(NETVSC,
"unhandled packet type %d, "
"tid %llx len %d\n",
- desc->Type, request_id,
+ desc->type, request_id,
bytes_recvd);
break;
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index b80b1e9..a612109 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -218,7 +218,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC,
@@ -249,7 +249,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC,
@@ -280,7 +280,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -317,7 +317,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -642,7 +642,7 @@ int stor_vsc_on_host_reset(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)&stor_device->reset_request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d",
@@ -744,7 +744,7 @@ static int stor_vsc_on_io_request(struct hv_device *device,
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request_extension,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
diff --git a/drivers/staging/hv/vmbus_packet_format.h
b/drivers/staging/hv/vmbus_packet_format.h
index f9f6b4b..7f6dfa3 100644
--- a/drivers/staging/hv/vmbus_packet_format.h
+++ b/drivers/staging/hv/vmbus_packet_format.h
@@ -25,43 +25,43 @@
#define _VMBUSPACKETFORMAT_H_
struct vmpacket_descriptor {
- u16 Type;
- u16 DataOffset8;
- u16 Length8;
- u16 Flags;
- u64 TransactionId;
+ u16 type;
+ u16 offset8;
+ u16 len8;
+ u16 flags;
+ u64 trans_id;
} __attribute__((packed));
struct vmpacket_header {
- u32 PreviousPacketStartOffset;
- struct vmpacket_descriptor Descriptor;
+ u32 prev_pkt_start_offset;
+ struct vmpacket_descriptor descriptor;
} __attribute__((packed));
struct vmtransfer_page_range {
- u32 ByteCount;
- u32 ByteOffset;
+ u32 byte_count;
+ u32 byte_offset;
} __attribute__((packed));
struct vmtransfer_page_packet_header {
struct vmpacket_descriptor d;
- u16 TransferPageSetId;
- bool SenderOwnsSet;
- u8 Reserved;
- u32 RangeCount;
- struct vmtransfer_page_range Ranges[1];
+ u16 xfer_pageset_id;
+ bool sender_owns_set;
+ u8 reserved;
+ u32 range_cnt;
+ struct vmtransfer_page_range ranges[1];
} __attribute__((packed));
struct vmgpadl_packet_header {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 Reserved;
+ u32 gpadl;
+ u32 reserved;
} __attribute__((packed));
struct vmadd_remove_transfer_page_set {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u16 TransferPageSetId;
- u16 Reserved;
+ u32 gpadl;
+ u16 xfer_pageset_id;
+ u16 reserved;
} __attribute__((packed));
/*
@@ -69,9 +69,9 @@ struct vmadd_remove_transfer_page_set {
* look virtually contiguous.
*/
struct gpa_range {
- u32 ByteCount;
- u32 ByteOffset;
- u64 PfnArray[0];
+ u32 byte_count;
+ u32 byte_offset;
+ u64 pfn_array[0];
};
/*
@@ -83,9 +83,9 @@ struct gpa_range {
*/
struct vmestablish_gpadl {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 RangeCount;
- struct gpa_range Range[1];
+ u32 gpadl;
+ u32 range_cnt;
+ struct gpa_range range[1];
} __attribute__((packed));
/*
@@ -94,8 +94,8 @@ struct vmestablish_gpadl {
*/
struct vmteardown_gpadl {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 Reserved; /* for alignment to a 8-byte boundary */
+ u32 gpadl;
+ u32 reserved; /* for alignment to a 8-byte boundary */
} __attribute__((packed));
/*
@@ -104,56 +104,56 @@ struct vmteardown_gpadl {
*/
struct vmdata_gpa_direct {
struct vmpacket_descriptor d;
- u32 Reserved;
- u32 RangeCount;
- struct gpa_range Range[1];
+ u32 reserved;
+ u32 range_cnt;
+ struct gpa_range range[1];
} __attribute__((packed));
/* This is the format for a Additional Data Packet. */
struct vmadditional_data {
struct vmpacket_descriptor d;
- u64 TotalBytes;
- u32 ByteOffset;
- u32 ByteCount;
- unsigned char Data[1];
+ u64 total_bytes;
+ u32 offset;
+ u32 byte_cnt;
+ unsigned char data[1];
} __attribute__((packed));
union vmpacket_largest_possible_header {
- struct vmpacket_descriptor SimpleHeader;
- struct vmtransfer_page_packet_header TransferPageHeader;
- struct vmgpadl_packet_header GpadlHeader;
- struct vmadd_remove_transfer_page_set AddRemoveTransferPageHeader;
- struct vmestablish_gpadl EstablishGpadlHeader;
- struct vmteardown_gpadl TeardownGpadlHeader;
- struct vmdata_gpa_direct DataGpaDirectHeader;
+ struct vmpacket_descriptor simple_hdr;
+ struct vmtransfer_page_packet_header xfer_page_hdr;
+ struct vmgpadl_packet_header gpadl_hdr;
+ struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
+ struct vmestablish_gpadl establish_gpadl_hdr;
+ struct vmteardown_gpadl teardown_gpadl_hdr;
+ struct vmdata_gpa_direct data_gpa_direct_hdr;
};
#define VMPACKET_DATA_START_ADDRESS(__packet) \
(void *)(((unsigned char *)__packet) + \
- ((struct vmpacket_descriptor)__packet)->DataOffset8 * 8)
+ ((struct vmpacket_descriptor)__packet)->offset8 * 8)
#define VMPACKET_DATA_LENGTH(__packet) \
- ((((struct vmpacket_descriptor)__packet)->Length8 - \
- ((struct vmpacket_descriptor)__packet)->DataOffset8) * 8)
+ ((((struct vmpacket_descriptor)__packet)->len8 - \
+ ((struct vmpacket_descriptor)__packet)->offset8) * 8)
#define VMPACKET_TRANSFER_MODE(__packet) \
- (((struct IMPACT)__packet)->Type)
+ (((struct IMPACT)__packet)->type)
enum vmbus_packet_type {
- VmbusPacketTypeInvalid = 0x0,
- VmbusPacketTypeSynch = 0x1,
- VmbusPacketTypeAddTransferPageSet = 0x2,
- VmbusPacketTypeRemoveTransferPageSet = 0x3,
- VmbusPacketTypeEstablishGpadl = 0x4,
- VmbusPacketTypeTearDownGpadl = 0x5,
- VmbusPacketTypeDataInBand = 0x6,
- VmbusPacketTypeDataUsingTransferPages = 0x7,
- VmbusPacketTypeDataUsingGpadl = 0x8,
- VmbusPacketTypeDataUsingGpaDirect = 0x9,
- VmbusPacketTypeCancelRequest = 0xa,
- VmbusPacketTypeCompletion = 0xb,
- VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
- VmbusPacketTypeAdditionalData = 0xd
+ VM_PKT_INVALID = 0x0,
+ VM_PKT_SYNCH = 0x1,
+ VM_PKT_ADD_XFER_PAGESET = 0x2,
+ VM_PKT_RM_XFER_PAGESET = 0x3,
+ VM_PKT_ESTABLISH_GPADL = 0x4,
+ VM_PKT_TEARDOWN_GPADL = 0x5,
+ VM_PKT_DATA_INBAND = 0x6,
+ VM_PKT_DATA_USING_XFER_PAGES = 0x7,
+ VM_PKT_DATA_USING_GPADL = 0x8,
+ VM_PKT_DATA_USING_GPA_DIRECT = 0x9,
+ VM_PKT_CANCEL_REQUEST = 0xa,
+ VM_PKT_COMP = 0xb,
+ VM_PKT_DATA_USING_ADDITIONAL_PKT = 0xc,
+ VM_PKT_ADDITIONAL_DATA = 0xd
};
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 20:12 UTC
[PATCH 1/8] staging: hv: Convert camel cased variables in connection.c to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 48 ++++++------
drivers/staging/hv/channel_mgmt.c | 48 ++++++------
drivers/staging/hv/connection.c | 154 ++++++++++++++++++------------------
drivers/staging/hv/vmbus_drv.c | 2 +-
drivers/staging/hv/vmbus_private.h | 2 +-
5 files changed, 128 insertions(+), 126 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 69e7856..99b2d2a 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -77,10 +77,10 @@ static void vmbus_setevent(struct vmbus_channel *channel)
if (channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
set_bit(channel->offermsg.child_relid & 31,
- (unsigned long *) gVmbusConnection.SendInterruptPage +
+ (unsigned long *) vmbus_connection.SendInterruptPage +
(channel->offermsg.child_relid >> 5));
- monitorpage = gVmbusConnection.MonitorPages;
+ monitorpage = vmbus_connection.MonitorPages;
monitorpage++; /* Get the child to parent monitor page */
set_bit(channel->monitor_bit,
@@ -100,11 +100,11 @@ static void VmbusChannelClearEvent(struct vmbus_channel
*channel)
if (Channel->offermsg.monitor_allocated) {
/* Each u32 represents 32 channels */
clear_bit(Channel->offermsg.child_relid & 31,
- (unsigned long *)gVmbusConnection.SendInterruptPage +
+ (unsigned long *)vmbus_connection.SendInterruptPage +
(Channel->offermsg.child_relid >> 5));
monitorPage - (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
+ (struct hv_monitor_page *)vmbus_connection.MonitorPages;
monitorPage++; /* Get the child to parent monitor page */
clear_bit(Channel->monitor_bit,
@@ -133,7 +133,7 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
&channel->offermsg.offer.InterfaceInstance,
sizeof(struct hv_guid));
- monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages;
+ monitorpage = (struct hv_monitor_page *)vmbus_connection.MonitorPages;
debuginfo->monitorid = channel->offermsg.monitorid;
@@ -265,10 +265,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
if (userdatalen)
memcpy(openMsg->userdata, userdata, userdatalen);
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&openInfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ &vmbus_connection.ChannelMsgList);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg...");
@@ -289,9 +289,9 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
newchannel, openInfo->response.open_result.status);
Cleanup:
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&openInfo->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(openInfo->waitevent);
kfree(openInfo);
@@ -501,8 +501,8 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
unsigned long flags;
int ret = 0;
- next_gpadl_handle = atomic_read(&gVmbusConnection.NextGpadlHandle);
- atomic_inc(&gVmbusConnection.NextGpadlHandle);
+ next_gpadl_handle = atomic_read(&vmbus_connection.NextGpadlHandle);
+ atomic_inc(&vmbus_connection.NextGpadlHandle);
ret = create_gpadl_header(kbuffer, size, &msginfo, &msgcount);
if (ret)
@@ -521,11 +521,11 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
dump_gpadl_header(gpadlmsg);
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&msginfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
+ &vmbus_connection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
kbuffer, size, msgcount);
@@ -577,9 +577,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
*gpadl_handle = gpadlmsg->gpadl;
Cleanup:
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&msginfo->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(msginfo->waitevent);
kfree(msginfo);
@@ -616,10 +616,10 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel,
u32 gpadl_handle)
msg->child_relid = channel->offermsg.child_relid;
msg->gpadl = gpadl_handle;
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_add_tail(&info->msglistentry,
- &gVmbusConnection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ &vmbus_connection.ChannelMsgList);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
@@ -631,9 +631,9 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32
gpadl_handle)
osd_waitevent_wait(info->waitevent);
/* Received a torndown response */
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
list_del(&info->msglistentry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
kfree(info->waitevent);
kfree(info);
@@ -697,9 +697,9 @@ void vmbus_close(struct vmbus_channel *channel)
*/
if (channel->state == CHANNEL_OPEN_STATE) {
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&channel->listentry);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(channel);
}
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index fb71f88..351ebeb 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -308,7 +308,7 @@ void free_channel(struct vmbus_channel *channel)
* ie we can't destroy ourselves.
*/
INIT_WORK(&channel->work, release_channel);
- queue_work(gVmbusConnection.WorkQueue, &channel->work);
+ queue_work(vmbus_connection.WorkQueue, &channel->work);
}
@@ -323,10 +323,10 @@ static void count_hv_channel(void)
static int counter;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
if (++counter == MAX_MSG_TYPES)
complete(&hv_channel_ready);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
}
/*
@@ -361,9 +361,9 @@ static void vmbus_process_offer(struct work_struct *work)
INIT_WORK(&newchannel->work, vmbus_process_rescind_offer);
/* Make sure this is a new offer */
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
+ list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
if (!memcmp(&channel->offermsg.offer.InterfaceType,
&newchannel->offermsg.offer.InterfaceType,
sizeof(struct hv_guid)) &&
@@ -377,9 +377,9 @@ static void vmbus_process_offer(struct work_struct *work)
if (fnew)
list_add_tail(&newchannel->listentry,
- &gVmbusConnection.ChannelList);
+ &vmbus_connection.ChannelList);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
if (!fnew) {
DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)",
@@ -412,9 +412,9 @@ static void vmbus_process_offer(struct work_struct *work)
"unable to add child device object (relid %d)",
newchannel->offermsg.child_relid);
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_del(&newchannel->listentry);
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
free_channel(newchannel);
} else {
@@ -577,9 +577,9 @@ static void vmbus_onopen_result(struct
vmbus_channel_message_header *hdr)
/*
* Find the open msg, copy the result and signal/unblock the wait event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -598,7 +598,7 @@ static void vmbus_onopen_result(struct
vmbus_channel_message_header *hdr)
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -625,9 +625,9 @@ static void vmbus_ongpadl_created(struct
vmbus_channel_message_header *hdr)
* Find the establish msg, copy the result and signal/unblock the wait
* event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -648,7 +648,7 @@ static void vmbus_ongpadl_created(struct
vmbus_channel_message_header *hdr)
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -673,9 +673,9 @@ static void vmbus_ongpadl_torndown(
/*
* Find the open msg, copy the result and signal/unblock the wait event
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -694,7 +694,7 @@ static void vmbus_ongpadl_torndown(
}
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/*
@@ -715,9 +715,9 @@ static void vmbus_onversion_response(
unsigned long flags;
version_response = (struct vmbus_channel_version_response *)hdr;
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
- list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &vmbus_connection.ChannelMsgList) {
/* FIXME: this should probably use list_entry() instead */
msginfo = (struct vmbus_channel_msginfo *)curr;
requestheader @@ -733,7 +733,7 @@ static void vmbus_onversion_response(
osd_waitevent_set(msginfo->waitevent);
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
}
/* Channel message dispatch table */
@@ -857,9 +857,9 @@ void vmbus_release_unattached_channels(void)
struct vmbus_channel *start = NULL;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
- list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList,
+ list_for_each_entry_safe(channel, pos, &vmbus_connection.ChannelList,
listentry) {
if (channel == start)
break;
@@ -878,7 +878,7 @@ void vmbus_release_unattached_channels(void)
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
}
/* eof */
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index c2e298f..a30b98d 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -29,7 +29,7 @@
#include "vmbus_private.h"
-struct VMBUS_CONNECTION gVmbusConnection = {
+struct VMBUS_CONNECTION vmbus_connection = {
.ConnectState = Disconnected,
.NextGpadlHandle = ATOMIC_INIT(0xE1E10),
};
@@ -40,86 +40,86 @@ struct VMBUS_CONNECTION gVmbusConnection = {
int VmbusConnect(void)
{
int ret = 0;
- struct vmbus_channel_msginfo *msgInfo = NULL;
+ struct vmbus_channel_msginfo *msginfo = NULL;
struct vmbus_channel_initiate_contact *msg;
unsigned long flags;
/* Make sure we are not connecting or connected */
- if (gVmbusConnection.ConnectState != Disconnected)
+ if (vmbus_connection.ConnectState != Disconnected)
return -1;
/* Initialize the vmbus connection */
- gVmbusConnection.ConnectState = Connecting;
- gVmbusConnection.WorkQueue = create_workqueue("hv_vmbus_con");
- if (!gVmbusConnection.WorkQueue) {
+ vmbus_connection.ConnectState = Connecting;
+ vmbus_connection.WorkQueue = create_workqueue("hv_vmbus_con");
+ if (!vmbus_connection.WorkQueue) {
ret = -1;
goto Cleanup;
}
- INIT_LIST_HEAD(&gVmbusConnection.ChannelMsgList);
- spin_lock_init(&gVmbusConnection.channelmsg_lock);
+ INIT_LIST_HEAD(&vmbus_connection.ChannelMsgList);
+ spin_lock_init(&vmbus_connection.channelmsg_lock);
- INIT_LIST_HEAD(&gVmbusConnection.ChannelList);
- spin_lock_init(&gVmbusConnection.channel_lock);
+ INIT_LIST_HEAD(&vmbus_connection.ChannelList);
+ spin_lock_init(&vmbus_connection.channel_lock);
/*
* Setup the vmbus event connection for channel interrupt
* abstraction stuff
*/
- gVmbusConnection.InterruptPage = osd_page_alloc(1);
- if (gVmbusConnection.InterruptPage == NULL) {
+ vmbus_connection.InterruptPage = osd_page_alloc(1);
+ if (vmbus_connection.InterruptPage == NULL) {
ret = -1;
goto Cleanup;
}
- gVmbusConnection.RecvInterruptPage = gVmbusConnection.InterruptPage;
- gVmbusConnection.SendInterruptPage - (void *)((unsigned
long)gVmbusConnection.InterruptPage +
+ vmbus_connection.RecvInterruptPage = vmbus_connection.InterruptPage;
+ vmbus_connection.SendInterruptPage + (void *)((unsigned
long)vmbus_connection.InterruptPage +
(PAGE_SIZE >> 1));
/*
* Setup the monitor notification facility. The 1st page for
* parent->child and the 2nd page for child->parent
*/
- gVmbusConnection.MonitorPages = osd_page_alloc(2);
- if (gVmbusConnection.MonitorPages == NULL) {
+ vmbus_connection.MonitorPages = osd_page_alloc(2);
+ if (vmbus_connection.MonitorPages == NULL) {
ret = -1;
goto Cleanup;
}
- msgInfo = kzalloc(sizeof(*msgInfo) +
+ msginfo = kzalloc(sizeof(*msginfo) +
sizeof(struct vmbus_channel_initiate_contact),
GFP_KERNEL);
- if (msgInfo == NULL) {
+ if (msginfo == NULL) {
ret = -ENOMEM;
goto Cleanup;
}
- msgInfo->waitevent = osd_waitevent_create();
- if (!msgInfo->waitevent) {
+ msginfo->waitevent = osd_waitevent_create();
+ if (!msginfo->waitevent) {
ret = -ENOMEM;
goto Cleanup;
}
- msg = (struct vmbus_channel_initiate_contact *)msgInfo->msg;
+ msg = (struct vmbus_channel_initiate_contact *)msginfo->msg;
msg->header.msgtype = CHANNELMSG_INITIATE_CONTACT;
msg->vmbus_version_requested = VMBUS_REVISION_NUMBER;
- msg->interrupt_page = virt_to_phys(gVmbusConnection.InterruptPage);
- msg->monitor_page1 = virt_to_phys(gVmbusConnection.MonitorPages);
+ msg->interrupt_page = virt_to_phys(vmbus_connection.InterruptPage);
+ msg->monitor_page1 = virt_to_phys(vmbus_connection.MonitorPages);
msg->monitor_page2 = virt_to_phys(
- (void *)((unsigned long)gVmbusConnection.MonitorPages +
+ (void *)((unsigned long)vmbus_connection.MonitorPages +
PAGE_SIZE));
/*
* Add to list before we send the request since we may
* receive the response before returning from this routine
*/
- spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- list_add_tail(&msgInfo->msglistentry,
- &gVmbusConnection.ChannelMsgList);
+ spin_lock_irqsave(&vmbus_connection.channelmsg_lock, flags);
+ list_add_tail(&msginfo->msglistentry,
+ &vmbus_connection.ChannelMsgList);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
"monitor1 pfn %llx,, monitor2 pfn %llx",
@@ -129,19 +129,19 @@ int VmbusConnect(void)
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) {
- list_del(&msgInfo->msglistentry);
+ list_del(&msginfo->msglistentry);
goto Cleanup;
}
/* Wait for the connection response */
- osd_waitevent_wait(msgInfo->waitevent);
+ osd_waitevent_wait(msginfo->waitevent);
- list_del(&msgInfo->msglistentry);
+ list_del(&msginfo->msglistentry);
/* Check if successful */
- if (msgInfo->response.version_response.version_supported) {
+ if (msginfo->response.version_response.version_supported) {
DPRINT_INFO(VMBUS, "Vmbus connected!!");
- gVmbusConnection.ConnectState = Connected;
+ vmbus_connection.ConnectState = Connected;
} else {
DPRINT_ERR(VMBUS, "Vmbus connection failed!!..."
@@ -151,29 +151,29 @@ int VmbusConnect(void)
goto Cleanup;
}
- kfree(msgInfo->waitevent);
- kfree(msgInfo);
+ kfree(msginfo->waitevent);
+ kfree(msginfo);
return 0;
Cleanup:
- gVmbusConnection.ConnectState = Disconnected;
+ vmbus_connection.ConnectState = Disconnected;
- if (gVmbusConnection.WorkQueue)
- destroy_workqueue(gVmbusConnection.WorkQueue);
+ if (vmbus_connection.WorkQueue)
+ destroy_workqueue(vmbus_connection.WorkQueue);
- if (gVmbusConnection.InterruptPage) {
- osd_page_free(gVmbusConnection.InterruptPage, 1);
- gVmbusConnection.InterruptPage = NULL;
+ if (vmbus_connection.InterruptPage) {
+ osd_page_free(vmbus_connection.InterruptPage, 1);
+ vmbus_connection.InterruptPage = NULL;
}
- if (gVmbusConnection.MonitorPages) {
- osd_page_free(gVmbusConnection.MonitorPages, 2);
- gVmbusConnection.MonitorPages = NULL;
+ if (vmbus_connection.MonitorPages) {
+ osd_page_free(vmbus_connection.MonitorPages, 2);
+ vmbus_connection.MonitorPages = NULL;
}
- if (msgInfo) {
- kfree(msgInfo->waitevent);
- kfree(msgInfo);
+ if (msginfo) {
+ kfree(msginfo->waitevent);
+ kfree(msginfo);
}
return ret;
@@ -188,7 +188,7 @@ int VmbusDisconnect(void)
struct vmbus_channel_message_header *msg;
/* Make sure we are connected */
- if (gVmbusConnection.ConnectState != Connected)
+ if (vmbus_connection.ConnectState != Connected)
return -1;
msg = kzalloc(sizeof(struct vmbus_channel_message_header), GFP_KERNEL);
@@ -202,12 +202,12 @@ int VmbusDisconnect(void)
if (ret != 0)
goto Cleanup;
- osd_page_free(gVmbusConnection.InterruptPage, 1);
+ osd_page_free(vmbus_connection.InterruptPage, 1);
/* TODO: iterate thru the msg list and free up */
- destroy_workqueue(gVmbusConnection.WorkQueue);
+ destroy_workqueue(vmbus_connection.WorkQueue);
- gVmbusConnection.ConnectState = Disconnected;
+ vmbus_connection.ConnectState = Disconnected;
DPRINT_INFO(VMBUS, "Vmbus disconnected!!");
@@ -219,22 +219,22 @@ Cleanup:
/*
* GetChannelFromRelId - Get the channel object given its child relative id (ie
channel id)
*/
-struct vmbus_channel *GetChannelFromRelId(u32 relId)
+struct vmbus_channel *GetChannelFromRelId(u32 relid)
{
struct vmbus_channel *channel;
- struct vmbus_channel *foundChannel = NULL;
+ struct vmbus_channel *found_channel = NULL;
unsigned long flags;
- spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) {
- if (channel->offermsg.child_relid == relId) {
- foundChannel = channel;
+ spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
+ list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
+ if (channel->offermsg.child_relid == relid) {
+ found_channel = channel;
break;
}
}
- spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
+ spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
- return foundChannel;
+ return found_channel;
}
/*
@@ -243,7 +243,7 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId)
static void VmbusProcessChannelEvent(void *context)
{
struct vmbus_channel *channel;
- u32 relId = (u32)(unsigned long)context;
+ u32 relid = (u32)(unsigned long)context;
/* ASSERT(relId > 0); */
@@ -251,7 +251,7 @@ static void VmbusProcessChannelEvent(void *context)
* Find the channel based on this relid and invokes the
* channel callback to process the event
*/
- channel = GetChannelFromRelId(relId);
+ channel = GetChannelFromRelId(relid);
if (channel) {
vmbus_onchannel_event(channel);
@@ -261,7 +261,7 @@ static void VmbusProcessChannelEvent(void *context)
* (void*)channel);
*/
} else {
- DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relId);
+ DPRINT_ERR(VMBUS, "channel not found for relid - %d.", relid);
}
}
@@ -274,14 +274,16 @@ void VmbusOnEvents(void)
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
int bit;
int relid;
- u32 *recvInterruptPage = gVmbusConnection.RecvInterruptPage;
+ u32 *recv_int_page = vmbus_connection.RecvInterruptPage;
/* Check events */
- if (recvInterruptPage) {
+ if (recv_int_page) {
for (dword = 0; dword < maxdword; dword++) {
- if (recvInterruptPage[dword]) {
+ if (recv_int_page[dword]) {
for (bit = 0; bit < 32; bit++) {
- if (test_and_clear_bit(bit, (unsigned long
*)&recvInterruptPage[dword])) {
+ if (test_and_clear_bit(bit,
+ (unsigned long *)
+ &recv_int_page[dword])) {
relid = (dword << 5) + bit;
DPRINT_DBG(VMBUS, "event detected for relid - %d", relid);
@@ -305,24 +307,24 @@ void VmbusOnEvents(void)
/*
* VmbusPostMessage - Send a msg on the vmbus's message connection
*/
-int VmbusPostMessage(void *buffer, size_t bufferLen)
+int VmbusPostMessage(void *buffer, size_t buflen)
{
- union hv_connection_id connId;
+ union hv_connection_id conn_id;
- connId.asu32 = 0;
- connId.u.id = VMBUS_MESSAGE_CONNECTION_ID;
- return hv_post_message(connId, 1, buffer, bufferLen);
+ conn_id.asu32 = 0;
+ conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
+ return hv_post_message(conn_id, 1, buffer, buflen);
}
/*
* VmbusSetEvent - Send an event notification to the parent
*/
-int VmbusSetEvent(u32 childRelId)
+int VmbusSetEvent(u32 child_relid)
{
/* Each u32 represents 32 channels */
- set_bit(childRelId & 31,
- (unsigned long *)gVmbusConnection.SendInterruptPage +
- (childRelId >> 5));
+ set_bit(child_relid & 31,
+ (unsigned long *)vmbus_connection.SendInterruptPage +
+ (child_relid >> 5));
return hv_signal_event();
}
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index 84fdb64..fd0881a 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -239,7 +239,7 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
continue;
INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg));
- queue_work(gVmbusConnection.WorkQueue, &ctx->work);
+ queue_work(vmbus_connection.WorkQueue, &ctx->work);
}
msg->header.message_type = HVMSG_NONE;
diff --git a/drivers/staging/hv/vmbus_private.h
b/drivers/staging/hv/vmbus_private.h
index 07f6d22..9b51ac1 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -98,7 +98,7 @@ struct VMBUS_MSGINFO {
};
-extern struct VMBUS_CONNECTION gVmbusConnection;
+extern struct VMBUS_CONNECTION vmbus_connection;
/* General vmbus interface */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 20:12 UTC
[PATCH 2/8] staging: hv: Convert camel cased functions in connection.c to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 12 +++++-----
drivers/staging/hv/channel_mgmt.c | 4 +-
drivers/staging/hv/connection.c | 39 +++++++++++++++++++----------------
drivers/staging/hv/vmbus_drv.c | 6 ++--
drivers/staging/hv/vmbus_private.h | 12 +++++-----
5 files changed, 38 insertions(+), 35 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 99b2d2a..ca76098 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -88,7 +88,7 @@ static void vmbus_setevent(struct vmbus_channel *channel)
[channel->monitor_grp].pending);
} else {
- VmbusSetEvent(channel->offermsg.child_relid);
+ vmbus_set_event(channel->offermsg.child_relid);
}
}
@@ -272,7 +272,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32
send_ringbuffer_size,
DPRINT_DBG(VMBUS, "Sending channel open msg...");
- ret = VmbusPostMessage(openMsg,
+ ret = vmbus_post_msg(openMsg,
sizeof(struct vmbus_channel_open_channel));
if (ret != 0) {
DPRINT_ERR(VMBUS, "unable to open channel - %d", ret);
@@ -532,7 +532,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd",
msginfo->msgsize - sizeof(*msginfo));
- ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize -
+ ret = vmbus_post_msg(gpadlmsg, msginfo->msgsize -
sizeof(*msginfo));
if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret);
@@ -557,7 +557,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel,
void *kbuffer,
dump_gpadl_body(gpadl_body, submsginfo->msgsize -
sizeof(*submsginfo));
- ret = VmbusPostMessage(gpadl_body,
+ ret = vmbus_post_msg(gpadl_body,
submsginfo->msgsize -
sizeof(*submsginfo));
if (ret != 0)
@@ -621,7 +621,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32
gpadl_handle)
&vmbus_connection.ChannelMsgList);
spin_unlock_irqrestore(&vmbus_connection.channelmsg_lock, flags);
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_gpadl_teardown));
if (ret != 0) {
/* TODO: */
@@ -669,7 +669,7 @@ void vmbus_close(struct vmbus_channel *channel)
msg->header.msgtype = CHANNELMSG_CLOSECHANNEL;
msg->child_relid = channel->offermsg.child_relid;
- ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel));
+ ret = vmbus_post_msg(msg, sizeof(struct vmbus_channel_close_channel));
if (ret != 0) {
/* TODO: */
/* something... */
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index 351ebeb..0ce8f54 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -532,7 +532,7 @@ static void vmbus_onoffer_rescind(struct
vmbus_channel_message_header *hdr)
struct vmbus_channel *channel;
rescind = (struct vmbus_channel_rescind_offer *)hdr;
- channel = GetChannelFromRelId(rescind->child_relid);
+ channel = relid2channel(rescind->child_relid);
if (channel == NULL) {
DPRINT_DBG(VMBUS, "channel not found for relId %d",
rescind->child_relid);
@@ -820,7 +820,7 @@ int vmbus_request_offers(void)
&msgInfo->msgListEntry);
SpinlockRelease(gVmbusConnection.channelMsgLock);*/
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0) {
DPRINT_ERR(VMBUS, "Unable to request offers - %d", ret);
diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c
index a30b98d..002e86c 100644
--- a/drivers/staging/hv/connection.c
+++ b/drivers/staging/hv/connection.c
@@ -35,9 +35,9 @@ struct VMBUS_CONNECTION vmbus_connection = {
};
/*
- * VmbusConnect - Sends a connect request on the partition service connection
+ * vmbus_connect - Sends a connect request on the partition service connection
*/
-int VmbusConnect(void)
+int vmbus_connect(void)
{
int ret = 0;
struct vmbus_channel_msginfo *msginfo = NULL;
@@ -126,7 +126,7 @@ int VmbusConnect(void)
msg->interrupt_page, msg->monitor_page1, msg->monitor_page2);
DPRINT_DBG(VMBUS, "Sending channel initiate msg...");
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) {
list_del(&msginfo->msglistentry);
@@ -180,9 +180,10 @@ Cleanup:
}
/*
- * VmbusDisconnect - Sends a disconnect request on the partition service
connection
+ * vmbus_disconnect -
+ * Sends a disconnect request on the partition service connection
*/
-int VmbusDisconnect(void)
+int vmbus_disconnect(void)
{
int ret = 0;
struct vmbus_channel_message_header *msg;
@@ -197,7 +198,7 @@ int VmbusDisconnect(void)
msg->msgtype = CHANNELMSG_UNLOAD;
- ret = VmbusPostMessage(msg,
+ ret = vmbus_post_msg(msg,
sizeof(struct vmbus_channel_message_header));
if (ret != 0)
goto Cleanup;
@@ -217,9 +218,10 @@ Cleanup:
}
/*
- * GetChannelFromRelId - Get the channel object given its child relative id (ie
channel id)
+ * relid2channel - Get the channel object given its
+ * child relative id (ie channel id)
*/
-struct vmbus_channel *GetChannelFromRelId(u32 relid)
+struct vmbus_channel *relid2channel(u32 relid)
{
struct vmbus_channel *channel;
struct vmbus_channel *found_channel = NULL;
@@ -238,9 +240,9 @@ struct vmbus_channel *GetChannelFromRelId(u32 relid)
}
/*
- * VmbusProcessChannelEvent - Process a channel event notification
+ * process_chn_event - Process a channel event notification
*/
-static void VmbusProcessChannelEvent(void *context)
+static void process_chn_event(void *context)
{
struct vmbus_channel *channel;
u32 relid = (u32)(unsigned long)context;
@@ -251,7 +253,7 @@ static void VmbusProcessChannelEvent(void *context)
* Find the channel based on this relid and invokes the
* channel callback to process the event
*/
- channel = GetChannelFromRelId(relid);
+ channel = relid2channel(relid);
if (channel) {
vmbus_onchannel_event(channel);
@@ -266,9 +268,9 @@ static void VmbusProcessChannelEvent(void *context)
}
/*
- * VmbusOnEvents - Handler for events
+ * vmbus_on_event - Handler for events
*/
-void VmbusOnEvents(void)
+void vmbus_on_event(void)
{
int dword;
int maxdword = MAX_NUM_CHANNELS_SUPPORTED >> 5;
@@ -294,7 +296,8 @@ void VmbusOnEvents(void)
} else {
/* QueueWorkItem(VmbusProcessEvent, (void*)relid); */
/* ret = WorkQueueQueueWorkItem(gVmbusConnection.workQueue,
VmbusProcessChannelEvent, (void*)relid); */
- VmbusProcessChannelEvent((void *)(unsigned long)relid);
+ process_chn_event((void *)
+ (unsigned long)relid);
}
}
}
@@ -305,9 +308,9 @@ void VmbusOnEvents(void)
}
/*
- * VmbusPostMessage - Send a msg on the vmbus's message connection
+ * vmbus_post_msg - Send a msg on the vmbus's message connection
*/
-int VmbusPostMessage(void *buffer, size_t buflen)
+int vmbus_post_msg(void *buffer, size_t buflen)
{
union hv_connection_id conn_id;
@@ -317,9 +320,9 @@ int VmbusPostMessage(void *buffer, size_t buflen)
}
/*
- * VmbusSetEvent - Send an event notification to the parent
+ * vmbus_set_event - Send an event notification to the parent
*/
-int VmbusSetEvent(u32 child_relid)
+int vmbus_set_event(u32 child_relid)
{
/* Each u32 represents 32 channels */
set_bit(child_relid & 31,
diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c
index fd0881a..b33f497 100644
--- a/drivers/staging/hv/vmbus_drv.c
+++ b/drivers/staging/hv/vmbus_drv.c
@@ -174,7 +174,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void
*AdditionalInfo)
on_each_cpu(hv_synic_init, (void *)irqvector, 1);
/* Connect to VMBus in the root partition */
- ret = VmbusConnect();
+ ret = vmbus_connect();
/* VmbusSendEvent(device->localPortId+1); */
return ret;
@@ -188,7 +188,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
int ret = 0;
vmbus_release_unattached_channels();
- VmbusDisconnect();
+ vmbus_disconnect();
on_each_cpu(hv_synic_cleanup, NULL, 1);
return ret;
}
@@ -1045,7 +1045,7 @@ static void vmbus_msg_dpc(unsigned long data)
static void vmbus_event_dpc(unsigned long data)
{
/* Call to bus driver to handle interrupt */
- VmbusOnEvents();
+ vmbus_on_event();
}
static irqreturn_t vmbus_isr(int irq, void *dev_id)
diff --git a/drivers/staging/hv/vmbus_private.h
b/drivers/staging/hv/vmbus_private.h
index 9b51ac1..e3b0663 100644
--- a/drivers/staging/hv/vmbus_private.h
+++ b/drivers/staging/hv/vmbus_private.h
@@ -115,20 +115,20 @@ void vmbus_child_device_unregister(struct hv_device
*device_obj);
/* VmbusChildDeviceDestroy( */
/* struct hv_device *); */
-struct vmbus_channel *GetChannelFromRelId(u32 relId);
+struct vmbus_channel *relid2channel(u32 relid);
/* Connection interface */
-int VmbusConnect(void);
+int vmbus_connect(void);
-int VmbusDisconnect(void);
+int vmbus_disconnect(void);
-int VmbusPostMessage(void *buffer, size_t bufSize);
+int vmbus_post_msg(void *buffer, size_t buflen);
-int VmbusSetEvent(u32 childRelId);
+int vmbus_set_event(u32 child_relid);
-void VmbusOnEvents(void);
+void vmbus_on_event(void);
#endif /* _VMBUS_PRIVATE_H_ */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 20:12 UTC
[PATCH 6/8] staging: hv: Convert camel cased struct fields in vmbus_channel_interface.h to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/channel.c | 4 ++--
drivers/staging/hv/channel_mgmt.c | 20 ++++++++++----------
drivers/staging/hv/vmbus_channel_interface.h | 26 +++++++++++++-------------
3 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 960e155..711548f 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -128,9 +128,9 @@ void vmbus_get_debug_info(struct vmbus_channel *channel,
debuginfo->relid = channel->offermsg.child_relid;
debuginfo->state = channel->state;
memcpy(&debuginfo->interfacetype,
- &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid));
+ &channel->offermsg.offer.if_type, sizeof(struct hv_guid));
memcpy(&debuginfo->interface_instance,
- &channel->offermsg.offer.InterfaceInstance,
+ &channel->offermsg.offer.if_instance,
sizeof(struct hv_guid));
monitorpage = (struct hv_monitor_page *)vmbus_connection.MonitorPages;
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index b4a8561..3e229fa 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -364,11 +364,11 @@ static void vmbus_process_offer(struct work_struct *work)
spin_lock_irqsave(&vmbus_connection.channel_lock, flags);
list_for_each_entry(channel, &vmbus_connection.ChannelList, listentry) {
- if (!memcmp(&channel->offermsg.offer.InterfaceType,
- &newchannel->offermsg.offer.InterfaceType,
+ if (!memcmp(&channel->offermsg.offer.if_type,
+ &newchannel->offermsg.offer.if_type,
sizeof(struct hv_guid)) &&
- !memcmp(&channel->offermsg.offer.InterfaceInstance,
- &newchannel->offermsg.offer.InterfaceInstance,
+ !memcmp(&channel->offermsg.offer.if_instance,
+ &newchannel->offermsg.offer.if_instance,
sizeof(struct hv_guid))) {
fnew = false;
break;
@@ -394,8 +394,8 @@ static void vmbus_process_offer(struct work_struct *work)
* vmbus_child_dev_add()
*/
newchannel->device_obj = vmbus_child_device_create(
- &newchannel->offermsg.offer.InterfaceType,
- &newchannel->offermsg.offer.InterfaceInstance,
+ &newchannel->offermsg.offer.if_type,
+ &newchannel->offermsg.offer.if_instance,
newchannel);
DPRINT_DBG(VMBUS, "child device object allocated - %p",
@@ -427,7 +427,7 @@ static void vmbus_process_offer(struct work_struct *work)
/* Open IC channels */
for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) {
- if (memcmp(&newchannel->offermsg.offer.InterfaceType,
+ if (memcmp(&newchannel->offermsg.offer.if_type,
&hv_cb_utils[cnt].data,
sizeof(struct hv_guid)) == 0 &&
vmbus_open(newchannel, 2 * PAGE_SIZE,
@@ -461,7 +461,7 @@ static void vmbus_onoffer(struct
vmbus_channel_message_header *hdr)
offer = (struct vmbus_channel_offer_channel *)hdr;
for (i = 0; i < MAX_NUM_DEVICE_CLASSES_SUPPORTED; i++) {
- if (memcmp(&offer->offer.InterfaceType,
+ if (memcmp(&offer->offer.if_type,
&gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) {
fsupported = 1;
break;
@@ -474,8 +474,8 @@ static void vmbus_onoffer(struct
vmbus_channel_message_header *hdr)
return;
}
- guidtype = &offer->offer.InterfaceType;
- guidinstance = &offer->offer.InterfaceInstance;
+ guidtype = &offer->offer.if_type;
+ guidinstance = &offer->offer.if_instance;
DPRINT_INFO(VMBUS, "Channel offer notification - "
"child relid %d monitor id %d allocated %d, "
diff --git a/drivers/staging/hv/vmbus_channel_interface.h
b/drivers/staging/hv/vmbus_channel_interface.h
index 2674282..fbfad5e 100644
--- a/drivers/staging/hv/vmbus_channel_interface.h
+++ b/drivers/staging/hv/vmbus_channel_interface.h
@@ -48,19 +48,19 @@
* struct contains the fundamental information about an offer.
*/
struct vmbus_channel_offer {
- struct hv_guid InterfaceType;
- struct hv_guid InterfaceInstance;
- u64 InterruptLatencyIn100nsUnits;
- u32 InterfaceRevision;
- u32 ServerContextAreaSize; /* in bytes */
- u16 ChannelFlags;
- u16 MmioMegabytes; /* in bytes * 1024 * 1024 */
+ struct hv_guid if_type;
+ struct hv_guid if_instance;
+ u64 int_latency; /* in 100ns units */
+ u32 if_revision;
+ u32 server_ctx_size; /* in bytes */
+ u16 chn_flags;
+ u16 mmio_megabytes; /* in bytes * 1024 * 1024 */
union {
/* Non-pipes: The user has MAX_USER_DEFINED_BYTES bytes. */
struct {
- unsigned char UserDefined[MAX_USER_DEFINED_BYTES];
- } Standard;
+ unsigned char user_def[MAX_USER_DEFINED_BYTES];
+ } std;
/*
* Pipes:
@@ -70,11 +70,11 @@ struct vmbus_channel_offer {
* use.
*/
struct {
- u32 PipeMode;
- unsigned char UserDefined[MAX_PIPE_USER_DEFINED_BYTES];
- } Pipe;
+ u32 pipe_mode;
+ unsigned char user_def[MAX_PIPE_USER_DEFINED_BYTES];
+ } pipe;
} u;
- u32 Padding;
+ u32 padding;
} __attribute__((packed));
/* Server Flags */
--
1.6.3.2
Haiyang Zhang
2011-Jan-26 20:12 UTC
[PATCH 7/8] staging: hv: Convert camel cased struct fields in vmbus_packet_format.h to lower cases
Signed-off-by: Haiyang Zhang <haiyangz at microsoft.com>
Signed-off-by: Hank Janssen <hjanssen at microsoft.com>
---
drivers/staging/hv/blkvsc_drv.c | 2 +-
drivers/staging/hv/channel.c | 56 +++++++-------
drivers/staging/hv/channel_mgmt.c | 2 +-
drivers/staging/hv/hv_kvp.c | 4 +-
drivers/staging/hv/hv_util.c | 6 +-
drivers/staging/hv/netvsc.c | 68 +++++++++---------
drivers/staging/hv/storvsc.c | 12 ++--
drivers/staging/hv/vmbus_packet_format.h | 118 +++++++++++++++---------------
8 files changed, 134 insertions(+), 134 deletions(-)
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c
index cabadf0..58bbcd6 100644
--- a/drivers/staging/hv/blkvsc_drv.c
+++ b/drivers/staging/hv/blkvsc_drv.c
@@ -873,7 +873,7 @@ static int blkvsc_submit_request(struct blkvsc_request
*blkvsc_req,
DPRINT_DBG(BLKVSC_DRV, "blkvsc_submit_request() - "
"req %p pfn[%d] %llx\n",
blkvsc_req, i,
- blkvsc_req->request.data_buffer.PfnArray[i]);
+ blkvsc_req->request.data_buffer.pfn_array[i]);
}
#endif
diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c
index 711548f..a8f5c38 100644
--- a/drivers/staging/hv/channel.c
+++ b/drivers/staging/hv/channel.c
@@ -338,16 +338,16 @@ static void dump_gpadl_header(struct
vmbus_channel_gpadl_header *gpadl)
"gpadl header - relid %d, range count %d, range buflen %d",
gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen);
for (i = 0; i < gpadl->rangecount; i++) {
- pagecount = gpadl->range[i].ByteCount >> PAGE_SHIFT;
+ pagecount = gpadl->range[i].byte_count >> PAGE_SHIFT;
pagecount = (pagecount > 26) ? 26 : pagecount;
DPRINT_DBG(VMBUS, "gpadl range %d - len %d offset %d "
- "page count %d", i, gpadl->range[i].ByteCount,
- gpadl->range[i].ByteOffset, pagecount);
+ "page count %d", i, gpadl->range[i].byte_count,
+ gpadl->range[i].byte_offset, pagecount);
for (j = 0; j < pagecount; j++)
DPRINT_DBG(VMBUS, "%d) pfn %llu", j,
- gpadl->range[i].PfnArray[j]);
+ gpadl->range[i].pfn_array[j]);
}
}
@@ -399,10 +399,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->rangecount = 1;
gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64);
- gpadl_header->range[0].ByteOffset = 0;
- gpadl_header->range[0].ByteCount = size;
+ gpadl_header->range[0].byte_offset = 0;
+ gpadl_header->range[0].byte_count = size;
for (i = 0; i < pfncount; i++)
- gpadl_header->range[0].PfnArray[i] = pfn+i;
+ gpadl_header->range[0].pfn_array[i] = pfn+i;
*msginfo = msgheader;
*messagecount = 1;
@@ -463,10 +463,10 @@ static int create_gpadl_header(void *kbuffer, u32 size,
gpadl_header->rangecount = 1;
gpadl_header->range_buflen = sizeof(struct gpa_range) +
pagecount * sizeof(u64);
- gpadl_header->range[0].ByteOffset = 0;
- gpadl_header->range[0].ByteCount = size;
+ gpadl_header->range[0].byte_offset = 0;
+ gpadl_header->range[0].byte_count = size;
for (i = 0; i < pagecount; i++)
- gpadl_header->range[0].PfnArray[i] = pfn+i;
+ gpadl_header->range[0].pfn_array[i] = pfn+i;
*msginfo = msgheader;
*messagecount = 1;
@@ -739,12 +739,12 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const
void *buffer,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.Type = type; /* VmbusPacketTypeDataInBand; */
- desc.Flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
+ desc.type = type; /* VmbusPacketTypeDataInBand; */
+ desc.flags = flags; /* VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; */
/* in 8-bytes granularity */
- desc.DataOffset8 = sizeof(struct vmpacket_descriptor) >> 3;
- desc.Length8 = (u16)(packetlen_aligned >> 3);
- desc.TransactionId = requestid;
+ desc.offset8 = sizeof(struct vmpacket_descriptor) >> 3;
+ desc.len8 = (u16)(packetlen_aligned >> 3);
+ desc.trans_id = requestid;
sg_init_table(bufferlist, 3);
sg_set_buf(&bufferlist[0], &desc, sizeof(struct vmpacket_descriptor));
@@ -798,7 +798,7 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel
*channel,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.type = VmbusPacketTypeDataUsingGpaDirect;
+ desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
desc.length8 = (u16)(packetlen_aligned >> 3);
@@ -867,7 +867,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel
*channel,
/* ASSERT((packetLenAligned - packetLen) < sizeof(u64)); */
/* Setup the descriptor */
- desc.type = VmbusPacketTypeDataUsingGpaDirect;
+ desc.type = VM_PKT_DATA_USING_GPA_DIRECT;
desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED;
desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */
desc.length8 = (u16)(packetlen_aligned >> 3);
@@ -934,14 +934,14 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void
*buffer,
/* VmbusChannelClearEvent(Channel); */
- packetlen = desc.Length8 << 3;
- userlen = packetlen - (desc.DataOffset8 << 3);
+ packetlen = desc.len8 << 3;
+ userlen = packetlen - (desc.offset8 << 3);
/* ASSERT(userLen > 0); */
DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d
"
"flag %d tid %llx pktlen %d datalen %d> ",
- channel, channel->offermsg.child_relid, desc.Type,
- desc.Flags, desc.TransactionId, packetlen, userlen);
+ channel, channel->offermsg.child_relid, desc.type,
+ desc.flags, desc.trans_id, packetlen, userlen);
*buffer_actual_len = userlen;
@@ -953,11 +953,11 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void
*buffer,
return -1;
}
- *requestid = desc.TransactionId;
+ *requestid = desc.trans_id;
/* Copy over the packet to the user buffer */
ret = ringbuffer_read(&channel->inbound, buffer, userlen,
- (desc.DataOffset8 << 3));
+ (desc.offset8 << 3));
spin_unlock_irqrestore(&channel->inbound_lock, flags);
@@ -994,13 +994,13 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel,
void *buffer,
/* VmbusChannelClearEvent(Channel); */
- packetlen = desc.Length8 << 3;
- userlen = packetlen - (desc.DataOffset8 << 3);
+ packetlen = desc.len8 << 3;
+ userlen = packetlen - (desc.offset8 << 3);
DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d
"
"flag %d tid %llx pktlen %d datalen %d> ",
- channel, channel->offermsg.child_relid, desc.Type,
- desc.Flags, desc.TransactionId, packetlen, userlen);
+ channel, channel->offermsg.child_relid, desc.type,
+ desc.flags, desc.trans_id, packetlen, userlen);
*buffer_actual_len = packetlen;
@@ -1012,7 +1012,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel,
void *buffer,
return -2;
}
- *requestid = desc.TransactionId;
+ *requestid = desc.trans_id;
/* Copy over the entire packet to the user buffer */
ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0);
diff --git a/drivers/staging/hv/channel_mgmt.c
b/drivers/staging/hv/channel_mgmt.c
index 3e229fa..78c4f10 100644
--- a/drivers/staging/hv/channel_mgmt.c
+++ b/drivers/staging/hv/channel_mgmt.c
@@ -194,7 +194,7 @@ void chn_cb_negotiate(void *context)
vmbus_sendpacket(channel, buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
kfree(buf);
diff --git a/drivers/staging/hv/hv_kvp.c b/drivers/staging/hv/hv_kvp.c
index 5458631..bc1c20e 100644
--- a/drivers/staging/hv/hv_kvp.c
+++ b/drivers/staging/hv/hv_kvp.c
@@ -224,7 +224,7 @@ response_done:
icmsghdrp->icflags = ICMSGHDRFLAG_TRANSACTION | ICMSGHDRFLAG_RESPONSE;
vmbus_sendpacket(channel, recv_buffer, buf_len, req_id,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
kvp_transaction.active = false;
}
@@ -318,7 +318,7 @@ callback_done:
vmbus_sendpacket(channel, recv_buffer,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
diff --git a/drivers/staging/hv/hv_util.c b/drivers/staging/hv/hv_util.c
index dea0513..43c7ec0 100644
--- a/drivers/staging/hv/hv_util.c
+++ b/drivers/staging/hv/hv_util.c
@@ -97,7 +97,7 @@ static void shutdown_onchannelcallback(void *context)
vmbus_sendpacket(channel, shut_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
if (execute_shutdown == true)
@@ -179,7 +179,7 @@ static void timesync_onchannelcallback(void *context)
vmbus_sendpacket(channel, time_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
@@ -225,7 +225,7 @@ static void heartbeat_onchannelcallback(void *context)
vmbus_sendpacket(channel, hbeat_txf_buf,
recvlen, requestid,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
}
}
diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c
index 2d46528..4319363 100644
--- a/drivers/staging/hv/netvsc.c
+++ b/drivers/staging/hv/netvsc.c
@@ -270,7 +270,7 @@ static int netvsc_init_recv_buf(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(NETVSC,
@@ -404,7 +404,7 @@ static int netvsc_init_send_buf(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(NETVSC,
@@ -466,7 +466,7 @@ static int netvsc_destroy_recv_buf(struct netvsc_device
*net_device)
revoke_packet,
sizeof(struct nvsp_message),
(unsigned long)revoke_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
/*
* If we failed here, we might as well return and
* have a leak rather than continue and a bugchk
@@ -540,7 +540,7 @@ static int netvsc_destroy_send_buf(struct netvsc_device
*net_device)
revoke_packet,
sizeof(struct nvsp_message),
(unsigned long)revoke_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
/*
* If we failed here, we might as well return and have a leak
* rather than continue and a bugchk
@@ -612,7 +612,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -666,7 +666,7 @@ static int netvsc_connect_vsp(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, init_packet,
sizeof(struct nvsp_message),
(unsigned long)init_packet,
- VmbusPacketTypeDataInBand, 0);
+ VM_PKT_DATA_INBAND, 0);
if (ret != 0) {
DPRINT_ERR(NETVSC,
"unable to send NvspMessage1TypeSendNdisVersion");
@@ -872,7 +872,7 @@ static void netvsc_send_completion(struct hv_device *device,
}
nvsp_packet = (struct nvsp_message *)((unsigned long)packet +
- (packet->DataOffset8 << 3));
+ (packet->offset8 << 3));
DPRINT_DBG(NETVSC, "send completion packet - type %d",
nvsp_packet->hdr.msg_type);
@@ -890,7 +890,7 @@ static void netvsc_send_completion(struct hv_device *device,
NVSP_MSG1_TYPE_SEND_RNDIS_PKT_COMPLETE) {
/* Get the send context */
nvsc_packet = (struct hv_netvsc_packet *)(unsigned long)
- packet->TransactionId;
+ packet->trans_id;
/* ASSERT(nvscPacket); */
/* Notify the layer above us */
@@ -946,7 +946,7 @@ static int netvsc_send(struct hv_device *device,
ret = vmbus_sendpacket(device->channel, &sendMessage,
sizeof(struct nvsp_message),
(unsigned long)packet,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
@@ -987,15 +987,15 @@ static void netvsc_receive(struct hv_device *device,
* All inbound packets other than send completion should be xfer page
* packet
*/
- if (packet->Type != VmbusPacketTypeDataUsingTransferPages) {
+ if (packet->type != VM_PKT_DATA_USING_XFER_PAGES) {
DPRINT_ERR(NETVSC, "Unknown packet type received - %d",
- packet->Type);
+ packet->type);
put_net_device(device);
return;
}
nvsp_packet = (struct nvsp_message *)((unsigned long)packet +
- (packet->DataOffset8 << 3));
+ (packet->offset8 << 3));
/* Make sure this is a valid nvsp packet */
if (nvsp_packet->hdr.msg_type !@@ -1011,16 +1011,16 @@ static void
netvsc_receive(struct hv_device *device,
vmxferpage_packet = (struct vmtransfer_page_packet_header *)packet;
- if (vmxferpage_packet->TransferPageSetId != NETVSC_RECEIVE_BUFFER_ID) {
+ if (vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID) {
DPRINT_ERR(NETVSC, "Invalid xfer page set id - "
"expecting %x got %x", NETVSC_RECEIVE_BUFFER_ID,
- vmxferpage_packet->TransferPageSetId);
+ vmxferpage_packet->xfer_pageset_id);
put_net_device(device);
return;
}
DPRINT_DBG(NETVSC, "xfer page - range count %d",
- vmxferpage_packet->RangeCount);
+ vmxferpage_packet->range_cnt);
/*
* Grab free packets (range count + 1) to represent this xfer
@@ -1031,7 +1031,7 @@ static void netvsc_receive(struct hv_device *device,
spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
while (!list_empty(&net_device->recv_pkt_list)) {
list_move_tail(net_device->recv_pkt_list.next, &listHead);
- if (++count == vmxferpage_packet->RangeCount + 1)
+ if (++count == vmxferpage_packet->range_cnt + 1)
break;
}
spin_unlock_irqrestore(&net_device->recv_pkt_list_lock, flags);
@@ -1044,7 +1044,7 @@ static void netvsc_receive(struct hv_device *device,
if (count < 2) {
DPRINT_ERR(NETVSC, "Got only %d netvsc pkt...needed %d pkts. "
"Dropping this xfer page packet completely!",
- count, vmxferpage_packet->RangeCount + 1);
+ count, vmxferpage_packet->range_cnt + 1);
/* Return it to the freelist */
spin_lock_irqsave(&net_device->recv_pkt_list_lock, flags);
@@ -1056,7 +1056,7 @@ static void netvsc_receive(struct hv_device *device,
flags);
netvsc_send_recv_completion(device,
- vmxferpage_packet->d.TransactionId);
+ vmxferpage_packet->d.trans_id);
put_net_device(device);
return;
@@ -1071,9 +1071,9 @@ static void netvsc_receive(struct hv_device *device,
/* ASSERT(xferpagePacket->Count > 0 && xferpagePacket->Count
<= */
/* vmxferpagePacket->RangeCount); */
- if (xferpage_packet->count != vmxferpage_packet->RangeCount) {
+ if (xferpage_packet->count != vmxferpage_packet->range_cnt) {
DPRINT_INFO(NETVSC, "Needed %d netvsc pkts to satisy this xfer "
- "page...got %d", vmxferpage_packet->RangeCount,
+ "page...got %d", vmxferpage_packet->range_cnt,
xferpage_packet->count);
}
@@ -1091,10 +1091,10 @@ static void netvsc_receive(struct hv_device *device,
netvsc_packet->device = device;
/* Save this so that we can send it back */
netvsc_packet->completion.recv.recv_completion_tid -
vmxferpage_packet->d.TransactionId;
+ vmxferpage_packet->d.trans_id;
netvsc_packet->total_data_buflen -
vmxferpage_packet->Ranges[i].ByteCount;
+ vmxferpage_packet->ranges[i].byte_count;
netvsc_packet->page_buf_cnt = 1;
/* ASSERT(vmxferpagePacket->Ranges[i].ByteOffset + */
@@ -1102,20 +1102,20 @@ static void netvsc_receive(struct hv_device *device,
/* netDevice->ReceiveBufferSize); */
netvsc_packet->page_buf[0].len -
vmxferpage_packet->Ranges[i].ByteCount;
+ vmxferpage_packet->ranges[i].byte_count;
start = virt_to_phys((void *)((unsigned long)net_device->
- recv_buf + vmxferpage_packet->Ranges[i].ByteOffset));
+ recv_buf + vmxferpage_packet->ranges[i].byte_offset));
netvsc_packet->page_buf[0].pfn = start >> PAGE_SHIFT;
end_virtual = (unsigned long)net_device->recv_buf
- + vmxferpage_packet->Ranges[i].ByteOffset
- + vmxferpage_packet->Ranges[i].ByteCount - 1;
+ + vmxferpage_packet->ranges[i].byte_offset
+ + vmxferpage_packet->ranges[i].byte_count - 1;
end = virt_to_phys((void *)end_virtual);
/* Calculate the page relative offset */
netvsc_packet->page_buf[0].offset -
vmxferpage_packet->Ranges[i].ByteOffset &
+ vmxferpage_packet->ranges[i].byte_offset &
(PAGE_SIZE - 1);
if ((end >> PAGE_SHIFT) != (start >> PAGE_SHIFT)) {
/* Handle frame across multiple pages: */
@@ -1147,8 +1147,8 @@ static void netvsc_receive(struct hv_device *device,
}
DPRINT_DBG(NETVSC, "[%d] - (abs offset %u len %u) => "
"(pfn %llx, offset %u, len %u)", i,
- vmxferpage_packet->Ranges[i].ByteOffset,
- vmxferpage_packet->Ranges[i].ByteCount,
+ vmxferpage_packet->ranges[i].byte_offset,
+ vmxferpage_packet->ranges[i].byte_count,
netvsc_packet->page_buf[0].pfn,
netvsc_packet->page_buf[0].offset,
netvsc_packet->page_buf[0].len);
@@ -1187,7 +1187,7 @@ retry_send_cmplt:
/* Send the completion */
ret = vmbus_sendpacket(device->channel, &recvcompMessage,
sizeof(struct nvsp_message), transaction_id,
- VmbusPacketTypeCompletion, 0);
+ VM_PKT_COMP, 0);
if (ret == 0) {
/* success */
/* no-op */
@@ -1300,12 +1300,12 @@ static void netvsc_channel_cb(void *context)
bytes_recvd, request_id);
desc = (struct vmpacket_descriptor *)buffer;
- switch (desc->Type) {
- case VmbusPacketTypeCompletion:
+ switch (desc->type) {
+ case VM_PKT_COMP:
netvsc_send_completion(device, desc);
break;
- case VmbusPacketTypeDataUsingTransferPages:
+ case VM_PKT_DATA_USING_XFER_PAGES:
netvsc_receive(device, desc);
break;
@@ -1313,7 +1313,7 @@ static void netvsc_channel_cb(void *context)
DPRINT_ERR(NETVSC,
"unhandled packet type %d, "
"tid %llx len %d\n",
- desc->Type, request_id,
+ desc->type, request_id,
bytes_recvd);
break;
}
diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c
index b80b1e9..a612109 100644
--- a/drivers/staging/hv/storvsc.c
+++ b/drivers/staging/hv/storvsc.c
@@ -218,7 +218,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC,
@@ -249,7 +249,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC,
@@ -280,7 +280,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -317,7 +317,7 @@ static int stor_vsc_channel_init(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
@@ -642,7 +642,7 @@ int stor_vsc_on_host_reset(struct hv_device *device)
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)&stor_device->reset_request,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0) {
DPRINT_ERR(STORVSC, "Unable to send reset packet %p ret %d",
@@ -744,7 +744,7 @@ static int stor_vsc_on_io_request(struct hv_device *device,
ret = vmbus_sendpacket(device->channel, vstor_packet,
sizeof(struct vstor_packet),
(unsigned long)request_extension,
- VmbusPacketTypeDataInBand,
+ VM_PKT_DATA_INBAND,
VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
}
diff --git a/drivers/staging/hv/vmbus_packet_format.h
b/drivers/staging/hv/vmbus_packet_format.h
index f9f6b4b..5cb13e5 100644
--- a/drivers/staging/hv/vmbus_packet_format.h
+++ b/drivers/staging/hv/vmbus_packet_format.h
@@ -25,43 +25,43 @@
#define _VMBUSPACKETFORMAT_H_
struct vmpacket_descriptor {
- u16 Type;
- u16 DataOffset8;
- u16 Length8;
- u16 Flags;
- u64 TransactionId;
+ u16 type;
+ u16 offset8;
+ u16 len8;
+ u16 flags;
+ u64 trans_id;
} __attribute__((packed));
struct vmpacket_header {
- u32 PreviousPacketStartOffset;
- struct vmpacket_descriptor Descriptor;
+ u32 prev_pkt_start_offset;
+ struct vmpacket_descriptor descriptor;
} __attribute__((packed));
struct vmtransfer_page_range {
- u32 ByteCount;
- u32 ByteOffset;
+ u32 byte_count;
+ u32 byte_offset;
} __attribute__((packed));
struct vmtransfer_page_packet_header {
struct vmpacket_descriptor d;
- u16 TransferPageSetId;
- bool SenderOwnsSet;
- u8 Reserved;
- u32 RangeCount;
- struct vmtransfer_page_range Ranges[1];
+ u16 xfer_pageset_id;
+ bool sender_owns_set;
+ u8 reserved;
+ u32 range_cnt;
+ struct vmtransfer_page_range ranges[1];
} __attribute__((packed));
struct vmgpadl_packet_header {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 Reserved;
+ u32 gpadl;
+ u32 reserved;
} __attribute__((packed));
struct vmadd_remove_transfer_page_set {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u16 TransferPageSetId;
- u16 Reserved;
+ u32 gpadl;
+ u16 xfer_pageset_id;
+ u16 reserved;
} __attribute__((packed));
/*
@@ -69,9 +69,9 @@ struct vmadd_remove_transfer_page_set {
* look virtually contiguous.
*/
struct gpa_range {
- u32 ByteCount;
- u32 ByteOffset;
- u64 PfnArray[0];
+ u32 byte_count;
+ u32 byte_offset;
+ u64 pfn_array[0];
};
/*
@@ -83,9 +83,9 @@ struct gpa_range {
*/
struct vmestablish_gpadl {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 RangeCount;
- struct gpa_range Range[1];
+ u32 gpadl;
+ u32 range_cnt;
+ struct gpa_range range[1];
} __attribute__((packed));
/*
@@ -94,8 +94,8 @@ struct vmestablish_gpadl {
*/
struct vmteardown_gpadl {
struct vmpacket_descriptor d;
- u32 Gpadl;
- u32 Reserved; /* for alignment to a 8-byte boundary */
+ u32 gpadl;
+ u32 reserved; /* for alignment to a 8-byte boundary */
} __attribute__((packed));
/*
@@ -104,56 +104,56 @@ struct vmteardown_gpadl {
*/
struct vmdata_gpa_direct {
struct vmpacket_descriptor d;
- u32 Reserved;
- u32 RangeCount;
- struct gpa_range Range[1];
+ u32 reserved;
+ u32 range_cnt;
+ struct gpa_range range[1];
} __attribute__((packed));
/* This is the format for a Additional Data Packet. */
struct vmadditional_data {
struct vmpacket_descriptor d;
- u64 TotalBytes;
- u32 ByteOffset;
- u32 ByteCount;
- unsigned char Data[1];
+ u64 total_bytes;
+ u32 offset;
+ u32 byte_cnt;
+ unsigned char data[1];
} __attribute__((packed));
union vmpacket_largest_possible_header {
- struct vmpacket_descriptor SimpleHeader;
- struct vmtransfer_page_packet_header TransferPageHeader;
- struct vmgpadl_packet_header GpadlHeader;
- struct vmadd_remove_transfer_page_set AddRemoveTransferPageHeader;
- struct vmestablish_gpadl EstablishGpadlHeader;
- struct vmteardown_gpadl TeardownGpadlHeader;
- struct vmdata_gpa_direct DataGpaDirectHeader;
+ struct vmpacket_descriptor simple_hdr;
+ struct vmtransfer_page_packet_header xfer_page_hdr;
+ struct vmgpadl_packet_header gpadl_hdr;
+ struct vmadd_remove_transfer_page_set add_rm_xfer_page_hdr;
+ struct vmestablish_gpadl establish_gpadl_hdr;
+ struct vmteardown_gpadl teardown_gpadl_hdr;
+ struct vmdata_gpa_direct data_gpa_direct_hdr;
};
#define VMPACKET_DATA_START_ADDRESS(__packet) \
(void *)(((unsigned char *)__packet) + \
- ((struct vmpacket_descriptor)__packet)->DataOffset8 * 8)
+ ((struct vmpacket_descriptor)__packet)->offset8 * 8)
#define VMPACKET_DATA_LENGTH(__packet) \
- ((((struct vmpacket_descriptor)__packet)->Length8 - \
- ((struct vmpacket_descriptor)__packet)->DataOffset8) * 8)
+ ((((struct vmpacket_descriptor)__packet)->len8 - \
+ ((struct vmpacket_descriptor)__packet)->offset8) * 8)
#define VMPACKET_TRANSFER_MODE(__packet) \
- (((struct IMPACT)__packet)->Type)
+ (((struct IMPACT)__packet)->type)
enum vmbus_packet_type {
- VmbusPacketTypeInvalid = 0x0,
- VmbusPacketTypeSynch = 0x1,
- VmbusPacketTypeAddTransferPageSet = 0x2,
- VmbusPacketTypeRemoveTransferPageSet = 0x3,
- VmbusPacketTypeEstablishGpadl = 0x4,
- VmbusPacketTypeTearDownGpadl = 0x5,
- VmbusPacketTypeDataInBand = 0x6,
- VmbusPacketTypeDataUsingTransferPages = 0x7,
- VmbusPacketTypeDataUsingGpadl = 0x8,
- VmbusPacketTypeDataUsingGpaDirect = 0x9,
- VmbusPacketTypeCancelRequest = 0xa,
- VmbusPacketTypeCompletion = 0xb,
- VmbusPacketTypeDataUsingAdditionalPackets = 0xc,
- VmbusPacketTypeAdditionalData = 0xd
+ VM_PKT_INVALID = 0x0,
+ VM_PKT_SYNCH = 0x1,
+ VM_PKT_ADD_XFER_PAGESET = 0x2,
+ VM_PKT_RM_XFER_PAGESET = 0x3,
+ VM_PKT_ESTABLISH_GPADL = 0x4,
+ VM_PKT_TEARDOWN_GPADL = 0x5,
+ VM_PKT_DATA_INBAND = 0x6,
+ VM_PKT_DATA_USING_XFER_PAGES = 0x7,
+ VM_PKT_DATA_USING_GPADL = 0x8,
+ VM_PKT_DATA_USING_GPA_DIRECT = 0x9,
+ VM_PKT_CANCEL_REQUEST = 0xa,
+ VM_PKT_COMP = 0xb,
+ VM_PKT_DATA_USING_ADDITIONAL_PKT = 0xc,
+ VM_PKT_ADDITIONAL_DATA = 0xd
};
#define VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED 1
--
1.6.3.2
Possibly Parallel Threads
- [PATCH 1/8] staging: hv: Convert camel cased variables in connection.c to lower cases
- [PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
- [PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
- [PATCH 1/1] Rename camel case variables in channel.c (updated)
- [PATCH 1/1] Rename camel case variables in channel.c (updated)