Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in channel_mgmt.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 | 302 ++++++++++++++++++------------------ drivers/staging/hv/channel_mgmt.c | 186 ++++++++++++------------ drivers/staging/hv/channel_mgmt.h | 244 +++++++++++++++--------------- drivers/staging/hv/connection.c | 38 +++--- drivers/staging/hv/hv_utils.c | 12 +- drivers/staging/hv/vmbus_drv.c | 42 +++--- 6 files changed, 412 insertions(+), 412 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 26ebc77..9fa0fe1 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -74,21 +74,21 @@ static void vmbus_setevent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorpage; - if (channel->OfferMsg.MonitorAllocated) { + if (channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - set_bit(channel->OfferMsg.ChildRelId & 31, + set_bit(channel->offermsg.child_relid & 31, (unsigned long *) gVmbusConnection.SendInterruptPage + - (channel->OfferMsg.ChildRelId >> 5)); + (channel->offermsg.child_relid >> 5)); monitorpage = gVmbusConnection.MonitorPages; monitorpage++; /* Get the child to parent monitor page */ - set_bit(channel->MonitorBit, + set_bit(channel->monitor_bit, (unsigned long *)&monitorpage->TriggerGroup - [channel->MonitorGroup].Pending); + [channel->monitor_grp].Pending); } else { - VmbusSetEvent(channel->OfferMsg.ChildRelId); + VmbusSetEvent(channel->offermsg.child_relid); } } @@ -97,19 +97,19 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorPage; - if (Channel->OfferMsg.MonitorAllocated) { + if (Channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - clear_bit(Channel->OfferMsg.ChildRelId & 31, + clear_bit(Channel->offermsg.child_relid & 31, (unsigned long *)gVmbusConnection.SendInterruptPage + - (Channel->OfferMsg.ChildRelId >> 5)); + (Channel->offermsg.child_relid >> 5)); monitorPage (struct hv_monitor_page *)gVmbusConnection.MonitorPages; monitorPage++; /* Get the child to parent monitor page */ - clear_bit(Channel->MonitorBit, + clear_bit(Channel->monitor_bit, (unsigned long *)&monitorPage->TriggerGroup - [Channel->MonitorGroup].Pending); + [Channel->monitor_grp].Pending); } } @@ -121,42 +121,42 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, struct vmbus_channel_debug_info *debuginfo) { struct hv_monitor_page *monitorpage; - u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32; - u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32; + u8 monitor_group = (u8)channel->offermsg.monitorid / 32; + u8 monitor_offset = (u8)channel->offermsg.monitorid % 32; /* u32 monitorBit = 1 << monitorOffset; */ - debuginfo->RelId = channel->OfferMsg.ChildRelId; - debuginfo->State = channel->State; - memcpy(&debuginfo->InterfaceType, - &channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); - memcpy(&debuginfo->InterfaceInstance, - &channel->OfferMsg.Offer.InterfaceInstance, + debuginfo->relid = channel->offermsg.child_relid; + debuginfo->state = channel->state; + memcpy(&debuginfo->interfacetype, + &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)); + memcpy(&debuginfo->interface_instance, + &channel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid)); monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; - debuginfo->MonitorId = channel->OfferMsg.MonitorId; + debuginfo->monitorid = channel->offermsg.monitorid; - debuginfo->ServerMonitorPending + debuginfo->servermonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ServerMonitorLatency + debuginfo->servermonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ServerMonitorConnectionId + debuginfo->servermonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; monitorpage++; - debuginfo->ClientMonitorPending + debuginfo->clientmonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ClientMonitorLatency + debuginfo->clientmonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ClientMonitorConnectionId + debuginfo->clientmonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; - RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound); - RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound); + RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); + RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); } /* @@ -176,8 +176,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */ /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */ - newchannel->OnChannelCallback = onchannelcallback; - newchannel->ChannelCallbackContext = context; + newchannel->onchannel_callback = onchannelcallback; + newchannel->channel_callback_context = context; /* Allocate the ring buffer */ out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) @@ -189,17 +189,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, in = (void *)((unsigned long)out + send_ringbuffer_size); - newchannel->RingBufferPages = out; - newchannel->RingBufferPageCount = (send_ringbuffer_size + + newchannel->ringbuffer_pages = out; + newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size); + ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size); + ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -210,13 +210,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...", newchannel); - newchannel->RingBufferGpadlHandle = 0; + newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->Outbound.RingBuffer, + newchannel->outbound.RingBuffer, send_ringbuffer_size + recv_ringbuffer_size, - &newchannel->RingBufferGpadlHandle); + &newchannel->ringbuffer_gpadlhandle); if (ret != 0) { err = ret; @@ -225,12 +225,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p " "size %d recv ring %p size %d, downstreamoffset %d>", - newchannel, newchannel->OfferMsg.ChildRelId, - newchannel->RingBufferGpadlHandle, - newchannel->Outbound.RingBuffer, - newchannel->Outbound.RingSize, - newchannel->Inbound.RingBuffer, - newchannel->Inbound.RingSize, + newchannel, newchannel->offermsg.child_relid, + newchannel->ringbuffer_gpadlhandle, + newchannel->outbound.RingBuffer, + newchannel->outbound.RingSize, + newchannel->inbound.RingBuffer, + newchannel->inbound.RingSize, send_ringbuffer_size); /* Create and init the channel open message */ @@ -242,20 +242,20 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->WaitEvent = osd_WaitEventCreate(); - if (!openInfo->WaitEvent) { + openInfo->waitevent = osd_WaitEventCreate(); + if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; } - openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg; - openMsg->Header.MessageType = ChannelMessageOpenChannel; - openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */ - openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId; - openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle; - openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >> + openMsg = (struct vmbus_channel_open_channel *)openInfo->msg; + openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL; + openMsg->openid = newchannel->offermsg.child_relid; /* FIXME */ + openMsg->child_relid = newchannel->offermsg.child_relid; + openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; + openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >> PAGE_SHIFT; - openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ + openMsg->server_contextarea_gpadlhandle = 0; /* TODO */ if (userdatalen > MAX_USER_DEFINED_BYTES) { err = -EINVAL; @@ -263,10 +263,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } if (userdatalen) - memcpy(openMsg->UserData, userdata, userdatalen); + memcpy(openMsg->userdata, userdata, userdatalen); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&openInfo->MsgListEntry, + list_add_tail(&openInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -280,26 +280,26 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->WaitEvent); + osd_WaitEventWait(openInfo->waitevent); - if (openInfo->Response.OpenResult.Status == 0) + if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); else DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!", - newchannel, openInfo->Response.OpenResult.Status); + newchannel, openInfo->response.open_result.status); Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&openInfo->MsgListEntry); + list_del(&openInfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(openInfo->WaitEvent); + kfree(openInfo->waitevent); kfree(openInfo); return 0; errorout: - RingBufferCleanup(&newchannel->Outbound); - RingBufferCleanup(&newchannel->Inbound); + RingBufferCleanup(&newchannel->outbound); + RingBufferCleanup(&newchannel->inbound); osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -322,7 +322,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) for (i = 0; i < pfncount; i++) DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu", - i, gpadl->Pfn[i]); + i, gpadl->pfn[i]); } /* @@ -336,18 +336,18 @@ static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl) DPRINT_DBG(VMBUS, "gpadl header - relid %d, range count %d, range buflen %d", - gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen); - for (i = 0; i < gpadl->RangeCount; i++) { - pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT; + gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen); + for (i = 0; i < gpadl->rangecount; i++) { + pagecount = gpadl->range[i].ByteCount >> 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].ByteCount, + gpadl->range[i].ByteOffset, pagecount); for (j = 0; j < pagecount; j++) DPRINT_DBG(VMBUS, "%d) pfn %llu", j, - gpadl->Range[i].PfnArray[j]); + gpadl->range[i].PfnArray[j]); } } @@ -391,18 +391,18 @@ static int create_gpadl_header(void *kbuffer, u32 size, if (!msgheader) goto nomem; - INIT_LIST_HEAD(&msgheader->SubMsgList); - msgheader->MessageSize = msgsize; + INIT_LIST_HEAD(&msgheader->submsglist); + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pfncount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -428,10 +428,10 @@ static int create_gpadl_header(void *kbuffer, u32 size, /* FIXME: we probably need to more if this fails */ if (!msgbody) goto nomem; - msgbody->MessageSize = msgsize; + msgbody->msgsize = msgsize; (*messagecount)++; gpadl_body - (struct vmbus_channel_gpadl_body *)msgbody->Msg; + (struct vmbus_channel_gpadl_body *)msgbody->msg; /* * FIXME: @@ -440,11 +440,11 @@ static int create_gpadl_header(void *kbuffer, u32 size, */ /* gpadl_body->Gpadl = kbuffer; */ for (i = 0; i < pfncurr; i++) - gpadl_body->Pfn[i] = pfn + pfnsum + i; + gpadl_body->pfn[i] = pfn + pfnsum + i; /* add to msg header */ - list_add_tail(&msgbody->MsgListEntry, - &msgheader->SubMsgList); + list_add_tail(&msgbody->msglistentry, + &msgheader->submsglist); pfnsum += pfncurr; pfnleft -= pfncurr; } @@ -456,17 +456,17 @@ static int create_gpadl_header(void *kbuffer, u32 size, msgheader = kzalloc(msgsize, GFP_KERNEL); if (msgheader == NULL) goto nomem; - msgheader->MessageSize = msgsize; + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pagecount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -508,21 +508,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; } - gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg; - gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader; - gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId; - gpadlmsg->Gpadl = next_gpadl_handle; + gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg; + gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER; + gpadlmsg->child_relid = channel->offermsg.child_relid; + gpadlmsg->gpadl = next_gpadl_handle; dump_gpadl_header(gpadlmsg); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msginfo->MsgListEntry, + list_add_tail(&msginfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -530,9 +530,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, kbuffer, size, msgcount); DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", - msginfo->MessageSize - sizeof(*msginfo)); + msginfo->msgsize - sizeof(*msginfo)); - ret = VmbusPostMessage(gpadlmsg, msginfo->MessageSize - + ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize - sizeof(*msginfo)); if (ret != 0) { DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret); @@ -540,48 +540,48 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } if (msgcount > 1) { - list_for_each(curr, &msginfo->SubMsgList) { + list_for_each(curr, &msginfo->submsglist) { /* FIXME: should this use list_entry() instead ? */ submsginfo = (struct vmbus_channel_msginfo *)curr; gpadl_body - (struct vmbus_channel_gpadl_body *)submsginfo->Msg; + (struct vmbus_channel_gpadl_body *)submsginfo->msg; - gpadl_body->Header.MessageType - ChannelMessageGpadlBody; - gpadl_body->Gpadl = next_gpadl_handle; + gpadl_body->header.msgtype + CHANNELMSG_GPADL_BODY; + gpadl_body->gpadl = next_gpadl_handle; DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); - dump_gpadl_body(gpadl_body, submsginfo->MessageSize - + dump_gpadl_body(gpadl_body, submsginfo->msgsize - sizeof(*submsginfo)); ret = VmbusPostMessage(gpadl_body, - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); if (ret != 0) goto Cleanup; } } - osd_WaitEventWait(msginfo->WaitEvent); + osd_WaitEventWait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " "(relid %d, status %d handle %x)", - channel->OfferMsg.ChildRelId, - msginfo->Response.GpadlCreated.CreationStatus, - gpadlmsg->Gpadl); + channel->offermsg.child_relid, + msginfo->response.gpadl_created.creation_status, + gpadlmsg->gpadl); - *gpadl_handle = gpadlmsg->Gpadl; + *gpadl_handle = gpadlmsg->gpadl; Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&msginfo->MsgListEntry); + list_del(&msginfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); return ret; } @@ -604,20 +604,20 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->WaitEvent = osd_WaitEventCreate(); - if (!info->WaitEvent) { + info->waitevent = osd_WaitEventCreate(); + if (!info->waitevent) { kfree(info); return -ENOMEM; } - msg = (struct vmbus_channel_gpadl_teardown *)info->Msg; + msg = (struct vmbus_channel_gpadl_teardown *)info->msg; - msg->Header.MessageType = ChannelMessageGpadlTeardown; - msg->ChildRelId = channel->OfferMsg.ChildRelId; - msg->Gpadl = gpadl_handle; + msg->header.msgtype = CHANNELMSG_GPADL_TEARDOWN; + msg->child_relid = channel->offermsg.child_relid; + msg->gpadl = gpadl_handle; spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&info->MsgListEntry, + list_add_tail(&info->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -628,14 +628,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->WaitEvent); + osd_WaitEventWait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&info->MsgListEntry); + list_del(&info->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(info->WaitEvent); + kfree(info->waitevent); kfree(info); return ret; } @@ -652,7 +652,7 @@ void vmbus_close(struct vmbus_channel *channel) int ret; /* Stop callback and cancel the timer asap */ - channel->OnChannelCallback = NULL; + channel->onchannel_callback = NULL; del_timer_sync(&channel->poll_timer); /* Send a closing message */ @@ -665,9 +665,9 @@ void vmbus_close(struct vmbus_channel *channel) /* info->waitEvent = osd_WaitEventCreate(); */ - msg = (struct vmbus_channel_close_channel *)info->Msg; - msg->Header.MessageType = ChannelMessageCloseChannel; - msg->ChildRelId = channel->OfferMsg.ChildRelId; + msg = (struct vmbus_channel_close_channel *)info->msg; + msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; + msg->child_relid = channel->offermsg.child_relid; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel)); if (ret != 0) { @@ -676,17 +676,17 @@ void vmbus_close(struct vmbus_channel *channel) } /* Tear down the gpadl for the channel's ring buffer */ - if (channel->RingBufferGpadlHandle) + if (channel->ringbuffer_gpadlhandle) vmbus_teardown_gpadl(channel, - channel->RingBufferGpadlHandle); + channel->ringbuffer_gpadlhandle); /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->Outbound); - RingBufferCleanup(&channel->Inbound); + RingBufferCleanup(&channel->outbound); + RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount); + osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); @@ -696,9 +696,9 @@ void vmbus_close(struct vmbus_channel *channel) * caller will free the channel */ - if (channel->State == CHANNEL_OPEN_STATE) { + if (channel->state == CHANNEL_OPEN_STATE) { spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&channel->ListEntry); + list_del(&channel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(channel); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -940,7 +940,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = userlen; @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, userlen, + ret = RingBufferRead(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -999,7 +999,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = packetlen; @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, packetlen, 0); + ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1030,7 +1030,7 @@ void vmbus_onchannel_event(struct vmbus_channel *channel) dump_vmbus_channel(channel); /* ASSERT(Channel->OnChannelCallback); */ - channel->OnChannelCallback(channel->ChannelCallbackContext); + channel->onchannel_callback(channel->channel_callback_context); mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100)); } @@ -1042,8 +1042,8 @@ void vmbus_ontimer(unsigned long data) { struct vmbus_channel *channel = (struct vmbus_channel *)data; - if (channel->OnChannelCallback) - channel->OnChannelCallback(channel->ChannelCallbackContext); + if (channel->onchannel_callback) + channel->onchannel_callback(channel->channel_callback_context); } /* @@ -1051,7 +1051,7 @@ void vmbus_ontimer(unsigned long data) */ static void dump_vmbus_channel(struct vmbus_channel *channel) { - DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId); - DumpRingInfo(&channel->Outbound, "Outbound "); - DumpRingInfo(&channel->Inbound, "Inbound "); + DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); + DumpRingInfo(&channel->outbound, "Outbound "); + DumpRingInfo(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 45dbe30..dbfe0f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -251,8 +251,8 @@ static struct vmbus_channel *alloc_channel(void) channel->poll_timer.data = (unsigned long)channel; channel->poll_timer.function = vmbus_ontimer; - channel->ControlWQ = create_workqueue("hv_vmbus_ctl"); - if (!channel->ControlWQ) { + channel->controlwq = create_workqueue("hv_vmbus_ctl"); + if (!channel->controlwq) { kfree(channel); return NULL; } @@ -268,7 +268,7 @@ static inline void release_channel(void *context) struct vmbus_channel *channel = context; DPRINT_DBG(VMBUS, "releasing channel (%p)", channel); - destroy_workqueue(channel->ControlWQ); + destroy_workqueue(channel->controlwq); DPRINT_DBG(VMBUS, "channel released (%p)", channel); kfree(channel); @@ -325,12 +325,12 @@ static void vmbus_process_offer(void *context) /* Make sure this is a new offer */ spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceType, + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (!memcmp(&channel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)) && - !memcmp(&channel->OfferMsg.Offer.InterfaceInstance, - &newchannel->OfferMsg.Offer.InterfaceInstance, + !memcmp(&channel->offermsg.offer.InterfaceInstance, + &newchannel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid))) { fnew = false; break; @@ -338,14 +338,14 @@ static void vmbus_process_offer(void *context) } if (fnew) - list_add_tail(&newchannel->ListEntry, + list_add_tail(&newchannel->listentry, &gVmbusConnection.ChannelList); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); if (!fnew) { DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); free_channel(newchannel); return; } @@ -355,27 +355,27 @@ static void vmbus_process_offer(void *context) * We need to set the DeviceObject field before calling * VmbusChildDeviceAdd() */ - newchannel->DeviceObject = VmbusChildDeviceCreate( - &newchannel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceInstance, + newchannel->device_obj = VmbusChildDeviceCreate( + &newchannel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceInstance, newchannel); DPRINT_DBG(VMBUS, "child device object allocated - %p", - newchannel->DeviceObject); + newchannel->device_obj); /* * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. */ - ret = VmbusChildDeviceAdd(newchannel->DeviceObject); + ret = VmbusChildDeviceAdd(newchannel->device_obj); if (ret != 0) { DPRINT_ERR(VMBUS, "unable to add child device object (relid %d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&newchannel->ListEntry); + list_del(&newchannel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(newchannel); @@ -385,11 +385,11 @@ static void vmbus_process_offer(void *context) * so that when we do close the channel normally, we * can cleanup properly */ - newchannel->State = CHANNEL_OPEN_STATE; + newchannel->state = CHANNEL_OPEN_STATE; /* Open IC channels */ for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) { - if (memcmp(&newchannel->OfferMsg.Offer.InterfaceType, + if (memcmp(&newchannel->offermsg.offer.InterfaceType, &hv_cb_utils[cnt].data, sizeof(struct hv_guid)) == 0 && vmbus_open(newchannel, 2 * PAGE_SIZE, @@ -413,7 +413,7 @@ static void vmbus_process_rescind_offer(void *context) { struct vmbus_channel *channel = context; - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); } /* @@ -434,7 +434,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.InterfaceType, &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) { fsupported = 1; break; @@ -443,12 +443,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) if (!fsupported) { DPRINT_DBG(VMBUS, "Ignoring channel offer notification for " - "child relid %d", offer->ChildRelId); + "child relid %d", offer->child_relid); return; } - guidtype = &offer->Offer.InterfaceType; - guidinstance = &offer->Offer.InterfaceInstance; + guidtype = &offer->offer.InterfaceType; + guidinstance = &offer->offer.InterfaceInstance; DPRINT_INFO(VMBUS, "Channel offer notification - " "child relid %d monitor id %d allocated %d, " @@ -456,8 +456,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) "%02x%02x%02x%02x%02x%02x%02x%02x} " "instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x%02x%02x%02x%02x%02x%02x}", - offer->ChildRelId, offer->MonitorId, - offer->MonitorAllocated, + offer->child_relid, offer->monitorid, + offer->monitor_allocated, guidtype->data[3], guidtype->data[2], guidtype->data[1], guidtype->data[0], guidtype->data[5], guidtype->data[4], @@ -484,13 +484,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel); - memcpy(&newchannel->OfferMsg, offer, + memcpy(&newchannel->offermsg, offer, sizeof(struct vmbus_channel_offer_channel)); - newchannel->MonitorGroup = (u8)offer->MonitorId / 32; - newchannel->MonitorBit = (u8)offer->MonitorId % 32; + newchannel->monitor_grp = (u8)offer->monitorid / 32; + newchannel->monitor_bit = (u8)offer->monitorid % 32; /* TODO: Make sure the offer comes from our parent partition */ - osd_schedule_callback(newchannel->ControlWQ, vmbus_process_offer, + osd_schedule_callback(newchannel->controlwq, vmbus_process_offer, newchannel); } @@ -505,14 +505,14 @@ 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->ChildRelId); + channel = GetChannelFromRelId(rescind->child_relid); if (channel == NULL) { DPRINT_DBG(VMBUS, "channel not found for relId %d", - rescind->ChildRelId); + rescind->child_relid); return; } - osd_schedule_callback(channel->ControlWQ, + osd_schedule_callback(channel->controlwq, vmbus_process_rescind_offer, channel); } @@ -545,7 +545,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) unsigned long flags; result = (struct vmbus_channel_open_result *)hdr; - DPRINT_DBG(VMBUS, "vmbus open result - %d", result->Status); + DPRINT_DBG(VMBUS, "vmbus open result - %d", result->status); /* * Find the open msg, copy the result and signal/unblock the wait event @@ -556,17 +556,17 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageOpenChannel) { + if (requestheader->msgtype == CHANNELMSG_OPENCHANNEL) { openmsg - (struct vmbus_channel_open_channel *)msginfo->Msg; - if (openmsg->ChildRelId == result->ChildRelId && - openmsg->OpenId == result->OpenId) { - memcpy(&msginfo->Response.OpenResult, + (struct vmbus_channel_open_channel *)msginfo->msg; + if (openmsg->child_relid == result->child_relid && + openmsg->openid == result->openid) { + memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -592,7 +592,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr; DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d", - gpadlcreated->CreationStatus); + gpadlcreated->creation_status); /* * Find the establish msg, copy the result and signal/unblock the wait @@ -604,19 +604,19 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlHeader) { + if (requestheader->msgtype == CHANNELMSG_GPADL_HEADER) { gpadlheader (struct vmbus_channel_gpadl_header *)requestheader; - if ((gpadlcreated->ChildRelId =- gpadlheader->ChildRelId) && - (gpadlcreated->Gpadl == gpadlheader->Gpadl)) { - memcpy(&msginfo->Response.GpadlCreated, + if ((gpadlcreated->child_relid =+ gpadlheader->child_relid) && + (gpadlcreated->gpadl == gpadlheader->gpadl)) { + memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -652,17 +652,17 @@ static void vmbus_ongpadl_torndown( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlTeardown) { + if (requestheader->msgtype == CHANNELMSG_GPADL_TEARDOWN) { gpadl_teardown (struct vmbus_channel_gpadl_teardown *)requestheader; - if (gpadl_torndown->Gpadl == gpadl_teardown->Gpadl) { - memcpy(&msginfo->Response.GpadlTorndown, + if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) { + memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -694,16 +694,16 @@ static void vmbus_onversion_response( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType =- ChannelMessageInitiateContact) { + if (requestheader->msgtype =+ CHANNELMSG_INITIATE_CONTACT) { initiate (struct vmbus_channel_initiate_contact *)requestheader; - memcpy(&msginfo->Response.VersionResponse, + memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -711,24 +711,24 @@ static void vmbus_onversion_response( /* Channel message dispatch table */ static struct vmbus_channel_message_table_entry - gChannelMessageTable[ChannelMessageCount] = { - {ChannelMessageInvalid, NULL}, - {ChannelMessageOfferChannel, vmbus_onoffer}, - {ChannelMessageRescindChannelOffer, vmbus_onoffer_rescind}, - {ChannelMessageRequestOffers, NULL}, - {ChannelMessageAllOffersDelivered, vmbus_onoffers_delivered}, - {ChannelMessageOpenChannel, NULL}, - {ChannelMessageOpenChannelResult, vmbus_onopen_result}, - {ChannelMessageCloseChannel, NULL}, - {ChannelMessageGpadlHeader, NULL}, - {ChannelMessageGpadlBody, NULL}, - {ChannelMessageGpadlCreated, vmbus_ongpadl_created}, - {ChannelMessageGpadlTeardown, NULL}, - {ChannelMessageGpadlTorndown, vmbus_ongpadl_torndown}, - {ChannelMessageRelIdReleased, NULL}, - {ChannelMessageInitiateContact, NULL}, - {ChannelMessageVersionResponse, vmbus_onversion_response}, - {ChannelMessageUnload, NULL}, + gChannelMessageTable[CHANNELMSG_COUNT] = { + {CHANNELMSG_INVALID, NULL}, + {CHANNELMSG_OFFERCHANNEL, vmbus_onoffer}, + {CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind}, + {CHANNELMSG_REQUESTOFFERS, NULL}, + {CHANNELMSG_ALLOFFERS_DELIVERED, vmbus_onoffers_delivered}, + {CHANNELMSG_OPENCHANNEL, NULL}, + {CHANNELMSG_OPENCHANNEL_RESULT, vmbus_onopen_result}, + {CHANNELMSG_CLOSECHANNEL, NULL}, + {CHANNELMSG_GPADL_HEADER, NULL}, + {CHANNELMSG_GPADL_BODY, NULL}, + {CHANNELMSG_GPADL_CREATED, vmbus_ongpadl_created}, + {CHANNELMSG_GPADL_TEARDOWN, NULL}, + {CHANNELMSG_GPADL_TORNDOWN, vmbus_ongpadl_torndown}, + {CHANNELMSG_RELID_RELEASED, NULL}, + {CHANNELMSG_INITIATE_CONTACT, NULL}, + {CHANNELMSG_VERSION_RESPONSE, vmbus_onversion_response}, + {CHANNELMSG_UNLOAD, NULL}, }; /* @@ -745,23 +745,23 @@ void vmbus_onmessage(void *context) hdr = (struct vmbus_channel_message_header *)msg->u.Payload; size = msg->Header.PayloadSize; - DPRINT_DBG(VMBUS, "message type %d size %d", hdr->MessageType, size); + DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); - if (hdr->MessageType >= ChannelMessageCount) { + if (hdr->msgtype >= CHANNELMSG_COUNT) { DPRINT_ERR(VMBUS, "Received invalid channel message type %d size %d", - hdr->MessageType, size); + hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, (unsigned char *)msg->u.Payload, size); kfree(msg); return; } - if (gChannelMessageTable[hdr->MessageType].messageHandler) - gChannelMessageTable[hdr->MessageType].messageHandler(hdr); + if (gChannelMessageTable[hdr->msgtype].messageHandler) + gChannelMessageTable[hdr->msgtype].messageHandler(hdr); else DPRINT_ERR(VMBUS, "Unhandled channel message type %d", - hdr->MessageType); + hdr->msgtype); /* Free the msg that was allocated in VmbusOnMsgDPC() */ kfree(msg); @@ -782,15 +782,15 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; } - msg = (struct vmbus_channel_message_header *)msginfo->Msg; + msg = (struct vmbus_channel_message_header *)msginfo->msg; - msg->MessageType = ChannelMessageRequestOffers; + msg->msgtype = CHANNELMSG_REQUESTOFFERS; /*SpinlockAcquire(gVmbusConnection.channelMsgLock); INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList, @@ -817,7 +817,7 @@ int vmbus_request_offers(void) Cleanup: if (msginfo) { - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); } @@ -837,17 +837,17 @@ void vmbus_release_unattached_channels(void) spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, - ListEntry) { + listentry) { if (channel == start) break; - if (!channel->DeviceObject->Driver) { - list_del(&channel->ListEntry); + if (!channel->device_obj->Driver) { + list_del(&channel->listentry); DPRINT_INFO(VMBUS, "Releasing unattached device object %p", - channel->DeviceObject); + channel->device_obj); - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); free_channel(channel); } else { if (!start) diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h index d16cc08..12f30af 100644 --- a/drivers/staging/hv/channel_mgmt.h +++ b/drivers/staging/hv/channel_mgmt.h @@ -33,60 +33,60 @@ /* Version 1 messages */ enum vmbus_channel_message_type { - ChannelMessageInvalid = 0, - ChannelMessageOfferChannel = 1, - ChannelMessageRescindChannelOffer = 2, - ChannelMessageRequestOffers = 3, - ChannelMessageAllOffersDelivered = 4, - ChannelMessageOpenChannel = 5, - ChannelMessageOpenChannelResult = 6, - ChannelMessageCloseChannel = 7, - ChannelMessageGpadlHeader = 8, - ChannelMessageGpadlBody = 9, - ChannelMessageGpadlCreated = 10, - ChannelMessageGpadlTeardown = 11, - ChannelMessageGpadlTorndown = 12, - ChannelMessageRelIdReleased = 13, - ChannelMessageInitiateContact = 14, - ChannelMessageVersionResponse = 15, - ChannelMessageUnload = 16, + CHANNELMSG_INVALID = 0, + CHANNELMSG_OFFERCHANNEL = 1, + CHANNELMSG_RESCIND_CHANNELOFFER = 2, + CHANNELMSG_REQUESTOFFERS = 3, + CHANNELMSG_ALLOFFERS_DELIVERED = 4, + CHANNELMSG_OPENCHANNEL = 5, + CHANNELMSG_OPENCHANNEL_RESULT = 6, + CHANNELMSG_CLOSECHANNEL = 7, + CHANNELMSG_GPADL_HEADER = 8, + CHANNELMSG_GPADL_BODY = 9, + CHANNELMSG_GPADL_CREATED = 10, + CHANNELMSG_GPADL_TEARDOWN = 11, + CHANNELMSG_GPADL_TORNDOWN = 12, + CHANNELMSG_RELID_RELEASED = 13, + CHANNELMSG_INITIATE_CONTACT = 14, + CHANNELMSG_VERSION_RESPONSE = 15, + CHANNELMSG_UNLOAD = 16, #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD - ChannelMessageViewRangeAdd = 17, - ChannelMessageViewRangeRemove = 18, + CHANNELMSG_VIEWRANGE_ADD = 17, + CHANNELMSG_VIEWRANGE_REMOVE = 18, #endif - ChannelMessageCount + CHANNELMSG_COUNT }; struct vmbus_channel_message_header { - enum vmbus_channel_message_type MessageType; - u32 Padding; + enum vmbus_channel_message_type msgtype; + u32 padding; } __attribute__((packed)); /* Query VMBus Version parameters */ struct vmbus_channel_query_vmbus_version { - struct vmbus_channel_message_header Header; - u32 Version; + struct vmbus_channel_message_header header; + u32 version; } __attribute__((packed)); /* VMBus Version Supported parameters */ struct vmbus_channel_version_supported { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); /* Offer Channel parameters */ struct vmbus_channel_offer_channel { - struct vmbus_channel_message_header Header; - struct vmbus_channel_offer Offer; - u32 ChildRelId; - u8 MonitorId; - bool MonitorAllocated; + struct vmbus_channel_message_header header; + struct vmbus_channel_offer offer; + u32 child_relid; + u8 monitorid; + bool monitor_allocated; } __attribute__((packed)); /* Rescind Offer parameters */ struct vmbus_channel_rescind_offer { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* @@ -100,43 +100,43 @@ struct vmbus_channel_rescind_offer { /* Open Channel parameters */ struct vmbus_channel_open_channel { - struct vmbus_channel_message_header Header; + struct vmbus_channel_message_header header; /* Identifies the specific VMBus channel that is being opened. */ - u32 ChildRelId; + u32 child_relid; /* ID making a particular open request at a channel offer unique. */ - u32 OpenId; + u32 openid; /* GPADL for the channel's ring buffer. */ - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* GPADL for the channel's server context save area. */ - u32 ServerContextAreaGpadlHandle; + u32 server_contextarea_gpadlhandle; /* * The upstream ring buffer begins at offset zero in the memory * described by RingBufferGpadlHandle. The downstream ring buffer * follows it at this offset (in pages). */ - u32 DownstreamRingBufferPageOffset; + u32 downstream_ringbuffer_pageoffset; /* User-specific data to be passed along to the server endpoint. */ - unsigned char UserData[MAX_USER_DEFINED_BYTES]; + unsigned char userdata[MAX_USER_DEFINED_BYTES]; } __attribute__((packed)); /* Open Channel Result parameters */ struct vmbus_channel_open_result { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 OpenId; - u32 Status; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 openid; + u32 status; } __attribute__((packed)); /* Close channel parameters; */ struct vmbus_channel_close_channel { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* Channel Message GPADL */ @@ -151,72 +151,72 @@ struct vmbus_channel_close_channel { * follow-up packet that contains more. */ struct vmbus_channel_gpadl_header { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u16 RangeBufLen; - u16 RangeCount; - struct gpa_range Range[0]; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u16 range_buflen; + u16 rangecount; + struct gpa_range range[0]; } __attribute__((packed)); /* This is the followup packet that contains more PFNs. */ struct vmbus_channel_gpadl_body { - struct vmbus_channel_message_header Header; - u32 MessageNumber; - u32 Gpadl; - u64 Pfn[0]; + struct vmbus_channel_message_header header; + u32 msgnumber; + u32 gpadl; + u64 pfn[0]; } __attribute__((packed)); struct vmbus_channel_gpadl_created { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u32 CreationStatus; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u32 creation_status; } __attribute__((packed)); struct vmbus_channel_gpadl_teardown { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; } __attribute__((packed)); struct vmbus_channel_gpadl_torndown { - struct vmbus_channel_message_header Header; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 gpadl; } __attribute__((packed)); #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD struct vmbus_channel_view_range_add { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u64 ViewRangeLength; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u64 viewrange_length; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_view_range_remove { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u32 child_relid; } __attribute__((packed)); #endif struct vmbus_channel_relid_released { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_initiate_contact { - struct vmbus_channel_message_header Header; - u32 VMBusVersionRequested; - u32 Padding2; - u64 InterruptPage; - u64 MonitorPage1; - u64 MonitorPage2; + struct vmbus_channel_message_header header; + u32 vmbus_version_requested; + u32 padding2; + u64 interrupt_page; + u64 monitor_page1; + u64 monitor_page2; } __attribute__((packed)); struct vmbus_channel_version_response { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); enum vmbus_channel_state { @@ -226,54 +226,54 @@ enum vmbus_channel_state { }; struct vmbus_channel { - struct list_head ListEntry; + struct list_head listentry; - struct hv_device *DeviceObject; + struct hv_device *device_obj; struct timer_list poll_timer; /* SA-111 workaround */ - enum vmbus_channel_state State; + enum vmbus_channel_state state; - struct vmbus_channel_offer_channel OfferMsg; + struct vmbus_channel_offer_channel offermsg; /* * These are based on the OfferMsg.MonitorId. * Save it here for easy access. */ - u8 MonitorGroup; - u8 MonitorBit; + u8 monitor_grp; + u8 monitor_bit; - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* Allocated memory for ring buffer */ - void *RingBufferPages; - u32 RingBufferPageCount; - struct hv_ring_buffer_info Outbound; /* send to parent */ - struct hv_ring_buffer_info Inbound; /* receive from parent */ + void *ringbuffer_pages; + u32 ringbuffer_pagecount; + struct hv_ring_buffer_info outbound; /* send to parent */ + struct hv_ring_buffer_info inbound; /* receive from parent */ spinlock_t inbound_lock; - struct workqueue_struct *ControlWQ; + struct workqueue_struct *controlwq; /* Channel callback are invoked in this workqueue context */ /* HANDLE dataWorkQueue; */ - void (*OnChannelCallback)(void *context); - void *ChannelCallbackContext; + void (*onchannel_callback)(void *context); + void *channel_callback_context; }; struct vmbus_channel_debug_info { - u32 RelId; - enum vmbus_channel_state State; - struct hv_guid InterfaceType; - struct hv_guid InterfaceInstance; - u32 MonitorId; - u32 ServerMonitorPending; - u32 ServerMonitorLatency; - u32 ServerMonitorConnectionId; - u32 ClientMonitorPending; - u32 ClientMonitorLatency; - u32 ClientMonitorConnectionId; - - struct hv_ring_buffer_debug_info Inbound; - struct hv_ring_buffer_debug_info Outbound; + u32 relid; + enum vmbus_channel_state state; + struct hv_guid interfacetype; + struct hv_guid interface_instance; + u32 monitorid; + u32 servermonitor_pending; + u32 servermonitor_latency; + u32 servermonitor_connectionid; + u32 clientmonitor_pending; + u32 clientmonitor_latency; + u32 clientmonitor_connectionid; + + struct hv_ring_buffer_debug_info inbound; + struct hv_ring_buffer_debug_info outbound; }; /* @@ -282,28 +282,28 @@ struct vmbus_channel_debug_info { */ struct vmbus_channel_msginfo { /* Bookkeeping stuff */ - struct list_head MsgListEntry; + struct list_head msglistentry; /* So far, this is only used to handle gpadl body message */ - struct list_head SubMsgList; + struct list_head submsglist; /* Synchronize the request/response if needed */ - struct osd_waitevent *WaitEvent; + struct osd_waitevent *waitevent; union { - struct vmbus_channel_version_supported VersionSupported; - struct vmbus_channel_open_result OpenResult; - struct vmbus_channel_gpadl_torndown GpadlTorndown; - struct vmbus_channel_gpadl_created GpadlCreated; - struct vmbus_channel_version_response VersionResponse; - } Response; - - u32 MessageSize; + struct vmbus_channel_version_supported version_supported; + struct vmbus_channel_open_result open_result; + struct vmbus_channel_gpadl_torndown gpadl_torndown; + struct vmbus_channel_gpadl_created gpadl_created; + struct vmbus_channel_version_response version_response; + } response; + + u32 msgsize; /* * The channel message that goes out on the "wire". * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header */ - unsigned char Msg[0]; + unsigned char msg[0]; }; diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index f847707..6f3f525 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -95,19 +95,19 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->WaitEvent = osd_WaitEventCreate(); - if (!msgInfo->WaitEvent) { + msgInfo->waitevent = osd_WaitEventCreate(); + 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.MessageType = ChannelMessageInitiateContact; - msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER; - msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage); - msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages); - msg->MonitorPage2 = virt_to_phys( + 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->monitor_page2 = virt_to_phys( (void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE)); @@ -116,30 +116,30 @@ int VmbusConnect(void) * receive the response before returning from this routine */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msgInfo->MsgListEntry, + list_add_tail(&msgInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, " "monitor1 pfn %llx,, monitor2 pfn %llx", - msg->InterruptPage, msg->MonitorPage1, msg->MonitorPage2); + msg->interrupt_page, msg->monitor_page1, msg->monitor_page2); DPRINT_DBG(VMBUS, "Sending channel initiate msg..."); 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_WaitEventWait(msgInfo->WaitEvent); + osd_WaitEventWait(msgInfo->waitevent); - list_del(&msgInfo->MsgListEntry); + list_del(&msgInfo->msglistentry); /* Check if successful */ - if (msgInfo->Response.VersionResponse.VersionSupported) { + if (msgInfo->response.version_response.version_supported) { DPRINT_INFO(VMBUS, "Vmbus connected!!"); gVmbusConnection.ConnectState = Connected; @@ -151,7 +151,7 @@ int VmbusConnect(void) goto Cleanup; } - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); return 0; @@ -172,7 +172,7 @@ Cleanup: } if (msgInfo) { - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); } @@ -195,7 +195,7 @@ int VmbusDisconnect(void) if (!msg) return -ENOMEM; - msg->MessageType = ChannelMessageUnload; + msg->msgtype = CHANNELMSG_UNLOAD; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_message_header)); @@ -226,8 +226,8 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId) unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (channel->OfferMsg.ChildRelId == relId) { + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (channel->offermsg.child_relid == relId) { foundChannel = channel; break; } diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 702a478..6dc1c35 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -271,15 +271,15 @@ static int __init init_hyperv_utils(void) if (!dmi_check_system(hv_utils_dmi_table)) return -ENODEV; - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &shutdown_onchannelcallback; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback ×ync_onchannelcallback; hv_cb_utils[HV_TIMESYNC_MSG].callback = ×ync_onchannelcallback; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &heartbeat_onchannelcallback; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &heartbeat_onchannelcallback; @@ -290,15 +290,15 @@ static void exit_hyperv_utils(void) { printk(KERN_INFO "De-Registered HyperV Utility Driver\n"); - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_TIMESYNC_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate; } diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 0d9f3a4..2bbf4ec 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -139,35 +139,35 @@ static void get_channel_info(struct hv_device *device, vmbus_get_debug_info(device->channel, &debug_info); - info->ChannelId = debug_info.RelId; - info->ChannelState = debug_info.State; - memcpy(&info->ChannelType, &debug_info.InterfaceType, + info->ChannelId = debug_info.relid; + info->ChannelState = debug_info.state; + memcpy(&info->ChannelType, &debug_info.interfacetype, sizeof(struct hv_guid)); - memcpy(&info->ChannelInstance, &debug_info.InterfaceInstance, + memcpy(&info->ChannelInstance, &debug_info.interface_instance, sizeof(struct hv_guid)); - info->MonitorId = debug_info.MonitorId; + info->MonitorId = debug_info.monitorid; - info->ServerMonitorPending = debug_info.ServerMonitorPending; - info->ServerMonitorLatency = debug_info.ServerMonitorLatency; - info->ServerMonitorConnectionId = debug_info.ServerMonitorConnectionId; + info->ServerMonitorPending = debug_info.servermonitor_pending; + info->ServerMonitorLatency = debug_info.servermonitor_latency; + info->ServerMonitorConnectionId = debug_info.servermonitor_connectionid; - info->ClientMonitorPending = debug_info.ClientMonitorPending; - info->ClientMonitorLatency = debug_info.ClientMonitorLatency; - info->ClientMonitorConnectionId = debug_info.ClientMonitorConnectionId; + info->ClientMonitorPending = debug_info.clientmonitor_pending; + info->ClientMonitorLatency = debug_info.clientmonitor_latency; + info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.Inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.Inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.Inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.Inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.Inbound.BytesAvailToWrite; + info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; + info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; + info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; + info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; + info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - info->Outbound.InterruptMask = debug_info.Outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.Outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.Outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.Outbound.BytesAvailToRead; + info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; + info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; + info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; + info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; info->Outbound.BytesAvailToWrite - debug_info.Outbound.BytesAvailToWrite; + debug_info.outbound.BytesAvailToWrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 02/10] staging: hv: Convert camel cased struct fields in hv_api.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in hv_api.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 | 32 ++-- drivers/staging/hv/channel_mgmt.c | 6 +- drivers/staging/hv/connection.c | 4 +- drivers/staging/hv/hv.c | 120 ++++++++-------- drivers/staging/hv/hv_api.h | 274 ++++++++++++++++++------------------ drivers/staging/hv/vmbus.c | 18 ++-- 6 files changed, 227 insertions(+), 227 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 9fa0fe1..7c15c40 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -43,24 +43,24 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) int j = 0; DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d", - MonitorPage, MonitorPage->TriggerState); + MonitorPage, MonitorPage->trigger_state); for (i = 0; i < 4; i++) DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i, - MonitorPage->TriggerGroup[i].AsUINT64); + MonitorPage->trigger_group[i].as_uint64); for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j, - MonitorPage->Latency[i][j]); + MonitorPage->latency[i][j]); } } for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].ConnectionId.Asu32); + MonitorPage->parameter[i][j].connectionid.asu32); DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].FlagNumber); + MonitorPage->parameter[i][j].flag_number); } } } @@ -84,8 +84,8 @@ static void vmbus_setevent(struct vmbus_channel *channel) monitorpage++; /* Get the child to parent monitor page */ set_bit(channel->monitor_bit, - (unsigned long *)&monitorpage->TriggerGroup - [channel->monitor_grp].Pending); + (unsigned long *)&monitorpage->trigger_group + [channel->monitor_grp].pending); } else { VmbusSetEvent(channel->offermsg.child_relid); @@ -108,7 +108,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) monitorPage++; /* Get the child to parent monitor page */ clear_bit(Channel->monitor_bit, - (unsigned long *)&monitorPage->TriggerGroup + (unsigned long *)&monitorPage->trigger_group [Channel->monitor_grp].Pending); } } @@ -138,22 +138,22 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, debuginfo->monitorid = channel->offermsg.monitorid; debuginfo->servermonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->servermonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->servermonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; monitorpage++; debuginfo->clientmonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->clientmonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->clientmonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index dbfe0f2..be34e38 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -742,8 +742,8 @@ void vmbus_onmessage(void *context) struct vmbus_channel_message_header *hdr; int size; - hdr = (struct vmbus_channel_message_header *)msg->u.Payload; - size = msg->Header.PayloadSize; + hdr = (struct vmbus_channel_message_header *)msg->u.payload; + size = msg->header.payload_size; DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); @@ -752,7 +752,7 @@ void vmbus_onmessage(void *context) "Received invalid channel message type %d size %d", hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, - (unsigned char *)msg->u.Payload, size); + (unsigned char *)msg->u.payload, size); kfree(msg); return; } diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 6f3f525..ba50dd8 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -309,8 +309,8 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) { union hv_connection_id connId; - connId.Asu32 = 0; - connId.u.Id = VMBUS_MESSAGE_CONNECTION_ID; + connId.asu32 = 0; + connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; return HvPostMessage(connId, 1, buffer, bufferLen); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 86b1ddd..ab03327 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -50,7 +50,7 @@ static int HvQueryHypervisorPresence(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionVersionAndFeatures; + op = HVCPUID_VERSION_FEATURES; cpuid(op, &eax, &ebx, &ecx, &edx); return ecx & HV_PRESENT_BIT; @@ -76,7 +76,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvVendorAndMaxFunction; + op = HVCPUID_VENDOR_MAXFUNCTION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Vendor ID: %c%c%c%c%c%c%c%c%c%c%c%c", @@ -98,7 +98,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvInterface; + op = HVCPUID_INTERFACE; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Interface ID: %c%c%c%c", @@ -107,12 +107,12 @@ static int HvQueryHypervisorInfo(void) ((eax >> 16) & 0xFF), ((eax >> 24) & 0xFF)); - if (maxLeaf >= HvCpuIdFunctionMsHvVersion) { + if (maxLeaf >= HVCPUID_VERSION) { eax = 0; ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionMsHvVersion; + op = HVCPUID_VERSION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "OS Build:%d-%d.%d-%d-%d.%d",\ eax, @@ -222,7 +222,7 @@ int HvInit(void) gHvContext.GuestId = HV_LINUX_GUEST_ID; /* See if the hypercall page is already set */ - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* * Allocate the hypercall page memory @@ -236,16 +236,16 @@ int HvInit(void) goto Cleanup; } - hypercallMsr.Enable = 1; + hypercallMsr.enable = 1; - hypercallMsr.GuestPhysicalAddress = vmalloc_to_pfn(virtAddr); - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.guest_physical_address = vmalloc_to_pfn(virtAddr); + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* Confirm that hypercall page did get setup. */ - hypercallMsr.AsUINT64 = 0; - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); - if (!hypercallMsr.Enable) { + if (!hypercallMsr.enable) { DPRINT_ERR(VMBUS, "unable to set hypercall page!!"); goto Cleanup; } @@ -254,7 +254,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx", gHvContext.HypercallPage, - (u64)hypercallMsr.GuestPhysicalAddress << PAGE_SHIFT); + (u64)hypercallMsr.guest_physical_address << PAGE_SHIFT); /* Setup the global signal event param for the signal event hypercall */ gHvContext.SignalEventBuffer @@ -267,19 +267,19 @@ int HvInit(void) (struct hv_input_signal_event *) (ALIGN_UP((unsigned long)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN)); - gHvContext.SignalEventParam->ConnectionId.Asu32 = 0; - gHvContext.SignalEventParam->ConnectionId.u.Id + gHvContext.SignalEventParam->connectionid.asu32 = 0; + gHvContext.SignalEventParam->connectionid.u.id VMBUS_EVENT_CONNECTION_ID; - gHvContext.SignalEventParam->FlagNumber = 0; - gHvContext.SignalEventParam->RsvdZ = 0; + gHvContext.SignalEventParam->flag_number = 0; + gHvContext.SignalEventParam->rsvdz = 0; return ret; Cleanup: if (virtAddr) { - if (hypercallMsr.Enable) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + if (hypercallMsr.enable) { + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); } vfree(virtAddr); @@ -302,8 +302,8 @@ void HvCleanup(void) gHvContext.SignalEventParam = NULL; if (gHvContext.HypercallPage) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); vfree(gHvContext.HypercallPage); gHvContext.HypercallPage = NULL; } @@ -337,12 +337,12 @@ u16 HvPostMessage(union hv_connection_id connectionId, alignedMsg = (struct hv_input_post_message *) (ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); - alignedMsg->ConnectionId = connectionId; - alignedMsg->MessageType = messageType; - alignedMsg->PayloadSize = payloadSize; - memcpy((void *)alignedMsg->Payload, payload, payloadSize); + alignedMsg->connectionid = connectionId; + alignedMsg->message_type = messageType; + alignedMsg->payload_size = payloadSize; + memcpy((void *)alignedMsg->payload, payload, payloadSize); - status = HvDoHypercall(HvCallPostMessage, alignedMsg, NULL) & 0xFFFF; + status = HvDoHypercall(HVCALL_POST_MESSAGE, alignedMsg, NULL) & 0xFFFF; kfree((void *)addr); @@ -359,7 +359,7 @@ u16 HvSignalEvent(void) { u16 status; - status = HvDoHypercall(HvCallSignalEvent, gHvContext.SignalEventParam, + status = HvDoHypercall(HVCALL_SIGNAL_EVENT, gHvContext.SignalEventParam, NULL) & 0xFFFF; return status; } @@ -407,47 +407,47 @@ void HvSynicInit(void *irqarg) } /* Setup the Synic's message page */ - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 1; - simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 1; + simp.base_simp_gpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.as_uint64); - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); /* Setup the Synic's event page */ - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 1; - siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu]) + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 1; + siefp.base_siefp_gpa = virt_to_phys(gHvContext.synICEventPage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.as_uint64); - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); /* Setup the interception SINT. */ /* wrmsrl((HV_X64_MSR_SINT0 + HV_SYNIC_INTERCEPTION_SINT_INDEX), */ - /* interceptionSint.AsUINT64); */ + /* interceptionSint.as_uint64); */ /* Setup the shared SINT. */ - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.AsUINT64 = 0; - sharedSint.Vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - sharedSint.Masked = false; - sharedSint.AutoEoi = true; + sharedSint.as_uint64 = 0; + sharedSint.vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ + sharedSint.masked = false; + sharedSint.auto_eoi = true; DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx", - sharedSint.AsUINT64); + sharedSint.as_uint64); - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); /* Enable the global synic bit */ - rdmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); - sctrl.Enable = 1; + rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); + sctrl.enable = 1; - wrmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); + wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); gHvContext.SynICInitialized = true; return; @@ -474,25 +474,25 @@ void HvSynicCleanup(void *arg) if (!gHvContext.SynICInitialized) return; - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.Masked = 1; + sharedSint.masked = 1; /* Need to correctly cleanup in the case of SMP!!! */ /* Disable the interrupt */ - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 0; - simp.BaseSimpGpa = 0; + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 0; + simp.base_simp_gpa = 0; - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 0; - siefp.BaseSiefpGpa = 0; + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 0; + siefp.base_siefp_gpa = 0; - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); osd_PageFree(gHvContext.synICMessagePage[cpu], 1); osd_PageFree(gHvContext.synICEventPage[cpu], 1); diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9eb818e..9df6472 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -510,21 +510,21 @@ /* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent - * is set by CPUID(HvCpuIdFunctionVersionAndFeatures). + * is set by CPUID(HVCPUID_VERSION_FEATURES). */ enum hv_cpuid_function { - HvCpuIdFunctionVersionAndFeatures = 0x00000001, - HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000, - HvCpuIdFunctionHvInterface = 0x40000001, + HVCPUID_VERSION_FEATURES = 0x00000001, + HVCPUID_VENDOR_MAXFUNCTION = 0x40000000, + HVCPUID_INTERFACE = 0x40000001, /* * The remaining functions depend on the value of - * HvCpuIdFunctionInterface + * HVCPUID_INTERFACE */ - HvCpuIdFunctionMsHvVersion = 0x40000002, - HvCpuIdFunctionMsHvFeatures = 0x40000003, - HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004, - HvCpuIdFunctionMsHvImplementationLimits = 0x40000005, + HVCPUID_VERSION = 0x40000002, + HVCPUID_FEATURES = 0x40000003, + HVCPUID_ENLIGHTENMENT_INFO = 0x40000004, + HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005, }; /* Define the virtual APIC registers */ @@ -575,30 +575,30 @@ enum hv_cpuid_function { /* Define hypervisor message types. */ enum hv_message_type { - HvMessageTypeNone = 0x00000000, + HVMSG_NONE = 0x00000000, /* Memory access messages. */ - HvMessageTypeUnmappedGpa = 0x80000000, - HvMessageTypeGpaIntercept = 0x80000001, + HVMSG_UNMAPPED_GPA = 0x80000000, + HVMSG_GPA_INTERCEPT = 0x80000001, /* Timer notification messages. */ - HvMessageTimerExpired = 0x80000010, + HVMSG_TIMER_EXPIRED = 0x80000010, /* Error messages. */ - HvMessageTypeInvalidVpRegisterValue = 0x80000020, - HvMessageTypeUnrecoverableException = 0x80000021, - HvMessageTypeUnsupportedFeature = 0x80000022, + HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, + HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, + HVMSG_UNSUPPORTED_FEATURE = 0x80000022, /* Trace buffer complete messages. */ - HvMessageTypeEventLogBufferComplete = 0x80000040, + HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, /* Platform-specific processor intercept messages. */ - HvMessageTypeX64IoPortIntercept = 0x80010000, - HvMessageTypeX64MsrIntercept = 0x80010001, - HvMessageTypeX64CpuidIntercept = 0x80010002, - HvMessageTypeX64ExceptionIntercept = 0x80010003, - HvMessageTypeX64ApicEoi = 0x80010004, - HvMessageTypeX64LegacyFpError = 0x80010005 + HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, + HVMSG_X64_MSR_INTERCEPT = 0x80010001, + HVMSG_X64_CPUID_INTERCEPT = 0x80010002, + HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003, + HVMSG_X64_APIC_EOI = 0x80010004, + HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 }; /* Define the number of synthetic interrupt sources. */ @@ -610,103 +610,103 @@ enum hv_message_type { /* Define connection identifier type. */ union hv_connection_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u; }; /* Define port identifier type. */ union hv_port_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u ; }; /* Define port type. */ enum hv_port_type { - HvPortTypeMessage = 1, - HvPortTypeEvent = 2, - HvPortTypeMonitor = 3 + HVPORT_MSG = 1, + HVPORT_EVENT = 2, + HVPORT_MONITOR = 3 }; /* Define port information structure. */ struct hv_port_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u32 TargetSint; - u32 TargetVp; - u64 RsvdZ; - } MessagePortInfo; + u32 target_sint; + u32 target_vp; + u64 rsvdz; + } message_port_info; struct { - u32 TargetSint; - u32 TargetVp; - u16 BaseFlagNumber; - u16 FlagCount; - u32 RsvdZ; - } EventPortInfo; + u32 target_sint; + u32 target_vp; + u16 base_flag_bumber; + u16 flag_count; + u32 rsvdz; + } event_port_info; struct { - u64 MonitorAddress; - u64 RsvdZ; - } MonitorPortInfo; + u64 monitor_address; + u64 rsvdz; + } monitor_port_info; }; }; struct hv_connection_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u64 RsvdZ; - } MessageConnectionInfo; + u64 rsvdz; + } message_connection_info; struct { - u64 RsvdZ; - } EventConnectionInfo; + u64 rsvdz; + } event_connection_info; struct { - u64 MonitorAddress; - } MonitorConnectionInfo; + u64 monitor_address; + } monitor_connection_info; }; }; /* Define synthetic interrupt controller message flags. */ union hv_message_flags { - u8 Asu8; + u8 asu8; struct { - u8 MessagePending:1; - u8 Reserved:7; + u8 msg_pending:1; + u8 reserved:7; }; }; /* Define synthetic interrupt controller message header. */ struct hv_message_header { - enum hv_message_type MessageType; - u8 PayloadSize; - union hv_message_flags MessageFlags; - u8 Reserved[2]; + enum hv_message_type message_type; + u8 payload_size; + union hv_message_flags message_flags; + u8 reserved[2]; union { - u64 Sender; - union hv_port_id Port; + u64 sender; + union hv_port_id port; }; }; /* Define timer message payload structure. */ struct hv_timer_message_payload { - u32 TimerIndex; - u32 Reserved; - u64 ExpirationTime; /* When the timer expired */ - u64 DeliveryTime; /* When the message was delivered */ + u32 timer_index; + u32 reserved; + u64 expiration_time; /* When the timer expired */ + u64 delivery_time; /* When the message was delivered */ }; /* Define synthetic interrupt controller message format. */ struct hv_message { - struct hv_message_header Header; + struct hv_message_header header; union { - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; } u ; }; @@ -715,82 +715,82 @@ struct hv_message { /* Define the synthetic interrupt message page layout. */ struct hv_message_page { - struct hv_message SintMessage[HV_SYNIC_SINT_COUNT]; + struct hv_message sint_message[HV_SYNIC_SINT_COUNT]; }; /* Define the synthetic interrupt controller event flags format. */ union hv_synic_event_flags { - u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT]; - u32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT]; + u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT]; + u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT]; }; /* Define the synthetic interrupt flags page layout. */ struct hv_synic_event_flags_page { - union hv_synic_event_flags SintEventFlags[HV_SYNIC_SINT_COUNT]; + union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; }; /* Define SynIC control register. */ union hv_synic_scontrol { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:63; + u64 enable:1; + u64 reserved:63; }; }; /* Define synthetic interrupt source. */ union hv_synic_sint { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Vector:8; - u64 Reserved1:8; - u64 Masked:1; - u64 AutoEoi:1; - u64 Reserved2:46; + u64 vector:8; + u64 reserved1:8; + u64 masked:1; + u64 auto_eoi:1; + u64 reserved2:46; }; }; /* Define the format of the SIMP register */ union hv_synic_simp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SimpEnabled:1; - u64 Preserved:11; - u64 BaseSimpGpa:52; + u64 simp_enabled:1; + u64 preserved:11; + u64 base_simp_gpa:52; }; }; /* Define the format of the SIEFP register */ union hv_synic_siefp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SiefpEnabled:1; - u64 Preserved:11; - u64 BaseSiefpGpa:52; + u64 siefp_enabled:1; + u64 preserved:11; + u64 base_siefp_gpa:52; }; }; /* Definitions for the monitored notification facility */ union hv_monitor_trigger_group { - u64 AsUINT64; + u64 as_uint64; struct { - u32 Pending; - u32 Armed; + u32 pending; + u32 armed; }; }; struct hv_monitor_parameter { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flagnumber; + u16 rsvdz; }; union hv_monitor_trigger_state { - u32 Asu32; + u32 asu32; struct { - u32 GroupEnable:4; - u32 RsvdZ:28; + u32 group_enable:4; + u32 rsvdz:28; }; }; @@ -814,42 +814,42 @@ union hv_monitor_trigger_state { /* | 840 | Rsvd4[0] | */ /* ------------------------------------------------------ */ struct hv_monitor_page { - union hv_monitor_trigger_state TriggerState; - u32 RsvdZ1; + union hv_monitor_trigger_state trigger_state; + u32 rsvdz1; - union hv_monitor_trigger_group TriggerGroup[4]; - u64 RsvdZ2[3]; + union hv_monitor_trigger_group trigger_group[4]; + u64 rsvdz2[3]; - s32 NextCheckTime[4][32]; + s32 next_checktime[4][32]; - u16 Latency[4][32]; - u64 RsvdZ3[32]; + u16 latency[4][32]; + u64 rsvdz3[32]; - struct hv_monitor_parameter Parameter[4][32]; + struct hv_monitor_parameter parameter[4][32]; - u8 RsvdZ4[1984]; + u8 rsvdz4[1984]; }; /* Declare the various hypercall operations. */ enum hv_call_code { - HvCallPostMessage = 0x005c, - HvCallSignalEvent = 0x005d, + HVCALL_POST_MESSAGE = 0x005c, + HVCALL_SIGNAL_EVENT = 0x005d, }; /* Definition of the HvPostMessage hypercall input structure. */ struct hv_input_post_message { - union hv_connection_id ConnectionId; - u32 Reserved; - enum hv_message_type MessageType; - u32 PayloadSize; - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + union hv_connection_id connectionid; + u32 reserved; + enum hv_message_type message_type; + u32 payload_size; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; /* Definition of the HvSignalEvent hypercall input structure. */ struct hv_input_signal_event { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flag_number; + u16 rsvdz; }; /* @@ -859,16 +859,16 @@ struct hv_input_signal_event { /* Version info reported by guest OS's */ enum hv_guest_os_vendor { - HvGuestOsVendorMicrosoft = 0x0001 + HVGUESTOS_VENDOR_MICROSOFT = 0x0001 }; enum hv_guest_os_microsoft_ids { - HvGuestOsMicrosoftUndefined = 0x00, - HvGuestOsMicrosoftMSDOS = 0x01, - HvGuestOsMicrosoftWindows3x = 0x02, - HvGuestOsMicrosoftWindows9x = 0x03, - HvGuestOsMicrosoftWindowsNT = 0x04, - HvGuestOsMicrosoftWindowsCE = 0x05 + HVGUESTOS_MICROSOFT_UNDEFINED = 0x00, + HVGUESTOS_MICROSOFT_MSDOS = 0x01, + HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02, + HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03, + HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04, + HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05 }; /* @@ -877,14 +877,14 @@ enum hv_guest_os_microsoft_ids { #define HV_X64_MSR_GUEST_OS_ID 0x40000000 union hv_x64_msr_guest_os_id_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 BuildNumber:16; - u64 ServiceVersion:8; /* Service Pack, etc. */ - u64 MinorVersion:8; - u64 MajorVersion:8; - u64 OsId:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ - u64 VendorId:16; /* enum hv_guest_os_vendor */ + u64 build_number:16; + u64 service_version:8; /* Service Pack, etc. */ + u64 minor_version:8; + u64 major_version:8; + u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ + u64 vendor_id:16; /* enum hv_guest_os_vendor */ }; }; @@ -894,11 +894,11 @@ union hv_x64_msr_guest_os_id_contents { #define HV_X64_MSR_HYPERCALL 0x40000001 union hv_x64_msr_hypercall_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:11; - u64 GuestPhysicalAddress:52; + u64 enable:1; + u64 reserved:11; + u64 guest_physical_address:52; }; }; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index d449daf..7c54ca9 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -153,7 +153,7 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) struct hv_message *copied; while (1) { - if (msg->Header.MessageType == HvMessageTypeNone) { + if (msg->header.message_type == HVMSG_NONE) { /* no msg */ break; } else { @@ -166,18 +166,18 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) (void *)copied); } - msg->Header.MessageType = HvMessageTypeNone; + msg->header.message_type = HVMSG_NONE; /* * Make sure the write to MessageType (ie set to - * HvMessageTypeNone) happens before we read the + * HVMSG_NONE) happens before we read the * MessagePending and EOMing. Otherwise, the EOMing * will not deliver any more messages since there is * no empty slot */ mb(); - if (msg->Header.MessageFlags.MessagePending) { + if (msg->header.message_flags.msg_pending) { /* * This will cause message queue rescan to * possibly deliver another msg from the @@ -212,10 +212,10 @@ static int VmbusOnISR(struct hv_driver *drv) msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; /* Check if there are actual msgs to be process */ - if (msg->Header.MessageType != HvMessageTypeNone) { + if (msg->header.message_type != HVMSG_NONE) { DPRINT_DBG(VMBUS, "received msg type %d size %d", - msg->Header.MessageType, - msg->Header.PayloadSize); + msg->header.message_type, + msg->header.payload_size); ret |= 0x1; } @@ -224,8 +224,8 @@ static int VmbusOnISR(struct hv_driver *drv) event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; /* Since we are a child, we only need to check bit 0 */ - if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) { - DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]); + if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) { + DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]); ret |= 0x2; } -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 05/10] staging: hv: Convert camel cased functions in hv.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in hv.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/connection.c | 4 +- drivers/staging/hv/hv.c | 42 ++++++++++++++++++++------------------ drivers/staging/hv/hv.h | 16 +++++++------- drivers/staging/hv/hv_api.h | 4 +- drivers/staging/hv/vmbus.c | 8 +++--- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index ba50dd8..97321d1 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -311,7 +311,7 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) connId.asu32 = 0; connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; - return HvPostMessage(connId, 1, buffer, bufferLen); + return hv_post_message(connId, 1, buffer, bufferLen); } /* @@ -324,5 +324,5 @@ int VmbusSetEvent(u32 childRelId) (unsigned long *)gVmbusConnection.SendInterruptPage + (childRelId >> 5)); - return HvSignalEvent(); + return hv_signal_event(); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 5d72736..3aefd2c 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -38,7 +38,7 @@ struct hv_context g_hv_context = { /* * HvQueryHypervisorPresence - Query the cpuid for presense of windows hypervisor */ -static int HvQueryHypervisorPresence(void) +static int hvquery_hypervisor_presence(void) { unsigned int eax; unsigned int ebx; @@ -59,7 +59,7 @@ static int HvQueryHypervisorPresence(void) /* * HvQueryHypervisorInfo - Get version info of the windows hypervisor */ -static int HvQueryHypervisorInfo(void) +static int hvquery_hypervisor_info(void) { unsigned int eax; unsigned int ebx; @@ -126,9 +126,9 @@ static int HvQueryHypervisorInfo(void) } /* - * HvDoHypercall - Invoke the specified hypercall + * hvdo_hypercall- Invoke the specified hypercall */ -static u64 HvDoHypercall(u64 control, void *input, void *output) +static u64 hvdo_hypercall(u64 control, void *input, void *output) { #ifdef CONFIG_X86_64 u64 hv_status = 0; @@ -181,11 +181,11 @@ static u64 HvDoHypercall(u64 control, void *input, void *output) } /* - * HvInit - Main initialization routine. + * hv_init - Main initialization routine. * * This routine must be called before any other routines in here are called */ -int HvInit(void) +int hv_init(void) { int ret = 0; int max_leaf; @@ -196,7 +196,7 @@ int HvInit(void) memset(g_hv_context.synic_message_page, 0, sizeof(void *) * MAX_NUM_CPUS); - if (!HvQueryHypervisorPresence()) { + if (!hvquery_hypervisor_presence()) { DPRINT_ERR(VMBUS, "No Windows hypervisor detected!!"); goto Cleanup; } @@ -204,7 +204,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Windows hypervisor detected! Retrieving more info..."); - max_leaf = HvQueryHypervisorInfo(); + max_leaf = hvquery_hypervisor_info(); /* HvQueryHypervisorFeatures(maxLeaf); */ /* @@ -291,11 +291,11 @@ Cleanup: } /* - * HvCleanup - Cleanup routine. + * hv_cleanup - Cleanup routine. * * This routine is called normally during driver unloading or exiting. */ -void HvCleanup(void) +void hv_cleanup(void) { union hv_x64_msr_hypercall_contents hypercall_msr; @@ -312,11 +312,11 @@ void HvCleanup(void) } /* - * HvPostMessage - Post a message using the hypervisor message IPC. + * hv_post_message - Post a message using the hypervisor message IPC. * * This involves a hypercall. */ -u16 HvPostMessage(union hv_connection_id connection_id, +u16 hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, void *payload, size_t payload_size) { @@ -344,7 +344,8 @@ u16 HvPostMessage(union hv_connection_id connection_id, aligned_msg->payload_size = payload_size; memcpy((void *)aligned_msg->payload, payload, payload_size); - status = HvDoHypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) & 0xFFFF; + status = hvdo_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) + & 0xFFFF; kfree((void *)addr); @@ -353,28 +354,29 @@ u16 HvPostMessage(union hv_connection_id connection_id, /* - * HvSignalEvent - Signal an event on the specified connection using the hypervisor event IPC. + * hv_signal_event - + * Signal an event on the specified connection using the hypervisor event IPC. * * This involves a hypercall. */ -u16 HvSignalEvent(void) +u16 hv_signal_event(void) { u16 status; - status = HvDoHypercall(HVCALL_SIGNAL_EVENT, + status = hvdo_hypercall(HVCALL_SIGNAL_EVENT, g_hv_context.signal_event_param, NULL) & 0xFFFF; return status; } /* - * HvSynicInit - Initialize the Synthethic Interrupt Controller. + * hv_synic_init - Initialize the Synthethic Interrupt Controller. * * If it is already initialized by another entity (ie x2v shim), we need to * retrieve the initialized message and event pages. Otherwise, we create and * initialize the message and event pages. */ -void HvSynicInit(void *irqarg) +void hv_synic_init(void *irqarg) { u64 version; union hv_synic_simp simp; @@ -467,9 +469,9 @@ Cleanup: } /* - * HvSynicCleanup - Cleanup routine for HvSynicInit(). + * hv_synic_cleanup - Cleanup routine for hv_synic_init(). */ -void HvSynicCleanup(void *arg) +void hv_synic_cleanup(void *arg) { union hv_synic_sint shared_sint; union hv_synic_simp simp; diff --git a/drivers/staging/hv/hv.h b/drivers/staging/hv/hv.h index 5a9e574..f252f2e 100644 --- a/drivers/staging/hv/hv.h +++ b/drivers/staging/hv/hv.h @@ -123,18 +123,18 @@ extern struct hv_context g_hv_context; /* Hv Interface */ -extern int HvInit(void); +extern int hv_init(void); -extern void HvCleanup(void); +extern void hv_cleanup(void); -extern u16 HvPostMessage(union hv_connection_id connectionId, - enum hv_message_type messageType, - void *payload, size_t payloadSize); +extern u16 hv_post_message(union hv_connection_id connection_id, + enum hv_message_type message_type, + void *payload, size_t payload_size); -extern u16 HvSignalEvent(void); +extern u16 hv_signal_event(void); -extern void HvSynicInit(void *irqarg); +extern void hv_synic_init(void *irqarg); -extern void HvSynicCleanup(void *arg); +extern void hv_synic_cleanup(void *arg); #endif /* __HV_H__ */ diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9df6472..70e863a 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -836,7 +836,7 @@ enum hv_call_code { HVCALL_SIGNAL_EVENT = 0x005d, }; -/* Definition of the HvPostMessage hypercall input structure. */ +/* Definition of the hv_post_message hypercall input structure. */ struct hv_input_post_message { union hv_connection_id connectionid; u32 reserved; @@ -845,7 +845,7 @@ struct hv_input_post_message { u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; -/* Definition of the HvSignalEvent hypercall input structure. */ +/* Definition of the hv_signal_event hypercall input structure. */ struct hv_input_signal_event { union hv_connection_id connectionid; u16 flag_number; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index 7b68212..b785246 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -109,7 +109,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) /* strcpy(dev->name, "vmbus"); */ /* SynIC setup... */ - on_each_cpu(HvSynicInit, (void *)irqvector, 1); + on_each_cpu(hv_synic_init, (void *)irqvector, 1); /* Connect to VMBus in the root partition */ ret = VmbusConnect(); @@ -127,7 +127,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev) vmbus_release_unattached_channels(); VmbusDisconnect(); - on_each_cpu(HvSynicCleanup, NULL, 1); + on_each_cpu(hv_synic_cleanup, NULL, 1); return ret; } @@ -138,7 +138,7 @@ static void VmbusOnCleanup(struct hv_driver *drv) { /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ - HvCleanup(); + hv_cleanup(); } /* @@ -264,7 +264,7 @@ int VmbusInitialize(struct hv_driver *drv) driver->GetChannelOffers = VmbusGetChannelOffers; /* Hypervisor initialization...setup hypercall page..etc */ - ret = HvInit(); + ret = hv_init(); if (ret != 0) DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", ret); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 06/10] staging: hv: Convert camel cased local variables in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased local variables in osd.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/osd.c | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index 8c3eb27..b39ec25 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -130,9 +130,9 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); /** * osd_WaitEventSet() - Wake up the process - * @waitEvent: Structure to event to be woken up + * @wait_event: Structure to event to be woken up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Wake up the sleeping process so it can do some work. * And set condition indicator in &struct osd_waitevent to indicate @@ -140,18 +140,18 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *waitEvent) +void osd_WaitEventSet(struct osd_waitevent *wait_event) { - waitEvent->condition = 1; - wake_up_interruptible(&waitEvent->event); + wait_event->condition = 1; + wake_up_interruptible(&wait_event->event); } EXPORT_SYMBOL_GPL(osd_WaitEventSet); /** * osd_WaitEventWait() - Wait for event till condition is true - * @waitEvent: Structure to event to be put to sleep + * @wait_event: Structure to event to be put to sleep * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Set up the process to sleep until waitEvent->condition get true. * And set condition indicator in &struct osd_waitevent to indicate @@ -161,25 +161,25 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *waitEvent) +int osd_WaitEventWait(struct osd_waitevent *wait_event) { int ret = 0; - ret = wait_event_interruptible(waitEvent->event, - waitEvent->condition); - waitEvent->condition = 0; + ret = wait_event_interruptible(wait_event->event, + wait_event->condition); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWait); /** * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup - * @waitEvent: Structure to event to be put to sleep - * @TimeoutInMs: Total number of Milliseconds to wait before waking up + * @wait_event: Structure to event to be put to sleep + * @timeout_in_ms: Total number of Milliseconds to wait before waking up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * Set up the process to sleep until @waitEvent->condition get true or - * @TimeoutInMs (Time out in Milliseconds) has been reached. + * @timeout_in_ms (Time out in Milliseconds) has been reached. * And set condition indicator in &struct osd_waitevent to indicate * the process is in a sleeping state. * @@ -187,14 +187,14 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs) +int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; - ret = wait_event_interruptible_timeout(waitEvent->event, - waitEvent->condition, - msecs_to_jiffies(TimeoutInMs)); - waitEvent->condition = 0; + ret = wait_event_interruptible_timeout(wait_event->event, + wait_event->condition, + msecs_to_jiffies(timeout_in_ms)); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 07/10] staging: hv: Convert camel cased functions in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in osd.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 | 20 +++++++++--------- drivers/staging/hv/channel_mgmt.c | 12 +++++----- drivers/staging/hv/connection.c | 14 ++++++------ drivers/staging/hv/hv.c | 12 +++++----- drivers/staging/hv/netvsc.c | 24 +++++++++++----------- drivers/staging/hv/osd.c | 40 ++++++++++++++++++------------------ drivers/staging/hv/osd.h | 18 ++++++++-------- drivers/staging/hv/rndis_filter.c | 10 ++++---- drivers/staging/hv/storvsc.c | 16 +++++++------- 9 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 7c15c40..abc2988 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -180,7 +180,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) + out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); if (!out) return -ENOMEM; @@ -242,7 +242,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->waitevent = osd_WaitEventCreate(); + openInfo->waitevent = osd_waitevent_create(); if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; @@ -280,7 +280,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->waitevent); + osd_waitevent_wait(openInfo->waitevent); if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); @@ -300,7 +300,7 @@ Cleanup: errorout: RingBufferCleanup(&newchannel->outbound); RingBufferCleanup(&newchannel->inbound); - osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) + osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); return err; @@ -508,7 +508,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -565,7 +565,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } } - osd_WaitEventWait(msginfo->waitevent); + osd_waitevent_wait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " @@ -604,7 +604,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->waitevent = osd_WaitEventCreate(); + info->waitevent = osd_waitevent_create(); if (!info->waitevent) { kfree(info); return -ENOMEM; @@ -628,7 +628,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->waitevent); + osd_waitevent_wait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); @@ -663,7 +663,7 @@ void vmbus_close(struct vmbus_channel *channel) if (!info) return; - /* info->waitEvent = osd_WaitEventCreate(); */ + /* info->waitEvent = osd_waitevent_create(); */ msg = (struct vmbus_channel_close_channel *)info->msg; msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; @@ -686,7 +686,7 @@ void vmbus_close(struct vmbus_channel *channel) RingBufferCleanup(&channel->outbound); RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); + osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index be34e38..ae830f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -566,7 +566,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -616,7 +616,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -662,7 +662,7 @@ static void vmbus_ongpadl_torndown( memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -703,7 +703,7 @@ static void vmbus_onversion_response( memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -782,7 +782,7 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; @@ -808,7 +808,7 @@ int vmbus_request_offers(void) goto Cleanup; } - /* osd_WaitEventWait(msgInfo->waitEvent); */ + /* osd_waitevent_wait(msgInfo->waitEvent); */ /*SpinlockAcquire(gVmbusConnection.channelMsgLock); REMOVE_ENTRY_LIST(&msgInfo->msgListEntry); diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 97321d1..c2e298f 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -66,7 +66,7 @@ int VmbusConnect(void) * Setup the vmbus event connection for channel interrupt * abstraction stuff */ - gVmbusConnection.InterruptPage = osd_PageAlloc(1); + gVmbusConnection.InterruptPage = osd_page_alloc(1); if (gVmbusConnection.InterruptPage == NULL) { ret = -1; goto Cleanup; @@ -81,7 +81,7 @@ int VmbusConnect(void) * Setup the monitor notification facility. The 1st page for * parent->child and the 2nd page for child->parent */ - gVmbusConnection.MonitorPages = osd_PageAlloc(2); + gVmbusConnection.MonitorPages = osd_page_alloc(2); if (gVmbusConnection.MonitorPages == NULL) { ret = -1; goto Cleanup; @@ -95,7 +95,7 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->waitevent = osd_WaitEventCreate(); + msgInfo->waitevent = osd_waitevent_create(); if (!msgInfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -134,7 +134,7 @@ int VmbusConnect(void) } /* Wait for the connection response */ - osd_WaitEventWait(msgInfo->waitevent); + osd_waitevent_wait(msgInfo->waitevent); list_del(&msgInfo->msglistentry); @@ -162,12 +162,12 @@ Cleanup: destroy_workqueue(gVmbusConnection.WorkQueue); if (gVmbusConnection.InterruptPage) { - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); gVmbusConnection.InterruptPage = NULL; } if (gVmbusConnection.MonitorPages) { - osd_PageFree(gVmbusConnection.MonitorPages, 2); + osd_page_free(gVmbusConnection.MonitorPages, 2); gVmbusConnection.MonitorPages = NULL; } @@ -202,7 +202,7 @@ int VmbusDisconnect(void) if (ret != 0) goto Cleanup; - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); /* TODO: iterate thru the msg list and free up */ destroy_workqueue(gVmbusConnection.WorkQueue); diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 3aefd2c..3374a02 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -227,9 +227,9 @@ int hv_init(void) /* * Allocate the hypercall page memory - * virtAddr = osd_PageAlloc(1); + * virtAddr = osd_page_alloc(1); */ - virtaddr = osd_VirtualAllocExec(PAGE_SIZE); + virtaddr = osd_virtual_alloc_exec(PAGE_SIZE); if (!virtaddr) { DPRINT_ERR(VMBUS, @@ -461,10 +461,10 @@ void hv_synic_init(void *irqarg) Cleanup: if (g_hv_context.synic_event_page[cpu]) - osd_PageFree(g_hv_context.synic_event_page[cpu], 1); + osd_page_free(g_hv_context.synic_event_page[cpu], 1); if (g_hv_context.synic_message_page[cpu]) - osd_PageFree(g_hv_context.synic_message_page[cpu], 1); + osd_page_free(g_hv_context.synic_message_page[cpu], 1); return; } @@ -501,6 +501,6 @@ void hv_synic_cleanup(void *arg) wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); - osd_PageFree(g_hv_context.synic_message_page[cpu], 1); - osd_PageFree(g_hv_context.synic_event_page[cpu], 1); + osd_page_free(g_hv_context.synic_message_page[cpu], 1); + osd_page_free(g_hv_context.synic_event_page[cpu], 1); } diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index 4c2632c..8022781 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c @@ -221,7 +221,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->ReceiveBuffer - osd_PageAlloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); if (!netDevice->ReceiveBuffer) { DPRINT_ERR(NETVSC, "unable to allocate receive buffer of size %d", @@ -249,7 +249,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer..."); @@ -274,7 +274,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendReceiveBufferComplete.Status != NvspStatusSuccess) { @@ -350,7 +350,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->SendBuffer - osd_PageAlloc(netDevice->SendBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->SendBufferSize >> PAGE_SHIFT); if (!netDevice->SendBuffer) { DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d", netDevice->SendBufferSize); @@ -375,7 +375,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer..."); @@ -400,7 +400,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendSendBufferComplete.Status != NvspStatusSuccess) { @@ -480,7 +480,7 @@ static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up receive buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->ReceiveBuffer, + osd_page_free(NetDevice->ReceiveBuffer, NetDevice->ReceiveBufferSize >> PAGE_SHIFT); NetDevice->ReceiveBuffer = NULL; } @@ -553,7 +553,7 @@ static int NetVscDestroySendBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up send buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->SendBuffer, + osd_page_free(NetDevice->SendBuffer, NetDevice->SendBufferSize >> PAGE_SHIFT); NetDevice->SendBuffer = NULL; } @@ -597,7 +597,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Now, check the response */ /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */ @@ -651,7 +651,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) * packet) since our Vmbus always set the * VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag */ - /* osd_WaitEventWait(NetVscChannel->ChannelInitEvent); */ + /* osd_waitevent_wait(NetVscChannel->ChannelInitEvent); */ /* Post the big receive buffer to NetVSP */ ret = NetVscInitializeReceiveBufferWithNetVsp(Device); @@ -710,7 +710,7 @@ static int NetVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) list_add_tail(&packet->ListEntry, &netDevice->ReceivePacketList); } - netDevice->ChannelInitEvent = osd_WaitEventCreate(); + netDevice->ChannelInitEvent = osd_waitevent_create(); if (!netDevice->ChannelInitEvent) { ret = -ENOMEM; goto Cleanup; @@ -855,7 +855,7 @@ static void NetVscOnSendCompletion(struct hv_device *Device, /* Copy the response back */ memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(struct nvsp_message)); - osd_WaitEventSet(netDevice->ChannelInitEvent); + osd_waitevent_set(netDevice->ChannelInitEvent); } else if (nvspPacket->Header.MessageType = NvspMessage1TypeSendRNDISPacketComplete) { /* Get the send context */ diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index b39ec25..b699ee2 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -49,7 +49,7 @@ struct osd_callback_struct { void *data; }; -void *osd_VirtualAllocExec(unsigned int size) +void *osd_virtual_alloc_exec(unsigned int size) { #ifdef __x86_64__ return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL_EXEC); @@ -60,7 +60,7 @@ void *osd_VirtualAllocExec(unsigned int size) } /** - * osd_PageAlloc() - Allocate pages + * osd_page_alloc() - Allocate pages * @count: Total number of Kernel pages you want to allocate * * Tries to allocate @count number of consecutive free kernel pages. @@ -68,7 +68,7 @@ void *osd_VirtualAllocExec(unsigned int size) * If successfull it will return pointer to the @count pages. * Mainly used by Hyper-V drivers. */ -void *osd_PageAlloc(unsigned int count) +void *osd_page_alloc(unsigned int count) { void *p; @@ -85,26 +85,26 @@ void *osd_PageAlloc(unsigned int count) /* if (p) memset(p, 0, PAGE_SIZE); */ /* return p; */ } -EXPORT_SYMBOL_GPL(osd_PageAlloc); +EXPORT_SYMBOL_GPL(osd_page_alloc); /** - * osd_PageFree() - Free pages + * osd_page_free() - Free pages * @page: Pointer to the first page to be freed * @count: Total number of Kernel pages you free * - * Frees the pages allocated by osd_PageAlloc() + * Frees the pages allocated by osd_page_alloc() * Mainly used by Hyper-V drivers. */ -void osd_PageFree(void *page, unsigned int count) +void osd_page_free(void *page, unsigned int count) { free_pages((unsigned long)page, get_order(count * PAGE_SIZE)); /*struct page* p = virt_to_page(page); __free_page(p);*/ } -EXPORT_SYMBOL_GPL(osd_PageFree); +EXPORT_SYMBOL_GPL(osd_page_free); /** - * osd_WaitEventCreate() - Create the event queue + * osd_waitevent_create() - Create the event queue * * Allocates memory for a &struct osd_waitevent. And then calls * init_waitqueue_head to set up the wait queue for the event. @@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(osd_PageFree); * Returns pointer to &struct osd_waitevent * Mainly used by Hyper-V drivers. */ -struct osd_waitevent *osd_WaitEventCreate(void) +struct osd_waitevent *osd_waitevent_create(void) { struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL); @@ -125,11 +125,11 @@ struct osd_waitevent *osd_WaitEventCreate(void) init_waitqueue_head(&wait->event); return wait; } -EXPORT_SYMBOL_GPL(osd_WaitEventCreate); +EXPORT_SYMBOL_GPL(osd_waitevent_create); /** - * osd_WaitEventSet() - Wake up the process + * osd_waitevent_set() - Wake up the process * @wait_event: Structure to event to be woken up * * @wait_event is of type &struct osd_waitevent @@ -140,15 +140,15 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *wait_event) +void osd_waitevent_set(struct osd_waitevent *wait_event) { wait_event->condition = 1; wake_up_interruptible(&wait_event->event); } -EXPORT_SYMBOL_GPL(osd_WaitEventSet); +EXPORT_SYMBOL_GPL(osd_waitevent_set); /** - * osd_WaitEventWait() - Wait for event till condition is true + * osd_waitevent_wait() - Wait for event till condition is true * @wait_event: Structure to event to be put to sleep * * @wait_event is of type &struct osd_waitevent @@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *wait_event) +int osd_waitevent_wait(struct osd_waitevent *wait_event) { int ret = 0; @@ -170,10 +170,10 @@ int osd_WaitEventWait(struct osd_waitevent *wait_event) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWait); +EXPORT_SYMBOL_GPL(osd_waitevent_wait); /** - * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup + * osd_waitevent_waitex() - Wait for event or timeout for process wakeup * @wait_event: Structure to event to be put to sleep * @timeout_in_ms: Total number of Milliseconds to wait before waking up * @@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) +int osd_waitevent_waitex(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; @@ -197,7 +197,7 @@ int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); +EXPORT_SYMBOL_GPL(osd_waitevent_waitex); static void osd_callback_work(struct work_struct *work) { diff --git a/drivers/staging/hv/osd.h b/drivers/staging/hv/osd.h index ce064e8..cae126f 100644 --- a/drivers/staging/hv/osd.h +++ b/drivers/staging/hv/osd.h @@ -50,18 +50,18 @@ struct osd_waitevent { /* Osd routines */ -extern void *osd_VirtualAllocExec(unsigned int size); +extern void *osd_virtual_alloc_exec(unsigned int size); -extern void *osd_PageAlloc(unsigned int count); -extern void osd_PageFree(void *page, unsigned int count); +extern void *osd_page_alloc(unsigned int count); +extern void osd_page_free(void *page, unsigned int count); -extern struct osd_waitevent *osd_WaitEventCreate(void); -extern void osd_WaitEventSet(struct osd_waitevent *waitEvent); -extern int osd_WaitEventWait(struct osd_waitevent *waitEvent); +extern struct osd_waitevent *osd_waitevent_create(void); +extern void osd_waitevent_set(struct osd_waitevent *wait_event); +extern int osd_waitevent_wait(struct osd_waitevent *wait_event); -/* If >0, waitEvent got signaled. If ==0, timeout. If < 0, error */ -extern int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, - u32 TimeoutInMs); +/* If >0, wait_event got signaled. If ==0, timeout. If < 0, error */ +extern int osd_waitevent_waitex(struct osd_waitevent *wait_event, + u32 timeout_in_ms); int osd_schedule_callback(struct workqueue_struct *wq, void (*func)(void *), diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c index fa2141f..b85c825 100644 --- a/drivers/staging/hv/rndis_filter.c +++ b/drivers/staging/hv/rndis_filter.c @@ -129,7 +129,7 @@ static struct rndis_request *GetRndisRequest(struct rndis_device *Device, if (!request) return NULL; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { kfree(request); return NULL; @@ -313,7 +313,7 @@ static void RndisFilterReceiveResponse(struct rndis_device *Device, } } - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { DPRINT_ERR(NETVSC, "no rndis request found for this response " "(id 0x%x res type 0x%x)", @@ -497,7 +497,7 @@ static int RndisFilterQueryDevice(struct rndis_device *Device, u32 Oid, if (ret != 0) goto Cleanup; - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* Copy the response back */ queryComplete = &request->ResponseMessage.Message.QueryComplete; @@ -572,7 +572,7 @@ static int RndisFilterSetPacketFilter(struct rndis_device *Device, if (ret != 0) goto Cleanup; - ret = osd_WaitEventWaitEx(request->WaitEvent, 2000/*2sec*/); + ret = osd_waitevent_waitex(request->WaitEvent, 2000/*2sec*/); if (!ret) { ret = -1; DPRINT_ERR(NETVSC, "timeout before we got a set response..."); @@ -665,7 +665,7 @@ static int RndisFilterInitDevice(struct rndis_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); initComplete = &request->ResponseMessage.Message.InitializeComplete; status = initComplete->Status; diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 19e87f6..525c8ee 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -198,7 +198,7 @@ static int StorVscChannelInit(struct hv_device *Device) * channel */ memset(request, 0, sizeof(struct storvsc_request_extension)); - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto nomem; @@ -224,7 +224,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -255,7 +255,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -287,7 +287,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -323,7 +323,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -473,7 +473,7 @@ static void StorVscOnChannelCallback(void *context) memcpy(&request->VStorPacket, packet, sizeof(struct vstor_packet)); - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { StorVscOnReceive(device, (struct vstor_packet *)packet, @@ -622,7 +622,7 @@ int StorVscOnHostReset(struct hv_device *Device) request = &storDevice->ResetRequest; vstorPacket = &request->VStorPacket; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto Cleanup; @@ -644,7 +644,7 @@ int StorVscOnHostReset(struct hv_device *Device) } /* FIXME: Add a timeout */ - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); kfree(request->WaitEvent); DPRINT_INFO(STORVSC, "host adapter reset completed"); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 08/10] staging: hv: Convert camel cased struct fields in ring_buffer.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in ring_buffer.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 | 10 +++--- drivers/staging/hv/ring_buffer.c | 58 ++++++++++++++++++++----------------- drivers/staging/hv/ring_buffer.h | 30 ++++++++++---------- drivers/staging/hv/vmbus_drv.c | 25 +++++++++------- 4 files changed, 65 insertions(+), 58 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index abc2988..0e554e9 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -213,7 +213,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->outbound.RingBuffer, + newchannel->outbound.ring_buffer, send_ringbuffer_size + recv_ringbuffer_size, &newchannel->ringbuffer_gpadlhandle); @@ -227,10 +227,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, "size %d recv ring %p size %d, downstreamoffset %d>", newchannel, newchannel->offermsg.child_relid, newchannel->ringbuffer_gpadlhandle, - newchannel->outbound.RingBuffer, - newchannel->outbound.RingSize, - newchannel->inbound.RingBuffer, - newchannel->inbound.RingSize, + newchannel->outbound.ring_buffer, + newchannel->outbound.ring_size, + newchannel->inbound.ring_buffer, + newchannel->inbound.ring_size, send_ringbuffer_size); /* Create and init the channel open message */ diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index d78c569..6095cc5 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -51,11 +51,11 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) u32 read_loc, write_loc; /* Capture the read/write indices before they changed */ - read_loc = rbi->RingBuffer->ReadIndex; - write_loc = rbi->RingBuffer->WriteIndex; + read_loc = rbi->ring_buffer->read_index; + write_loc = rbi->ring_buffer->write_index; - *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->RingDataSize); - *read = rbi->RingDataSize - *write; + *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize); + *read = rbi->ring_datasize - *write; } /*++ @@ -70,7 +70,7 @@ Description: static inline u32 GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->WriteIndex; + u32 next = RingInfo->ring_buffer->write_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -90,7 +90,7 @@ static inline void SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, u32 NextWriteLocation) { - RingInfo->RingBuffer->WriteIndex = NextWriteLocation; + RingInfo->ring_buffer->write_index = NextWriteLocation; } /*++ @@ -105,7 +105,7 @@ Description: static inline u32 GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -125,11 +125,11 @@ Description: static inline u32 GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ next += Offset; - next %= RingInfo->RingDataSize; + next %= RingInfo->ring_datasize; return next; } @@ -146,7 +146,7 @@ Description: static inline void SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) { - RingInfo->RingBuffer->ReadIndex = NextReadLocation; + RingInfo->ring_buffer->read_index = NextReadLocation; } @@ -162,7 +162,7 @@ Description: static inline void * GetRingBuffer(struct hv_ring_buffer_info *RingInfo) { - return (void *)RingInfo->RingBuffer->Buffer; + return (void *)RingInfo->ring_buffer->buffer; } @@ -178,7 +178,7 @@ Description: static inline u32 GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) { - return RingInfo->RingDataSize; + return RingInfo->ring_datasize; } /*++ @@ -193,7 +193,7 @@ Description: static inline u64 GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) { - return (u64)RingInfo->RingBuffer->WriteIndex << 32; + return (u64)RingInfo->ring_buffer->write_index << 32; } @@ -221,11 +221,11 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) "avail read %u read idx %u write idx %u>>", Prefix, RingInfo, - RingInfo->RingBuffer->Buffer, + RingInfo->ring_buffer->buffer, bytesAvailToWrite, bytesAvailToRead, - RingInfo->RingBuffer->ReadIndex, - RingInfo->RingBuffer->WriteIndex); + RingInfo->ring_buffer->read_index, + RingInfo->ring_buffer->write_index); } @@ -262,16 +262,19 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, u32 bytesAvailToWrite; u32 bytesAvailToRead; - if (RingInfo->RingBuffer) { + if (RingInfo->ring_buffer) { GetRingBufferAvailBytes(RingInfo, &bytesAvailToRead, &bytesAvailToWrite); - debug_info->BytesAvailToRead = bytesAvailToRead; - debug_info->BytesAvailToWrite = bytesAvailToWrite; - debug_info->CurrentReadIndex = RingInfo->RingBuffer->ReadIndex; - debug_info->CurrentWriteIndex = RingInfo->RingBuffer->WriteIndex; - debug_info->CurrentInterruptMask = RingInfo->RingBuffer->InterruptMask; + debug_info->bytes_avail_toread = bytesAvailToRead; + debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->current_read_index + RingInfo->ring_buffer->read_index; + debug_info->current_write_index + RingInfo->ring_buffer->write_index; + debug_info->current_interrupt_mask + RingInfo->ring_buffer->interrupt_mask; } } @@ -287,7 +290,7 @@ Description: --*/ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) { - return rbi->RingBuffer->InterruptMask; + return rbi->ring_buffer->interrupt_mask; } /*++ @@ -306,11 +309,12 @@ int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 Buffe memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->RingBuffer = (struct hv_ring_buffer *)Buffer; - RingInfo->RingBuffer->ReadIndex = RingInfo->RingBuffer->WriteIndex = 0; + RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; + RingInfo->ring_buffer->read_index + RingInfo->ring_buffer->write_index = 0; - RingInfo->RingSize = BufferLen; - RingInfo->RingDataSize = BufferLen - sizeof(struct hv_ring_buffer); + RingInfo->ring_size = BufferLen; + RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); spin_lock_init(&RingInfo->ring_lock); diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index a7f1717..bb4c5bc 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -29,18 +29,18 @@ struct hv_ring_buffer { /* Offset in bytes from the start of ring data below */ - volatile u32 WriteIndex; + volatile u32 write_index; /* Offset in bytes from the start of ring data below */ - volatile u32 ReadIndex; + volatile u32 read_index; - volatile u32 InterruptMask; + volatile u32 interrupt_mask; /* Pad it to PAGE_SIZE so that data starts on page boundary */ - u8 Reserved[4084]; + u8 reserved[4084]; /* NOTE: - * The InterruptMask field is used only for channels but since our + * The interrupt_mask field is used only for channels but since our * vmbus connection also uses this data structure and its data starts * here, we commented out this field. */ @@ -50,24 +50,24 @@ struct hv_ring_buffer { * Ring data starts here + RingDataStartOffset * !!! DO NOT place any fields below this !!! */ - u8 Buffer[0]; + u8 buffer[0]; } __attribute__((packed)); struct hv_ring_buffer_info { - struct hv_ring_buffer *RingBuffer; - u32 RingSize; /* Include the shared header */ + struct hv_ring_buffer *ring_buffer; + u32 ring_size; /* Include the shared header */ spinlock_t ring_lock; - u32 RingDataSize; /* < ringSize */ - u32 RingDataStartOffset; + u32 ring_datasize; /* < ring_size */ + u32 ring_data_startoffset; }; struct hv_ring_buffer_debug_info { - u32 CurrentInterruptMask; - u32 CurrentReadIndex; - u32 CurrentWriteIndex; - u32 BytesAvailToRead; - u32 BytesAvailToWrite; + u32 current_interrupt_mask; + u32 current_read_index; + u32 current_write_index; + u32 bytes_avail_toread; + u32 bytes_avail_towrite; }; diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 2bbf4ec..0965875 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -156,18 +156,21 @@ static void get_channel_info(struct hv_device *device, info->ClientMonitorLatency = debug_info.clientmonitor_latency; info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - - info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; + info->Inbound.InterruptMask = debug_info.inbound.current_interrupt_mask; + info->Inbound.ReadIndex = debug_info.inbound.current_read_index; + info->Inbound.WriteIndex = debug_info.inbound.current_write_index; + info->Inbound.BytesAvailToRead = debug_info.inbound.bytes_avail_toread; + info->Inbound.BytesAvailToWrite + debug_info.inbound.bytes_avail_towrite; + + info->Outbound.InterruptMask + debug_info.outbound.current_interrupt_mask; + info->Outbound.ReadIndex = debug_info.outbound.current_read_index; + info->Outbound.WriteIndex = debug_info.outbound.current_write_index; + info->Outbound.BytesAvailToRead + debug_info.outbound.bytes_avail_toread; info->Outbound.BytesAvailToWrite - debug_info.outbound.BytesAvailToWrite; + debug_info.outbound.bytes_avail_towrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 09/10] staging: hv: Convert camel cased local variables in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased local variables in ring_buffer.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 | 4 +- drivers/staging/hv/ring_buffer.c | 337 +++++++++++++++++++------------------- drivers/staging/hv/ring_buffer.h | 26 ++-- 3 files changed, 185 insertions(+), 182 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 0e554e9..97db545 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - DumpRingInfo(&channel->outbound, "Outbound "); - DumpRingInfo(&channel->inbound, "Inbound "); + Dumpring_info(&channel->outbound, "Outbound "); + Dumpring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 6095cc5..705d95f 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -68,11 +68,11 @@ Description: --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) +GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->write_index; + u32 next = ring_info->ring_buffer->write_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -87,10 +87,10 @@ Description: --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, - u32 NextWriteLocation) +SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, + u32 next_write_location) { - RingInfo->ring_buffer->write_index = NextWriteLocation; + ring_info->ring_buffer->write_index = next_write_location; } /*++ @@ -103,11 +103,11 @@ Description: --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) +GetNextReadLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -123,13 +123,13 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) +GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ - next += Offset; - next %= RingInfo->ring_datasize; + /* ASSERT(next < ring_info->RingDataSize); */ + next += offset; + next %= ring_info->ring_datasize; return next; } @@ -144,9 +144,10 @@ Description: --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) +SetNextReadLocation(struct hv_ring_buffer_info *ring_info, + u32 next_read_location) { - RingInfo->ring_buffer->read_index = NextReadLocation; + ring_info->ring_buffer->read_index = next_read_location; } @@ -160,9 +161,9 @@ Description: --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *RingInfo) +GetRingBuffer(struct hv_ring_buffer_info *ring_info) { - return (void *)RingInfo->ring_buffer->buffer; + return (void *)ring_info->ring_buffer->buffer; } @@ -176,9 +177,9 @@ Description: --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) +GetRingBufferSize(struct hv_ring_buffer_info *ring_info) { - return RingInfo->ring_datasize; + return ring_info->ring_datasize; } /*++ @@ -191,41 +192,41 @@ Description: --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) +GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) { - return (u64)RingInfo->ring_buffer->write_index << 32; + return (u64)ring_info->ring_buffer->write_index << 32; } /*++ Name: - DumpRingInfo() + Dumpring_info() Description: Dump out to console the ring buffer info --*/ -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); DPRINT(VMBUS, DEBUG_RING_LVL, "%s <<ringinfo %p buffer %p avail write %u " "avail read %u read idx %u write idx %u>>", - Prefix, - RingInfo, - RingInfo->ring_buffer->buffer, - bytesAvailToWrite, - bytesAvailToRead, - RingInfo->ring_buffer->read_index, - RingInfo->ring_buffer->write_index); + prefix, + ring_info, + ring_info->ring_buffer->buffer, + bytes_avail_towrite, + bytes_avail_toread, + ring_info->ring_buffer->read_index, + ring_info->ring_buffer->write_index); } @@ -233,17 +234,17 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen); + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen); static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset); + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset); @@ -256,25 +257,25 @@ Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - if (RingInfo->ring_buffer) { - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + if (ring_info->ring_buffer) { + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - debug_info->bytes_avail_toread = bytesAvailToRead; - debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->bytes_avail_toread = bytes_avail_toread; + debug_info->bytes_avail_towrite = bytes_avail_towrite; debug_info->current_read_index - RingInfo->ring_buffer->read_index; + ring_info->ring_buffer->read_index; debug_info->current_write_index - RingInfo->ring_buffer->write_index; + ring_info->ring_buffer->write_index; debug_info->current_interrupt_mask - RingInfo->ring_buffer->interrupt_mask; + ring_info->ring_buffer->interrupt_mask; } } @@ -302,21 +303,22 @@ Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 BufferLen) +int RingBufferInit(struct hv_ring_buffer_info *ring_info, + void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) return -EINVAL; - memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); + memset(ring_info, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; - RingInfo->ring_buffer->read_index - RingInfo->ring_buffer->write_index = 0; + ring_info->ring_buffer = (struct hv_ring_buffer *)buffer; + ring_info->ring_buffer->read_index + ring_info->ring_buffer->write_index = 0; - RingInfo->ring_size = BufferLen; - RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); + ring_info->ring_size = buflen; + ring_info->ring_datasize = buflen - sizeof(struct hv_ring_buffer); - spin_lock_init(&RingInfo->ring_lock); + spin_lock_init(&ring_info->ring_lock); return 0; } @@ -330,7 +332,7 @@ Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo) +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) { } @@ -343,78 +345,78 @@ Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *OutRingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; - u32 byteAvailToWrite; - u32 byteAvailToRead; - u32 totalBytesToWrite = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 totalbytes_towrite = 0; struct scatterlist *sg; - volatile u32 nextWriteLocation; - u64 prevIndices = 0; + volatile u32 next_write_location; + u64 prev_indices = 0; unsigned long flags; for_each_sg(sglist, sg, sgcount, i) { - totalBytesToWrite += sg->length; + totalbytes_towrite += sg->length; } - totalBytesToWrite += sizeof(u64); + totalbytes_towrite += sizeof(u64); - spin_lock_irqsave(&OutRingInfo->ring_lock, flags); + spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(OutRingInfo, - &byteAvailToRead, - &byteAvailToWrite); + GetRingBufferAvailBytes(outring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Writing %u bytes...", totalBytesToWrite); + DPRINT_DBG(VMBUS, "Writing %u bytes...", totalbytes_towrite); - /* DumpRingInfo(OutRingInfo, "BEFORE "); */ + /* Dumpring_info(Outring_info, "BEFORE "); */ /* If there is only room for the packet, assume it is full. */ /* Otherwise, the next time around, we think the ring buffer */ /* is empty since the read index == write index */ - if (byteAvailToWrite <= totalBytesToWrite) { + if (bytes_avail_towrite <= totalbytes_towrite) { DPRINT_DBG(VMBUS, "No more space left on outbound ring buffer " "(needed %u, avail %u)", - totalBytesToWrite, - byteAvailToWrite); + totalbytes_towrite, + bytes_avail_towrite); - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return -1; } /* Write to the ring buffer */ - nextWriteLocation = GetNextWriteLocation(OutRingInfo); + next_write_location = GetNextWriteLocation(outring_info); for_each_sg(sglist, sg, sgcount, i) { - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prevIndices = GetRingBufferIndices(OutRingInfo); + prev_indices = GetRingBufferIndices(outring_info); - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, - &prevIndices, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, + &prev_indices, sizeof(u64)); /* Make sure we flush all writes before updating the writeIndex */ mb(); /* Now, update the write location */ - SetNextWriteLocation(OutRingInfo, nextWriteLocation); + SetNextWriteLocation(outring_info, next_write_location); - /* DumpRingInfo(OutRingInfo, "AFTER "); */ + /* Dumpring_info(Outring_info, "AFTER "); */ - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return 0; } @@ -428,41 +430,42 @@ Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *InRingInfo, void *Buffer, u32 BufferLen) +int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, + void *Buffer, u32 buflen) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; unsigned long flags; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(Inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { /* DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, + bytes_avail_toread, BufferLen); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return -1; } /* Convert to byte offset */ - nextReadLocation = GetNextReadLocation(InRingInfo); + next_read_location = GetNextReadLocation(Inring_info); - nextReadLocation = CopyFromRingBuffer(InRingInfo, + next_read_location = CopyFromRingBuffer(Inring_info, Buffer, - BufferLen, - nextReadLocation); + buflen, + next_read_location); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return 0; } @@ -477,52 +480,52 @@ Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, - u32 BufferLen, u32 Offset) +int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, + u32 buflen, u32 offset) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; - u64 prevIndices = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; + u64 prev_indices = 0; unsigned long flags; - if (BufferLen <= 0) + if (buflen <= 0) return -EINVAL; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Reading %u bytes...", BufferLen); + DPRINT_DBG(VMBUS, "Reading %u bytes...", buflen); - /* DumpRingInfo(InRingInfo, "BEFORE "); */ + /* Dumpring_info(Inring_info, "BEFORE "); */ /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, - BufferLen); + bytes_avail_toread, + buflen); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return -1; } - nextReadLocation = GetNextReadLocationWithOffset(InRingInfo, Offset); + next_read_location = GetNextReadLocationWithOffset(inring_info, offset); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - Buffer, - BufferLen, - nextReadLocation); + next_read_location = CopyFromRingBuffer(inring_info, + buffer, + buflen, + next_read_location); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - &prevIndices, + next_read_location = CopyFromRingBuffer(inring_info, + &prev_indices, sizeof(u64), - nextReadLocation); + next_read_location); /* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ @@ -530,11 +533,11 @@ int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, mb(); /* Update the read index */ - SetNextReadLocation(InRingInfo, nextReadLocation); + SetNextReadLocation(inring_info, next_read_location); - /* DumpRingInfo(InRingInfo, "AFTER "); */ + /* Dumpring_info(Inring_info, "AFTER "); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return 0; } @@ -552,29 +555,29 @@ Description: --*/ static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen) + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); - u32 fragLen; + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); + u32 frag_len; /* wrap-around detected! */ - if (SrcLen > ringBufferSize - StartWriteOffset) { + if (srclen > ring_buffer_size - start_write_offset) { DPRINT_DBG(VMBUS, "wrap-around detected!"); - fragLen = ringBufferSize - StartWriteOffset; - memcpy(ringBuffer + StartWriteOffset, Src, fragLen); - memcpy(ringBuffer, Src + fragLen, SrcLen - fragLen); + frag_len = ring_buffer_size - start_write_offset; + memcpy(ring_buffer + start_write_offset, src, frag_len); + memcpy(ring_buffer, src + frag_len, srclen - frag_len); } else - memcpy(ringBuffer + StartWriteOffset, Src, SrcLen); + memcpy(ring_buffer + start_write_offset, src, srclen); - StartWriteOffset += SrcLen; - StartWriteOffset %= ringBufferSize; + start_write_offset += srclen; + start_write_offset %= ring_buffer_size; - return StartWriteOffset; + return start_write_offset; } @@ -590,33 +593,33 @@ Description: --*/ static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset) + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); - u32 fragLen; + u32 frag_len; /* wrap-around detected at the src */ - if (DestLen > ringBufferSize - StartReadOffset) { + if (destlen > ring_buffer_size - start_read_offset) { DPRINT_DBG(VMBUS, "src wrap-around detected!"); - fragLen = ringBufferSize - StartReadOffset; + frag_len = ring_buffer_size - start_read_offset; - memcpy(Dest, ringBuffer + StartReadOffset, fragLen); - memcpy(Dest + fragLen, ringBuffer, DestLen - fragLen); + memcpy(dest, ring_buffer + start_read_offset, frag_len); + memcpy(dest + frag_len, ring_buffer, destlen - frag_len); } else - memcpy(Dest, ringBuffer + StartReadOffset, DestLen); + memcpy(dest, ring_buffer + start_read_offset, destlen); - StartReadOffset += DestLen; - StartReadOffset %= ringBufferSize; + start_read_offset += destlen; + start_read_offset %= ring_buffer_size; - return StartReadOffset; + return start_read_offset; } diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index bb4c5bc..f30be1f 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo); +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *RingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *RingInfo, - void *Buffer, - u32 BufferLen, - u32 Offset); +int RingBufferRead(struct hv_ring_buffer_info *ring_info, + void *buffer, + u32 buflen, + u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *RingInfo); +u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix); +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 16:31 UTC
[PATCH 10/10] staging: hv: Convert camel cased functions in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in ring_buffer.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 | 40 ++++++------ drivers/staging/hv/ring_buffer.c | 123 +++++++++++++++++++------------------ drivers/staging/hv/ring_buffer.h | 16 +++--- 3 files changed, 91 insertions(+), 88 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 97db545..45a627d 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -155,8 +155,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, monitorpage->parameter[monitor_group] [monitor_offset].connectionid.u.id; - RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); - RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); + ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound); + ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound); } /* @@ -193,13 +193,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); + ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); + ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -298,8 +298,8 @@ Cleanup: return 0; errorout: - RingBufferCleanup(&newchannel->outbound); - RingBufferCleanup(&newchannel->inbound); + ringbuffer_cleanup(&newchannel->outbound); + ringbuffer_cleanup(&newchannel->inbound); osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -683,8 +683,8 @@ void vmbus_close(struct vmbus_channel *channel) /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->outbound); - RingBufferCleanup(&channel->inbound); + ringbuffer_cleanup(&channel->outbound); + ringbuffer_cleanup(&channel->inbound); osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, userlen, + ret = ringbuffer_read(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); + ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - Dumpring_info(&channel->outbound, "Outbound "); - Dumpring_info(&channel->inbound, "Inbound "); + dump_ring_info(&channel->outbound, "Outbound "); + dump_ring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 705d95f..4d53392 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -38,7 +38,7 @@ /*++ Name: - GetRingBufferAvailBytes() + get_ringbuffer_availbytes() Description: Get number of bytes available to read and to write to @@ -46,7 +46,8 @@ Description: --*/ static inline void -GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) +get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, + u32 *read, u32 *write) { u32 read_loc, write_loc; @@ -61,14 +62,14 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) /*++ Name: - GetNextWriteLocation() + get_next_write_location() Description: Get the next write location for the specified ring buffer --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) +get_next_write_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->write_index; @@ -80,14 +81,14 @@ GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - SetNextWriteLocation() + set_next_write_location() Description: Set the next write location for the specified ring buffer --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, +set_next_write_location(struct hv_ring_buffer_info *ring_info, u32 next_write_location) { ring_info->ring_buffer->write_index = next_write_location; @@ -96,14 +97,14 @@ SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetNextReadLocation() + get_next_read_location() Description: Get the next read location for the specified ring buffer --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *ring_info) +get_next_read_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->read_index; @@ -115,7 +116,7 @@ GetNextReadLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetNextReadLocationWithOffset() + get_next_readlocation_withoffset() Description: Get the next read location + offset for the specified ring buffer. @@ -123,7 +124,8 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) +get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info, + u32 offset) { u32 next = ring_info->ring_buffer->read_index; @@ -137,14 +139,14 @@ GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) /*++ Name: - SetNextReadLocation() + set_next_read_location() Description: Set the next read location for the specified ring buffer --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *ring_info, +set_next_read_location(struct hv_ring_buffer_info *ring_info, u32 next_read_location) { ring_info->ring_buffer->read_index = next_read_location; @@ -154,14 +156,14 @@ SetNextReadLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBuffer() + get_ring_buffer() Description: Get the start of the ring buffer --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *ring_info) +get_ring_buffer(struct hv_ring_buffer_info *ring_info) { return (void *)ring_info->ring_buffer->buffer; } @@ -170,14 +172,14 @@ GetRingBuffer(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferSize() + get_ring_buffersize() Description: Get the size of the ring buffer --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *ring_info) +get_ring_buffersize(struct hv_ring_buffer_info *ring_info) { return ring_info->ring_datasize; } @@ -185,14 +187,14 @@ GetRingBufferSize(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferIndices() + get_ring_bufferindices() Description: Get the read and write indices as u64 of the specified ring buffer --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) +get_ring_bufferindices(struct hv_ring_buffer_info *ring_info) { return (u64)ring_info->ring_buffer->write_index << 32; } @@ -201,18 +203,18 @@ GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) /*++ Name: - Dumpring_info() + dump_ring_info() Description: Dump out to console the ring buffer info --*/ -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { u32 bytes_avail_towrite; u32 bytes_avail_toread; - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -233,14 +235,14 @@ void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) /* Internal routines */ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen); static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, @@ -251,20 +253,20 @@ CopyFromRingBuffer( /*++ Name: - RingBufferGetDebugInfo() + ringbuffer_get_debuginfo() Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { u32 bytes_avail_towrite; u32 bytes_avail_toread; if (ring_info->ring_buffer) { - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -283,13 +285,13 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBufferInterruptMask() + get_ringbuffer_interrupt_mask() Description: Get the interrupt mask for the specified ring buffer --*/ -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi) { return rbi->ring_buffer->interrupt_mask; } @@ -297,13 +299,13 @@ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) /*++ Name: - RingBufferInit() + ringbuffer_init() Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) @@ -326,26 +328,26 @@ int RingBufferInit(struct hv_ring_buffer_info *ring_info, /*++ Name: - RingBufferCleanup() + ringbuffer_cleanup() Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) { } /*++ Name: - RingBufferWrite() + ringbuffer_write() Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *outring_info, +int ringbuffer_write(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; @@ -367,7 +369,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(outring_info, + get_ringbuffer_availbytes(outring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -390,20 +392,20 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, } /* Write to the ring buffer */ - next_write_location = GetNextWriteLocation(outring_info); + next_write_location = get_next_write_location(outring_info); for_each_sg(sglist, sg, sgcount, i) { - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prev_indices = GetRingBufferIndices(outring_info); + prev_indices = get_ring_bufferindices(outring_info); - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, &prev_indices, sizeof(u64)); @@ -412,7 +414,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, mb(); /* Now, update the write location */ - SetNextWriteLocation(outring_info, next_write_location); + set_next_write_location(outring_info, next_write_location); /* Dumpring_info(Outring_info, "AFTER "); */ @@ -424,13 +426,13 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, /*++ Name: - RingBufferPeek() + ringbuffer_peek() Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, +int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info, void *Buffer, u32 buflen) { u32 bytes_avail_towrite; @@ -440,7 +442,7 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(Inring_info, + get_ringbuffer_availbytes(Inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -458,9 +460,9 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, } /* Convert to byte offset */ - next_read_location = GetNextReadLocation(Inring_info); + next_read_location = get_next_read_location(Inring_info); - next_read_location = CopyFromRingBuffer(Inring_info, + next_read_location = copyfrom_ringbuffer(Inring_info, Buffer, buflen, next_read_location); @@ -474,13 +476,13 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, /*++ Name: - RingBufferRead() + ringbuffer_read() Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, +int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, u32 buflen, u32 offset) { u32 bytes_avail_towrite; @@ -494,7 +496,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(inring_info, + get_ringbuffer_availbytes(inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -515,14 +517,15 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, return -1; } - next_read_location = GetNextReadLocationWithOffset(inring_info, offset); + next_read_location + get_next_readlocation_withoffset(inring_info, offset); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, buffer, buflen, next_read_location); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, &prev_indices, sizeof(u64), next_read_location); @@ -533,7 +536,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, mb(); /* Update the read index */ - SetNextReadLocation(inring_info, next_read_location); + set_next_read_location(inring_info, next_read_location); /* Dumpring_info(Inring_info, "AFTER "); */ @@ -546,7 +549,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, /*++ Name: - CopyToRingBuffer() + copyto_ringbuffer() Description: Helper routine to copy from source to ring buffer. @@ -554,14 +557,14 @@ Description: --*/ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; /* wrap-around detected! */ @@ -584,7 +587,7 @@ CopyToRingBuffer( /*++ Name: - CopyFromRingBuffer() + copyfrom_ringbuffer() Description: Helper routine to copy to source from ring buffer. @@ -592,14 +595,14 @@ Description: --*/ static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, u32 start_read_offset) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index f30be1f..7bd6ecf 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *ring_info, +int ringbuffer_write(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *ring_info, +int ringbuffer_read(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen, u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info); -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in channel_mgmt.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 | 302 ++++++++++++++++++------------------ drivers/staging/hv/channel_mgmt.c | 186 ++++++++++++------------ drivers/staging/hv/channel_mgmt.h | 244 +++++++++++++++--------------- drivers/staging/hv/connection.c | 38 +++--- drivers/staging/hv/hv_utils.c | 12 +- drivers/staging/hv/vmbus_drv.c | 42 +++--- 6 files changed, 412 insertions(+), 412 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 26ebc77..9fa0fe1 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -74,21 +74,21 @@ static void vmbus_setevent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorpage; - if (channel->OfferMsg.MonitorAllocated) { + if (channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - set_bit(channel->OfferMsg.ChildRelId & 31, + set_bit(channel->offermsg.child_relid & 31, (unsigned long *) gVmbusConnection.SendInterruptPage + - (channel->OfferMsg.ChildRelId >> 5)); + (channel->offermsg.child_relid >> 5)); monitorpage = gVmbusConnection.MonitorPages; monitorpage++; /* Get the child to parent monitor page */ - set_bit(channel->MonitorBit, + set_bit(channel->monitor_bit, (unsigned long *)&monitorpage->TriggerGroup - [channel->MonitorGroup].Pending); + [channel->monitor_grp].Pending); } else { - VmbusSetEvent(channel->OfferMsg.ChildRelId); + VmbusSetEvent(channel->offermsg.child_relid); } } @@ -97,19 +97,19 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorPage; - if (Channel->OfferMsg.MonitorAllocated) { + if (Channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - clear_bit(Channel->OfferMsg.ChildRelId & 31, + clear_bit(Channel->offermsg.child_relid & 31, (unsigned long *)gVmbusConnection.SendInterruptPage + - (Channel->OfferMsg.ChildRelId >> 5)); + (Channel->offermsg.child_relid >> 5)); monitorPage (struct hv_monitor_page *)gVmbusConnection.MonitorPages; monitorPage++; /* Get the child to parent monitor page */ - clear_bit(Channel->MonitorBit, + clear_bit(Channel->monitor_bit, (unsigned long *)&monitorPage->TriggerGroup - [Channel->MonitorGroup].Pending); + [Channel->monitor_grp].Pending); } } @@ -121,42 +121,42 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, struct vmbus_channel_debug_info *debuginfo) { struct hv_monitor_page *monitorpage; - u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32; - u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32; + u8 monitor_group = (u8)channel->offermsg.monitorid / 32; + u8 monitor_offset = (u8)channel->offermsg.monitorid % 32; /* u32 monitorBit = 1 << monitorOffset; */ - debuginfo->RelId = channel->OfferMsg.ChildRelId; - debuginfo->State = channel->State; - memcpy(&debuginfo->InterfaceType, - &channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); - memcpy(&debuginfo->InterfaceInstance, - &channel->OfferMsg.Offer.InterfaceInstance, + debuginfo->relid = channel->offermsg.child_relid; + debuginfo->state = channel->state; + memcpy(&debuginfo->interfacetype, + &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)); + memcpy(&debuginfo->interface_instance, + &channel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid)); monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; - debuginfo->MonitorId = channel->OfferMsg.MonitorId; + debuginfo->monitorid = channel->offermsg.monitorid; - debuginfo->ServerMonitorPending + debuginfo->servermonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ServerMonitorLatency + debuginfo->servermonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ServerMonitorConnectionId + debuginfo->servermonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; monitorpage++; - debuginfo->ClientMonitorPending + debuginfo->clientmonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ClientMonitorLatency + debuginfo->clientmonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ClientMonitorConnectionId + debuginfo->clientmonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; - RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound); - RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound); + RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); + RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); } /* @@ -176,8 +176,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */ /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */ - newchannel->OnChannelCallback = onchannelcallback; - newchannel->ChannelCallbackContext = context; + newchannel->onchannel_callback = onchannelcallback; + newchannel->channel_callback_context = context; /* Allocate the ring buffer */ out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) @@ -189,17 +189,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, in = (void *)((unsigned long)out + send_ringbuffer_size); - newchannel->RingBufferPages = out; - newchannel->RingBufferPageCount = (send_ringbuffer_size + + newchannel->ringbuffer_pages = out; + newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size); + ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size); + ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -210,13 +210,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...", newchannel); - newchannel->RingBufferGpadlHandle = 0; + newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->Outbound.RingBuffer, + newchannel->outbound.RingBuffer, send_ringbuffer_size + recv_ringbuffer_size, - &newchannel->RingBufferGpadlHandle); + &newchannel->ringbuffer_gpadlhandle); if (ret != 0) { err = ret; @@ -225,12 +225,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p " "size %d recv ring %p size %d, downstreamoffset %d>", - newchannel, newchannel->OfferMsg.ChildRelId, - newchannel->RingBufferGpadlHandle, - newchannel->Outbound.RingBuffer, - newchannel->Outbound.RingSize, - newchannel->Inbound.RingBuffer, - newchannel->Inbound.RingSize, + newchannel, newchannel->offermsg.child_relid, + newchannel->ringbuffer_gpadlhandle, + newchannel->outbound.RingBuffer, + newchannel->outbound.RingSize, + newchannel->inbound.RingBuffer, + newchannel->inbound.RingSize, send_ringbuffer_size); /* Create and init the channel open message */ @@ -242,20 +242,20 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->WaitEvent = osd_WaitEventCreate(); - if (!openInfo->WaitEvent) { + openInfo->waitevent = osd_WaitEventCreate(); + if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; } - openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg; - openMsg->Header.MessageType = ChannelMessageOpenChannel; - openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */ - openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId; - openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle; - openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >> + openMsg = (struct vmbus_channel_open_channel *)openInfo->msg; + openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL; + openMsg->openid = newchannel->offermsg.child_relid; /* FIXME */ + openMsg->child_relid = newchannel->offermsg.child_relid; + openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; + openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >> PAGE_SHIFT; - openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ + openMsg->server_contextarea_gpadlhandle = 0; /* TODO */ if (userdatalen > MAX_USER_DEFINED_BYTES) { err = -EINVAL; @@ -263,10 +263,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } if (userdatalen) - memcpy(openMsg->UserData, userdata, userdatalen); + memcpy(openMsg->userdata, userdata, userdatalen); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&openInfo->MsgListEntry, + list_add_tail(&openInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -280,26 +280,26 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->WaitEvent); + osd_WaitEventWait(openInfo->waitevent); - if (openInfo->Response.OpenResult.Status == 0) + if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); else DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!", - newchannel, openInfo->Response.OpenResult.Status); + newchannel, openInfo->response.open_result.status); Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&openInfo->MsgListEntry); + list_del(&openInfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(openInfo->WaitEvent); + kfree(openInfo->waitevent); kfree(openInfo); return 0; errorout: - RingBufferCleanup(&newchannel->Outbound); - RingBufferCleanup(&newchannel->Inbound); + RingBufferCleanup(&newchannel->outbound); + RingBufferCleanup(&newchannel->inbound); osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -322,7 +322,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) for (i = 0; i < pfncount; i++) DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu", - i, gpadl->Pfn[i]); + i, gpadl->pfn[i]); } /* @@ -336,18 +336,18 @@ static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl) DPRINT_DBG(VMBUS, "gpadl header - relid %d, range count %d, range buflen %d", - gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen); - for (i = 0; i < gpadl->RangeCount; i++) { - pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT; + gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen); + for (i = 0; i < gpadl->rangecount; i++) { + pagecount = gpadl->range[i].ByteCount >> 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].ByteCount, + gpadl->range[i].ByteOffset, pagecount); for (j = 0; j < pagecount; j++) DPRINT_DBG(VMBUS, "%d) pfn %llu", j, - gpadl->Range[i].PfnArray[j]); + gpadl->range[i].PfnArray[j]); } } @@ -391,18 +391,18 @@ static int create_gpadl_header(void *kbuffer, u32 size, if (!msgheader) goto nomem; - INIT_LIST_HEAD(&msgheader->SubMsgList); - msgheader->MessageSize = msgsize; + INIT_LIST_HEAD(&msgheader->submsglist); + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pfncount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -428,10 +428,10 @@ static int create_gpadl_header(void *kbuffer, u32 size, /* FIXME: we probably need to more if this fails */ if (!msgbody) goto nomem; - msgbody->MessageSize = msgsize; + msgbody->msgsize = msgsize; (*messagecount)++; gpadl_body - (struct vmbus_channel_gpadl_body *)msgbody->Msg; + (struct vmbus_channel_gpadl_body *)msgbody->msg; /* * FIXME: @@ -440,11 +440,11 @@ static int create_gpadl_header(void *kbuffer, u32 size, */ /* gpadl_body->Gpadl = kbuffer; */ for (i = 0; i < pfncurr; i++) - gpadl_body->Pfn[i] = pfn + pfnsum + i; + gpadl_body->pfn[i] = pfn + pfnsum + i; /* add to msg header */ - list_add_tail(&msgbody->MsgListEntry, - &msgheader->SubMsgList); + list_add_tail(&msgbody->msglistentry, + &msgheader->submsglist); pfnsum += pfncurr; pfnleft -= pfncurr; } @@ -456,17 +456,17 @@ static int create_gpadl_header(void *kbuffer, u32 size, msgheader = kzalloc(msgsize, GFP_KERNEL); if (msgheader == NULL) goto nomem; - msgheader->MessageSize = msgsize; + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pagecount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -508,21 +508,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; } - gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg; - gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader; - gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId; - gpadlmsg->Gpadl = next_gpadl_handle; + gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg; + gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER; + gpadlmsg->child_relid = channel->offermsg.child_relid; + gpadlmsg->gpadl = next_gpadl_handle; dump_gpadl_header(gpadlmsg); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msginfo->MsgListEntry, + list_add_tail(&msginfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -530,9 +530,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, kbuffer, size, msgcount); DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", - msginfo->MessageSize - sizeof(*msginfo)); + msginfo->msgsize - sizeof(*msginfo)); - ret = VmbusPostMessage(gpadlmsg, msginfo->MessageSize - + ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize - sizeof(*msginfo)); if (ret != 0) { DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret); @@ -540,48 +540,48 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } if (msgcount > 1) { - list_for_each(curr, &msginfo->SubMsgList) { + list_for_each(curr, &msginfo->submsglist) { /* FIXME: should this use list_entry() instead ? */ submsginfo = (struct vmbus_channel_msginfo *)curr; gpadl_body - (struct vmbus_channel_gpadl_body *)submsginfo->Msg; + (struct vmbus_channel_gpadl_body *)submsginfo->msg; - gpadl_body->Header.MessageType - ChannelMessageGpadlBody; - gpadl_body->Gpadl = next_gpadl_handle; + gpadl_body->header.msgtype + CHANNELMSG_GPADL_BODY; + gpadl_body->gpadl = next_gpadl_handle; DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); - dump_gpadl_body(gpadl_body, submsginfo->MessageSize - + dump_gpadl_body(gpadl_body, submsginfo->msgsize - sizeof(*submsginfo)); ret = VmbusPostMessage(gpadl_body, - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); if (ret != 0) goto Cleanup; } } - osd_WaitEventWait(msginfo->WaitEvent); + osd_WaitEventWait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " "(relid %d, status %d handle %x)", - channel->OfferMsg.ChildRelId, - msginfo->Response.GpadlCreated.CreationStatus, - gpadlmsg->Gpadl); + channel->offermsg.child_relid, + msginfo->response.gpadl_created.creation_status, + gpadlmsg->gpadl); - *gpadl_handle = gpadlmsg->Gpadl; + *gpadl_handle = gpadlmsg->gpadl; Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&msginfo->MsgListEntry); + list_del(&msginfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); return ret; } @@ -604,20 +604,20 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->WaitEvent = osd_WaitEventCreate(); - if (!info->WaitEvent) { + info->waitevent = osd_WaitEventCreate(); + if (!info->waitevent) { kfree(info); return -ENOMEM; } - msg = (struct vmbus_channel_gpadl_teardown *)info->Msg; + msg = (struct vmbus_channel_gpadl_teardown *)info->msg; - msg->Header.MessageType = ChannelMessageGpadlTeardown; - msg->ChildRelId = channel->OfferMsg.ChildRelId; - msg->Gpadl = gpadl_handle; + msg->header.msgtype = CHANNELMSG_GPADL_TEARDOWN; + msg->child_relid = channel->offermsg.child_relid; + msg->gpadl = gpadl_handle; spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&info->MsgListEntry, + list_add_tail(&info->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -628,14 +628,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->WaitEvent); + osd_WaitEventWait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&info->MsgListEntry); + list_del(&info->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(info->WaitEvent); + kfree(info->waitevent); kfree(info); return ret; } @@ -652,7 +652,7 @@ void vmbus_close(struct vmbus_channel *channel) int ret; /* Stop callback and cancel the timer asap */ - channel->OnChannelCallback = NULL; + channel->onchannel_callback = NULL; del_timer_sync(&channel->poll_timer); /* Send a closing message */ @@ -665,9 +665,9 @@ void vmbus_close(struct vmbus_channel *channel) /* info->waitEvent = osd_WaitEventCreate(); */ - msg = (struct vmbus_channel_close_channel *)info->Msg; - msg->Header.MessageType = ChannelMessageCloseChannel; - msg->ChildRelId = channel->OfferMsg.ChildRelId; + msg = (struct vmbus_channel_close_channel *)info->msg; + msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; + msg->child_relid = channel->offermsg.child_relid; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel)); if (ret != 0) { @@ -676,17 +676,17 @@ void vmbus_close(struct vmbus_channel *channel) } /* Tear down the gpadl for the channel's ring buffer */ - if (channel->RingBufferGpadlHandle) + if (channel->ringbuffer_gpadlhandle) vmbus_teardown_gpadl(channel, - channel->RingBufferGpadlHandle); + channel->ringbuffer_gpadlhandle); /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->Outbound); - RingBufferCleanup(&channel->Inbound); + RingBufferCleanup(&channel->outbound); + RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount); + osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); @@ -696,9 +696,9 @@ void vmbus_close(struct vmbus_channel *channel) * caller will free the channel */ - if (channel->State == CHANNEL_OPEN_STATE) { + if (channel->state == CHANNEL_OPEN_STATE) { spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&channel->ListEntry); + list_del(&channel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(channel); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -940,7 +940,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = userlen; @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, userlen, + ret = RingBufferRead(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -999,7 +999,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = packetlen; @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, packetlen, 0); + ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1030,7 +1030,7 @@ void vmbus_onchannel_event(struct vmbus_channel *channel) dump_vmbus_channel(channel); /* ASSERT(Channel->OnChannelCallback); */ - channel->OnChannelCallback(channel->ChannelCallbackContext); + channel->onchannel_callback(channel->channel_callback_context); mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100)); } @@ -1042,8 +1042,8 @@ void vmbus_ontimer(unsigned long data) { struct vmbus_channel *channel = (struct vmbus_channel *)data; - if (channel->OnChannelCallback) - channel->OnChannelCallback(channel->ChannelCallbackContext); + if (channel->onchannel_callback) + channel->onchannel_callback(channel->channel_callback_context); } /* @@ -1051,7 +1051,7 @@ void vmbus_ontimer(unsigned long data) */ static void dump_vmbus_channel(struct vmbus_channel *channel) { - DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId); - DumpRingInfo(&channel->Outbound, "Outbound "); - DumpRingInfo(&channel->Inbound, "Inbound "); + DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); + DumpRingInfo(&channel->outbound, "Outbound "); + DumpRingInfo(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 45dbe30..dbfe0f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -251,8 +251,8 @@ static struct vmbus_channel *alloc_channel(void) channel->poll_timer.data = (unsigned long)channel; channel->poll_timer.function = vmbus_ontimer; - channel->ControlWQ = create_workqueue("hv_vmbus_ctl"); - if (!channel->ControlWQ) { + channel->controlwq = create_workqueue("hv_vmbus_ctl"); + if (!channel->controlwq) { kfree(channel); return NULL; } @@ -268,7 +268,7 @@ static inline void release_channel(void *context) struct vmbus_channel *channel = context; DPRINT_DBG(VMBUS, "releasing channel (%p)", channel); - destroy_workqueue(channel->ControlWQ); + destroy_workqueue(channel->controlwq); DPRINT_DBG(VMBUS, "channel released (%p)", channel); kfree(channel); @@ -325,12 +325,12 @@ static void vmbus_process_offer(void *context) /* Make sure this is a new offer */ spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceType, + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (!memcmp(&channel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)) && - !memcmp(&channel->OfferMsg.Offer.InterfaceInstance, - &newchannel->OfferMsg.Offer.InterfaceInstance, + !memcmp(&channel->offermsg.offer.InterfaceInstance, + &newchannel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid))) { fnew = false; break; @@ -338,14 +338,14 @@ static void vmbus_process_offer(void *context) } if (fnew) - list_add_tail(&newchannel->ListEntry, + list_add_tail(&newchannel->listentry, &gVmbusConnection.ChannelList); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); if (!fnew) { DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); free_channel(newchannel); return; } @@ -355,27 +355,27 @@ static void vmbus_process_offer(void *context) * We need to set the DeviceObject field before calling * VmbusChildDeviceAdd() */ - newchannel->DeviceObject = VmbusChildDeviceCreate( - &newchannel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceInstance, + newchannel->device_obj = VmbusChildDeviceCreate( + &newchannel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceInstance, newchannel); DPRINT_DBG(VMBUS, "child device object allocated - %p", - newchannel->DeviceObject); + newchannel->device_obj); /* * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. */ - ret = VmbusChildDeviceAdd(newchannel->DeviceObject); + ret = VmbusChildDeviceAdd(newchannel->device_obj); if (ret != 0) { DPRINT_ERR(VMBUS, "unable to add child device object (relid %d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&newchannel->ListEntry); + list_del(&newchannel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(newchannel); @@ -385,11 +385,11 @@ static void vmbus_process_offer(void *context) * so that when we do close the channel normally, we * can cleanup properly */ - newchannel->State = CHANNEL_OPEN_STATE; + newchannel->state = CHANNEL_OPEN_STATE; /* Open IC channels */ for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) { - if (memcmp(&newchannel->OfferMsg.Offer.InterfaceType, + if (memcmp(&newchannel->offermsg.offer.InterfaceType, &hv_cb_utils[cnt].data, sizeof(struct hv_guid)) == 0 && vmbus_open(newchannel, 2 * PAGE_SIZE, @@ -413,7 +413,7 @@ static void vmbus_process_rescind_offer(void *context) { struct vmbus_channel *channel = context; - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); } /* @@ -434,7 +434,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.InterfaceType, &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) { fsupported = 1; break; @@ -443,12 +443,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) if (!fsupported) { DPRINT_DBG(VMBUS, "Ignoring channel offer notification for " - "child relid %d", offer->ChildRelId); + "child relid %d", offer->child_relid); return; } - guidtype = &offer->Offer.InterfaceType; - guidinstance = &offer->Offer.InterfaceInstance; + guidtype = &offer->offer.InterfaceType; + guidinstance = &offer->offer.InterfaceInstance; DPRINT_INFO(VMBUS, "Channel offer notification - " "child relid %d monitor id %d allocated %d, " @@ -456,8 +456,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) "%02x%02x%02x%02x%02x%02x%02x%02x} " "instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x%02x%02x%02x%02x%02x%02x}", - offer->ChildRelId, offer->MonitorId, - offer->MonitorAllocated, + offer->child_relid, offer->monitorid, + offer->monitor_allocated, guidtype->data[3], guidtype->data[2], guidtype->data[1], guidtype->data[0], guidtype->data[5], guidtype->data[4], @@ -484,13 +484,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel); - memcpy(&newchannel->OfferMsg, offer, + memcpy(&newchannel->offermsg, offer, sizeof(struct vmbus_channel_offer_channel)); - newchannel->MonitorGroup = (u8)offer->MonitorId / 32; - newchannel->MonitorBit = (u8)offer->MonitorId % 32; + newchannel->monitor_grp = (u8)offer->monitorid / 32; + newchannel->monitor_bit = (u8)offer->monitorid % 32; /* TODO: Make sure the offer comes from our parent partition */ - osd_schedule_callback(newchannel->ControlWQ, vmbus_process_offer, + osd_schedule_callback(newchannel->controlwq, vmbus_process_offer, newchannel); } @@ -505,14 +505,14 @@ 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->ChildRelId); + channel = GetChannelFromRelId(rescind->child_relid); if (channel == NULL) { DPRINT_DBG(VMBUS, "channel not found for relId %d", - rescind->ChildRelId); + rescind->child_relid); return; } - osd_schedule_callback(channel->ControlWQ, + osd_schedule_callback(channel->controlwq, vmbus_process_rescind_offer, channel); } @@ -545,7 +545,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) unsigned long flags; result = (struct vmbus_channel_open_result *)hdr; - DPRINT_DBG(VMBUS, "vmbus open result - %d", result->Status); + DPRINT_DBG(VMBUS, "vmbus open result - %d", result->status); /* * Find the open msg, copy the result and signal/unblock the wait event @@ -556,17 +556,17 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageOpenChannel) { + if (requestheader->msgtype == CHANNELMSG_OPENCHANNEL) { openmsg - (struct vmbus_channel_open_channel *)msginfo->Msg; - if (openmsg->ChildRelId == result->ChildRelId && - openmsg->OpenId == result->OpenId) { - memcpy(&msginfo->Response.OpenResult, + (struct vmbus_channel_open_channel *)msginfo->msg; + if (openmsg->child_relid == result->child_relid && + openmsg->openid == result->openid) { + memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -592,7 +592,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr; DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d", - gpadlcreated->CreationStatus); + gpadlcreated->creation_status); /* * Find the establish msg, copy the result and signal/unblock the wait @@ -604,19 +604,19 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlHeader) { + if (requestheader->msgtype == CHANNELMSG_GPADL_HEADER) { gpadlheader (struct vmbus_channel_gpadl_header *)requestheader; - if ((gpadlcreated->ChildRelId =- gpadlheader->ChildRelId) && - (gpadlcreated->Gpadl == gpadlheader->Gpadl)) { - memcpy(&msginfo->Response.GpadlCreated, + if ((gpadlcreated->child_relid =+ gpadlheader->child_relid) && + (gpadlcreated->gpadl == gpadlheader->gpadl)) { + memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -652,17 +652,17 @@ static void vmbus_ongpadl_torndown( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlTeardown) { + if (requestheader->msgtype == CHANNELMSG_GPADL_TEARDOWN) { gpadl_teardown (struct vmbus_channel_gpadl_teardown *)requestheader; - if (gpadl_torndown->Gpadl == gpadl_teardown->Gpadl) { - memcpy(&msginfo->Response.GpadlTorndown, + if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) { + memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -694,16 +694,16 @@ static void vmbus_onversion_response( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType =- ChannelMessageInitiateContact) { + if (requestheader->msgtype =+ CHANNELMSG_INITIATE_CONTACT) { initiate (struct vmbus_channel_initiate_contact *)requestheader; - memcpy(&msginfo->Response.VersionResponse, + memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -711,24 +711,24 @@ static void vmbus_onversion_response( /* Channel message dispatch table */ static struct vmbus_channel_message_table_entry - gChannelMessageTable[ChannelMessageCount] = { - {ChannelMessageInvalid, NULL}, - {ChannelMessageOfferChannel, vmbus_onoffer}, - {ChannelMessageRescindChannelOffer, vmbus_onoffer_rescind}, - {ChannelMessageRequestOffers, NULL}, - {ChannelMessageAllOffersDelivered, vmbus_onoffers_delivered}, - {ChannelMessageOpenChannel, NULL}, - {ChannelMessageOpenChannelResult, vmbus_onopen_result}, - {ChannelMessageCloseChannel, NULL}, - {ChannelMessageGpadlHeader, NULL}, - {ChannelMessageGpadlBody, NULL}, - {ChannelMessageGpadlCreated, vmbus_ongpadl_created}, - {ChannelMessageGpadlTeardown, NULL}, - {ChannelMessageGpadlTorndown, vmbus_ongpadl_torndown}, - {ChannelMessageRelIdReleased, NULL}, - {ChannelMessageInitiateContact, NULL}, - {ChannelMessageVersionResponse, vmbus_onversion_response}, - {ChannelMessageUnload, NULL}, + gChannelMessageTable[CHANNELMSG_COUNT] = { + {CHANNELMSG_INVALID, NULL}, + {CHANNELMSG_OFFERCHANNEL, vmbus_onoffer}, + {CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind}, + {CHANNELMSG_REQUESTOFFERS, NULL}, + {CHANNELMSG_ALLOFFERS_DELIVERED, vmbus_onoffers_delivered}, + {CHANNELMSG_OPENCHANNEL, NULL}, + {CHANNELMSG_OPENCHANNEL_RESULT, vmbus_onopen_result}, + {CHANNELMSG_CLOSECHANNEL, NULL}, + {CHANNELMSG_GPADL_HEADER, NULL}, + {CHANNELMSG_GPADL_BODY, NULL}, + {CHANNELMSG_GPADL_CREATED, vmbus_ongpadl_created}, + {CHANNELMSG_GPADL_TEARDOWN, NULL}, + {CHANNELMSG_GPADL_TORNDOWN, vmbus_ongpadl_torndown}, + {CHANNELMSG_RELID_RELEASED, NULL}, + {CHANNELMSG_INITIATE_CONTACT, NULL}, + {CHANNELMSG_VERSION_RESPONSE, vmbus_onversion_response}, + {CHANNELMSG_UNLOAD, NULL}, }; /* @@ -745,23 +745,23 @@ void vmbus_onmessage(void *context) hdr = (struct vmbus_channel_message_header *)msg->u.Payload; size = msg->Header.PayloadSize; - DPRINT_DBG(VMBUS, "message type %d size %d", hdr->MessageType, size); + DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); - if (hdr->MessageType >= ChannelMessageCount) { + if (hdr->msgtype >= CHANNELMSG_COUNT) { DPRINT_ERR(VMBUS, "Received invalid channel message type %d size %d", - hdr->MessageType, size); + hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, (unsigned char *)msg->u.Payload, size); kfree(msg); return; } - if (gChannelMessageTable[hdr->MessageType].messageHandler) - gChannelMessageTable[hdr->MessageType].messageHandler(hdr); + if (gChannelMessageTable[hdr->msgtype].messageHandler) + gChannelMessageTable[hdr->msgtype].messageHandler(hdr); else DPRINT_ERR(VMBUS, "Unhandled channel message type %d", - hdr->MessageType); + hdr->msgtype); /* Free the msg that was allocated in VmbusOnMsgDPC() */ kfree(msg); @@ -782,15 +782,15 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; } - msg = (struct vmbus_channel_message_header *)msginfo->Msg; + msg = (struct vmbus_channel_message_header *)msginfo->msg; - msg->MessageType = ChannelMessageRequestOffers; + msg->msgtype = CHANNELMSG_REQUESTOFFERS; /*SpinlockAcquire(gVmbusConnection.channelMsgLock); INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList, @@ -817,7 +817,7 @@ int vmbus_request_offers(void) Cleanup: if (msginfo) { - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); } @@ -837,17 +837,17 @@ void vmbus_release_unattached_channels(void) spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, - ListEntry) { + listentry) { if (channel == start) break; - if (!channel->DeviceObject->Driver) { - list_del(&channel->ListEntry); + if (!channel->device_obj->Driver) { + list_del(&channel->listentry); DPRINT_INFO(VMBUS, "Releasing unattached device object %p", - channel->DeviceObject); + channel->device_obj); - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); free_channel(channel); } else { if (!start) diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h index d16cc08..12f30af 100644 --- a/drivers/staging/hv/channel_mgmt.h +++ b/drivers/staging/hv/channel_mgmt.h @@ -33,60 +33,60 @@ /* Version 1 messages */ enum vmbus_channel_message_type { - ChannelMessageInvalid = 0, - ChannelMessageOfferChannel = 1, - ChannelMessageRescindChannelOffer = 2, - ChannelMessageRequestOffers = 3, - ChannelMessageAllOffersDelivered = 4, - ChannelMessageOpenChannel = 5, - ChannelMessageOpenChannelResult = 6, - ChannelMessageCloseChannel = 7, - ChannelMessageGpadlHeader = 8, - ChannelMessageGpadlBody = 9, - ChannelMessageGpadlCreated = 10, - ChannelMessageGpadlTeardown = 11, - ChannelMessageGpadlTorndown = 12, - ChannelMessageRelIdReleased = 13, - ChannelMessageInitiateContact = 14, - ChannelMessageVersionResponse = 15, - ChannelMessageUnload = 16, + CHANNELMSG_INVALID = 0, + CHANNELMSG_OFFERCHANNEL = 1, + CHANNELMSG_RESCIND_CHANNELOFFER = 2, + CHANNELMSG_REQUESTOFFERS = 3, + CHANNELMSG_ALLOFFERS_DELIVERED = 4, + CHANNELMSG_OPENCHANNEL = 5, + CHANNELMSG_OPENCHANNEL_RESULT = 6, + CHANNELMSG_CLOSECHANNEL = 7, + CHANNELMSG_GPADL_HEADER = 8, + CHANNELMSG_GPADL_BODY = 9, + CHANNELMSG_GPADL_CREATED = 10, + CHANNELMSG_GPADL_TEARDOWN = 11, + CHANNELMSG_GPADL_TORNDOWN = 12, + CHANNELMSG_RELID_RELEASED = 13, + CHANNELMSG_INITIATE_CONTACT = 14, + CHANNELMSG_VERSION_RESPONSE = 15, + CHANNELMSG_UNLOAD = 16, #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD - ChannelMessageViewRangeAdd = 17, - ChannelMessageViewRangeRemove = 18, + CHANNELMSG_VIEWRANGE_ADD = 17, + CHANNELMSG_VIEWRANGE_REMOVE = 18, #endif - ChannelMessageCount + CHANNELMSG_COUNT }; struct vmbus_channel_message_header { - enum vmbus_channel_message_type MessageType; - u32 Padding; + enum vmbus_channel_message_type msgtype; + u32 padding; } __attribute__((packed)); /* Query VMBus Version parameters */ struct vmbus_channel_query_vmbus_version { - struct vmbus_channel_message_header Header; - u32 Version; + struct vmbus_channel_message_header header; + u32 version; } __attribute__((packed)); /* VMBus Version Supported parameters */ struct vmbus_channel_version_supported { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); /* Offer Channel parameters */ struct vmbus_channel_offer_channel { - struct vmbus_channel_message_header Header; - struct vmbus_channel_offer Offer; - u32 ChildRelId; - u8 MonitorId; - bool MonitorAllocated; + struct vmbus_channel_message_header header; + struct vmbus_channel_offer offer; + u32 child_relid; + u8 monitorid; + bool monitor_allocated; } __attribute__((packed)); /* Rescind Offer parameters */ struct vmbus_channel_rescind_offer { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* @@ -100,43 +100,43 @@ struct vmbus_channel_rescind_offer { /* Open Channel parameters */ struct vmbus_channel_open_channel { - struct vmbus_channel_message_header Header; + struct vmbus_channel_message_header header; /* Identifies the specific VMBus channel that is being opened. */ - u32 ChildRelId; + u32 child_relid; /* ID making a particular open request at a channel offer unique. */ - u32 OpenId; + u32 openid; /* GPADL for the channel's ring buffer. */ - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* GPADL for the channel's server context save area. */ - u32 ServerContextAreaGpadlHandle; + u32 server_contextarea_gpadlhandle; /* * The upstream ring buffer begins at offset zero in the memory * described by RingBufferGpadlHandle. The downstream ring buffer * follows it at this offset (in pages). */ - u32 DownstreamRingBufferPageOffset; + u32 downstream_ringbuffer_pageoffset; /* User-specific data to be passed along to the server endpoint. */ - unsigned char UserData[MAX_USER_DEFINED_BYTES]; + unsigned char userdata[MAX_USER_DEFINED_BYTES]; } __attribute__((packed)); /* Open Channel Result parameters */ struct vmbus_channel_open_result { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 OpenId; - u32 Status; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 openid; + u32 status; } __attribute__((packed)); /* Close channel parameters; */ struct vmbus_channel_close_channel { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* Channel Message GPADL */ @@ -151,72 +151,72 @@ struct vmbus_channel_close_channel { * follow-up packet that contains more. */ struct vmbus_channel_gpadl_header { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u16 RangeBufLen; - u16 RangeCount; - struct gpa_range Range[0]; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u16 range_buflen; + u16 rangecount; + struct gpa_range range[0]; } __attribute__((packed)); /* This is the followup packet that contains more PFNs. */ struct vmbus_channel_gpadl_body { - struct vmbus_channel_message_header Header; - u32 MessageNumber; - u32 Gpadl; - u64 Pfn[0]; + struct vmbus_channel_message_header header; + u32 msgnumber; + u32 gpadl; + u64 pfn[0]; } __attribute__((packed)); struct vmbus_channel_gpadl_created { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u32 CreationStatus; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u32 creation_status; } __attribute__((packed)); struct vmbus_channel_gpadl_teardown { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; } __attribute__((packed)); struct vmbus_channel_gpadl_torndown { - struct vmbus_channel_message_header Header; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 gpadl; } __attribute__((packed)); #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD struct vmbus_channel_view_range_add { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u64 ViewRangeLength; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u64 viewrange_length; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_view_range_remove { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u32 child_relid; } __attribute__((packed)); #endif struct vmbus_channel_relid_released { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_initiate_contact { - struct vmbus_channel_message_header Header; - u32 VMBusVersionRequested; - u32 Padding2; - u64 InterruptPage; - u64 MonitorPage1; - u64 MonitorPage2; + struct vmbus_channel_message_header header; + u32 vmbus_version_requested; + u32 padding2; + u64 interrupt_page; + u64 monitor_page1; + u64 monitor_page2; } __attribute__((packed)); struct vmbus_channel_version_response { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); enum vmbus_channel_state { @@ -226,54 +226,54 @@ enum vmbus_channel_state { }; struct vmbus_channel { - struct list_head ListEntry; + struct list_head listentry; - struct hv_device *DeviceObject; + struct hv_device *device_obj; struct timer_list poll_timer; /* SA-111 workaround */ - enum vmbus_channel_state State; + enum vmbus_channel_state state; - struct vmbus_channel_offer_channel OfferMsg; + struct vmbus_channel_offer_channel offermsg; /* * These are based on the OfferMsg.MonitorId. * Save it here for easy access. */ - u8 MonitorGroup; - u8 MonitorBit; + u8 monitor_grp; + u8 monitor_bit; - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* Allocated memory for ring buffer */ - void *RingBufferPages; - u32 RingBufferPageCount; - struct hv_ring_buffer_info Outbound; /* send to parent */ - struct hv_ring_buffer_info Inbound; /* receive from parent */ + void *ringbuffer_pages; + u32 ringbuffer_pagecount; + struct hv_ring_buffer_info outbound; /* send to parent */ + struct hv_ring_buffer_info inbound; /* receive from parent */ spinlock_t inbound_lock; - struct workqueue_struct *ControlWQ; + struct workqueue_struct *controlwq; /* Channel callback are invoked in this workqueue context */ /* HANDLE dataWorkQueue; */ - void (*OnChannelCallback)(void *context); - void *ChannelCallbackContext; + void (*onchannel_callback)(void *context); + void *channel_callback_context; }; struct vmbus_channel_debug_info { - u32 RelId; - enum vmbus_channel_state State; - struct hv_guid InterfaceType; - struct hv_guid InterfaceInstance; - u32 MonitorId; - u32 ServerMonitorPending; - u32 ServerMonitorLatency; - u32 ServerMonitorConnectionId; - u32 ClientMonitorPending; - u32 ClientMonitorLatency; - u32 ClientMonitorConnectionId; - - struct hv_ring_buffer_debug_info Inbound; - struct hv_ring_buffer_debug_info Outbound; + u32 relid; + enum vmbus_channel_state state; + struct hv_guid interfacetype; + struct hv_guid interface_instance; + u32 monitorid; + u32 servermonitor_pending; + u32 servermonitor_latency; + u32 servermonitor_connectionid; + u32 clientmonitor_pending; + u32 clientmonitor_latency; + u32 clientmonitor_connectionid; + + struct hv_ring_buffer_debug_info inbound; + struct hv_ring_buffer_debug_info outbound; }; /* @@ -282,28 +282,28 @@ struct vmbus_channel_debug_info { */ struct vmbus_channel_msginfo { /* Bookkeeping stuff */ - struct list_head MsgListEntry; + struct list_head msglistentry; /* So far, this is only used to handle gpadl body message */ - struct list_head SubMsgList; + struct list_head submsglist; /* Synchronize the request/response if needed */ - struct osd_waitevent *WaitEvent; + struct osd_waitevent *waitevent; union { - struct vmbus_channel_version_supported VersionSupported; - struct vmbus_channel_open_result OpenResult; - struct vmbus_channel_gpadl_torndown GpadlTorndown; - struct vmbus_channel_gpadl_created GpadlCreated; - struct vmbus_channel_version_response VersionResponse; - } Response; - - u32 MessageSize; + struct vmbus_channel_version_supported version_supported; + struct vmbus_channel_open_result open_result; + struct vmbus_channel_gpadl_torndown gpadl_torndown; + struct vmbus_channel_gpadl_created gpadl_created; + struct vmbus_channel_version_response version_response; + } response; + + u32 msgsize; /* * The channel message that goes out on the "wire". * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header */ - unsigned char Msg[0]; + unsigned char msg[0]; }; diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index f847707..6f3f525 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -95,19 +95,19 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->WaitEvent = osd_WaitEventCreate(); - if (!msgInfo->WaitEvent) { + msgInfo->waitevent = osd_WaitEventCreate(); + 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.MessageType = ChannelMessageInitiateContact; - msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER; - msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage); - msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages); - msg->MonitorPage2 = virt_to_phys( + 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->monitor_page2 = virt_to_phys( (void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE)); @@ -116,30 +116,30 @@ int VmbusConnect(void) * receive the response before returning from this routine */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msgInfo->MsgListEntry, + list_add_tail(&msgInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, " "monitor1 pfn %llx,, monitor2 pfn %llx", - msg->InterruptPage, msg->MonitorPage1, msg->MonitorPage2); + msg->interrupt_page, msg->monitor_page1, msg->monitor_page2); DPRINT_DBG(VMBUS, "Sending channel initiate msg..."); 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_WaitEventWait(msgInfo->WaitEvent); + osd_WaitEventWait(msgInfo->waitevent); - list_del(&msgInfo->MsgListEntry); + list_del(&msgInfo->msglistentry); /* Check if successful */ - if (msgInfo->Response.VersionResponse.VersionSupported) { + if (msgInfo->response.version_response.version_supported) { DPRINT_INFO(VMBUS, "Vmbus connected!!"); gVmbusConnection.ConnectState = Connected; @@ -151,7 +151,7 @@ int VmbusConnect(void) goto Cleanup; } - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); return 0; @@ -172,7 +172,7 @@ Cleanup: } if (msgInfo) { - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); } @@ -195,7 +195,7 @@ int VmbusDisconnect(void) if (!msg) return -ENOMEM; - msg->MessageType = ChannelMessageUnload; + msg->msgtype = CHANNELMSG_UNLOAD; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_message_header)); @@ -226,8 +226,8 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId) unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (channel->OfferMsg.ChildRelId == relId) { + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (channel->offermsg.child_relid == relId) { foundChannel = channel; break; } diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 702a478..6dc1c35 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -271,15 +271,15 @@ static int __init init_hyperv_utils(void) if (!dmi_check_system(hv_utils_dmi_table)) return -ENODEV; - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &shutdown_onchannelcallback; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback ×ync_onchannelcallback; hv_cb_utils[HV_TIMESYNC_MSG].callback = ×ync_onchannelcallback; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &heartbeat_onchannelcallback; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &heartbeat_onchannelcallback; @@ -290,15 +290,15 @@ static void exit_hyperv_utils(void) { printk(KERN_INFO "De-Registered HyperV Utility Driver\n"); - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_TIMESYNC_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate; } diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 0d9f3a4..2bbf4ec 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -139,35 +139,35 @@ static void get_channel_info(struct hv_device *device, vmbus_get_debug_info(device->channel, &debug_info); - info->ChannelId = debug_info.RelId; - info->ChannelState = debug_info.State; - memcpy(&info->ChannelType, &debug_info.InterfaceType, + info->ChannelId = debug_info.relid; + info->ChannelState = debug_info.state; + memcpy(&info->ChannelType, &debug_info.interfacetype, sizeof(struct hv_guid)); - memcpy(&info->ChannelInstance, &debug_info.InterfaceInstance, + memcpy(&info->ChannelInstance, &debug_info.interface_instance, sizeof(struct hv_guid)); - info->MonitorId = debug_info.MonitorId; + info->MonitorId = debug_info.monitorid; - info->ServerMonitorPending = debug_info.ServerMonitorPending; - info->ServerMonitorLatency = debug_info.ServerMonitorLatency; - info->ServerMonitorConnectionId = debug_info.ServerMonitorConnectionId; + info->ServerMonitorPending = debug_info.servermonitor_pending; + info->ServerMonitorLatency = debug_info.servermonitor_latency; + info->ServerMonitorConnectionId = debug_info.servermonitor_connectionid; - info->ClientMonitorPending = debug_info.ClientMonitorPending; - info->ClientMonitorLatency = debug_info.ClientMonitorLatency; - info->ClientMonitorConnectionId = debug_info.ClientMonitorConnectionId; + info->ClientMonitorPending = debug_info.clientmonitor_pending; + info->ClientMonitorLatency = debug_info.clientmonitor_latency; + info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.Inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.Inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.Inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.Inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.Inbound.BytesAvailToWrite; + info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; + info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; + info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; + info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; + info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - info->Outbound.InterruptMask = debug_info.Outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.Outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.Outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.Outbound.BytesAvailToRead; + info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; + info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; + info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; + info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; info->Outbound.BytesAvailToWrite - debug_info.Outbound.BytesAvailToWrite; + debug_info.outbound.BytesAvailToWrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 02/10] staging: hv: Convert camel cased struct fields in hv_api.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in hv_api.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 | 32 ++-- drivers/staging/hv/channel_mgmt.c | 6 +- drivers/staging/hv/connection.c | 4 +- drivers/staging/hv/hv.c | 120 ++++++++-------- drivers/staging/hv/hv_api.h | 274 ++++++++++++++++++------------------ drivers/staging/hv/vmbus.c | 18 ++-- 6 files changed, 227 insertions(+), 227 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 9fa0fe1..7c15c40 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -43,24 +43,24 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) int j = 0; DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d", - MonitorPage, MonitorPage->TriggerState); + MonitorPage, MonitorPage->trigger_state); for (i = 0; i < 4; i++) DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i, - MonitorPage->TriggerGroup[i].AsUINT64); + MonitorPage->trigger_group[i].as_uint64); for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j, - MonitorPage->Latency[i][j]); + MonitorPage->latency[i][j]); } } for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].ConnectionId.Asu32); + MonitorPage->parameter[i][j].connectionid.asu32); DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].FlagNumber); + MonitorPage->parameter[i][j].flag_number); } } } @@ -84,8 +84,8 @@ static void vmbus_setevent(struct vmbus_channel *channel) monitorpage++; /* Get the child to parent monitor page */ set_bit(channel->monitor_bit, - (unsigned long *)&monitorpage->TriggerGroup - [channel->monitor_grp].Pending); + (unsigned long *)&monitorpage->trigger_group + [channel->monitor_grp].pending); } else { VmbusSetEvent(channel->offermsg.child_relid); @@ -108,7 +108,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) monitorPage++; /* Get the child to parent monitor page */ clear_bit(Channel->monitor_bit, - (unsigned long *)&monitorPage->TriggerGroup + (unsigned long *)&monitorPage->trigger_group [Channel->monitor_grp].Pending); } } @@ -138,22 +138,22 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, debuginfo->monitorid = channel->offermsg.monitorid; debuginfo->servermonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->servermonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->servermonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; monitorpage++; debuginfo->clientmonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->clientmonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->clientmonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index dbfe0f2..be34e38 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -742,8 +742,8 @@ void vmbus_onmessage(void *context) struct vmbus_channel_message_header *hdr; int size; - hdr = (struct vmbus_channel_message_header *)msg->u.Payload; - size = msg->Header.PayloadSize; + hdr = (struct vmbus_channel_message_header *)msg->u.payload; + size = msg->header.payload_size; DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); @@ -752,7 +752,7 @@ void vmbus_onmessage(void *context) "Received invalid channel message type %d size %d", hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, - (unsigned char *)msg->u.Payload, size); + (unsigned char *)msg->u.payload, size); kfree(msg); return; } diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 6f3f525..ba50dd8 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -309,8 +309,8 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) { union hv_connection_id connId; - connId.Asu32 = 0; - connId.u.Id = VMBUS_MESSAGE_CONNECTION_ID; + connId.asu32 = 0; + connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; return HvPostMessage(connId, 1, buffer, bufferLen); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 86b1ddd..ab03327 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -50,7 +50,7 @@ static int HvQueryHypervisorPresence(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionVersionAndFeatures; + op = HVCPUID_VERSION_FEATURES; cpuid(op, &eax, &ebx, &ecx, &edx); return ecx & HV_PRESENT_BIT; @@ -76,7 +76,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvVendorAndMaxFunction; + op = HVCPUID_VENDOR_MAXFUNCTION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Vendor ID: %c%c%c%c%c%c%c%c%c%c%c%c", @@ -98,7 +98,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvInterface; + op = HVCPUID_INTERFACE; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Interface ID: %c%c%c%c", @@ -107,12 +107,12 @@ static int HvQueryHypervisorInfo(void) ((eax >> 16) & 0xFF), ((eax >> 24) & 0xFF)); - if (maxLeaf >= HvCpuIdFunctionMsHvVersion) { + if (maxLeaf >= HVCPUID_VERSION) { eax = 0; ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionMsHvVersion; + op = HVCPUID_VERSION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "OS Build:%d-%d.%d-%d-%d.%d",\ eax, @@ -222,7 +222,7 @@ int HvInit(void) gHvContext.GuestId = HV_LINUX_GUEST_ID; /* See if the hypercall page is already set */ - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* * Allocate the hypercall page memory @@ -236,16 +236,16 @@ int HvInit(void) goto Cleanup; } - hypercallMsr.Enable = 1; + hypercallMsr.enable = 1; - hypercallMsr.GuestPhysicalAddress = vmalloc_to_pfn(virtAddr); - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.guest_physical_address = vmalloc_to_pfn(virtAddr); + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* Confirm that hypercall page did get setup. */ - hypercallMsr.AsUINT64 = 0; - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); - if (!hypercallMsr.Enable) { + if (!hypercallMsr.enable) { DPRINT_ERR(VMBUS, "unable to set hypercall page!!"); goto Cleanup; } @@ -254,7 +254,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx", gHvContext.HypercallPage, - (u64)hypercallMsr.GuestPhysicalAddress << PAGE_SHIFT); + (u64)hypercallMsr.guest_physical_address << PAGE_SHIFT); /* Setup the global signal event param for the signal event hypercall */ gHvContext.SignalEventBuffer @@ -267,19 +267,19 @@ int HvInit(void) (struct hv_input_signal_event *) (ALIGN_UP((unsigned long)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN)); - gHvContext.SignalEventParam->ConnectionId.Asu32 = 0; - gHvContext.SignalEventParam->ConnectionId.u.Id + gHvContext.SignalEventParam->connectionid.asu32 = 0; + gHvContext.SignalEventParam->connectionid.u.id VMBUS_EVENT_CONNECTION_ID; - gHvContext.SignalEventParam->FlagNumber = 0; - gHvContext.SignalEventParam->RsvdZ = 0; + gHvContext.SignalEventParam->flag_number = 0; + gHvContext.SignalEventParam->rsvdz = 0; return ret; Cleanup: if (virtAddr) { - if (hypercallMsr.Enable) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + if (hypercallMsr.enable) { + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); } vfree(virtAddr); @@ -302,8 +302,8 @@ void HvCleanup(void) gHvContext.SignalEventParam = NULL; if (gHvContext.HypercallPage) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); vfree(gHvContext.HypercallPage); gHvContext.HypercallPage = NULL; } @@ -337,12 +337,12 @@ u16 HvPostMessage(union hv_connection_id connectionId, alignedMsg = (struct hv_input_post_message *) (ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); - alignedMsg->ConnectionId = connectionId; - alignedMsg->MessageType = messageType; - alignedMsg->PayloadSize = payloadSize; - memcpy((void *)alignedMsg->Payload, payload, payloadSize); + alignedMsg->connectionid = connectionId; + alignedMsg->message_type = messageType; + alignedMsg->payload_size = payloadSize; + memcpy((void *)alignedMsg->payload, payload, payloadSize); - status = HvDoHypercall(HvCallPostMessage, alignedMsg, NULL) & 0xFFFF; + status = HvDoHypercall(HVCALL_POST_MESSAGE, alignedMsg, NULL) & 0xFFFF; kfree((void *)addr); @@ -359,7 +359,7 @@ u16 HvSignalEvent(void) { u16 status; - status = HvDoHypercall(HvCallSignalEvent, gHvContext.SignalEventParam, + status = HvDoHypercall(HVCALL_SIGNAL_EVENT, gHvContext.SignalEventParam, NULL) & 0xFFFF; return status; } @@ -407,47 +407,47 @@ void HvSynicInit(void *irqarg) } /* Setup the Synic's message page */ - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 1; - simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 1; + simp.base_simp_gpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.as_uint64); - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); /* Setup the Synic's event page */ - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 1; - siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu]) + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 1; + siefp.base_siefp_gpa = virt_to_phys(gHvContext.synICEventPage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.as_uint64); - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); /* Setup the interception SINT. */ /* wrmsrl((HV_X64_MSR_SINT0 + HV_SYNIC_INTERCEPTION_SINT_INDEX), */ - /* interceptionSint.AsUINT64); */ + /* interceptionSint.as_uint64); */ /* Setup the shared SINT. */ - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.AsUINT64 = 0; - sharedSint.Vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - sharedSint.Masked = false; - sharedSint.AutoEoi = true; + sharedSint.as_uint64 = 0; + sharedSint.vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ + sharedSint.masked = false; + sharedSint.auto_eoi = true; DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx", - sharedSint.AsUINT64); + sharedSint.as_uint64); - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); /* Enable the global synic bit */ - rdmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); - sctrl.Enable = 1; + rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); + sctrl.enable = 1; - wrmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); + wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); gHvContext.SynICInitialized = true; return; @@ -474,25 +474,25 @@ void HvSynicCleanup(void *arg) if (!gHvContext.SynICInitialized) return; - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.Masked = 1; + sharedSint.masked = 1; /* Need to correctly cleanup in the case of SMP!!! */ /* Disable the interrupt */ - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 0; - simp.BaseSimpGpa = 0; + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 0; + simp.base_simp_gpa = 0; - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 0; - siefp.BaseSiefpGpa = 0; + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 0; + siefp.base_siefp_gpa = 0; - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); osd_PageFree(gHvContext.synICMessagePage[cpu], 1); osd_PageFree(gHvContext.synICEventPage[cpu], 1); diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9eb818e..9df6472 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -510,21 +510,21 @@ /* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent - * is set by CPUID(HvCpuIdFunctionVersionAndFeatures). + * is set by CPUID(HVCPUID_VERSION_FEATURES). */ enum hv_cpuid_function { - HvCpuIdFunctionVersionAndFeatures = 0x00000001, - HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000, - HvCpuIdFunctionHvInterface = 0x40000001, + HVCPUID_VERSION_FEATURES = 0x00000001, + HVCPUID_VENDOR_MAXFUNCTION = 0x40000000, + HVCPUID_INTERFACE = 0x40000001, /* * The remaining functions depend on the value of - * HvCpuIdFunctionInterface + * HVCPUID_INTERFACE */ - HvCpuIdFunctionMsHvVersion = 0x40000002, - HvCpuIdFunctionMsHvFeatures = 0x40000003, - HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004, - HvCpuIdFunctionMsHvImplementationLimits = 0x40000005, + HVCPUID_VERSION = 0x40000002, + HVCPUID_FEATURES = 0x40000003, + HVCPUID_ENLIGHTENMENT_INFO = 0x40000004, + HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005, }; /* Define the virtual APIC registers */ @@ -575,30 +575,30 @@ enum hv_cpuid_function { /* Define hypervisor message types. */ enum hv_message_type { - HvMessageTypeNone = 0x00000000, + HVMSG_NONE = 0x00000000, /* Memory access messages. */ - HvMessageTypeUnmappedGpa = 0x80000000, - HvMessageTypeGpaIntercept = 0x80000001, + HVMSG_UNMAPPED_GPA = 0x80000000, + HVMSG_GPA_INTERCEPT = 0x80000001, /* Timer notification messages. */ - HvMessageTimerExpired = 0x80000010, + HVMSG_TIMER_EXPIRED = 0x80000010, /* Error messages. */ - HvMessageTypeInvalidVpRegisterValue = 0x80000020, - HvMessageTypeUnrecoverableException = 0x80000021, - HvMessageTypeUnsupportedFeature = 0x80000022, + HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, + HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, + HVMSG_UNSUPPORTED_FEATURE = 0x80000022, /* Trace buffer complete messages. */ - HvMessageTypeEventLogBufferComplete = 0x80000040, + HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, /* Platform-specific processor intercept messages. */ - HvMessageTypeX64IoPortIntercept = 0x80010000, - HvMessageTypeX64MsrIntercept = 0x80010001, - HvMessageTypeX64CpuidIntercept = 0x80010002, - HvMessageTypeX64ExceptionIntercept = 0x80010003, - HvMessageTypeX64ApicEoi = 0x80010004, - HvMessageTypeX64LegacyFpError = 0x80010005 + HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, + HVMSG_X64_MSR_INTERCEPT = 0x80010001, + HVMSG_X64_CPUID_INTERCEPT = 0x80010002, + HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003, + HVMSG_X64_APIC_EOI = 0x80010004, + HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 }; /* Define the number of synthetic interrupt sources. */ @@ -610,103 +610,103 @@ enum hv_message_type { /* Define connection identifier type. */ union hv_connection_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u; }; /* Define port identifier type. */ union hv_port_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u ; }; /* Define port type. */ enum hv_port_type { - HvPortTypeMessage = 1, - HvPortTypeEvent = 2, - HvPortTypeMonitor = 3 + HVPORT_MSG = 1, + HVPORT_EVENT = 2, + HVPORT_MONITOR = 3 }; /* Define port information structure. */ struct hv_port_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u32 TargetSint; - u32 TargetVp; - u64 RsvdZ; - } MessagePortInfo; + u32 target_sint; + u32 target_vp; + u64 rsvdz; + } message_port_info; struct { - u32 TargetSint; - u32 TargetVp; - u16 BaseFlagNumber; - u16 FlagCount; - u32 RsvdZ; - } EventPortInfo; + u32 target_sint; + u32 target_vp; + u16 base_flag_bumber; + u16 flag_count; + u32 rsvdz; + } event_port_info; struct { - u64 MonitorAddress; - u64 RsvdZ; - } MonitorPortInfo; + u64 monitor_address; + u64 rsvdz; + } monitor_port_info; }; }; struct hv_connection_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u64 RsvdZ; - } MessageConnectionInfo; + u64 rsvdz; + } message_connection_info; struct { - u64 RsvdZ; - } EventConnectionInfo; + u64 rsvdz; + } event_connection_info; struct { - u64 MonitorAddress; - } MonitorConnectionInfo; + u64 monitor_address; + } monitor_connection_info; }; }; /* Define synthetic interrupt controller message flags. */ union hv_message_flags { - u8 Asu8; + u8 asu8; struct { - u8 MessagePending:1; - u8 Reserved:7; + u8 msg_pending:1; + u8 reserved:7; }; }; /* Define synthetic interrupt controller message header. */ struct hv_message_header { - enum hv_message_type MessageType; - u8 PayloadSize; - union hv_message_flags MessageFlags; - u8 Reserved[2]; + enum hv_message_type message_type; + u8 payload_size; + union hv_message_flags message_flags; + u8 reserved[2]; union { - u64 Sender; - union hv_port_id Port; + u64 sender; + union hv_port_id port; }; }; /* Define timer message payload structure. */ struct hv_timer_message_payload { - u32 TimerIndex; - u32 Reserved; - u64 ExpirationTime; /* When the timer expired */ - u64 DeliveryTime; /* When the message was delivered */ + u32 timer_index; + u32 reserved; + u64 expiration_time; /* When the timer expired */ + u64 delivery_time; /* When the message was delivered */ }; /* Define synthetic interrupt controller message format. */ struct hv_message { - struct hv_message_header Header; + struct hv_message_header header; union { - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; } u ; }; @@ -715,82 +715,82 @@ struct hv_message { /* Define the synthetic interrupt message page layout. */ struct hv_message_page { - struct hv_message SintMessage[HV_SYNIC_SINT_COUNT]; + struct hv_message sint_message[HV_SYNIC_SINT_COUNT]; }; /* Define the synthetic interrupt controller event flags format. */ union hv_synic_event_flags { - u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT]; - u32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT]; + u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT]; + u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT]; }; /* Define the synthetic interrupt flags page layout. */ struct hv_synic_event_flags_page { - union hv_synic_event_flags SintEventFlags[HV_SYNIC_SINT_COUNT]; + union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; }; /* Define SynIC control register. */ union hv_synic_scontrol { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:63; + u64 enable:1; + u64 reserved:63; }; }; /* Define synthetic interrupt source. */ union hv_synic_sint { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Vector:8; - u64 Reserved1:8; - u64 Masked:1; - u64 AutoEoi:1; - u64 Reserved2:46; + u64 vector:8; + u64 reserved1:8; + u64 masked:1; + u64 auto_eoi:1; + u64 reserved2:46; }; }; /* Define the format of the SIMP register */ union hv_synic_simp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SimpEnabled:1; - u64 Preserved:11; - u64 BaseSimpGpa:52; + u64 simp_enabled:1; + u64 preserved:11; + u64 base_simp_gpa:52; }; }; /* Define the format of the SIEFP register */ union hv_synic_siefp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SiefpEnabled:1; - u64 Preserved:11; - u64 BaseSiefpGpa:52; + u64 siefp_enabled:1; + u64 preserved:11; + u64 base_siefp_gpa:52; }; }; /* Definitions for the monitored notification facility */ union hv_monitor_trigger_group { - u64 AsUINT64; + u64 as_uint64; struct { - u32 Pending; - u32 Armed; + u32 pending; + u32 armed; }; }; struct hv_monitor_parameter { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flagnumber; + u16 rsvdz; }; union hv_monitor_trigger_state { - u32 Asu32; + u32 asu32; struct { - u32 GroupEnable:4; - u32 RsvdZ:28; + u32 group_enable:4; + u32 rsvdz:28; }; }; @@ -814,42 +814,42 @@ union hv_monitor_trigger_state { /* | 840 | Rsvd4[0] | */ /* ------------------------------------------------------ */ struct hv_monitor_page { - union hv_monitor_trigger_state TriggerState; - u32 RsvdZ1; + union hv_monitor_trigger_state trigger_state; + u32 rsvdz1; - union hv_monitor_trigger_group TriggerGroup[4]; - u64 RsvdZ2[3]; + union hv_monitor_trigger_group trigger_group[4]; + u64 rsvdz2[3]; - s32 NextCheckTime[4][32]; + s32 next_checktime[4][32]; - u16 Latency[4][32]; - u64 RsvdZ3[32]; + u16 latency[4][32]; + u64 rsvdz3[32]; - struct hv_monitor_parameter Parameter[4][32]; + struct hv_monitor_parameter parameter[4][32]; - u8 RsvdZ4[1984]; + u8 rsvdz4[1984]; }; /* Declare the various hypercall operations. */ enum hv_call_code { - HvCallPostMessage = 0x005c, - HvCallSignalEvent = 0x005d, + HVCALL_POST_MESSAGE = 0x005c, + HVCALL_SIGNAL_EVENT = 0x005d, }; /* Definition of the HvPostMessage hypercall input structure. */ struct hv_input_post_message { - union hv_connection_id ConnectionId; - u32 Reserved; - enum hv_message_type MessageType; - u32 PayloadSize; - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + union hv_connection_id connectionid; + u32 reserved; + enum hv_message_type message_type; + u32 payload_size; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; /* Definition of the HvSignalEvent hypercall input structure. */ struct hv_input_signal_event { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flag_number; + u16 rsvdz; }; /* @@ -859,16 +859,16 @@ struct hv_input_signal_event { /* Version info reported by guest OS's */ enum hv_guest_os_vendor { - HvGuestOsVendorMicrosoft = 0x0001 + HVGUESTOS_VENDOR_MICROSOFT = 0x0001 }; enum hv_guest_os_microsoft_ids { - HvGuestOsMicrosoftUndefined = 0x00, - HvGuestOsMicrosoftMSDOS = 0x01, - HvGuestOsMicrosoftWindows3x = 0x02, - HvGuestOsMicrosoftWindows9x = 0x03, - HvGuestOsMicrosoftWindowsNT = 0x04, - HvGuestOsMicrosoftWindowsCE = 0x05 + HVGUESTOS_MICROSOFT_UNDEFINED = 0x00, + HVGUESTOS_MICROSOFT_MSDOS = 0x01, + HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02, + HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03, + HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04, + HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05 }; /* @@ -877,14 +877,14 @@ enum hv_guest_os_microsoft_ids { #define HV_X64_MSR_GUEST_OS_ID 0x40000000 union hv_x64_msr_guest_os_id_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 BuildNumber:16; - u64 ServiceVersion:8; /* Service Pack, etc. */ - u64 MinorVersion:8; - u64 MajorVersion:8; - u64 OsId:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ - u64 VendorId:16; /* enum hv_guest_os_vendor */ + u64 build_number:16; + u64 service_version:8; /* Service Pack, etc. */ + u64 minor_version:8; + u64 major_version:8; + u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ + u64 vendor_id:16; /* enum hv_guest_os_vendor */ }; }; @@ -894,11 +894,11 @@ union hv_x64_msr_guest_os_id_contents { #define HV_X64_MSR_HYPERCALL 0x40000001 union hv_x64_msr_hypercall_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:11; - u64 GuestPhysicalAddress:52; + u64 enable:1; + u64 reserved:11; + u64 guest_physical_address:52; }; }; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index d449daf..7c54ca9 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -153,7 +153,7 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) struct hv_message *copied; while (1) { - if (msg->Header.MessageType == HvMessageTypeNone) { + if (msg->header.message_type == HVMSG_NONE) { /* no msg */ break; } else { @@ -166,18 +166,18 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) (void *)copied); } - msg->Header.MessageType = HvMessageTypeNone; + msg->header.message_type = HVMSG_NONE; /* * Make sure the write to MessageType (ie set to - * HvMessageTypeNone) happens before we read the + * HVMSG_NONE) happens before we read the * MessagePending and EOMing. Otherwise, the EOMing * will not deliver any more messages since there is * no empty slot */ mb(); - if (msg->Header.MessageFlags.MessagePending) { + if (msg->header.message_flags.msg_pending) { /* * This will cause message queue rescan to * possibly deliver another msg from the @@ -212,10 +212,10 @@ static int VmbusOnISR(struct hv_driver *drv) msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; /* Check if there are actual msgs to be process */ - if (msg->Header.MessageType != HvMessageTypeNone) { + if (msg->header.message_type != HVMSG_NONE) { DPRINT_DBG(VMBUS, "received msg type %d size %d", - msg->Header.MessageType, - msg->Header.PayloadSize); + msg->header.message_type, + msg->header.payload_size); ret |= 0x1; } @@ -224,8 +224,8 @@ static int VmbusOnISR(struct hv_driver *drv) event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; /* Since we are a child, we only need to check bit 0 */ - if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) { - DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]); + if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) { + DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]); ret |= 0x2; } -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 05/10] staging: hv: Convert camel cased functions in hv.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in hv.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/connection.c | 4 +- drivers/staging/hv/hv.c | 42 ++++++++++++++++++++------------------ drivers/staging/hv/hv.h | 16 +++++++------- drivers/staging/hv/hv_api.h | 4 +- drivers/staging/hv/vmbus.c | 8 +++--- 5 files changed, 38 insertions(+), 36 deletions(-) diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index ba50dd8..97321d1 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -311,7 +311,7 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) connId.asu32 = 0; connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; - return HvPostMessage(connId, 1, buffer, bufferLen); + return hv_post_message(connId, 1, buffer, bufferLen); } /* @@ -324,5 +324,5 @@ int VmbusSetEvent(u32 childRelId) (unsigned long *)gVmbusConnection.SendInterruptPage + (childRelId >> 5)); - return HvSignalEvent(); + return hv_signal_event(); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 2fd234d..ce0a139 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -38,7 +38,7 @@ struct hv_context hv_context = { /* * HvQueryHypervisorPresence - Query the cpuid for presense of windows hypervisor */ -static int HvQueryHypervisorPresence(void) +static int hvquery_hypervisor_presence(void) { unsigned int eax; unsigned int ebx; @@ -59,7 +59,7 @@ static int HvQueryHypervisorPresence(void) /* * HvQueryHypervisorInfo - Get version info of the windows hypervisor */ -static int HvQueryHypervisorInfo(void) +static int hvquery_hypervisor_info(void) { unsigned int eax; unsigned int ebx; @@ -126,9 +126,9 @@ static int HvQueryHypervisorInfo(void) } /* - * HvDoHypercall - Invoke the specified hypercall + * hvdo_hypercall- Invoke the specified hypercall */ -static u64 HvDoHypercall(u64 control, void *input, void *output) +static u64 hvdo_hypercall(u64 control, void *input, void *output) { #ifdef CONFIG_X86_64 u64 hv_status = 0; @@ -181,11 +181,11 @@ static u64 HvDoHypercall(u64 control, void *input, void *output) } /* - * HvInit - Main initialization routine. + * hv_init - Main initialization routine. * * This routine must be called before any other routines in here are called */ -int HvInit(void) +int hv_init(void) { int ret = 0; int max_leaf; @@ -196,7 +196,7 @@ int HvInit(void) memset(hv_context.synic_message_page, 0, sizeof(void *) * MAX_NUM_CPUS); - if (!HvQueryHypervisorPresence()) { + if (!hvquery_hypervisor_presence()) { DPRINT_ERR(VMBUS, "No Windows hypervisor detected!!"); goto Cleanup; } @@ -204,7 +204,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Windows hypervisor detected! Retrieving more info..."); - max_leaf = HvQueryHypervisorInfo(); + max_leaf = hvquery_hypervisor_info(); /* HvQueryHypervisorFeatures(maxLeaf); */ /* @@ -291,11 +291,11 @@ Cleanup: } /* - * HvCleanup - Cleanup routine. + * hv_cleanup - Cleanup routine. * * This routine is called normally during driver unloading or exiting. */ -void HvCleanup(void) +void hv_cleanup(void) { union hv_x64_msr_hypercall_contents hypercall_msr; @@ -312,11 +312,11 @@ void HvCleanup(void) } /* - * HvPostMessage - Post a message using the hypervisor message IPC. + * hv_post_message - Post a message using the hypervisor message IPC. * * This involves a hypercall. */ -u16 HvPostMessage(union hv_connection_id connection_id, +u16 hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, void *payload, size_t payload_size) { @@ -344,7 +344,8 @@ u16 HvPostMessage(union hv_connection_id connection_id, aligned_msg->payload_size = payload_size; memcpy((void *)aligned_msg->payload, payload, payload_size); - status = HvDoHypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) & 0xFFFF; + status = hvdo_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) + & 0xFFFF; kfree((void *)addr); @@ -353,28 +354,29 @@ u16 HvPostMessage(union hv_connection_id connection_id, /* - * HvSignalEvent - Signal an event on the specified connection using the hypervisor event IPC. + * hv_signal_event - + * Signal an event on the specified connection using the hypervisor event IPC. * * This involves a hypercall. */ -u16 HvSignalEvent(void) +u16 hv_signal_event(void) { u16 status; - status = HvDoHypercall(HVCALL_SIGNAL_EVENT, + status = hvdo_hypercall(HVCALL_SIGNAL_EVENT, hv_context.signal_event_param, NULL) & 0xFFFF; return status; } /* - * HvSynicInit - Initialize the Synthethic Interrupt Controller. + * hv_synic_init - Initialize the Synthethic Interrupt Controller. * * If it is already initialized by another entity (ie x2v shim), we need to * retrieve the initialized message and event pages. Otherwise, we create and * initialize the message and event pages. */ -void HvSynicInit(void *irqarg) +void hv_synic_init(void *irqarg) { u64 version; union hv_synic_simp simp; @@ -467,9 +469,9 @@ Cleanup: } /* - * HvSynicCleanup - Cleanup routine for HvSynicInit(). + * hv_synic_cleanup - Cleanup routine for hv_synic_init(). */ -void HvSynicCleanup(void *arg) +void hv_synic_cleanup(void *arg) { union hv_synic_sint shared_sint; union hv_synic_simp simp; diff --git a/drivers/staging/hv/hv.h b/drivers/staging/hv/hv.h index 6e396fc..829aff8 100644 --- a/drivers/staging/hv/hv.h +++ b/drivers/staging/hv/hv.h @@ -123,18 +123,18 @@ extern struct hv_context hv_context; /* Hv Interface */ -extern int HvInit(void); +extern int hv_init(void); -extern void HvCleanup(void); +extern void hv_cleanup(void); -extern u16 HvPostMessage(union hv_connection_id connectionId, - enum hv_message_type messageType, - void *payload, size_t payloadSize); +extern u16 hv_post_message(union hv_connection_id connection_id, + enum hv_message_type message_type, + void *payload, size_t payload_size); -extern u16 HvSignalEvent(void); +extern u16 hv_signal_event(void); -extern void HvSynicInit(void *irqarg); +extern void hv_synic_init(void *irqarg); -extern void HvSynicCleanup(void *arg); +extern void hv_synic_cleanup(void *arg); #endif /* __HV_H__ */ diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9df6472..70e863a 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -836,7 +836,7 @@ enum hv_call_code { HVCALL_SIGNAL_EVENT = 0x005d, }; -/* Definition of the HvPostMessage hypercall input structure. */ +/* Definition of the hv_post_message hypercall input structure. */ struct hv_input_post_message { union hv_connection_id connectionid; u32 reserved; @@ -845,7 +845,7 @@ struct hv_input_post_message { u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; -/* Definition of the HvSignalEvent hypercall input structure. */ +/* Definition of the hv_signal_event hypercall input structure. */ struct hv_input_signal_event { union hv_connection_id connectionid; u16 flag_number; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index b1ec876..e6462c6 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -109,7 +109,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) /* strcpy(dev->name, "vmbus"); */ /* SynIC setup... */ - on_each_cpu(HvSynicInit, (void *)irqvector, 1); + on_each_cpu(hv_synic_init, (void *)irqvector, 1); /* Connect to VMBus in the root partition */ ret = VmbusConnect(); @@ -127,7 +127,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev) vmbus_release_unattached_channels(); VmbusDisconnect(); - on_each_cpu(HvSynicCleanup, NULL, 1); + on_each_cpu(hv_synic_cleanup, NULL, 1); return ret; } @@ -138,7 +138,7 @@ static void VmbusOnCleanup(struct hv_driver *drv) { /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ - HvCleanup(); + hv_cleanup(); } /* @@ -264,7 +264,7 @@ int VmbusInitialize(struct hv_driver *drv) driver->GetChannelOffers = VmbusGetChannelOffers; /* Hypervisor initialization...setup hypercall page..etc */ - ret = HvInit(); + ret = hv_init(); if (ret != 0) DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", ret); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 06/10] staging: hv: Convert camel cased local variables in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased local variables in osd.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/osd.c | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index 8c3eb27..b39ec25 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -130,9 +130,9 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); /** * osd_WaitEventSet() - Wake up the process - * @waitEvent: Structure to event to be woken up + * @wait_event: Structure to event to be woken up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Wake up the sleeping process so it can do some work. * And set condition indicator in &struct osd_waitevent to indicate @@ -140,18 +140,18 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *waitEvent) +void osd_WaitEventSet(struct osd_waitevent *wait_event) { - waitEvent->condition = 1; - wake_up_interruptible(&waitEvent->event); + wait_event->condition = 1; + wake_up_interruptible(&wait_event->event); } EXPORT_SYMBOL_GPL(osd_WaitEventSet); /** * osd_WaitEventWait() - Wait for event till condition is true - * @waitEvent: Structure to event to be put to sleep + * @wait_event: Structure to event to be put to sleep * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Set up the process to sleep until waitEvent->condition get true. * And set condition indicator in &struct osd_waitevent to indicate @@ -161,25 +161,25 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *waitEvent) +int osd_WaitEventWait(struct osd_waitevent *wait_event) { int ret = 0; - ret = wait_event_interruptible(waitEvent->event, - waitEvent->condition); - waitEvent->condition = 0; + ret = wait_event_interruptible(wait_event->event, + wait_event->condition); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWait); /** * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup - * @waitEvent: Structure to event to be put to sleep - * @TimeoutInMs: Total number of Milliseconds to wait before waking up + * @wait_event: Structure to event to be put to sleep + * @timeout_in_ms: Total number of Milliseconds to wait before waking up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * Set up the process to sleep until @waitEvent->condition get true or - * @TimeoutInMs (Time out in Milliseconds) has been reached. + * @timeout_in_ms (Time out in Milliseconds) has been reached. * And set condition indicator in &struct osd_waitevent to indicate * the process is in a sleeping state. * @@ -187,14 +187,14 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs) +int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; - ret = wait_event_interruptible_timeout(waitEvent->event, - waitEvent->condition, - msecs_to_jiffies(TimeoutInMs)); - waitEvent->condition = 0; + ret = wait_event_interruptible_timeout(wait_event->event, + wait_event->condition, + msecs_to_jiffies(timeout_in_ms)); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 07/10] staging: hv: Convert camel cased functions in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in osd.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 | 20 +++++++++--------- drivers/staging/hv/channel_mgmt.c | 12 +++++----- drivers/staging/hv/connection.c | 14 ++++++------ drivers/staging/hv/hv.c | 12 +++++----- drivers/staging/hv/netvsc.c | 24 +++++++++++----------- drivers/staging/hv/osd.c | 40 ++++++++++++++++++------------------ drivers/staging/hv/osd.h | 18 ++++++++-------- drivers/staging/hv/rndis_filter.c | 10 ++++---- drivers/staging/hv/storvsc.c | 16 +++++++------- 9 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 7c15c40..abc2988 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -180,7 +180,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) + out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); if (!out) return -ENOMEM; @@ -242,7 +242,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->waitevent = osd_WaitEventCreate(); + openInfo->waitevent = osd_waitevent_create(); if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; @@ -280,7 +280,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->waitevent); + osd_waitevent_wait(openInfo->waitevent); if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); @@ -300,7 +300,7 @@ Cleanup: errorout: RingBufferCleanup(&newchannel->outbound); RingBufferCleanup(&newchannel->inbound); - osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) + osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); return err; @@ -508,7 +508,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -565,7 +565,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } } - osd_WaitEventWait(msginfo->waitevent); + osd_waitevent_wait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " @@ -604,7 +604,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->waitevent = osd_WaitEventCreate(); + info->waitevent = osd_waitevent_create(); if (!info->waitevent) { kfree(info); return -ENOMEM; @@ -628,7 +628,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->waitevent); + osd_waitevent_wait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); @@ -663,7 +663,7 @@ void vmbus_close(struct vmbus_channel *channel) if (!info) return; - /* info->waitEvent = osd_WaitEventCreate(); */ + /* info->waitEvent = osd_waitevent_create(); */ msg = (struct vmbus_channel_close_channel *)info->msg; msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; @@ -686,7 +686,7 @@ void vmbus_close(struct vmbus_channel *channel) RingBufferCleanup(&channel->outbound); RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); + osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index be34e38..ae830f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -566,7 +566,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -616,7 +616,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -662,7 +662,7 @@ static void vmbus_ongpadl_torndown( memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -703,7 +703,7 @@ static void vmbus_onversion_response( memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -782,7 +782,7 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; @@ -808,7 +808,7 @@ int vmbus_request_offers(void) goto Cleanup; } - /* osd_WaitEventWait(msgInfo->waitEvent); */ + /* osd_waitevent_wait(msgInfo->waitEvent); */ /*SpinlockAcquire(gVmbusConnection.channelMsgLock); REMOVE_ENTRY_LIST(&msgInfo->msgListEntry); diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 97321d1..c2e298f 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -66,7 +66,7 @@ int VmbusConnect(void) * Setup the vmbus event connection for channel interrupt * abstraction stuff */ - gVmbusConnection.InterruptPage = osd_PageAlloc(1); + gVmbusConnection.InterruptPage = osd_page_alloc(1); if (gVmbusConnection.InterruptPage == NULL) { ret = -1; goto Cleanup; @@ -81,7 +81,7 @@ int VmbusConnect(void) * Setup the monitor notification facility. The 1st page for * parent->child and the 2nd page for child->parent */ - gVmbusConnection.MonitorPages = osd_PageAlloc(2); + gVmbusConnection.MonitorPages = osd_page_alloc(2); if (gVmbusConnection.MonitorPages == NULL) { ret = -1; goto Cleanup; @@ -95,7 +95,7 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->waitevent = osd_WaitEventCreate(); + msgInfo->waitevent = osd_waitevent_create(); if (!msgInfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -134,7 +134,7 @@ int VmbusConnect(void) } /* Wait for the connection response */ - osd_WaitEventWait(msgInfo->waitevent); + osd_waitevent_wait(msgInfo->waitevent); list_del(&msgInfo->msglistentry); @@ -162,12 +162,12 @@ Cleanup: destroy_workqueue(gVmbusConnection.WorkQueue); if (gVmbusConnection.InterruptPage) { - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); gVmbusConnection.InterruptPage = NULL; } if (gVmbusConnection.MonitorPages) { - osd_PageFree(gVmbusConnection.MonitorPages, 2); + osd_page_free(gVmbusConnection.MonitorPages, 2); gVmbusConnection.MonitorPages = NULL; } @@ -202,7 +202,7 @@ int VmbusDisconnect(void) if (ret != 0) goto Cleanup; - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); /* TODO: iterate thru the msg list and free up */ destroy_workqueue(gVmbusConnection.WorkQueue); diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index ce0a139..bb9ac6d 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -227,9 +227,9 @@ int hv_init(void) /* * Allocate the hypercall page memory - * virtaddr = osd_PageAlloc(1); + * virtaddr = osd_page_alloc(1); */ - virtaddr = osd_VirtualAllocExec(PAGE_SIZE); + virtaddr = osd_virtual_alloc_exec(PAGE_SIZE); if (!virtaddr) { DPRINT_ERR(VMBUS, @@ -461,10 +461,10 @@ void hv_synic_init(void *irqarg) Cleanup: if (hv_context.synic_event_page[cpu]) - osd_PageFree(hv_context.synic_event_page[cpu], 1); + osd_page_free(hv_context.synic_event_page[cpu], 1); if (hv_context.synic_message_page[cpu]) - osd_PageFree(hv_context.synic_message_page[cpu], 1); + osd_page_free(hv_context.synic_message_page[cpu], 1); return; } @@ -501,6 +501,6 @@ void hv_synic_cleanup(void *arg) wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); - osd_PageFree(hv_context.synic_message_page[cpu], 1); - osd_PageFree(hv_context.synic_event_page[cpu], 1); + osd_page_free(hv_context.synic_message_page[cpu], 1); + osd_page_free(hv_context.synic_event_page[cpu], 1); } diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index 4c2632c..8022781 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c @@ -221,7 +221,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->ReceiveBuffer - osd_PageAlloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); if (!netDevice->ReceiveBuffer) { DPRINT_ERR(NETVSC, "unable to allocate receive buffer of size %d", @@ -249,7 +249,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer..."); @@ -274,7 +274,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendReceiveBufferComplete.Status != NvspStatusSuccess) { @@ -350,7 +350,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->SendBuffer - osd_PageAlloc(netDevice->SendBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->SendBufferSize >> PAGE_SHIFT); if (!netDevice->SendBuffer) { DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d", netDevice->SendBufferSize); @@ -375,7 +375,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer..."); @@ -400,7 +400,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendSendBufferComplete.Status != NvspStatusSuccess) { @@ -480,7 +480,7 @@ static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up receive buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->ReceiveBuffer, + osd_page_free(NetDevice->ReceiveBuffer, NetDevice->ReceiveBufferSize >> PAGE_SHIFT); NetDevice->ReceiveBuffer = NULL; } @@ -553,7 +553,7 @@ static int NetVscDestroySendBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up send buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->SendBuffer, + osd_page_free(NetDevice->SendBuffer, NetDevice->SendBufferSize >> PAGE_SHIFT); NetDevice->SendBuffer = NULL; } @@ -597,7 +597,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Now, check the response */ /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */ @@ -651,7 +651,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) * packet) since our Vmbus always set the * VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag */ - /* osd_WaitEventWait(NetVscChannel->ChannelInitEvent); */ + /* osd_waitevent_wait(NetVscChannel->ChannelInitEvent); */ /* Post the big receive buffer to NetVSP */ ret = NetVscInitializeReceiveBufferWithNetVsp(Device); @@ -710,7 +710,7 @@ static int NetVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) list_add_tail(&packet->ListEntry, &netDevice->ReceivePacketList); } - netDevice->ChannelInitEvent = osd_WaitEventCreate(); + netDevice->ChannelInitEvent = osd_waitevent_create(); if (!netDevice->ChannelInitEvent) { ret = -ENOMEM; goto Cleanup; @@ -855,7 +855,7 @@ static void NetVscOnSendCompletion(struct hv_device *Device, /* Copy the response back */ memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(struct nvsp_message)); - osd_WaitEventSet(netDevice->ChannelInitEvent); + osd_waitevent_set(netDevice->ChannelInitEvent); } else if (nvspPacket->Header.MessageType = NvspMessage1TypeSendRNDISPacketComplete) { /* Get the send context */ diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index b39ec25..b699ee2 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -49,7 +49,7 @@ struct osd_callback_struct { void *data; }; -void *osd_VirtualAllocExec(unsigned int size) +void *osd_virtual_alloc_exec(unsigned int size) { #ifdef __x86_64__ return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL_EXEC); @@ -60,7 +60,7 @@ void *osd_VirtualAllocExec(unsigned int size) } /** - * osd_PageAlloc() - Allocate pages + * osd_page_alloc() - Allocate pages * @count: Total number of Kernel pages you want to allocate * * Tries to allocate @count number of consecutive free kernel pages. @@ -68,7 +68,7 @@ void *osd_VirtualAllocExec(unsigned int size) * If successfull it will return pointer to the @count pages. * Mainly used by Hyper-V drivers. */ -void *osd_PageAlloc(unsigned int count) +void *osd_page_alloc(unsigned int count) { void *p; @@ -85,26 +85,26 @@ void *osd_PageAlloc(unsigned int count) /* if (p) memset(p, 0, PAGE_SIZE); */ /* return p; */ } -EXPORT_SYMBOL_GPL(osd_PageAlloc); +EXPORT_SYMBOL_GPL(osd_page_alloc); /** - * osd_PageFree() - Free pages + * osd_page_free() - Free pages * @page: Pointer to the first page to be freed * @count: Total number of Kernel pages you free * - * Frees the pages allocated by osd_PageAlloc() + * Frees the pages allocated by osd_page_alloc() * Mainly used by Hyper-V drivers. */ -void osd_PageFree(void *page, unsigned int count) +void osd_page_free(void *page, unsigned int count) { free_pages((unsigned long)page, get_order(count * PAGE_SIZE)); /*struct page* p = virt_to_page(page); __free_page(p);*/ } -EXPORT_SYMBOL_GPL(osd_PageFree); +EXPORT_SYMBOL_GPL(osd_page_free); /** - * osd_WaitEventCreate() - Create the event queue + * osd_waitevent_create() - Create the event queue * * Allocates memory for a &struct osd_waitevent. And then calls * init_waitqueue_head to set up the wait queue for the event. @@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(osd_PageFree); * Returns pointer to &struct osd_waitevent * Mainly used by Hyper-V drivers. */ -struct osd_waitevent *osd_WaitEventCreate(void) +struct osd_waitevent *osd_waitevent_create(void) { struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL); @@ -125,11 +125,11 @@ struct osd_waitevent *osd_WaitEventCreate(void) init_waitqueue_head(&wait->event); return wait; } -EXPORT_SYMBOL_GPL(osd_WaitEventCreate); +EXPORT_SYMBOL_GPL(osd_waitevent_create); /** - * osd_WaitEventSet() - Wake up the process + * osd_waitevent_set() - Wake up the process * @wait_event: Structure to event to be woken up * * @wait_event is of type &struct osd_waitevent @@ -140,15 +140,15 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *wait_event) +void osd_waitevent_set(struct osd_waitevent *wait_event) { wait_event->condition = 1; wake_up_interruptible(&wait_event->event); } -EXPORT_SYMBOL_GPL(osd_WaitEventSet); +EXPORT_SYMBOL_GPL(osd_waitevent_set); /** - * osd_WaitEventWait() - Wait for event till condition is true + * osd_waitevent_wait() - Wait for event till condition is true * @wait_event: Structure to event to be put to sleep * * @wait_event is of type &struct osd_waitevent @@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *wait_event) +int osd_waitevent_wait(struct osd_waitevent *wait_event) { int ret = 0; @@ -170,10 +170,10 @@ int osd_WaitEventWait(struct osd_waitevent *wait_event) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWait); +EXPORT_SYMBOL_GPL(osd_waitevent_wait); /** - * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup + * osd_waitevent_waitex() - Wait for event or timeout for process wakeup * @wait_event: Structure to event to be put to sleep * @timeout_in_ms: Total number of Milliseconds to wait before waking up * @@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) +int osd_waitevent_waitex(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; @@ -197,7 +197,7 @@ int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); +EXPORT_SYMBOL_GPL(osd_waitevent_waitex); static void osd_callback_work(struct work_struct *work) { diff --git a/drivers/staging/hv/osd.h b/drivers/staging/hv/osd.h index ce064e8..cae126f 100644 --- a/drivers/staging/hv/osd.h +++ b/drivers/staging/hv/osd.h @@ -50,18 +50,18 @@ struct osd_waitevent { /* Osd routines */ -extern void *osd_VirtualAllocExec(unsigned int size); +extern void *osd_virtual_alloc_exec(unsigned int size); -extern void *osd_PageAlloc(unsigned int count); -extern void osd_PageFree(void *page, unsigned int count); +extern void *osd_page_alloc(unsigned int count); +extern void osd_page_free(void *page, unsigned int count); -extern struct osd_waitevent *osd_WaitEventCreate(void); -extern void osd_WaitEventSet(struct osd_waitevent *waitEvent); -extern int osd_WaitEventWait(struct osd_waitevent *waitEvent); +extern struct osd_waitevent *osd_waitevent_create(void); +extern void osd_waitevent_set(struct osd_waitevent *wait_event); +extern int osd_waitevent_wait(struct osd_waitevent *wait_event); -/* If >0, waitEvent got signaled. If ==0, timeout. If < 0, error */ -extern int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, - u32 TimeoutInMs); +/* If >0, wait_event got signaled. If ==0, timeout. If < 0, error */ +extern int osd_waitevent_waitex(struct osd_waitevent *wait_event, + u32 timeout_in_ms); int osd_schedule_callback(struct workqueue_struct *wq, void (*func)(void *), diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c index fa2141f..b85c825 100644 --- a/drivers/staging/hv/rndis_filter.c +++ b/drivers/staging/hv/rndis_filter.c @@ -129,7 +129,7 @@ static struct rndis_request *GetRndisRequest(struct rndis_device *Device, if (!request) return NULL; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { kfree(request); return NULL; @@ -313,7 +313,7 @@ static void RndisFilterReceiveResponse(struct rndis_device *Device, } } - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { DPRINT_ERR(NETVSC, "no rndis request found for this response " "(id 0x%x res type 0x%x)", @@ -497,7 +497,7 @@ static int RndisFilterQueryDevice(struct rndis_device *Device, u32 Oid, if (ret != 0) goto Cleanup; - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* Copy the response back */ queryComplete = &request->ResponseMessage.Message.QueryComplete; @@ -572,7 +572,7 @@ static int RndisFilterSetPacketFilter(struct rndis_device *Device, if (ret != 0) goto Cleanup; - ret = osd_WaitEventWaitEx(request->WaitEvent, 2000/*2sec*/); + ret = osd_waitevent_waitex(request->WaitEvent, 2000/*2sec*/); if (!ret) { ret = -1; DPRINT_ERR(NETVSC, "timeout before we got a set response..."); @@ -665,7 +665,7 @@ static int RndisFilterInitDevice(struct rndis_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); initComplete = &request->ResponseMessage.Message.InitializeComplete; status = initComplete->Status; diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 19e87f6..525c8ee 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -198,7 +198,7 @@ static int StorVscChannelInit(struct hv_device *Device) * channel */ memset(request, 0, sizeof(struct storvsc_request_extension)); - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto nomem; @@ -224,7 +224,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -255,7 +255,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -287,7 +287,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -323,7 +323,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -473,7 +473,7 @@ static void StorVscOnChannelCallback(void *context) memcpy(&request->VStorPacket, packet, sizeof(struct vstor_packet)); - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { StorVscOnReceive(device, (struct vstor_packet *)packet, @@ -622,7 +622,7 @@ int StorVscOnHostReset(struct hv_device *Device) request = &storDevice->ResetRequest; vstorPacket = &request->VStorPacket; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto Cleanup; @@ -644,7 +644,7 @@ int StorVscOnHostReset(struct hv_device *Device) } /* FIXME: Add a timeout */ - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); kfree(request->WaitEvent); DPRINT_INFO(STORVSC, "host adapter reset completed"); -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 08/10] staging: hv: Convert camel cased struct fields in ring_buffer.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased struct fields in ring_buffer.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 | 10 +++--- drivers/staging/hv/ring_buffer.c | 58 ++++++++++++++++++++----------------- drivers/staging/hv/ring_buffer.h | 30 ++++++++++---------- drivers/staging/hv/vmbus_drv.c | 25 +++++++++------- 4 files changed, 65 insertions(+), 58 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index abc2988..0e554e9 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -213,7 +213,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->outbound.RingBuffer, + newchannel->outbound.ring_buffer, send_ringbuffer_size + recv_ringbuffer_size, &newchannel->ringbuffer_gpadlhandle); @@ -227,10 +227,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, "size %d recv ring %p size %d, downstreamoffset %d>", newchannel, newchannel->offermsg.child_relid, newchannel->ringbuffer_gpadlhandle, - newchannel->outbound.RingBuffer, - newchannel->outbound.RingSize, - newchannel->inbound.RingBuffer, - newchannel->inbound.RingSize, + newchannel->outbound.ring_buffer, + newchannel->outbound.ring_size, + newchannel->inbound.ring_buffer, + newchannel->inbound.ring_size, send_ringbuffer_size); /* Create and init the channel open message */ diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index d78c569..6095cc5 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -51,11 +51,11 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) u32 read_loc, write_loc; /* Capture the read/write indices before they changed */ - read_loc = rbi->RingBuffer->ReadIndex; - write_loc = rbi->RingBuffer->WriteIndex; + read_loc = rbi->ring_buffer->read_index; + write_loc = rbi->ring_buffer->write_index; - *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->RingDataSize); - *read = rbi->RingDataSize - *write; + *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize); + *read = rbi->ring_datasize - *write; } /*++ @@ -70,7 +70,7 @@ Description: static inline u32 GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->WriteIndex; + u32 next = RingInfo->ring_buffer->write_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -90,7 +90,7 @@ static inline void SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, u32 NextWriteLocation) { - RingInfo->RingBuffer->WriteIndex = NextWriteLocation; + RingInfo->ring_buffer->write_index = NextWriteLocation; } /*++ @@ -105,7 +105,7 @@ Description: static inline u32 GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -125,11 +125,11 @@ Description: static inline u32 GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ next += Offset; - next %= RingInfo->RingDataSize; + next %= RingInfo->ring_datasize; return next; } @@ -146,7 +146,7 @@ Description: static inline void SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) { - RingInfo->RingBuffer->ReadIndex = NextReadLocation; + RingInfo->ring_buffer->read_index = NextReadLocation; } @@ -162,7 +162,7 @@ Description: static inline void * GetRingBuffer(struct hv_ring_buffer_info *RingInfo) { - return (void *)RingInfo->RingBuffer->Buffer; + return (void *)RingInfo->ring_buffer->buffer; } @@ -178,7 +178,7 @@ Description: static inline u32 GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) { - return RingInfo->RingDataSize; + return RingInfo->ring_datasize; } /*++ @@ -193,7 +193,7 @@ Description: static inline u64 GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) { - return (u64)RingInfo->RingBuffer->WriteIndex << 32; + return (u64)RingInfo->ring_buffer->write_index << 32; } @@ -221,11 +221,11 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) "avail read %u read idx %u write idx %u>>", Prefix, RingInfo, - RingInfo->RingBuffer->Buffer, + RingInfo->ring_buffer->buffer, bytesAvailToWrite, bytesAvailToRead, - RingInfo->RingBuffer->ReadIndex, - RingInfo->RingBuffer->WriteIndex); + RingInfo->ring_buffer->read_index, + RingInfo->ring_buffer->write_index); } @@ -262,16 +262,19 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, u32 bytesAvailToWrite; u32 bytesAvailToRead; - if (RingInfo->RingBuffer) { + if (RingInfo->ring_buffer) { GetRingBufferAvailBytes(RingInfo, &bytesAvailToRead, &bytesAvailToWrite); - debug_info->BytesAvailToRead = bytesAvailToRead; - debug_info->BytesAvailToWrite = bytesAvailToWrite; - debug_info->CurrentReadIndex = RingInfo->RingBuffer->ReadIndex; - debug_info->CurrentWriteIndex = RingInfo->RingBuffer->WriteIndex; - debug_info->CurrentInterruptMask = RingInfo->RingBuffer->InterruptMask; + debug_info->bytes_avail_toread = bytesAvailToRead; + debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->current_read_index + RingInfo->ring_buffer->read_index; + debug_info->current_write_index + RingInfo->ring_buffer->write_index; + debug_info->current_interrupt_mask + RingInfo->ring_buffer->interrupt_mask; } } @@ -287,7 +290,7 @@ Description: --*/ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) { - return rbi->RingBuffer->InterruptMask; + return rbi->ring_buffer->interrupt_mask; } /*++ @@ -306,11 +309,12 @@ int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 Buffe memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->RingBuffer = (struct hv_ring_buffer *)Buffer; - RingInfo->RingBuffer->ReadIndex = RingInfo->RingBuffer->WriteIndex = 0; + RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; + RingInfo->ring_buffer->read_index + RingInfo->ring_buffer->write_index = 0; - RingInfo->RingSize = BufferLen; - RingInfo->RingDataSize = BufferLen - sizeof(struct hv_ring_buffer); + RingInfo->ring_size = BufferLen; + RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); spin_lock_init(&RingInfo->ring_lock); diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index a7f1717..bb4c5bc 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -29,18 +29,18 @@ struct hv_ring_buffer { /* Offset in bytes from the start of ring data below */ - volatile u32 WriteIndex; + volatile u32 write_index; /* Offset in bytes from the start of ring data below */ - volatile u32 ReadIndex; + volatile u32 read_index; - volatile u32 InterruptMask; + volatile u32 interrupt_mask; /* Pad it to PAGE_SIZE so that data starts on page boundary */ - u8 Reserved[4084]; + u8 reserved[4084]; /* NOTE: - * The InterruptMask field is used only for channels but since our + * The interrupt_mask field is used only for channels but since our * vmbus connection also uses this data structure and its data starts * here, we commented out this field. */ @@ -50,24 +50,24 @@ struct hv_ring_buffer { * Ring data starts here + RingDataStartOffset * !!! DO NOT place any fields below this !!! */ - u8 Buffer[0]; + u8 buffer[0]; } __attribute__((packed)); struct hv_ring_buffer_info { - struct hv_ring_buffer *RingBuffer; - u32 RingSize; /* Include the shared header */ + struct hv_ring_buffer *ring_buffer; + u32 ring_size; /* Include the shared header */ spinlock_t ring_lock; - u32 RingDataSize; /* < ringSize */ - u32 RingDataStartOffset; + u32 ring_datasize; /* < ring_size */ + u32 ring_data_startoffset; }; struct hv_ring_buffer_debug_info { - u32 CurrentInterruptMask; - u32 CurrentReadIndex; - u32 CurrentWriteIndex; - u32 BytesAvailToRead; - u32 BytesAvailToWrite; + u32 current_interrupt_mask; + u32 current_read_index; + u32 current_write_index; + u32 bytes_avail_toread; + u32 bytes_avail_towrite; }; diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 2bbf4ec..0965875 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -156,18 +156,21 @@ static void get_channel_info(struct hv_device *device, info->ClientMonitorLatency = debug_info.clientmonitor_latency; info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - - info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; + info->Inbound.InterruptMask = debug_info.inbound.current_interrupt_mask; + info->Inbound.ReadIndex = debug_info.inbound.current_read_index; + info->Inbound.WriteIndex = debug_info.inbound.current_write_index; + info->Inbound.BytesAvailToRead = debug_info.inbound.bytes_avail_toread; + info->Inbound.BytesAvailToWrite + debug_info.inbound.bytes_avail_towrite; + + info->Outbound.InterruptMask + debug_info.outbound.current_interrupt_mask; + info->Outbound.ReadIndex = debug_info.outbound.current_read_index; + info->Outbound.WriteIndex = debug_info.outbound.current_write_index; + info->Outbound.BytesAvailToRead + debug_info.outbound.bytes_avail_toread; info->Outbound.BytesAvailToWrite - debug_info.outbound.BytesAvailToWrite; + debug_info.outbound.bytes_avail_towrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 09/10] staging: hv: Convert camel cased local variables in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased local variables in ring_buffer.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 | 4 +- drivers/staging/hv/ring_buffer.c | 337 +++++++++++++++++++------------------- drivers/staging/hv/ring_buffer.h | 26 ++-- 3 files changed, 185 insertions(+), 182 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 0e554e9..97db545 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - DumpRingInfo(&channel->outbound, "Outbound "); - DumpRingInfo(&channel->inbound, "Inbound "); + Dumpring_info(&channel->outbound, "Outbound "); + Dumpring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 6095cc5..705d95f 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -68,11 +68,11 @@ Description: --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) +GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->write_index; + u32 next = ring_info->ring_buffer->write_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -87,10 +87,10 @@ Description: --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, - u32 NextWriteLocation) +SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, + u32 next_write_location) { - RingInfo->ring_buffer->write_index = NextWriteLocation; + ring_info->ring_buffer->write_index = next_write_location; } /*++ @@ -103,11 +103,11 @@ Description: --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) +GetNextReadLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -123,13 +123,13 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) +GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ - next += Offset; - next %= RingInfo->ring_datasize; + /* ASSERT(next < ring_info->RingDataSize); */ + next += offset; + next %= ring_info->ring_datasize; return next; } @@ -144,9 +144,10 @@ Description: --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) +SetNextReadLocation(struct hv_ring_buffer_info *ring_info, + u32 next_read_location) { - RingInfo->ring_buffer->read_index = NextReadLocation; + ring_info->ring_buffer->read_index = next_read_location; } @@ -160,9 +161,9 @@ Description: --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *RingInfo) +GetRingBuffer(struct hv_ring_buffer_info *ring_info) { - return (void *)RingInfo->ring_buffer->buffer; + return (void *)ring_info->ring_buffer->buffer; } @@ -176,9 +177,9 @@ Description: --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) +GetRingBufferSize(struct hv_ring_buffer_info *ring_info) { - return RingInfo->ring_datasize; + return ring_info->ring_datasize; } /*++ @@ -191,41 +192,41 @@ Description: --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) +GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) { - return (u64)RingInfo->ring_buffer->write_index << 32; + return (u64)ring_info->ring_buffer->write_index << 32; } /*++ Name: - DumpRingInfo() + Dumpring_info() Description: Dump out to console the ring buffer info --*/ -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); DPRINT(VMBUS, DEBUG_RING_LVL, "%s <<ringinfo %p buffer %p avail write %u " "avail read %u read idx %u write idx %u>>", - Prefix, - RingInfo, - RingInfo->ring_buffer->buffer, - bytesAvailToWrite, - bytesAvailToRead, - RingInfo->ring_buffer->read_index, - RingInfo->ring_buffer->write_index); + prefix, + ring_info, + ring_info->ring_buffer->buffer, + bytes_avail_towrite, + bytes_avail_toread, + ring_info->ring_buffer->read_index, + ring_info->ring_buffer->write_index); } @@ -233,17 +234,17 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen); + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen); static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset); + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset); @@ -256,25 +257,25 @@ Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - if (RingInfo->ring_buffer) { - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + if (ring_info->ring_buffer) { + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - debug_info->bytes_avail_toread = bytesAvailToRead; - debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->bytes_avail_toread = bytes_avail_toread; + debug_info->bytes_avail_towrite = bytes_avail_towrite; debug_info->current_read_index - RingInfo->ring_buffer->read_index; + ring_info->ring_buffer->read_index; debug_info->current_write_index - RingInfo->ring_buffer->write_index; + ring_info->ring_buffer->write_index; debug_info->current_interrupt_mask - RingInfo->ring_buffer->interrupt_mask; + ring_info->ring_buffer->interrupt_mask; } } @@ -302,21 +303,22 @@ Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 BufferLen) +int RingBufferInit(struct hv_ring_buffer_info *ring_info, + void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) return -EINVAL; - memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); + memset(ring_info, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; - RingInfo->ring_buffer->read_index - RingInfo->ring_buffer->write_index = 0; + ring_info->ring_buffer = (struct hv_ring_buffer *)buffer; + ring_info->ring_buffer->read_index + ring_info->ring_buffer->write_index = 0; - RingInfo->ring_size = BufferLen; - RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); + ring_info->ring_size = buflen; + ring_info->ring_datasize = buflen - sizeof(struct hv_ring_buffer); - spin_lock_init(&RingInfo->ring_lock); + spin_lock_init(&ring_info->ring_lock); return 0; } @@ -330,7 +332,7 @@ Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo) +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) { } @@ -343,78 +345,78 @@ Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *OutRingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; - u32 byteAvailToWrite; - u32 byteAvailToRead; - u32 totalBytesToWrite = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 totalbytes_towrite = 0; struct scatterlist *sg; - volatile u32 nextWriteLocation; - u64 prevIndices = 0; + volatile u32 next_write_location; + u64 prev_indices = 0; unsigned long flags; for_each_sg(sglist, sg, sgcount, i) { - totalBytesToWrite += sg->length; + totalbytes_towrite += sg->length; } - totalBytesToWrite += sizeof(u64); + totalbytes_towrite += sizeof(u64); - spin_lock_irqsave(&OutRingInfo->ring_lock, flags); + spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(OutRingInfo, - &byteAvailToRead, - &byteAvailToWrite); + GetRingBufferAvailBytes(outring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Writing %u bytes...", totalBytesToWrite); + DPRINT_DBG(VMBUS, "Writing %u bytes...", totalbytes_towrite); - /* DumpRingInfo(OutRingInfo, "BEFORE "); */ + /* Dumpring_info(Outring_info, "BEFORE "); */ /* If there is only room for the packet, assume it is full. */ /* Otherwise, the next time around, we think the ring buffer */ /* is empty since the read index == write index */ - if (byteAvailToWrite <= totalBytesToWrite) { + if (bytes_avail_towrite <= totalbytes_towrite) { DPRINT_DBG(VMBUS, "No more space left on outbound ring buffer " "(needed %u, avail %u)", - totalBytesToWrite, - byteAvailToWrite); + totalbytes_towrite, + bytes_avail_towrite); - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return -1; } /* Write to the ring buffer */ - nextWriteLocation = GetNextWriteLocation(OutRingInfo); + next_write_location = GetNextWriteLocation(outring_info); for_each_sg(sglist, sg, sgcount, i) { - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prevIndices = GetRingBufferIndices(OutRingInfo); + prev_indices = GetRingBufferIndices(outring_info); - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, - &prevIndices, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, + &prev_indices, sizeof(u64)); /* Make sure we flush all writes before updating the writeIndex */ mb(); /* Now, update the write location */ - SetNextWriteLocation(OutRingInfo, nextWriteLocation); + SetNextWriteLocation(outring_info, next_write_location); - /* DumpRingInfo(OutRingInfo, "AFTER "); */ + /* Dumpring_info(Outring_info, "AFTER "); */ - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return 0; } @@ -428,41 +430,42 @@ Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *InRingInfo, void *Buffer, u32 BufferLen) +int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, + void *Buffer, u32 buflen) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; unsigned long flags; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(Inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { /* DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, + bytes_avail_toread, BufferLen); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return -1; } /* Convert to byte offset */ - nextReadLocation = GetNextReadLocation(InRingInfo); + next_read_location = GetNextReadLocation(Inring_info); - nextReadLocation = CopyFromRingBuffer(InRingInfo, + next_read_location = CopyFromRingBuffer(Inring_info, Buffer, - BufferLen, - nextReadLocation); + buflen, + next_read_location); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return 0; } @@ -477,52 +480,52 @@ Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, - u32 BufferLen, u32 Offset) +int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, + u32 buflen, u32 offset) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; - u64 prevIndices = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; + u64 prev_indices = 0; unsigned long flags; - if (BufferLen <= 0) + if (buflen <= 0) return -EINVAL; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Reading %u bytes...", BufferLen); + DPRINT_DBG(VMBUS, "Reading %u bytes...", buflen); - /* DumpRingInfo(InRingInfo, "BEFORE "); */ + /* Dumpring_info(Inring_info, "BEFORE "); */ /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, - BufferLen); + bytes_avail_toread, + buflen); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return -1; } - nextReadLocation = GetNextReadLocationWithOffset(InRingInfo, Offset); + next_read_location = GetNextReadLocationWithOffset(inring_info, offset); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - Buffer, - BufferLen, - nextReadLocation); + next_read_location = CopyFromRingBuffer(inring_info, + buffer, + buflen, + next_read_location); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - &prevIndices, + next_read_location = CopyFromRingBuffer(inring_info, + &prev_indices, sizeof(u64), - nextReadLocation); + next_read_location); /* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ @@ -530,11 +533,11 @@ int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, mb(); /* Update the read index */ - SetNextReadLocation(InRingInfo, nextReadLocation); + SetNextReadLocation(inring_info, next_read_location); - /* DumpRingInfo(InRingInfo, "AFTER "); */ + /* Dumpring_info(Inring_info, "AFTER "); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return 0; } @@ -552,29 +555,29 @@ Description: --*/ static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen) + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); - u32 fragLen; + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); + u32 frag_len; /* wrap-around detected! */ - if (SrcLen > ringBufferSize - StartWriteOffset) { + if (srclen > ring_buffer_size - start_write_offset) { DPRINT_DBG(VMBUS, "wrap-around detected!"); - fragLen = ringBufferSize - StartWriteOffset; - memcpy(ringBuffer + StartWriteOffset, Src, fragLen); - memcpy(ringBuffer, Src + fragLen, SrcLen - fragLen); + frag_len = ring_buffer_size - start_write_offset; + memcpy(ring_buffer + start_write_offset, src, frag_len); + memcpy(ring_buffer, src + frag_len, srclen - frag_len); } else - memcpy(ringBuffer + StartWriteOffset, Src, SrcLen); + memcpy(ring_buffer + start_write_offset, src, srclen); - StartWriteOffset += SrcLen; - StartWriteOffset %= ringBufferSize; + start_write_offset += srclen; + start_write_offset %= ring_buffer_size; - return StartWriteOffset; + return start_write_offset; } @@ -590,33 +593,33 @@ Description: --*/ static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset) + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); - u32 fragLen; + u32 frag_len; /* wrap-around detected at the src */ - if (DestLen > ringBufferSize - StartReadOffset) { + if (destlen > ring_buffer_size - start_read_offset) { DPRINT_DBG(VMBUS, "src wrap-around detected!"); - fragLen = ringBufferSize - StartReadOffset; + frag_len = ring_buffer_size - start_read_offset; - memcpy(Dest, ringBuffer + StartReadOffset, fragLen); - memcpy(Dest + fragLen, ringBuffer, DestLen - fragLen); + memcpy(dest, ring_buffer + start_read_offset, frag_len); + memcpy(dest + frag_len, ring_buffer, destlen - frag_len); } else - memcpy(Dest, ringBuffer + StartReadOffset, DestLen); + memcpy(dest, ring_buffer + start_read_offset, destlen); - StartReadOffset += DestLen; - StartReadOffset %= ringBufferSize; + start_read_offset += destlen; + start_read_offset %= ring_buffer_size; - return StartReadOffset; + return start_read_offset; } diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index bb4c5bc..f30be1f 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo); +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *RingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *RingInfo, - void *Buffer, - u32 BufferLen, - u32 Offset); +int RingBufferRead(struct hv_ring_buffer_info *ring_info, + void *buffer, + u32 buflen, + u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *RingInfo); +u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix); +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Haiyang Zhang
2010-Nov-01 20:46 UTC
[PATCH 10/10] staging: hv: Convert camel cased functions in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> Convert camel cased functions in ring_buffer.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 | 40 ++++++------ drivers/staging/hv/ring_buffer.c | 123 +++++++++++++++++++------------------ drivers/staging/hv/ring_buffer.h | 16 +++--- 3 files changed, 91 insertions(+), 88 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 97db545..45a627d 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -155,8 +155,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, monitorpage->parameter[monitor_group] [monitor_offset].connectionid.u.id; - RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); - RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); + ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound); + ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound); } /* @@ -193,13 +193,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); + ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); + ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -298,8 +298,8 @@ Cleanup: return 0; errorout: - RingBufferCleanup(&newchannel->outbound); - RingBufferCleanup(&newchannel->inbound); + ringbuffer_cleanup(&newchannel->outbound); + ringbuffer_cleanup(&newchannel->inbound); osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -683,8 +683,8 @@ void vmbus_close(struct vmbus_channel *channel) /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->outbound); - RingBufferCleanup(&channel->inbound); + ringbuffer_cleanup(&channel->outbound); + ringbuffer_cleanup(&channel->inbound); osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, userlen, + ret = ringbuffer_read(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); + ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - Dumpring_info(&channel->outbound, "Outbound "); - Dumpring_info(&channel->inbound, "Inbound "); + dump_ring_info(&channel->outbound, "Outbound "); + dump_ring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 705d95f..4d53392 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -38,7 +38,7 @@ /*++ Name: - GetRingBufferAvailBytes() + get_ringbuffer_availbytes() Description: Get number of bytes available to read and to write to @@ -46,7 +46,8 @@ Description: --*/ static inline void -GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) +get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, + u32 *read, u32 *write) { u32 read_loc, write_loc; @@ -61,14 +62,14 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) /*++ Name: - GetNextWriteLocation() + get_next_write_location() Description: Get the next write location for the specified ring buffer --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) +get_next_write_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->write_index; @@ -80,14 +81,14 @@ GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - SetNextWriteLocation() + set_next_write_location() Description: Set the next write location for the specified ring buffer --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, +set_next_write_location(struct hv_ring_buffer_info *ring_info, u32 next_write_location) { ring_info->ring_buffer->write_index = next_write_location; @@ -96,14 +97,14 @@ SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetNextReadLocation() + get_next_read_location() Description: Get the next read location for the specified ring buffer --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *ring_info) +get_next_read_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->read_index; @@ -115,7 +116,7 @@ GetNextReadLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetNextReadLocationWithOffset() + get_next_readlocation_withoffset() Description: Get the next read location + offset for the specified ring buffer. @@ -123,7 +124,8 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) +get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info, + u32 offset) { u32 next = ring_info->ring_buffer->read_index; @@ -137,14 +139,14 @@ GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) /*++ Name: - SetNextReadLocation() + set_next_read_location() Description: Set the next read location for the specified ring buffer --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *ring_info, +set_next_read_location(struct hv_ring_buffer_info *ring_info, u32 next_read_location) { ring_info->ring_buffer->read_index = next_read_location; @@ -154,14 +156,14 @@ SetNextReadLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBuffer() + get_ring_buffer() Description: Get the start of the ring buffer --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *ring_info) +get_ring_buffer(struct hv_ring_buffer_info *ring_info) { return (void *)ring_info->ring_buffer->buffer; } @@ -170,14 +172,14 @@ GetRingBuffer(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferSize() + get_ring_buffersize() Description: Get the size of the ring buffer --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *ring_info) +get_ring_buffersize(struct hv_ring_buffer_info *ring_info) { return ring_info->ring_datasize; } @@ -185,14 +187,14 @@ GetRingBufferSize(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferIndices() + get_ring_bufferindices() Description: Get the read and write indices as u64 of the specified ring buffer --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) +get_ring_bufferindices(struct hv_ring_buffer_info *ring_info) { return (u64)ring_info->ring_buffer->write_index << 32; } @@ -201,18 +203,18 @@ GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) /*++ Name: - Dumpring_info() + dump_ring_info() Description: Dump out to console the ring buffer info --*/ -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { u32 bytes_avail_towrite; u32 bytes_avail_toread; - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -233,14 +235,14 @@ void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) /* Internal routines */ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen); static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, @@ -251,20 +253,20 @@ CopyFromRingBuffer( /*++ Name: - RingBufferGetDebugInfo() + ringbuffer_get_debuginfo() Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { u32 bytes_avail_towrite; u32 bytes_avail_toread; if (ring_info->ring_buffer) { - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -283,13 +285,13 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBufferInterruptMask() + get_ringbuffer_interrupt_mask() Description: Get the interrupt mask for the specified ring buffer --*/ -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi) { return rbi->ring_buffer->interrupt_mask; } @@ -297,13 +299,13 @@ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) /*++ Name: - RingBufferInit() + ringbuffer_init() Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) @@ -326,26 +328,26 @@ int RingBufferInit(struct hv_ring_buffer_info *ring_info, /*++ Name: - RingBufferCleanup() + ringbuffer_cleanup() Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) { } /*++ Name: - RingBufferWrite() + ringbuffer_write() Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *outring_info, +int ringbuffer_write(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; @@ -367,7 +369,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(outring_info, + get_ringbuffer_availbytes(outring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -390,20 +392,20 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, } /* Write to the ring buffer */ - next_write_location = GetNextWriteLocation(outring_info); + next_write_location = get_next_write_location(outring_info); for_each_sg(sglist, sg, sgcount, i) { - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prev_indices = GetRingBufferIndices(outring_info); + prev_indices = get_ring_bufferindices(outring_info); - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, &prev_indices, sizeof(u64)); @@ -412,7 +414,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, mb(); /* Now, update the write location */ - SetNextWriteLocation(outring_info, next_write_location); + set_next_write_location(outring_info, next_write_location); /* Dumpring_info(Outring_info, "AFTER "); */ @@ -424,13 +426,13 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, /*++ Name: - RingBufferPeek() + ringbuffer_peek() Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, +int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info, void *Buffer, u32 buflen) { u32 bytes_avail_towrite; @@ -440,7 +442,7 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(Inring_info, + get_ringbuffer_availbytes(Inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -458,9 +460,9 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, } /* Convert to byte offset */ - next_read_location = GetNextReadLocation(Inring_info); + next_read_location = get_next_read_location(Inring_info); - next_read_location = CopyFromRingBuffer(Inring_info, + next_read_location = copyfrom_ringbuffer(Inring_info, Buffer, buflen, next_read_location); @@ -474,13 +476,13 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, /*++ Name: - RingBufferRead() + ringbuffer_read() Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, +int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, u32 buflen, u32 offset) { u32 bytes_avail_towrite; @@ -494,7 +496,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(inring_info, + get_ringbuffer_availbytes(inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -515,14 +517,15 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, return -1; } - next_read_location = GetNextReadLocationWithOffset(inring_info, offset); + next_read_location + get_next_readlocation_withoffset(inring_info, offset); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, buffer, buflen, next_read_location); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, &prev_indices, sizeof(u64), next_read_location); @@ -533,7 +536,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, mb(); /* Update the read index */ - SetNextReadLocation(inring_info, next_read_location); + set_next_read_location(inring_info, next_read_location); /* Dumpring_info(Inring_info, "AFTER "); */ @@ -546,7 +549,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, /*++ Name: - CopyToRingBuffer() + copyto_ringbuffer() Description: Helper routine to copy from source to ring buffer. @@ -554,14 +557,14 @@ Description: --*/ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; /* wrap-around detected! */ @@ -584,7 +587,7 @@ CopyToRingBuffer( /*++ Name: - CopyFromRingBuffer() + copyfrom_ringbuffer() Description: Helper routine to copy to source from ring buffer. @@ -592,14 +595,14 @@ Description: --*/ static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, u32 start_read_offset) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index f30be1f..7bd6ecf 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *ring_info, +int ringbuffer_write(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *ring_info, +int ringbuffer_read(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen, u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info); -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Brandon Philips
2010-Nov-02 17:04 UTC
[PATCH 05/10] staging: hv: Convert camel cased functions in hv.c to lower cases
On 13:46 Mon 01 Nov 2010, Haiyang Zhang wrote:> -static int HvQueryHypervisorInfo(void) > +static int hvquery_hypervisor_info(void) > -static u64 HvDoHypercall(u64 control, void *input, void *output) > +static u64 hvdo_hypercall(u64 control, void *input, void *output)Should these be hv_do_hypercall and hv_query_hypervisor? That seems to be the style in the rest of the patch:> -int HvInit(void) > +int hv_init(void)> -void HvCleanup(void) > +void hv_cleanup(void)> -u16 HvPostMessage(union hv_connection_id connection_id, > +u16 hv_post_message(union hv_connection_id connection_id,> -u16 HvSignalEvent(void) > +u16 hv_signal_event(void)Cheers, Brandon
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased struct fields in channel_mgmt.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 | 302 ++++++++++++++++++------------------ drivers/staging/hv/channel_mgmt.c | 186 ++++++++++++------------ drivers/staging/hv/channel_mgmt.h | 244 +++++++++++++++--------------- drivers/staging/hv/connection.c | 38 +++--- drivers/staging/hv/hv_utils.c | 12 +- drivers/staging/hv/vmbus_drv.c | 42 +++--- 6 files changed, 412 insertions(+), 412 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 26ebc77..9fa0fe1 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -74,21 +74,21 @@ static void vmbus_setevent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorpage; - if (channel->OfferMsg.MonitorAllocated) { + if (channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - set_bit(channel->OfferMsg.ChildRelId & 31, + set_bit(channel->offermsg.child_relid & 31, (unsigned long *) gVmbusConnection.SendInterruptPage + - (channel->OfferMsg.ChildRelId >> 5)); + (channel->offermsg.child_relid >> 5)); monitorpage = gVmbusConnection.MonitorPages; monitorpage++; /* Get the child to parent monitor page */ - set_bit(channel->MonitorBit, + set_bit(channel->monitor_bit, (unsigned long *)&monitorpage->TriggerGroup - [channel->MonitorGroup].Pending); + [channel->monitor_grp].Pending); } else { - VmbusSetEvent(channel->OfferMsg.ChildRelId); + VmbusSetEvent(channel->offermsg.child_relid); } } @@ -97,19 +97,19 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) { struct hv_monitor_page *monitorPage; - if (Channel->OfferMsg.MonitorAllocated) { + if (Channel->offermsg.monitor_allocated) { /* Each u32 represents 32 channels */ - clear_bit(Channel->OfferMsg.ChildRelId & 31, + clear_bit(Channel->offermsg.child_relid & 31, (unsigned long *)gVmbusConnection.SendInterruptPage + - (Channel->OfferMsg.ChildRelId >> 5)); + (Channel->offermsg.child_relid >> 5)); monitorPage (struct hv_monitor_page *)gVmbusConnection.MonitorPages; monitorPage++; /* Get the child to parent monitor page */ - clear_bit(Channel->MonitorBit, + clear_bit(Channel->monitor_bit, (unsigned long *)&monitorPage->TriggerGroup - [Channel->MonitorGroup].Pending); + [Channel->monitor_grp].Pending); } } @@ -121,42 +121,42 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, struct vmbus_channel_debug_info *debuginfo) { struct hv_monitor_page *monitorpage; - u8 monitor_group = (u8)channel->OfferMsg.MonitorId / 32; - u8 monitor_offset = (u8)channel->OfferMsg.MonitorId % 32; + u8 monitor_group = (u8)channel->offermsg.monitorid / 32; + u8 monitor_offset = (u8)channel->offermsg.monitorid % 32; /* u32 monitorBit = 1 << monitorOffset; */ - debuginfo->RelId = channel->OfferMsg.ChildRelId; - debuginfo->State = channel->State; - memcpy(&debuginfo->InterfaceType, - &channel->OfferMsg.Offer.InterfaceType, sizeof(struct hv_guid)); - memcpy(&debuginfo->InterfaceInstance, - &channel->OfferMsg.Offer.InterfaceInstance, + debuginfo->relid = channel->offermsg.child_relid; + debuginfo->state = channel->state; + memcpy(&debuginfo->interfacetype, + &channel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)); + memcpy(&debuginfo->interface_instance, + &channel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid)); monitorpage = (struct hv_monitor_page *)gVmbusConnection.MonitorPages; - debuginfo->MonitorId = channel->OfferMsg.MonitorId; + debuginfo->monitorid = channel->offermsg.monitorid; - debuginfo->ServerMonitorPending + debuginfo->servermonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ServerMonitorLatency + debuginfo->servermonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ServerMonitorConnectionId + debuginfo->servermonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; monitorpage++; - debuginfo->ClientMonitorPending + debuginfo->clientmonitor_pending monitorpage->TriggerGroup[monitor_group].Pending; - debuginfo->ClientMonitorLatency + debuginfo->clientmonitor_latency monitorpage->Latency[monitor_group][monitor_offset]; - debuginfo->ClientMonitorConnectionId + debuginfo->clientmonitor_connectionid monitorpage->Parameter[monitor_group] [monitor_offset].ConnectionId.u.Id; - RingBufferGetDebugInfo(&channel->Inbound, &debuginfo->Inbound); - RingBufferGetDebugInfo(&channel->Outbound, &debuginfo->Outbound); + RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); + RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); } /* @@ -176,8 +176,8 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, /* ASSERT(!(SendRingBufferSize & (PAGE_SIZE - 1))); */ /* ASSERT(!(RecvRingBufferSize & (PAGE_SIZE - 1))); */ - newchannel->OnChannelCallback = onchannelcallback; - newchannel->ChannelCallbackContext = context; + newchannel->onchannel_callback = onchannelcallback; + newchannel->channel_callback_context = context; /* Allocate the ring buffer */ out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) @@ -189,17 +189,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, in = (void *)((unsigned long)out + send_ringbuffer_size); - newchannel->RingBufferPages = out; - newchannel->RingBufferPageCount = (send_ringbuffer_size + + newchannel->ringbuffer_pages = out; + newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->Outbound, out, send_ringbuffer_size); + ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->Inbound, in, recv_ringbuffer_size); + ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -210,13 +210,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "Establishing ring buffer's gpadl for channel %p...", newchannel); - newchannel->RingBufferGpadlHandle = 0; + newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->Outbound.RingBuffer, + newchannel->outbound.RingBuffer, send_ringbuffer_size + recv_ringbuffer_size, - &newchannel->RingBufferGpadlHandle); + &newchannel->ringbuffer_gpadlhandle); if (ret != 0) { err = ret; @@ -225,12 +225,12 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, DPRINT_DBG(VMBUS, "channel %p <relid %d gpadl 0x%x send ring %p " "size %d recv ring %p size %d, downstreamoffset %d>", - newchannel, newchannel->OfferMsg.ChildRelId, - newchannel->RingBufferGpadlHandle, - newchannel->Outbound.RingBuffer, - newchannel->Outbound.RingSize, - newchannel->Inbound.RingBuffer, - newchannel->Inbound.RingSize, + newchannel, newchannel->offermsg.child_relid, + newchannel->ringbuffer_gpadlhandle, + newchannel->outbound.RingBuffer, + newchannel->outbound.RingSize, + newchannel->inbound.RingBuffer, + newchannel->inbound.RingSize, send_ringbuffer_size); /* Create and init the channel open message */ @@ -242,20 +242,20 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->WaitEvent = osd_WaitEventCreate(); - if (!openInfo->WaitEvent) { + openInfo->waitevent = osd_WaitEventCreate(); + if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; } - openMsg = (struct vmbus_channel_open_channel *)openInfo->Msg; - openMsg->Header.MessageType = ChannelMessageOpenChannel; - openMsg->OpenId = newchannel->OfferMsg.ChildRelId; /* FIXME */ - openMsg->ChildRelId = newchannel->OfferMsg.ChildRelId; - openMsg->RingBufferGpadlHandle = newchannel->RingBufferGpadlHandle; - openMsg->DownstreamRingBufferPageOffset = send_ringbuffer_size >> + openMsg = (struct vmbus_channel_open_channel *)openInfo->msg; + openMsg->header.msgtype = CHANNELMSG_OPENCHANNEL; + openMsg->openid = newchannel->offermsg.child_relid; /* FIXME */ + openMsg->child_relid = newchannel->offermsg.child_relid; + openMsg->ringbuffer_gpadlhandle = newchannel->ringbuffer_gpadlhandle; + openMsg->downstream_ringbuffer_pageoffset = send_ringbuffer_size >> PAGE_SHIFT; - openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ + openMsg->server_contextarea_gpadlhandle = 0; /* TODO */ if (userdatalen > MAX_USER_DEFINED_BYTES) { err = -EINVAL; @@ -263,10 +263,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } if (userdatalen) - memcpy(openMsg->UserData, userdata, userdatalen); + memcpy(openMsg->userdata, userdata, userdatalen); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&openInfo->MsgListEntry, + list_add_tail(&openInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -280,26 +280,26 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->WaitEvent); + osd_WaitEventWait(openInfo->waitevent); - if (openInfo->Response.OpenResult.Status == 0) + if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); else DPRINT_INFO(VMBUS, "channel <%p> open failed - %d!!", - newchannel, openInfo->Response.OpenResult.Status); + newchannel, openInfo->response.open_result.status); Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&openInfo->MsgListEntry); + list_del(&openInfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(openInfo->WaitEvent); + kfree(openInfo->waitevent); kfree(openInfo); return 0; errorout: - RingBufferCleanup(&newchannel->Outbound); - RingBufferCleanup(&newchannel->Inbound); + RingBufferCleanup(&newchannel->outbound); + RingBufferCleanup(&newchannel->inbound); osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -322,7 +322,7 @@ static void dump_gpadl_body(struct vmbus_channel_gpadl_body *gpadl, u32 len) for (i = 0; i < pfncount; i++) DPRINT_DBG(VMBUS, "gpadl body - %d) pfn %llu", - i, gpadl->Pfn[i]); + i, gpadl->pfn[i]); } /* @@ -336,18 +336,18 @@ static void dump_gpadl_header(struct vmbus_channel_gpadl_header *gpadl) DPRINT_DBG(VMBUS, "gpadl header - relid %d, range count %d, range buflen %d", - gpadl->ChildRelId, gpadl->RangeCount, gpadl->RangeBufLen); - for (i = 0; i < gpadl->RangeCount; i++) { - pagecount = gpadl->Range[i].ByteCount >> PAGE_SHIFT; + gpadl->child_relid, gpadl->rangecount, gpadl->range_buflen); + for (i = 0; i < gpadl->rangecount; i++) { + pagecount = gpadl->range[i].ByteCount >> 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].ByteCount, + gpadl->range[i].ByteOffset, pagecount); for (j = 0; j < pagecount; j++) DPRINT_DBG(VMBUS, "%d) pfn %llu", j, - gpadl->Range[i].PfnArray[j]); + gpadl->range[i].PfnArray[j]); } } @@ -391,18 +391,18 @@ static int create_gpadl_header(void *kbuffer, u32 size, if (!msgheader) goto nomem; - INIT_LIST_HEAD(&msgheader->SubMsgList); - msgheader->MessageSize = msgsize; + INIT_LIST_HEAD(&msgheader->submsglist); + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pfncount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -428,10 +428,10 @@ static int create_gpadl_header(void *kbuffer, u32 size, /* FIXME: we probably need to more if this fails */ if (!msgbody) goto nomem; - msgbody->MessageSize = msgsize; + msgbody->msgsize = msgsize; (*messagecount)++; gpadl_body - (struct vmbus_channel_gpadl_body *)msgbody->Msg; + (struct vmbus_channel_gpadl_body *)msgbody->msg; /* * FIXME: @@ -440,11 +440,11 @@ static int create_gpadl_header(void *kbuffer, u32 size, */ /* gpadl_body->Gpadl = kbuffer; */ for (i = 0; i < pfncurr; i++) - gpadl_body->Pfn[i] = pfn + pfnsum + i; + gpadl_body->pfn[i] = pfn + pfnsum + i; /* add to msg header */ - list_add_tail(&msgbody->MsgListEntry, - &msgheader->SubMsgList); + list_add_tail(&msgbody->msglistentry, + &msgheader->submsglist); pfnsum += pfncurr; pfnleft -= pfncurr; } @@ -456,17 +456,17 @@ static int create_gpadl_header(void *kbuffer, u32 size, msgheader = kzalloc(msgsize, GFP_KERNEL); if (msgheader == NULL) goto nomem; - msgheader->MessageSize = msgsize; + msgheader->msgsize = msgsize; gpadl_header = (struct vmbus_channel_gpadl_header *) - msgheader->Msg; - gpadl_header->RangeCount = 1; - gpadl_header->RangeBufLen = sizeof(struct gpa_range) + + msgheader->msg; + 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].ByteOffset = 0; + gpadl_header->range[0].ByteCount = size; for (i = 0; i < pagecount; i++) - gpadl_header->Range[0].PfnArray[i] = pfn+i; + gpadl_header->range[0].PfnArray[i] = pfn+i; *msginfo = msgheader; *messagecount = 1; @@ -508,21 +508,21 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; } - gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->Msg; - gpadlmsg->Header.MessageType = ChannelMessageGpadlHeader; - gpadlmsg->ChildRelId = channel->OfferMsg.ChildRelId; - gpadlmsg->Gpadl = next_gpadl_handle; + gpadlmsg = (struct vmbus_channel_gpadl_header *)msginfo->msg; + gpadlmsg->header.msgtype = CHANNELMSG_GPADL_HEADER; + gpadlmsg->child_relid = channel->offermsg.child_relid; + gpadlmsg->gpadl = next_gpadl_handle; dump_gpadl_header(gpadlmsg); spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msginfo->MsgListEntry, + list_add_tail(&msginfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -530,9 +530,9 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, kbuffer, size, msgcount); DPRINT_DBG(VMBUS, "Sending GPADL Header - len %zd", - msginfo->MessageSize - sizeof(*msginfo)); + msginfo->msgsize - sizeof(*msginfo)); - ret = VmbusPostMessage(gpadlmsg, msginfo->MessageSize - + ret = VmbusPostMessage(gpadlmsg, msginfo->msgsize - sizeof(*msginfo)); if (ret != 0) { DPRINT_ERR(VMBUS, "Unable to open channel - %d", ret); @@ -540,48 +540,48 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } if (msgcount > 1) { - list_for_each(curr, &msginfo->SubMsgList) { + list_for_each(curr, &msginfo->submsglist) { /* FIXME: should this use list_entry() instead ? */ submsginfo = (struct vmbus_channel_msginfo *)curr; gpadl_body - (struct vmbus_channel_gpadl_body *)submsginfo->Msg; + (struct vmbus_channel_gpadl_body *)submsginfo->msg; - gpadl_body->Header.MessageType - ChannelMessageGpadlBody; - gpadl_body->Gpadl = next_gpadl_handle; + gpadl_body->header.msgtype + CHANNELMSG_GPADL_BODY; + gpadl_body->gpadl = next_gpadl_handle; DPRINT_DBG(VMBUS, "Sending GPADL Body - len %zd", - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); - dump_gpadl_body(gpadl_body, submsginfo->MessageSize - + dump_gpadl_body(gpadl_body, submsginfo->msgsize - sizeof(*submsginfo)); ret = VmbusPostMessage(gpadl_body, - submsginfo->MessageSize - + submsginfo->msgsize - sizeof(*submsginfo)); if (ret != 0) goto Cleanup; } } - osd_WaitEventWait(msginfo->WaitEvent); + osd_WaitEventWait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " "(relid %d, status %d handle %x)", - channel->OfferMsg.ChildRelId, - msginfo->Response.GpadlCreated.CreationStatus, - gpadlmsg->Gpadl); + channel->offermsg.child_relid, + msginfo->response.gpadl_created.creation_status, + gpadlmsg->gpadl); - *gpadl_handle = gpadlmsg->Gpadl; + *gpadl_handle = gpadlmsg->gpadl; Cleanup: spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&msginfo->MsgListEntry); + list_del(&msginfo->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); return ret; } @@ -604,20 +604,20 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->WaitEvent = osd_WaitEventCreate(); - if (!info->WaitEvent) { + info->waitevent = osd_WaitEventCreate(); + if (!info->waitevent) { kfree(info); return -ENOMEM; } - msg = (struct vmbus_channel_gpadl_teardown *)info->Msg; + msg = (struct vmbus_channel_gpadl_teardown *)info->msg; - msg->Header.MessageType = ChannelMessageGpadlTeardown; - msg->ChildRelId = channel->OfferMsg.ChildRelId; - msg->Gpadl = gpadl_handle; + msg->header.msgtype = CHANNELMSG_GPADL_TEARDOWN; + msg->child_relid = channel->offermsg.child_relid; + msg->gpadl = gpadl_handle; spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&info->MsgListEntry, + list_add_tail(&info->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -628,14 +628,14 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->WaitEvent); + osd_WaitEventWait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_del(&info->MsgListEntry); + list_del(&info->msglistentry); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); - kfree(info->WaitEvent); + kfree(info->waitevent); kfree(info); return ret; } @@ -652,7 +652,7 @@ void vmbus_close(struct vmbus_channel *channel) int ret; /* Stop callback and cancel the timer asap */ - channel->OnChannelCallback = NULL; + channel->onchannel_callback = NULL; del_timer_sync(&channel->poll_timer); /* Send a closing message */ @@ -665,9 +665,9 @@ void vmbus_close(struct vmbus_channel *channel) /* info->waitEvent = osd_WaitEventCreate(); */ - msg = (struct vmbus_channel_close_channel *)info->Msg; - msg->Header.MessageType = ChannelMessageCloseChannel; - msg->ChildRelId = channel->OfferMsg.ChildRelId; + msg = (struct vmbus_channel_close_channel *)info->msg; + msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; + msg->child_relid = channel->offermsg.child_relid; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_close_channel)); if (ret != 0) { @@ -676,17 +676,17 @@ void vmbus_close(struct vmbus_channel *channel) } /* Tear down the gpadl for the channel's ring buffer */ - if (channel->RingBufferGpadlHandle) + if (channel->ringbuffer_gpadlhandle) vmbus_teardown_gpadl(channel, - channel->RingBufferGpadlHandle); + channel->ringbuffer_gpadlhandle); /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->Outbound); - RingBufferCleanup(&channel->Inbound); + RingBufferCleanup(&channel->outbound); + RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->RingBufferPages, channel->RingBufferPageCount); + osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); @@ -696,9 +696,9 @@ void vmbus_close(struct vmbus_channel *channel) * caller will free the channel */ - if (channel->State == CHANNEL_OPEN_STATE) { + if (channel->state == CHANNEL_OPEN_STATE) { spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&channel->ListEntry); + list_del(&channel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(channel); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->Outbound, bufferlist, 3); + ret = RingBufferWrite(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->Outbound)) + if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -940,7 +940,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = userlen; @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, userlen, + ret = RingBufferRead(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->Inbound, &desc, + ret = RingBufferPeek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -999,7 +999,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, DPRINT_DBG(VMBUS, "packet received on channel %p relid %d <type %d " "flag %d tid %llx pktlen %d datalen %d> ", - channel, channel->OfferMsg.ChildRelId, desc.Type, + channel, channel->offermsg.child_relid, desc.Type, desc.Flags, desc.TransactionId, packetlen, userlen); *buffer_actual_len = packetlen; @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->Inbound, buffer, packetlen, 0); + ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1030,7 +1030,7 @@ void vmbus_onchannel_event(struct vmbus_channel *channel) dump_vmbus_channel(channel); /* ASSERT(Channel->OnChannelCallback); */ - channel->OnChannelCallback(channel->ChannelCallbackContext); + channel->onchannel_callback(channel->channel_callback_context); mod_timer(&channel->poll_timer, jiffies + usecs_to_jiffies(100)); } @@ -1042,8 +1042,8 @@ void vmbus_ontimer(unsigned long data) { struct vmbus_channel *channel = (struct vmbus_channel *)data; - if (channel->OnChannelCallback) - channel->OnChannelCallback(channel->ChannelCallbackContext); + if (channel->onchannel_callback) + channel->onchannel_callback(channel->channel_callback_context); } /* @@ -1051,7 +1051,7 @@ void vmbus_ontimer(unsigned long data) */ static void dump_vmbus_channel(struct vmbus_channel *channel) { - DPRINT_DBG(VMBUS, "Channel (%d)", channel->OfferMsg.ChildRelId); - DumpRingInfo(&channel->Outbound, "Outbound "); - DumpRingInfo(&channel->Inbound, "Inbound "); + DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); + DumpRingInfo(&channel->outbound, "Outbound "); + DumpRingInfo(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index 45dbe30..dbfe0f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -251,8 +251,8 @@ static struct vmbus_channel *alloc_channel(void) channel->poll_timer.data = (unsigned long)channel; channel->poll_timer.function = vmbus_ontimer; - channel->ControlWQ = create_workqueue("hv_vmbus_ctl"); - if (!channel->ControlWQ) { + channel->controlwq = create_workqueue("hv_vmbus_ctl"); + if (!channel->controlwq) { kfree(channel); return NULL; } @@ -268,7 +268,7 @@ static inline void release_channel(void *context) struct vmbus_channel *channel = context; DPRINT_DBG(VMBUS, "releasing channel (%p)", channel); - destroy_workqueue(channel->ControlWQ); + destroy_workqueue(channel->controlwq); DPRINT_DBG(VMBUS, "channel released (%p)", channel); kfree(channel); @@ -325,12 +325,12 @@ static void vmbus_process_offer(void *context) /* Make sure this is a new offer */ spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (!memcmp(&channel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceType, + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (!memcmp(&channel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceType, sizeof(struct hv_guid)) && - !memcmp(&channel->OfferMsg.Offer.InterfaceInstance, - &newchannel->OfferMsg.Offer.InterfaceInstance, + !memcmp(&channel->offermsg.offer.InterfaceInstance, + &newchannel->offermsg.offer.InterfaceInstance, sizeof(struct hv_guid))) { fnew = false; break; @@ -338,14 +338,14 @@ static void vmbus_process_offer(void *context) } if (fnew) - list_add_tail(&newchannel->ListEntry, + list_add_tail(&newchannel->listentry, &gVmbusConnection.ChannelList); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); if (!fnew) { DPRINT_DBG(VMBUS, "Ignoring duplicate offer for relid (%d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); free_channel(newchannel); return; } @@ -355,27 +355,27 @@ static void vmbus_process_offer(void *context) * We need to set the DeviceObject field before calling * VmbusChildDeviceAdd() */ - newchannel->DeviceObject = VmbusChildDeviceCreate( - &newchannel->OfferMsg.Offer.InterfaceType, - &newchannel->OfferMsg.Offer.InterfaceInstance, + newchannel->device_obj = VmbusChildDeviceCreate( + &newchannel->offermsg.offer.InterfaceType, + &newchannel->offermsg.offer.InterfaceInstance, newchannel); DPRINT_DBG(VMBUS, "child device object allocated - %p", - newchannel->DeviceObject); + newchannel->device_obj); /* * Add the new device to the bus. This will kick off device-driver * binding which eventually invokes the device driver's AddDevice() * method. */ - ret = VmbusChildDeviceAdd(newchannel->DeviceObject); + ret = VmbusChildDeviceAdd(newchannel->device_obj); if (ret != 0) { DPRINT_ERR(VMBUS, "unable to add child device object (relid %d)", - newchannel->OfferMsg.ChildRelId); + newchannel->offermsg.child_relid); spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_del(&newchannel->ListEntry); + list_del(&newchannel->listentry); spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags); free_channel(newchannel); @@ -385,11 +385,11 @@ static void vmbus_process_offer(void *context) * so that when we do close the channel normally, we * can cleanup properly */ - newchannel->State = CHANNEL_OPEN_STATE; + newchannel->state = CHANNEL_OPEN_STATE; /* Open IC channels */ for (cnt = 0; cnt < MAX_MSG_TYPES; cnt++) { - if (memcmp(&newchannel->OfferMsg.Offer.InterfaceType, + if (memcmp(&newchannel->offermsg.offer.InterfaceType, &hv_cb_utils[cnt].data, sizeof(struct hv_guid)) == 0 && vmbus_open(newchannel, 2 * PAGE_SIZE, @@ -413,7 +413,7 @@ static void vmbus_process_rescind_offer(void *context) { struct vmbus_channel *channel = context; - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); } /* @@ -434,7 +434,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.InterfaceType, &gSupportedDeviceClasses[i], sizeof(struct hv_guid)) == 0) { fsupported = 1; break; @@ -443,12 +443,12 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) if (!fsupported) { DPRINT_DBG(VMBUS, "Ignoring channel offer notification for " - "child relid %d", offer->ChildRelId); + "child relid %d", offer->child_relid); return; } - guidtype = &offer->Offer.InterfaceType; - guidinstance = &offer->Offer.InterfaceInstance; + guidtype = &offer->offer.InterfaceType; + guidinstance = &offer->offer.InterfaceInstance; DPRINT_INFO(VMBUS, "Channel offer notification - " "child relid %d monitor id %d allocated %d, " @@ -456,8 +456,8 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) "%02x%02x%02x%02x%02x%02x%02x%02x} " "instance {%02x%02x%02x%02x-%02x%02x-%02x%02x-" "%02x%02x%02x%02x%02x%02x%02x%02x}", - offer->ChildRelId, offer->MonitorId, - offer->MonitorAllocated, + offer->child_relid, offer->monitorid, + offer->monitor_allocated, guidtype->data[3], guidtype->data[2], guidtype->data[1], guidtype->data[0], guidtype->data[5], guidtype->data[4], @@ -484,13 +484,13 @@ static void vmbus_onoffer(struct vmbus_channel_message_header *hdr) DPRINT_DBG(VMBUS, "channel object allocated - %p", newchannel); - memcpy(&newchannel->OfferMsg, offer, + memcpy(&newchannel->offermsg, offer, sizeof(struct vmbus_channel_offer_channel)); - newchannel->MonitorGroup = (u8)offer->MonitorId / 32; - newchannel->MonitorBit = (u8)offer->MonitorId % 32; + newchannel->monitor_grp = (u8)offer->monitorid / 32; + newchannel->monitor_bit = (u8)offer->monitorid % 32; /* TODO: Make sure the offer comes from our parent partition */ - osd_schedule_callback(newchannel->ControlWQ, vmbus_process_offer, + osd_schedule_callback(newchannel->controlwq, vmbus_process_offer, newchannel); } @@ -505,14 +505,14 @@ 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->ChildRelId); + channel = GetChannelFromRelId(rescind->child_relid); if (channel == NULL) { DPRINT_DBG(VMBUS, "channel not found for relId %d", - rescind->ChildRelId); + rescind->child_relid); return; } - osd_schedule_callback(channel->ControlWQ, + osd_schedule_callback(channel->controlwq, vmbus_process_rescind_offer, channel); } @@ -545,7 +545,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) unsigned long flags; result = (struct vmbus_channel_open_result *)hdr; - DPRINT_DBG(VMBUS, "vmbus open result - %d", result->Status); + DPRINT_DBG(VMBUS, "vmbus open result - %d", result->status); /* * Find the open msg, copy the result and signal/unblock the wait event @@ -556,17 +556,17 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageOpenChannel) { + if (requestheader->msgtype == CHANNELMSG_OPENCHANNEL) { openmsg - (struct vmbus_channel_open_channel *)msginfo->Msg; - if (openmsg->ChildRelId == result->ChildRelId && - openmsg->OpenId == result->OpenId) { - memcpy(&msginfo->Response.OpenResult, + (struct vmbus_channel_open_channel *)msginfo->msg; + if (openmsg->child_relid == result->child_relid && + openmsg->openid == result->openid) { + memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -592,7 +592,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) gpadlcreated = (struct vmbus_channel_gpadl_created *)hdr; DPRINT_DBG(VMBUS, "vmbus gpadl created result - %d", - gpadlcreated->CreationStatus); + gpadlcreated->creation_status); /* * Find the establish msg, copy the result and signal/unblock the wait @@ -604,19 +604,19 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlHeader) { + if (requestheader->msgtype == CHANNELMSG_GPADL_HEADER) { gpadlheader (struct vmbus_channel_gpadl_header *)requestheader; - if ((gpadlcreated->ChildRelId =- gpadlheader->ChildRelId) && - (gpadlcreated->Gpadl == gpadlheader->Gpadl)) { - memcpy(&msginfo->Response.GpadlCreated, + if ((gpadlcreated->child_relid =+ gpadlheader->child_relid) && + (gpadlcreated->gpadl == gpadlheader->gpadl)) { + memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -652,17 +652,17 @@ static void vmbus_ongpadl_torndown( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType == ChannelMessageGpadlTeardown) { + if (requestheader->msgtype == CHANNELMSG_GPADL_TEARDOWN) { gpadl_teardown (struct vmbus_channel_gpadl_teardown *)requestheader; - if (gpadl_torndown->Gpadl == gpadl_teardown->Gpadl) { - memcpy(&msginfo->Response.GpadlTorndown, + if (gpadl_torndown->gpadl == gpadl_teardown->gpadl) { + memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); break; } } @@ -694,16 +694,16 @@ static void vmbus_onversion_response( /* FIXME: this should probably use list_entry() instead */ msginfo = (struct vmbus_channel_msginfo *)curr; requestheader - (struct vmbus_channel_message_header *)msginfo->Msg; + (struct vmbus_channel_message_header *)msginfo->msg; - if (requestheader->MessageType =- ChannelMessageInitiateContact) { + if (requestheader->msgtype =+ CHANNELMSG_INITIATE_CONTACT) { initiate (struct vmbus_channel_initiate_contact *)requestheader; - memcpy(&msginfo->Response.VersionResponse, + memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->WaitEvent); + osd_WaitEventSet(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -711,24 +711,24 @@ static void vmbus_onversion_response( /* Channel message dispatch table */ static struct vmbus_channel_message_table_entry - gChannelMessageTable[ChannelMessageCount] = { - {ChannelMessageInvalid, NULL}, - {ChannelMessageOfferChannel, vmbus_onoffer}, - {ChannelMessageRescindChannelOffer, vmbus_onoffer_rescind}, - {ChannelMessageRequestOffers, NULL}, - {ChannelMessageAllOffersDelivered, vmbus_onoffers_delivered}, - {ChannelMessageOpenChannel, NULL}, - {ChannelMessageOpenChannelResult, vmbus_onopen_result}, - {ChannelMessageCloseChannel, NULL}, - {ChannelMessageGpadlHeader, NULL}, - {ChannelMessageGpadlBody, NULL}, - {ChannelMessageGpadlCreated, vmbus_ongpadl_created}, - {ChannelMessageGpadlTeardown, NULL}, - {ChannelMessageGpadlTorndown, vmbus_ongpadl_torndown}, - {ChannelMessageRelIdReleased, NULL}, - {ChannelMessageInitiateContact, NULL}, - {ChannelMessageVersionResponse, vmbus_onversion_response}, - {ChannelMessageUnload, NULL}, + gChannelMessageTable[CHANNELMSG_COUNT] = { + {CHANNELMSG_INVALID, NULL}, + {CHANNELMSG_OFFERCHANNEL, vmbus_onoffer}, + {CHANNELMSG_RESCIND_CHANNELOFFER, vmbus_onoffer_rescind}, + {CHANNELMSG_REQUESTOFFERS, NULL}, + {CHANNELMSG_ALLOFFERS_DELIVERED, vmbus_onoffers_delivered}, + {CHANNELMSG_OPENCHANNEL, NULL}, + {CHANNELMSG_OPENCHANNEL_RESULT, vmbus_onopen_result}, + {CHANNELMSG_CLOSECHANNEL, NULL}, + {CHANNELMSG_GPADL_HEADER, NULL}, + {CHANNELMSG_GPADL_BODY, NULL}, + {CHANNELMSG_GPADL_CREATED, vmbus_ongpadl_created}, + {CHANNELMSG_GPADL_TEARDOWN, NULL}, + {CHANNELMSG_GPADL_TORNDOWN, vmbus_ongpadl_torndown}, + {CHANNELMSG_RELID_RELEASED, NULL}, + {CHANNELMSG_INITIATE_CONTACT, NULL}, + {CHANNELMSG_VERSION_RESPONSE, vmbus_onversion_response}, + {CHANNELMSG_UNLOAD, NULL}, }; /* @@ -745,23 +745,23 @@ void vmbus_onmessage(void *context) hdr = (struct vmbus_channel_message_header *)msg->u.Payload; size = msg->Header.PayloadSize; - DPRINT_DBG(VMBUS, "message type %d size %d", hdr->MessageType, size); + DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); - if (hdr->MessageType >= ChannelMessageCount) { + if (hdr->msgtype >= CHANNELMSG_COUNT) { DPRINT_ERR(VMBUS, "Received invalid channel message type %d size %d", - hdr->MessageType, size); + hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, (unsigned char *)msg->u.Payload, size); kfree(msg); return; } - if (gChannelMessageTable[hdr->MessageType].messageHandler) - gChannelMessageTable[hdr->MessageType].messageHandler(hdr); + if (gChannelMessageTable[hdr->msgtype].messageHandler) + gChannelMessageTable[hdr->msgtype].messageHandler(hdr); else DPRINT_ERR(VMBUS, "Unhandled channel message type %d", - hdr->MessageType); + hdr->msgtype); /* Free the msg that was allocated in VmbusOnMsgDPC() */ kfree(msg); @@ -782,15 +782,15 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->WaitEvent = osd_WaitEventCreate(); - if (!msginfo->WaitEvent) { + msginfo->waitevent = osd_WaitEventCreate(); + if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; } - msg = (struct vmbus_channel_message_header *)msginfo->Msg; + msg = (struct vmbus_channel_message_header *)msginfo->msg; - msg->MessageType = ChannelMessageRequestOffers; + msg->msgtype = CHANNELMSG_REQUESTOFFERS; /*SpinlockAcquire(gVmbusConnection.channelMsgLock); INSERT_TAIL_LIST(&gVmbusConnection.channelMsgList, @@ -817,7 +817,7 @@ int vmbus_request_offers(void) Cleanup: if (msginfo) { - kfree(msginfo->WaitEvent); + kfree(msginfo->waitevent); kfree(msginfo); } @@ -837,17 +837,17 @@ void vmbus_release_unattached_channels(void) spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList, - ListEntry) { + listentry) { if (channel == start) break; - if (!channel->DeviceObject->Driver) { - list_del(&channel->ListEntry); + if (!channel->device_obj->Driver) { + list_del(&channel->listentry); DPRINT_INFO(VMBUS, "Releasing unattached device object %p", - channel->DeviceObject); + channel->device_obj); - VmbusChildDeviceRemove(channel->DeviceObject); + VmbusChildDeviceRemove(channel->device_obj); free_channel(channel); } else { if (!start) diff --git a/drivers/staging/hv/channel_mgmt.h b/drivers/staging/hv/channel_mgmt.h index d16cc08..12f30af 100644 --- a/drivers/staging/hv/channel_mgmt.h +++ b/drivers/staging/hv/channel_mgmt.h @@ -33,60 +33,60 @@ /* Version 1 messages */ enum vmbus_channel_message_type { - ChannelMessageInvalid = 0, - ChannelMessageOfferChannel = 1, - ChannelMessageRescindChannelOffer = 2, - ChannelMessageRequestOffers = 3, - ChannelMessageAllOffersDelivered = 4, - ChannelMessageOpenChannel = 5, - ChannelMessageOpenChannelResult = 6, - ChannelMessageCloseChannel = 7, - ChannelMessageGpadlHeader = 8, - ChannelMessageGpadlBody = 9, - ChannelMessageGpadlCreated = 10, - ChannelMessageGpadlTeardown = 11, - ChannelMessageGpadlTorndown = 12, - ChannelMessageRelIdReleased = 13, - ChannelMessageInitiateContact = 14, - ChannelMessageVersionResponse = 15, - ChannelMessageUnload = 16, + CHANNELMSG_INVALID = 0, + CHANNELMSG_OFFERCHANNEL = 1, + CHANNELMSG_RESCIND_CHANNELOFFER = 2, + CHANNELMSG_REQUESTOFFERS = 3, + CHANNELMSG_ALLOFFERS_DELIVERED = 4, + CHANNELMSG_OPENCHANNEL = 5, + CHANNELMSG_OPENCHANNEL_RESULT = 6, + CHANNELMSG_CLOSECHANNEL = 7, + CHANNELMSG_GPADL_HEADER = 8, + CHANNELMSG_GPADL_BODY = 9, + CHANNELMSG_GPADL_CREATED = 10, + CHANNELMSG_GPADL_TEARDOWN = 11, + CHANNELMSG_GPADL_TORNDOWN = 12, + CHANNELMSG_RELID_RELEASED = 13, + CHANNELMSG_INITIATE_CONTACT = 14, + CHANNELMSG_VERSION_RESPONSE = 15, + CHANNELMSG_UNLOAD = 16, #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD - ChannelMessageViewRangeAdd = 17, - ChannelMessageViewRangeRemove = 18, + CHANNELMSG_VIEWRANGE_ADD = 17, + CHANNELMSG_VIEWRANGE_REMOVE = 18, #endif - ChannelMessageCount + CHANNELMSG_COUNT }; struct vmbus_channel_message_header { - enum vmbus_channel_message_type MessageType; - u32 Padding; + enum vmbus_channel_message_type msgtype; + u32 padding; } __attribute__((packed)); /* Query VMBus Version parameters */ struct vmbus_channel_query_vmbus_version { - struct vmbus_channel_message_header Header; - u32 Version; + struct vmbus_channel_message_header header; + u32 version; } __attribute__((packed)); /* VMBus Version Supported parameters */ struct vmbus_channel_version_supported { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); /* Offer Channel parameters */ struct vmbus_channel_offer_channel { - struct vmbus_channel_message_header Header; - struct vmbus_channel_offer Offer; - u32 ChildRelId; - u8 MonitorId; - bool MonitorAllocated; + struct vmbus_channel_message_header header; + struct vmbus_channel_offer offer; + u32 child_relid; + u8 monitorid; + bool monitor_allocated; } __attribute__((packed)); /* Rescind Offer parameters */ struct vmbus_channel_rescind_offer { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* @@ -100,43 +100,43 @@ struct vmbus_channel_rescind_offer { /* Open Channel parameters */ struct vmbus_channel_open_channel { - struct vmbus_channel_message_header Header; + struct vmbus_channel_message_header header; /* Identifies the specific VMBus channel that is being opened. */ - u32 ChildRelId; + u32 child_relid; /* ID making a particular open request at a channel offer unique. */ - u32 OpenId; + u32 openid; /* GPADL for the channel's ring buffer. */ - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* GPADL for the channel's server context save area. */ - u32 ServerContextAreaGpadlHandle; + u32 server_contextarea_gpadlhandle; /* * The upstream ring buffer begins at offset zero in the memory * described by RingBufferGpadlHandle. The downstream ring buffer * follows it at this offset (in pages). */ - u32 DownstreamRingBufferPageOffset; + u32 downstream_ringbuffer_pageoffset; /* User-specific data to be passed along to the server endpoint. */ - unsigned char UserData[MAX_USER_DEFINED_BYTES]; + unsigned char userdata[MAX_USER_DEFINED_BYTES]; } __attribute__((packed)); /* Open Channel Result parameters */ struct vmbus_channel_open_result { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 OpenId; - u32 Status; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 openid; + u32 status; } __attribute__((packed)); /* Close channel parameters; */ struct vmbus_channel_close_channel { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); /* Channel Message GPADL */ @@ -151,72 +151,72 @@ struct vmbus_channel_close_channel { * follow-up packet that contains more. */ struct vmbus_channel_gpadl_header { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u16 RangeBufLen; - u16 RangeCount; - struct gpa_range Range[0]; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u16 range_buflen; + u16 rangecount; + struct gpa_range range[0]; } __attribute__((packed)); /* This is the followup packet that contains more PFNs. */ struct vmbus_channel_gpadl_body { - struct vmbus_channel_message_header Header; - u32 MessageNumber; - u32 Gpadl; - u64 Pfn[0]; + struct vmbus_channel_message_header header; + u32 msgnumber; + u32 gpadl; + u64 pfn[0]; } __attribute__((packed)); struct vmbus_channel_gpadl_created { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; - u32 CreationStatus; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; + u32 creation_status; } __attribute__((packed)); struct vmbus_channel_gpadl_teardown { - struct vmbus_channel_message_header Header; - u32 ChildRelId; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 child_relid; + u32 gpadl; } __attribute__((packed)); struct vmbus_channel_gpadl_torndown { - struct vmbus_channel_message_header Header; - u32 Gpadl; + struct vmbus_channel_message_header header; + u32 gpadl; } __attribute__((packed)); #ifdef VMBUS_FEATURE_PARENT_OR_PEER_MEMORY_MAPPED_INTO_A_CHILD struct vmbus_channel_view_range_add { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u64 ViewRangeLength; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u64 viewrange_length; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_view_range_remove { - struct vmbus_channel_message_header Header; - PHYSICAL_ADDRESS ViewRangeBase; - u32 ChildRelId; + struct vmbus_channel_message_header header; + PHYSICAL_ADDRESS viewrange_base; + u32 child_relid; } __attribute__((packed)); #endif struct vmbus_channel_relid_released { - struct vmbus_channel_message_header Header; - u32 ChildRelId; + struct vmbus_channel_message_header header; + u32 child_relid; } __attribute__((packed)); struct vmbus_channel_initiate_contact { - struct vmbus_channel_message_header Header; - u32 VMBusVersionRequested; - u32 Padding2; - u64 InterruptPage; - u64 MonitorPage1; - u64 MonitorPage2; + struct vmbus_channel_message_header header; + u32 vmbus_version_requested; + u32 padding2; + u64 interrupt_page; + u64 monitor_page1; + u64 monitor_page2; } __attribute__((packed)); struct vmbus_channel_version_response { - struct vmbus_channel_message_header Header; - bool VersionSupported; + struct vmbus_channel_message_header header; + bool version_supported; } __attribute__((packed)); enum vmbus_channel_state { @@ -226,54 +226,54 @@ enum vmbus_channel_state { }; struct vmbus_channel { - struct list_head ListEntry; + struct list_head listentry; - struct hv_device *DeviceObject; + struct hv_device *device_obj; struct timer_list poll_timer; /* SA-111 workaround */ - enum vmbus_channel_state State; + enum vmbus_channel_state state; - struct vmbus_channel_offer_channel OfferMsg; + struct vmbus_channel_offer_channel offermsg; /* * These are based on the OfferMsg.MonitorId. * Save it here for easy access. */ - u8 MonitorGroup; - u8 MonitorBit; + u8 monitor_grp; + u8 monitor_bit; - u32 RingBufferGpadlHandle; + u32 ringbuffer_gpadlhandle; /* Allocated memory for ring buffer */ - void *RingBufferPages; - u32 RingBufferPageCount; - struct hv_ring_buffer_info Outbound; /* send to parent */ - struct hv_ring_buffer_info Inbound; /* receive from parent */ + void *ringbuffer_pages; + u32 ringbuffer_pagecount; + struct hv_ring_buffer_info outbound; /* send to parent */ + struct hv_ring_buffer_info inbound; /* receive from parent */ spinlock_t inbound_lock; - struct workqueue_struct *ControlWQ; + struct workqueue_struct *controlwq; /* Channel callback are invoked in this workqueue context */ /* HANDLE dataWorkQueue; */ - void (*OnChannelCallback)(void *context); - void *ChannelCallbackContext; + void (*onchannel_callback)(void *context); + void *channel_callback_context; }; struct vmbus_channel_debug_info { - u32 RelId; - enum vmbus_channel_state State; - struct hv_guid InterfaceType; - struct hv_guid InterfaceInstance; - u32 MonitorId; - u32 ServerMonitorPending; - u32 ServerMonitorLatency; - u32 ServerMonitorConnectionId; - u32 ClientMonitorPending; - u32 ClientMonitorLatency; - u32 ClientMonitorConnectionId; - - struct hv_ring_buffer_debug_info Inbound; - struct hv_ring_buffer_debug_info Outbound; + u32 relid; + enum vmbus_channel_state state; + struct hv_guid interfacetype; + struct hv_guid interface_instance; + u32 monitorid; + u32 servermonitor_pending; + u32 servermonitor_latency; + u32 servermonitor_connectionid; + u32 clientmonitor_pending; + u32 clientmonitor_latency; + u32 clientmonitor_connectionid; + + struct hv_ring_buffer_debug_info inbound; + struct hv_ring_buffer_debug_info outbound; }; /* @@ -282,28 +282,28 @@ struct vmbus_channel_debug_info { */ struct vmbus_channel_msginfo { /* Bookkeeping stuff */ - struct list_head MsgListEntry; + struct list_head msglistentry; /* So far, this is only used to handle gpadl body message */ - struct list_head SubMsgList; + struct list_head submsglist; /* Synchronize the request/response if needed */ - struct osd_waitevent *WaitEvent; + struct osd_waitevent *waitevent; union { - struct vmbus_channel_version_supported VersionSupported; - struct vmbus_channel_open_result OpenResult; - struct vmbus_channel_gpadl_torndown GpadlTorndown; - struct vmbus_channel_gpadl_created GpadlCreated; - struct vmbus_channel_version_response VersionResponse; - } Response; - - u32 MessageSize; + struct vmbus_channel_version_supported version_supported; + struct vmbus_channel_open_result open_result; + struct vmbus_channel_gpadl_torndown gpadl_torndown; + struct vmbus_channel_gpadl_created gpadl_created; + struct vmbus_channel_version_response version_response; + } response; + + u32 msgsize; /* * The channel message that goes out on the "wire". * It will contain at minimum the VMBUS_CHANNEL_MESSAGE_HEADER header */ - unsigned char Msg[0]; + unsigned char msg[0]; }; diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index f847707..6f3f525 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -95,19 +95,19 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->WaitEvent = osd_WaitEventCreate(); - if (!msgInfo->WaitEvent) { + msgInfo->waitevent = osd_WaitEventCreate(); + 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.MessageType = ChannelMessageInitiateContact; - msg->VMBusVersionRequested = VMBUS_REVISION_NUMBER; - msg->InterruptPage = virt_to_phys(gVmbusConnection.InterruptPage); - msg->MonitorPage1 = virt_to_phys(gVmbusConnection.MonitorPages); - msg->MonitorPage2 = virt_to_phys( + 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->monitor_page2 = virt_to_phys( (void *)((unsigned long)gVmbusConnection.MonitorPages + PAGE_SIZE)); @@ -116,30 +116,30 @@ int VmbusConnect(void) * receive the response before returning from this routine */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); - list_add_tail(&msgInfo->MsgListEntry, + list_add_tail(&msgInfo->msglistentry, &gVmbusConnection.ChannelMsgList); spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, " "monitor1 pfn %llx,, monitor2 pfn %llx", - msg->InterruptPage, msg->MonitorPage1, msg->MonitorPage2); + msg->interrupt_page, msg->monitor_page1, msg->monitor_page2); DPRINT_DBG(VMBUS, "Sending channel initiate msg..."); 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_WaitEventWait(msgInfo->WaitEvent); + osd_WaitEventWait(msgInfo->waitevent); - list_del(&msgInfo->MsgListEntry); + list_del(&msgInfo->msglistentry); /* Check if successful */ - if (msgInfo->Response.VersionResponse.VersionSupported) { + if (msgInfo->response.version_response.version_supported) { DPRINT_INFO(VMBUS, "Vmbus connected!!"); gVmbusConnection.ConnectState = Connected; @@ -151,7 +151,7 @@ int VmbusConnect(void) goto Cleanup; } - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); return 0; @@ -172,7 +172,7 @@ Cleanup: } if (msgInfo) { - kfree(msgInfo->WaitEvent); + kfree(msgInfo->waitevent); kfree(msgInfo); } @@ -195,7 +195,7 @@ int VmbusDisconnect(void) if (!msg) return -ENOMEM; - msg->MessageType = ChannelMessageUnload; + msg->msgtype = CHANNELMSG_UNLOAD; ret = VmbusPostMessage(msg, sizeof(struct vmbus_channel_message_header)); @@ -226,8 +226,8 @@ struct vmbus_channel *GetChannelFromRelId(u32 relId) unsigned long flags; spin_lock_irqsave(&gVmbusConnection.channel_lock, flags); - list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) { - if (channel->OfferMsg.ChildRelId == relId) { + list_for_each_entry(channel, &gVmbusConnection.ChannelList, listentry) { + if (channel->offermsg.child_relid == relId) { foundChannel = channel; break; } diff --git a/drivers/staging/hv/hv_utils.c b/drivers/staging/hv/hv_utils.c index 702a478..6dc1c35 100644 --- a/drivers/staging/hv/hv_utils.c +++ b/drivers/staging/hv/hv_utils.c @@ -271,15 +271,15 @@ static int __init init_hyperv_utils(void) if (!dmi_check_system(hv_utils_dmi_table)) return -ENODEV; - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &shutdown_onchannelcallback; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &shutdown_onchannelcallback; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback ×ync_onchannelcallback; hv_cb_utils[HV_TIMESYNC_MSG].callback = ×ync_onchannelcallback; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &heartbeat_onchannelcallback; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &heartbeat_onchannelcallback; @@ -290,15 +290,15 @@ static void exit_hyperv_utils(void) { printk(KERN_INFO "De-Registered HyperV Utility Driver\n"); - hv_cb_utils[HV_SHUTDOWN_MSG].channel->OnChannelCallback + hv_cb_utils[HV_SHUTDOWN_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_SHUTDOWN_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_TIMESYNC_MSG].channel->OnChannelCallback + hv_cb_utils[HV_TIMESYNC_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_TIMESYNC_MSG].callback = &chn_cb_negotiate; - hv_cb_utils[HV_HEARTBEAT_MSG].channel->OnChannelCallback + hv_cb_utils[HV_HEARTBEAT_MSG].channel->onchannel_callback &chn_cb_negotiate; hv_cb_utils[HV_HEARTBEAT_MSG].callback = &chn_cb_negotiate; } diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 0d9f3a4..2bbf4ec 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -139,35 +139,35 @@ static void get_channel_info(struct hv_device *device, vmbus_get_debug_info(device->channel, &debug_info); - info->ChannelId = debug_info.RelId; - info->ChannelState = debug_info.State; - memcpy(&info->ChannelType, &debug_info.InterfaceType, + info->ChannelId = debug_info.relid; + info->ChannelState = debug_info.state; + memcpy(&info->ChannelType, &debug_info.interfacetype, sizeof(struct hv_guid)); - memcpy(&info->ChannelInstance, &debug_info.InterfaceInstance, + memcpy(&info->ChannelInstance, &debug_info.interface_instance, sizeof(struct hv_guid)); - info->MonitorId = debug_info.MonitorId; + info->MonitorId = debug_info.monitorid; - info->ServerMonitorPending = debug_info.ServerMonitorPending; - info->ServerMonitorLatency = debug_info.ServerMonitorLatency; - info->ServerMonitorConnectionId = debug_info.ServerMonitorConnectionId; + info->ServerMonitorPending = debug_info.servermonitor_pending; + info->ServerMonitorLatency = debug_info.servermonitor_latency; + info->ServerMonitorConnectionId = debug_info.servermonitor_connectionid; - info->ClientMonitorPending = debug_info.ClientMonitorPending; - info->ClientMonitorLatency = debug_info.ClientMonitorLatency; - info->ClientMonitorConnectionId = debug_info.ClientMonitorConnectionId; + info->ClientMonitorPending = debug_info.clientmonitor_pending; + info->ClientMonitorLatency = debug_info.clientmonitor_latency; + info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.Inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.Inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.Inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.Inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.Inbound.BytesAvailToWrite; + info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; + info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; + info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; + info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; + info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - info->Outbound.InterruptMask = debug_info.Outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.Outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.Outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.Outbound.BytesAvailToRead; + info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; + info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; + info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; + info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; info->Outbound.BytesAvailToWrite - debug_info.Outbound.BytesAvailToWrite; + debug_info.outbound.BytesAvailToWrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 02/10] staging: hv: Convert camel cased struct fields in hv_api.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased struct fields in hv_api.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 | 32 ++-- drivers/staging/hv/channel_mgmt.c | 6 +- drivers/staging/hv/connection.c | 4 +- drivers/staging/hv/hv.c | 120 ++++++++-------- drivers/staging/hv/hv_api.h | 274 ++++++++++++++++++------------------ drivers/staging/hv/vmbus.c | 18 ++-- 6 files changed, 227 insertions(+), 227 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 9fa0fe1..7c15c40 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -43,24 +43,24 @@ static void DumpMonitorPage(struct hv_monitor_page *MonitorPage) int j = 0; DPRINT_DBG(VMBUS, "monitorPage - %p, trigger state - %d", - MonitorPage, MonitorPage->TriggerState); + MonitorPage, MonitorPage->trigger_state); for (i = 0; i < 4; i++) DPRINT_DBG(VMBUS, "trigger group (%d) - %llx", i, - MonitorPage->TriggerGroup[i].AsUINT64); + MonitorPage->trigger_group[i].as_uint64); for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "latency (%d)(%d) - %llx", i, j, - MonitorPage->Latency[i][j]); + MonitorPage->latency[i][j]); } } for (i = 0; i < 4; i++) { for (j = 0; j < 32; j++) { DPRINT_DBG(VMBUS, "param-conn id (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].ConnectionId.Asu32); + MonitorPage->parameter[i][j].connectionid.asu32); DPRINT_DBG(VMBUS, "param-flag (%d)(%d) - %d", i, j, - MonitorPage->Parameter[i][j].FlagNumber); + MonitorPage->parameter[i][j].flag_number); } } } @@ -84,8 +84,8 @@ static void vmbus_setevent(struct vmbus_channel *channel) monitorpage++; /* Get the child to parent monitor page */ set_bit(channel->monitor_bit, - (unsigned long *)&monitorpage->TriggerGroup - [channel->monitor_grp].Pending); + (unsigned long *)&monitorpage->trigger_group + [channel->monitor_grp].pending); } else { VmbusSetEvent(channel->offermsg.child_relid); @@ -108,7 +108,7 @@ static void VmbusChannelClearEvent(struct vmbus_channel *channel) monitorPage++; /* Get the child to parent monitor page */ clear_bit(Channel->monitor_bit, - (unsigned long *)&monitorPage->TriggerGroup + (unsigned long *)&monitorPage->trigger_group [Channel->monitor_grp].Pending); } } @@ -138,22 +138,22 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, debuginfo->monitorid = channel->offermsg.monitorid; debuginfo->servermonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->servermonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->servermonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; monitorpage++; debuginfo->clientmonitor_pending - monitorpage->TriggerGroup[monitor_group].Pending; + monitorpage->trigger_group[monitor_group].pending; debuginfo->clientmonitor_latency - monitorpage->Latency[monitor_group][monitor_offset]; + monitorpage->latency[monitor_group][monitor_offset]; debuginfo->clientmonitor_connectionid - monitorpage->Parameter[monitor_group] - [monitor_offset].ConnectionId.u.Id; + monitorpage->parameter[monitor_group] + [monitor_offset].connectionid.u.id; RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index dbfe0f2..be34e38 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -742,8 +742,8 @@ void vmbus_onmessage(void *context) struct vmbus_channel_message_header *hdr; int size; - hdr = (struct vmbus_channel_message_header *)msg->u.Payload; - size = msg->Header.PayloadSize; + hdr = (struct vmbus_channel_message_header *)msg->u.payload; + size = msg->header.payload_size; DPRINT_DBG(VMBUS, "message type %d size %d", hdr->msgtype, size); @@ -752,7 +752,7 @@ void vmbus_onmessage(void *context) "Received invalid channel message type %d size %d", hdr->msgtype, size); print_hex_dump_bytes("", DUMP_PREFIX_NONE, - (unsigned char *)msg->u.Payload, size); + (unsigned char *)msg->u.payload, size); kfree(msg); return; } diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 6f3f525..ba50dd8 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -309,8 +309,8 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) { union hv_connection_id connId; - connId.Asu32 = 0; - connId.u.Id = VMBUS_MESSAGE_CONNECTION_ID; + connId.asu32 = 0; + connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; return HvPostMessage(connId, 1, buffer, bufferLen); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 86b1ddd..ab03327 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -50,7 +50,7 @@ static int HvQueryHypervisorPresence(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionVersionAndFeatures; + op = HVCPUID_VERSION_FEATURES; cpuid(op, &eax, &ebx, &ecx, &edx); return ecx & HV_PRESENT_BIT; @@ -76,7 +76,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvVendorAndMaxFunction; + op = HVCPUID_VENDOR_MAXFUNCTION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Vendor ID: %c%c%c%c%c%c%c%c%c%c%c%c", @@ -98,7 +98,7 @@ static int HvQueryHypervisorInfo(void) ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionHvInterface; + op = HVCPUID_INTERFACE; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "Interface ID: %c%c%c%c", @@ -107,12 +107,12 @@ static int HvQueryHypervisorInfo(void) ((eax >> 16) & 0xFF), ((eax >> 24) & 0xFF)); - if (maxLeaf >= HvCpuIdFunctionMsHvVersion) { + if (maxLeaf >= HVCPUID_VERSION) { eax = 0; ebx = 0; ecx = 0; edx = 0; - op = HvCpuIdFunctionMsHvVersion; + op = HVCPUID_VERSION; cpuid(op, &eax, &ebx, &ecx, &edx); DPRINT_INFO(VMBUS, "OS Build:%d-%d.%d-%d-%d.%d",\ eax, @@ -222,7 +222,7 @@ int HvInit(void) gHvContext.GuestId = HV_LINUX_GUEST_ID; /* See if the hypercall page is already set */ - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* * Allocate the hypercall page memory @@ -236,16 +236,16 @@ int HvInit(void) goto Cleanup; } - hypercallMsr.Enable = 1; + hypercallMsr.enable = 1; - hypercallMsr.GuestPhysicalAddress = vmalloc_to_pfn(virtAddr); - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.guest_physical_address = vmalloc_to_pfn(virtAddr); + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); /* Confirm that hypercall page did get setup. */ - hypercallMsr.AsUINT64 = 0; - rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + rdmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); - if (!hypercallMsr.Enable) { + if (!hypercallMsr.enable) { DPRINT_ERR(VMBUS, "unable to set hypercall page!!"); goto Cleanup; } @@ -254,7 +254,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Hypercall page VA=%p, PA=0x%0llx", gHvContext.HypercallPage, - (u64)hypercallMsr.GuestPhysicalAddress << PAGE_SHIFT); + (u64)hypercallMsr.guest_physical_address << PAGE_SHIFT); /* Setup the global signal event param for the signal event hypercall */ gHvContext.SignalEventBuffer @@ -267,19 +267,19 @@ int HvInit(void) (struct hv_input_signal_event *) (ALIGN_UP((unsigned long)gHvContext.SignalEventBuffer, HV_HYPERCALL_PARAM_ALIGN)); - gHvContext.SignalEventParam->ConnectionId.Asu32 = 0; - gHvContext.SignalEventParam->ConnectionId.u.Id + gHvContext.SignalEventParam->connectionid.asu32 = 0; + gHvContext.SignalEventParam->connectionid.u.id VMBUS_EVENT_CONNECTION_ID; - gHvContext.SignalEventParam->FlagNumber = 0; - gHvContext.SignalEventParam->RsvdZ = 0; + gHvContext.SignalEventParam->flag_number = 0; + gHvContext.SignalEventParam->rsvdz = 0; return ret; Cleanup: if (virtAddr) { - if (hypercallMsr.Enable) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + if (hypercallMsr.enable) { + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); } vfree(virtAddr); @@ -302,8 +302,8 @@ void HvCleanup(void) gHvContext.SignalEventParam = NULL; if (gHvContext.HypercallPage) { - hypercallMsr.AsUINT64 = 0; - wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.AsUINT64); + hypercallMsr.as_uint64 = 0; + wrmsrl(HV_X64_MSR_HYPERCALL, hypercallMsr.as_uint64); vfree(gHvContext.HypercallPage); gHvContext.HypercallPage = NULL; } @@ -337,12 +337,12 @@ u16 HvPostMessage(union hv_connection_id connectionId, alignedMsg = (struct hv_input_post_message *) (ALIGN_UP(addr, HV_HYPERCALL_PARAM_ALIGN)); - alignedMsg->ConnectionId = connectionId; - alignedMsg->MessageType = messageType; - alignedMsg->PayloadSize = payloadSize; - memcpy((void *)alignedMsg->Payload, payload, payloadSize); + alignedMsg->connectionid = connectionId; + alignedMsg->message_type = messageType; + alignedMsg->payload_size = payloadSize; + memcpy((void *)alignedMsg->payload, payload, payloadSize); - status = HvDoHypercall(HvCallPostMessage, alignedMsg, NULL) & 0xFFFF; + status = HvDoHypercall(HVCALL_POST_MESSAGE, alignedMsg, NULL) & 0xFFFF; kfree((void *)addr); @@ -359,7 +359,7 @@ u16 HvSignalEvent(void) { u16 status; - status = HvDoHypercall(HvCallSignalEvent, gHvContext.SignalEventParam, + status = HvDoHypercall(HVCALL_SIGNAL_EVENT, gHvContext.SignalEventParam, NULL) & 0xFFFF; return status; } @@ -407,47 +407,47 @@ void HvSynicInit(void *irqarg) } /* Setup the Synic's message page */ - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 1; - simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 1; + simp.base_simp_gpa = virt_to_phys(gHvContext.synICMessagePage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx", simp.as_uint64); - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); /* Setup the Synic's event page */ - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 1; - siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu]) + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 1; + siefp.base_siefp_gpa = virt_to_phys(gHvContext.synICEventPage[cpu]) >> PAGE_SHIFT; - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.AsUINT64); + DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx", siefp.as_uint64); - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); /* Setup the interception SINT. */ /* wrmsrl((HV_X64_MSR_SINT0 + HV_SYNIC_INTERCEPTION_SINT_INDEX), */ - /* interceptionSint.AsUINT64); */ + /* interceptionSint.as_uint64); */ /* Setup the shared SINT. */ - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.AsUINT64 = 0; - sharedSint.Vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ - sharedSint.Masked = false; - sharedSint.AutoEoi = true; + sharedSint.as_uint64 = 0; + sharedSint.vector = irqVector; /* HV_SHARED_SINT_IDT_VECTOR + 0x20; */ + sharedSint.masked = false; + sharedSint.auto_eoi = true; DPRINT_DBG(VMBUS, "HV_X64_MSR_SINT1 msr set to: %llx", - sharedSint.AsUINT64); + sharedSint.as_uint64); - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); /* Enable the global synic bit */ - rdmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); - sctrl.Enable = 1; + rdmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); + sctrl.enable = 1; - wrmsrl(HV_X64_MSR_SCONTROL, sctrl.AsUINT64); + wrmsrl(HV_X64_MSR_SCONTROL, sctrl.as_uint64); gHvContext.SynICInitialized = true; return; @@ -474,25 +474,25 @@ void HvSynicCleanup(void *arg) if (!gHvContext.SynICInitialized) return; - rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + rdmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - sharedSint.Masked = 1; + sharedSint.masked = 1; /* Need to correctly cleanup in the case of SMP!!! */ /* Disable the interrupt */ - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64); + wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.as_uint64); - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); - simp.SimpEnabled = 0; - simp.BaseSimpGpa = 0; + rdmsrl(HV_X64_MSR_SIMP, simp.as_uint64); + simp.simp_enabled = 0; + simp.base_simp_gpa = 0; - wrmsrl(HV_X64_MSR_SIMP, simp.AsUINT64); + wrmsrl(HV_X64_MSR_SIMP, simp.as_uint64); - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); - siefp.SiefpEnabled = 0; - siefp.BaseSiefpGpa = 0; + rdmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); + siefp.siefp_enabled = 0; + siefp.base_siefp_gpa = 0; - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64); + wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); osd_PageFree(gHvContext.synICMessagePage[cpu], 1); osd_PageFree(gHvContext.synICEventPage[cpu], 1); diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9eb818e..9df6472 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -510,21 +510,21 @@ /* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent - * is set by CPUID(HvCpuIdFunctionVersionAndFeatures). + * is set by CPUID(HVCPUID_VERSION_FEATURES). */ enum hv_cpuid_function { - HvCpuIdFunctionVersionAndFeatures = 0x00000001, - HvCpuIdFunctionHvVendorAndMaxFunction = 0x40000000, - HvCpuIdFunctionHvInterface = 0x40000001, + HVCPUID_VERSION_FEATURES = 0x00000001, + HVCPUID_VENDOR_MAXFUNCTION = 0x40000000, + HVCPUID_INTERFACE = 0x40000001, /* * The remaining functions depend on the value of - * HvCpuIdFunctionInterface + * HVCPUID_INTERFACE */ - HvCpuIdFunctionMsHvVersion = 0x40000002, - HvCpuIdFunctionMsHvFeatures = 0x40000003, - HvCpuIdFunctionMsHvEnlightenmentInformation = 0x40000004, - HvCpuIdFunctionMsHvImplementationLimits = 0x40000005, + HVCPUID_VERSION = 0x40000002, + HVCPUID_FEATURES = 0x40000003, + HVCPUID_ENLIGHTENMENT_INFO = 0x40000004, + HVCPUID_IMPLEMENTATION_LIMITS = 0x40000005, }; /* Define the virtual APIC registers */ @@ -575,30 +575,30 @@ enum hv_cpuid_function { /* Define hypervisor message types. */ enum hv_message_type { - HvMessageTypeNone = 0x00000000, + HVMSG_NONE = 0x00000000, /* Memory access messages. */ - HvMessageTypeUnmappedGpa = 0x80000000, - HvMessageTypeGpaIntercept = 0x80000001, + HVMSG_UNMAPPED_GPA = 0x80000000, + HVMSG_GPA_INTERCEPT = 0x80000001, /* Timer notification messages. */ - HvMessageTimerExpired = 0x80000010, + HVMSG_TIMER_EXPIRED = 0x80000010, /* Error messages. */ - HvMessageTypeInvalidVpRegisterValue = 0x80000020, - HvMessageTypeUnrecoverableException = 0x80000021, - HvMessageTypeUnsupportedFeature = 0x80000022, + HVMSG_INVALID_VP_REGISTER_VALUE = 0x80000020, + HVMSG_UNRECOVERABLE_EXCEPTION = 0x80000021, + HVMSG_UNSUPPORTED_FEATURE = 0x80000022, /* Trace buffer complete messages. */ - HvMessageTypeEventLogBufferComplete = 0x80000040, + HVMSG_EVENTLOG_BUFFERCOMPLETE = 0x80000040, /* Platform-specific processor intercept messages. */ - HvMessageTypeX64IoPortIntercept = 0x80010000, - HvMessageTypeX64MsrIntercept = 0x80010001, - HvMessageTypeX64CpuidIntercept = 0x80010002, - HvMessageTypeX64ExceptionIntercept = 0x80010003, - HvMessageTypeX64ApicEoi = 0x80010004, - HvMessageTypeX64LegacyFpError = 0x80010005 + HVMSG_X64_IOPORT_INTERCEPT = 0x80010000, + HVMSG_X64_MSR_INTERCEPT = 0x80010001, + HVMSG_X64_CPUID_INTERCEPT = 0x80010002, + HVMSG_X64_EXCEPTION_INTERCEPT = 0x80010003, + HVMSG_X64_APIC_EOI = 0x80010004, + HVMSG_X64_LEGACY_FP_ERROR = 0x80010005 }; /* Define the number of synthetic interrupt sources. */ @@ -610,103 +610,103 @@ enum hv_message_type { /* Define connection identifier type. */ union hv_connection_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u; }; /* Define port identifier type. */ union hv_port_id { - u32 Asu32; + u32 asu32; struct { - u32 Id:24; - u32 Reserved:8; + u32 id:24; + u32 reserved:8; } u ; }; /* Define port type. */ enum hv_port_type { - HvPortTypeMessage = 1, - HvPortTypeEvent = 2, - HvPortTypeMonitor = 3 + HVPORT_MSG = 1, + HVPORT_EVENT = 2, + HVPORT_MONITOR = 3 }; /* Define port information structure. */ struct hv_port_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u32 TargetSint; - u32 TargetVp; - u64 RsvdZ; - } MessagePortInfo; + u32 target_sint; + u32 target_vp; + u64 rsvdz; + } message_port_info; struct { - u32 TargetSint; - u32 TargetVp; - u16 BaseFlagNumber; - u16 FlagCount; - u32 RsvdZ; - } EventPortInfo; + u32 target_sint; + u32 target_vp; + u16 base_flag_bumber; + u16 flag_count; + u32 rsvdz; + } event_port_info; struct { - u64 MonitorAddress; - u64 RsvdZ; - } MonitorPortInfo; + u64 monitor_address; + u64 rsvdz; + } monitor_port_info; }; }; struct hv_connection_info { - enum hv_port_type PortType; - u32 Padding; + enum hv_port_type port_type; + u32 padding; union { struct { - u64 RsvdZ; - } MessageConnectionInfo; + u64 rsvdz; + } message_connection_info; struct { - u64 RsvdZ; - } EventConnectionInfo; + u64 rsvdz; + } event_connection_info; struct { - u64 MonitorAddress; - } MonitorConnectionInfo; + u64 monitor_address; + } monitor_connection_info; }; }; /* Define synthetic interrupt controller message flags. */ union hv_message_flags { - u8 Asu8; + u8 asu8; struct { - u8 MessagePending:1; - u8 Reserved:7; + u8 msg_pending:1; + u8 reserved:7; }; }; /* Define synthetic interrupt controller message header. */ struct hv_message_header { - enum hv_message_type MessageType; - u8 PayloadSize; - union hv_message_flags MessageFlags; - u8 Reserved[2]; + enum hv_message_type message_type; + u8 payload_size; + union hv_message_flags message_flags; + u8 reserved[2]; union { - u64 Sender; - union hv_port_id Port; + u64 sender; + union hv_port_id port; }; }; /* Define timer message payload structure. */ struct hv_timer_message_payload { - u32 TimerIndex; - u32 Reserved; - u64 ExpirationTime; /* When the timer expired */ - u64 DeliveryTime; /* When the message was delivered */ + u32 timer_index; + u32 reserved; + u64 expiration_time; /* When the timer expired */ + u64 delivery_time; /* When the message was delivered */ }; /* Define synthetic interrupt controller message format. */ struct hv_message { - struct hv_message_header Header; + struct hv_message_header header; union { - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; } u ; }; @@ -715,82 +715,82 @@ struct hv_message { /* Define the synthetic interrupt message page layout. */ struct hv_message_page { - struct hv_message SintMessage[HV_SYNIC_SINT_COUNT]; + struct hv_message sint_message[HV_SYNIC_SINT_COUNT]; }; /* Define the synthetic interrupt controller event flags format. */ union hv_synic_event_flags { - u8 Flags8[HV_EVENT_FLAGS_BYTE_COUNT]; - u32 Flags32[HV_EVENT_FLAGS_DWORD_COUNT]; + u8 flags8[HV_EVENT_FLAGS_BYTE_COUNT]; + u32 flags32[HV_EVENT_FLAGS_DWORD_COUNT]; }; /* Define the synthetic interrupt flags page layout. */ struct hv_synic_event_flags_page { - union hv_synic_event_flags SintEventFlags[HV_SYNIC_SINT_COUNT]; + union hv_synic_event_flags sintevent_flags[HV_SYNIC_SINT_COUNT]; }; /* Define SynIC control register. */ union hv_synic_scontrol { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:63; + u64 enable:1; + u64 reserved:63; }; }; /* Define synthetic interrupt source. */ union hv_synic_sint { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Vector:8; - u64 Reserved1:8; - u64 Masked:1; - u64 AutoEoi:1; - u64 Reserved2:46; + u64 vector:8; + u64 reserved1:8; + u64 masked:1; + u64 auto_eoi:1; + u64 reserved2:46; }; }; /* Define the format of the SIMP register */ union hv_synic_simp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SimpEnabled:1; - u64 Preserved:11; - u64 BaseSimpGpa:52; + u64 simp_enabled:1; + u64 preserved:11; + u64 base_simp_gpa:52; }; }; /* Define the format of the SIEFP register */ union hv_synic_siefp { - u64 AsUINT64; + u64 as_uint64; struct { - u64 SiefpEnabled:1; - u64 Preserved:11; - u64 BaseSiefpGpa:52; + u64 siefp_enabled:1; + u64 preserved:11; + u64 base_siefp_gpa:52; }; }; /* Definitions for the monitored notification facility */ union hv_monitor_trigger_group { - u64 AsUINT64; + u64 as_uint64; struct { - u32 Pending; - u32 Armed; + u32 pending; + u32 armed; }; }; struct hv_monitor_parameter { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flagnumber; + u16 rsvdz; }; union hv_monitor_trigger_state { - u32 Asu32; + u32 asu32; struct { - u32 GroupEnable:4; - u32 RsvdZ:28; + u32 group_enable:4; + u32 rsvdz:28; }; }; @@ -814,42 +814,42 @@ union hv_monitor_trigger_state { /* | 840 | Rsvd4[0] | */ /* ------------------------------------------------------ */ struct hv_monitor_page { - union hv_monitor_trigger_state TriggerState; - u32 RsvdZ1; + union hv_monitor_trigger_state trigger_state; + u32 rsvdz1; - union hv_monitor_trigger_group TriggerGroup[4]; - u64 RsvdZ2[3]; + union hv_monitor_trigger_group trigger_group[4]; + u64 rsvdz2[3]; - s32 NextCheckTime[4][32]; + s32 next_checktime[4][32]; - u16 Latency[4][32]; - u64 RsvdZ3[32]; + u16 latency[4][32]; + u64 rsvdz3[32]; - struct hv_monitor_parameter Parameter[4][32]; + struct hv_monitor_parameter parameter[4][32]; - u8 RsvdZ4[1984]; + u8 rsvdz4[1984]; }; /* Declare the various hypercall operations. */ enum hv_call_code { - HvCallPostMessage = 0x005c, - HvCallSignalEvent = 0x005d, + HVCALL_POST_MESSAGE = 0x005c, + HVCALL_SIGNAL_EVENT = 0x005d, }; /* Definition of the HvPostMessage hypercall input structure. */ struct hv_input_post_message { - union hv_connection_id ConnectionId; - u32 Reserved; - enum hv_message_type MessageType; - u32 PayloadSize; - u64 Payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; + union hv_connection_id connectionid; + u32 reserved; + enum hv_message_type message_type; + u32 payload_size; + u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; /* Definition of the HvSignalEvent hypercall input structure. */ struct hv_input_signal_event { - union hv_connection_id ConnectionId; - u16 FlagNumber; - u16 RsvdZ; + union hv_connection_id connectionid; + u16 flag_number; + u16 rsvdz; }; /* @@ -859,16 +859,16 @@ struct hv_input_signal_event { /* Version info reported by guest OS's */ enum hv_guest_os_vendor { - HvGuestOsVendorMicrosoft = 0x0001 + HVGUESTOS_VENDOR_MICROSOFT = 0x0001 }; enum hv_guest_os_microsoft_ids { - HvGuestOsMicrosoftUndefined = 0x00, - HvGuestOsMicrosoftMSDOS = 0x01, - HvGuestOsMicrosoftWindows3x = 0x02, - HvGuestOsMicrosoftWindows9x = 0x03, - HvGuestOsMicrosoftWindowsNT = 0x04, - HvGuestOsMicrosoftWindowsCE = 0x05 + HVGUESTOS_MICROSOFT_UNDEFINED = 0x00, + HVGUESTOS_MICROSOFT_MSDOS = 0x01, + HVGUESTOS_MICROSOFT_WINDOWS3X = 0x02, + HVGUESTOS_MICROSOFT_WINDOWS9X = 0x03, + HVGUESTOS_MICROSOFT_WINDOWSNT = 0x04, + HVGUESTOS_MICROSOFT_WINDOWSCE = 0x05 }; /* @@ -877,14 +877,14 @@ enum hv_guest_os_microsoft_ids { #define HV_X64_MSR_GUEST_OS_ID 0x40000000 union hv_x64_msr_guest_os_id_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 BuildNumber:16; - u64 ServiceVersion:8; /* Service Pack, etc. */ - u64 MinorVersion:8; - u64 MajorVersion:8; - u64 OsId:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ - u64 VendorId:16; /* enum hv_guest_os_vendor */ + u64 build_number:16; + u64 service_version:8; /* Service Pack, etc. */ + u64 minor_version:8; + u64 major_version:8; + u64 os_id:8; /* enum hv_guest_os_microsoft_ids (if Vendor=MS) */ + u64 vendor_id:16; /* enum hv_guest_os_vendor */ }; }; @@ -894,11 +894,11 @@ union hv_x64_msr_guest_os_id_contents { #define HV_X64_MSR_HYPERCALL 0x40000001 union hv_x64_msr_hypercall_contents { - u64 AsUINT64; + u64 as_uint64; struct { - u64 Enable:1; - u64 Reserved:11; - u64 GuestPhysicalAddress:52; + u64 enable:1; + u64 reserved:11; + u64 guest_physical_address:52; }; }; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index d449daf..7c54ca9 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -153,7 +153,7 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) struct hv_message *copied; while (1) { - if (msg->Header.MessageType == HvMessageTypeNone) { + if (msg->header.message_type == HVMSG_NONE) { /* no msg */ break; } else { @@ -166,18 +166,18 @@ static void VmbusOnMsgDPC(struct hv_driver *drv) (void *)copied); } - msg->Header.MessageType = HvMessageTypeNone; + msg->header.message_type = HVMSG_NONE; /* * Make sure the write to MessageType (ie set to - * HvMessageTypeNone) happens before we read the + * HVMSG_NONE) happens before we read the * MessagePending and EOMing. Otherwise, the EOMing * will not deliver any more messages since there is * no empty slot */ mb(); - if (msg->Header.MessageFlags.MessagePending) { + if (msg->header.message_flags.msg_pending) { /* * This will cause message queue rescan to * possibly deliver another msg from the @@ -212,10 +212,10 @@ static int VmbusOnISR(struct hv_driver *drv) msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; /* Check if there are actual msgs to be process */ - if (msg->Header.MessageType != HvMessageTypeNone) { + if (msg->header.message_type != HVMSG_NONE) { DPRINT_DBG(VMBUS, "received msg type %d size %d", - msg->Header.MessageType, - msg->Header.PayloadSize); + msg->header.message_type, + msg->header.payload_size); ret |= 0x1; } @@ -224,8 +224,8 @@ static int VmbusOnISR(struct hv_driver *drv) event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT; /* Since we are a child, we only need to check bit 0 */ - if (test_and_clear_bit(0, (unsigned long *) &event->Flags32[0])) { - DPRINT_DBG(VMBUS, "received event %d", event->Flags32[0]); + if (test_and_clear_bit(0, (unsigned long *) &event->flags32[0])) { + DPRINT_DBG(VMBUS, "received event %d", event->flags32[0]); ret |= 0x2; } -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 05/10] staging: hv: Convert camel cased functions in hv.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased functions in hv.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/connection.c | 4 +- drivers/staging/hv/hv.c | 47 ++++++++++++++++++++------------------ drivers/staging/hv/hv.h | 16 ++++++------ drivers/staging/hv/hv_api.h | 4 +- drivers/staging/hv/vmbus.c | 8 +++--- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index ba50dd8..97321d1 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -311,7 +311,7 @@ int VmbusPostMessage(void *buffer, size_t bufferLen) connId.asu32 = 0; connId.u.id = VMBUS_MESSAGE_CONNECTION_ID; - return HvPostMessage(connId, 1, buffer, bufferLen); + return hv_post_message(connId, 1, buffer, bufferLen); } /* @@ -324,5 +324,5 @@ int VmbusSetEvent(u32 childRelId) (unsigned long *)gVmbusConnection.SendInterruptPage + (childRelId >> 5)); - return HvSignalEvent(); + return hv_signal_event(); } diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 2fd234d..66f04d8 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -36,9 +36,10 @@ struct hv_context hv_context = { }; /* - * HvQueryHypervisorPresence - Query the cpuid for presense of windows hypervisor + * query_hypervisor_presence + * - Query the cpuid for presense of windows hypervisor */ -static int HvQueryHypervisorPresence(void) +static int query_hypervisor_presence(void) { unsigned int eax; unsigned int ebx; @@ -57,9 +58,9 @@ static int HvQueryHypervisorPresence(void) } /* - * HvQueryHypervisorInfo - Get version info of the windows hypervisor + * query_hypervisor_info - Get version info of the windows hypervisor */ -static int HvQueryHypervisorInfo(void) +static int query_hypervisor_info(void) { unsigned int eax; unsigned int ebx; @@ -126,9 +127,9 @@ static int HvQueryHypervisorInfo(void) } /* - * HvDoHypercall - Invoke the specified hypercall + * do_hypercall- Invoke the specified hypercall */ -static u64 HvDoHypercall(u64 control, void *input, void *output) +static u64 do_hypercall(u64 control, void *input, void *output) { #ifdef CONFIG_X86_64 u64 hv_status = 0; @@ -181,11 +182,11 @@ static u64 HvDoHypercall(u64 control, void *input, void *output) } /* - * HvInit - Main initialization routine. + * hv_init - Main initialization routine. * * This routine must be called before any other routines in here are called */ -int HvInit(void) +int hv_init(void) { int ret = 0; int max_leaf; @@ -196,7 +197,7 @@ int HvInit(void) memset(hv_context.synic_message_page, 0, sizeof(void *) * MAX_NUM_CPUS); - if (!HvQueryHypervisorPresence()) { + if (!query_hypervisor_presence()) { DPRINT_ERR(VMBUS, "No Windows hypervisor detected!!"); goto Cleanup; } @@ -204,7 +205,7 @@ int HvInit(void) DPRINT_INFO(VMBUS, "Windows hypervisor detected! Retrieving more info..."); - max_leaf = HvQueryHypervisorInfo(); + max_leaf = query_hypervisor_info(); /* HvQueryHypervisorFeatures(maxLeaf); */ /* @@ -291,11 +292,11 @@ Cleanup: } /* - * HvCleanup - Cleanup routine. + * hv_cleanup - Cleanup routine. * * This routine is called normally during driver unloading or exiting. */ -void HvCleanup(void) +void hv_cleanup(void) { union hv_x64_msr_hypercall_contents hypercall_msr; @@ -312,11 +313,11 @@ void HvCleanup(void) } /* - * HvPostMessage - Post a message using the hypervisor message IPC. + * hv_post_message - Post a message using the hypervisor message IPC. * * This involves a hypercall. */ -u16 HvPostMessage(union hv_connection_id connection_id, +u16 hv_post_message(union hv_connection_id connection_id, enum hv_message_type message_type, void *payload, size_t payload_size) { @@ -344,7 +345,8 @@ u16 HvPostMessage(union hv_connection_id connection_id, aligned_msg->payload_size = payload_size; memcpy((void *)aligned_msg->payload, payload, payload_size); - status = HvDoHypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) & 0xFFFF; + status = do_hypercall(HVCALL_POST_MESSAGE, aligned_msg, NULL) + & 0xFFFF; kfree((void *)addr); @@ -353,28 +355,29 @@ u16 HvPostMessage(union hv_connection_id connection_id, /* - * HvSignalEvent - Signal an event on the specified connection using the hypervisor event IPC. + * hv_signal_event - + * Signal an event on the specified connection using the hypervisor event IPC. * * This involves a hypercall. */ -u16 HvSignalEvent(void) +u16 hv_signal_event(void) { u16 status; - status = HvDoHypercall(HVCALL_SIGNAL_EVENT, + status = do_hypercall(HVCALL_SIGNAL_EVENT, hv_context.signal_event_param, NULL) & 0xFFFF; return status; } /* - * HvSynicInit - Initialize the Synthethic Interrupt Controller. + * hv_synic_init - Initialize the Synthethic Interrupt Controller. * * If it is already initialized by another entity (ie x2v shim), we need to * retrieve the initialized message and event pages. Otherwise, we create and * initialize the message and event pages. */ -void HvSynicInit(void *irqarg) +void hv_synic_init(void *irqarg) { u64 version; union hv_synic_simp simp; @@ -467,9 +470,9 @@ Cleanup: } /* - * HvSynicCleanup - Cleanup routine for HvSynicInit(). + * hv_synic_cleanup - Cleanup routine for hv_synic_init(). */ -void HvSynicCleanup(void *arg) +void hv_synic_cleanup(void *arg) { union hv_synic_sint shared_sint; union hv_synic_simp simp; diff --git a/drivers/staging/hv/hv.h b/drivers/staging/hv/hv.h index 6e396fc..829aff8 100644 --- a/drivers/staging/hv/hv.h +++ b/drivers/staging/hv/hv.h @@ -123,18 +123,18 @@ extern struct hv_context hv_context; /* Hv Interface */ -extern int HvInit(void); +extern int hv_init(void); -extern void HvCleanup(void); +extern void hv_cleanup(void); -extern u16 HvPostMessage(union hv_connection_id connectionId, - enum hv_message_type messageType, - void *payload, size_t payloadSize); +extern u16 hv_post_message(union hv_connection_id connection_id, + enum hv_message_type message_type, + void *payload, size_t payload_size); -extern u16 HvSignalEvent(void); +extern u16 hv_signal_event(void); -extern void HvSynicInit(void *irqarg); +extern void hv_synic_init(void *irqarg); -extern void HvSynicCleanup(void *arg); +extern void hv_synic_cleanup(void *arg); #endif /* __HV_H__ */ diff --git a/drivers/staging/hv/hv_api.h b/drivers/staging/hv/hv_api.h index 9df6472..70e863a 100644 --- a/drivers/staging/hv/hv_api.h +++ b/drivers/staging/hv/hv_api.h @@ -836,7 +836,7 @@ enum hv_call_code { HVCALL_SIGNAL_EVENT = 0x005d, }; -/* Definition of the HvPostMessage hypercall input structure. */ +/* Definition of the hv_post_message hypercall input structure. */ struct hv_input_post_message { union hv_connection_id connectionid; u32 reserved; @@ -845,7 +845,7 @@ struct hv_input_post_message { u64 payload[HV_MESSAGE_PAYLOAD_QWORD_COUNT]; }; -/* Definition of the HvSignalEvent hypercall input structure. */ +/* Definition of the hv_signal_event hypercall input structure. */ struct hv_input_signal_event { union hv_connection_id connectionid; u16 flag_number; diff --git a/drivers/staging/hv/vmbus.c b/drivers/staging/hv/vmbus.c index b1ec876..e6462c6 100644 --- a/drivers/staging/hv/vmbus.c +++ b/drivers/staging/hv/vmbus.c @@ -109,7 +109,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo) /* strcpy(dev->name, "vmbus"); */ /* SynIC setup... */ - on_each_cpu(HvSynicInit, (void *)irqvector, 1); + on_each_cpu(hv_synic_init, (void *)irqvector, 1); /* Connect to VMBus in the root partition */ ret = VmbusConnect(); @@ -127,7 +127,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev) vmbus_release_unattached_channels(); VmbusDisconnect(); - on_each_cpu(HvSynicCleanup, NULL, 1); + on_each_cpu(hv_synic_cleanup, NULL, 1); return ret; } @@ -138,7 +138,7 @@ static void VmbusOnCleanup(struct hv_driver *drv) { /* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */ - HvCleanup(); + hv_cleanup(); } /* @@ -264,7 +264,7 @@ int VmbusInitialize(struct hv_driver *drv) driver->GetChannelOffers = VmbusGetChannelOffers; /* Hypervisor initialization...setup hypercall page..etc */ - ret = HvInit(); + ret = hv_init(); if (ret != 0) DPRINT_ERR(VMBUS, "Unable to initialize the hypervisor - 0x%x", ret); -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 06/10] staging: hv: Convert camel cased local variables in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased local variables in osd.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/osd.c | 40 ++++++++++++++++++++-------------------- 1 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index 8c3eb27..b39ec25 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -130,9 +130,9 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); /** * osd_WaitEventSet() - Wake up the process - * @waitEvent: Structure to event to be woken up + * @wait_event: Structure to event to be woken up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Wake up the sleeping process so it can do some work. * And set condition indicator in &struct osd_waitevent to indicate @@ -140,18 +140,18 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *waitEvent) +void osd_WaitEventSet(struct osd_waitevent *wait_event) { - waitEvent->condition = 1; - wake_up_interruptible(&waitEvent->event); + wait_event->condition = 1; + wake_up_interruptible(&wait_event->event); } EXPORT_SYMBOL_GPL(osd_WaitEventSet); /** * osd_WaitEventWait() - Wait for event till condition is true - * @waitEvent: Structure to event to be put to sleep + * @wait_event: Structure to event to be put to sleep * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * * Set up the process to sleep until waitEvent->condition get true. * And set condition indicator in &struct osd_waitevent to indicate @@ -161,25 +161,25 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *waitEvent) +int osd_WaitEventWait(struct osd_waitevent *wait_event) { int ret = 0; - ret = wait_event_interruptible(waitEvent->event, - waitEvent->condition); - waitEvent->condition = 0; + ret = wait_event_interruptible(wait_event->event, + wait_event->condition); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWait); /** * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup - * @waitEvent: Structure to event to be put to sleep - * @TimeoutInMs: Total number of Milliseconds to wait before waking up + * @wait_event: Structure to event to be put to sleep + * @timeout_in_ms: Total number of Milliseconds to wait before waking up * - * @waitevent is of type &struct osd_waitevent + * @wait_event is of type &struct osd_waitevent * Set up the process to sleep until @waitEvent->condition get true or - * @TimeoutInMs (Time out in Milliseconds) has been reached. + * @timeout_in_ms (Time out in Milliseconds) has been reached. * And set condition indicator in &struct osd_waitevent to indicate * the process is in a sleeping state. * @@ -187,14 +187,14 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, u32 TimeoutInMs) +int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; - ret = wait_event_interruptible_timeout(waitEvent->event, - waitEvent->condition, - msecs_to_jiffies(TimeoutInMs)); - waitEvent->condition = 0; + ret = wait_event_interruptible_timeout(wait_event->event, + wait_event->condition, + msecs_to_jiffies(timeout_in_ms)); + wait_event->condition = 0; return ret; } EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 07/10] staging: hv: Convert camel cased functions in osd.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased functions in osd.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 | 20 +++++++++--------- drivers/staging/hv/channel_mgmt.c | 12 +++++----- drivers/staging/hv/connection.c | 14 ++++++------ drivers/staging/hv/hv.c | 12 +++++----- drivers/staging/hv/netvsc.c | 24 +++++++++++----------- drivers/staging/hv/osd.c | 40 ++++++++++++++++++------------------ drivers/staging/hv/osd.h | 18 ++++++++-------- drivers/staging/hv/rndis_filter.c | 10 ++++---- drivers/staging/hv/storvsc.c | 16 +++++++------- 9 files changed, 83 insertions(+), 83 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 7c15c40..abc2988 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -180,7 +180,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = osd_PageAlloc((send_ringbuffer_size + recv_ringbuffer_size) + out = osd_page_alloc((send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); if (!out) return -ENOMEM; @@ -242,7 +242,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, goto errorout; } - openInfo->waitevent = osd_WaitEventCreate(); + openInfo->waitevent = osd_waitevent_create(); if (!openInfo->waitevent) { err = -ENOMEM; goto errorout; @@ -280,7 +280,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, } /* FIXME: Need to time-out here */ - osd_WaitEventWait(openInfo->waitevent); + osd_waitevent_wait(openInfo->waitevent); if (openInfo->response.open_result.status == 0) DPRINT_INFO(VMBUS, "channel <%p> open success!!", newchannel); @@ -300,7 +300,7 @@ Cleanup: errorout: RingBufferCleanup(&newchannel->outbound); RingBufferCleanup(&newchannel->inbound); - osd_PageFree(out, (send_ringbuffer_size + recv_ringbuffer_size) + osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); return err; @@ -508,7 +508,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, if (ret) return ret; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -565,7 +565,7 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } } - osd_WaitEventWait(msginfo->waitevent); + osd_waitevent_wait(msginfo->waitevent); /* At this point, we received the gpadl created msg */ DPRINT_DBG(VMBUS, "Received GPADL created " @@ -604,7 +604,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) if (!info) return -ENOMEM; - info->waitevent = osd_WaitEventCreate(); + info->waitevent = osd_waitevent_create(); if (!info->waitevent) { kfree(info); return -ENOMEM; @@ -628,7 +628,7 @@ int vmbus_teardown_gpadl(struct vmbus_channel *channel, u32 gpadl_handle) /* something... */ } - osd_WaitEventWait(info->waitevent); + osd_waitevent_wait(info->waitevent); /* Received a torndown response */ spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags); @@ -663,7 +663,7 @@ void vmbus_close(struct vmbus_channel *channel) if (!info) return; - /* info->waitEvent = osd_WaitEventCreate(); */ + /* info->waitEvent = osd_waitevent_create(); */ msg = (struct vmbus_channel_close_channel *)info->msg; msg->header.msgtype = CHANNELMSG_CLOSECHANNEL; @@ -686,7 +686,7 @@ void vmbus_close(struct vmbus_channel *channel) RingBufferCleanup(&channel->outbound); RingBufferCleanup(&channel->inbound); - osd_PageFree(channel->ringbuffer_pages, channel->ringbuffer_pagecount); + osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); kfree(info); diff --git a/drivers/staging/hv/channel_mgmt.c b/drivers/staging/hv/channel_mgmt.c index be34e38..ae830f2 100644 --- a/drivers/staging/hv/channel_mgmt.c +++ b/drivers/staging/hv/channel_mgmt.c @@ -566,7 +566,7 @@ static void vmbus_onopen_result(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.open_result, result, sizeof(struct vmbus_channel_open_result)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -616,7 +616,7 @@ static void vmbus_ongpadl_created(struct vmbus_channel_message_header *hdr) memcpy(&msginfo->response.gpadl_created, gpadlcreated, sizeof(struct vmbus_channel_gpadl_created)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -662,7 +662,7 @@ static void vmbus_ongpadl_torndown( memcpy(&msginfo->response.gpadl_torndown, gpadl_torndown, sizeof(struct vmbus_channel_gpadl_torndown)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); break; } } @@ -703,7 +703,7 @@ static void vmbus_onversion_response( memcpy(&msginfo->response.version_response, version_response, sizeof(struct vmbus_channel_version_response)); - osd_WaitEventSet(msginfo->waitevent); + osd_waitevent_set(msginfo->waitevent); } } spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags); @@ -782,7 +782,7 @@ int vmbus_request_offers(void) if (!msginfo) return -ENOMEM; - msginfo->waitevent = osd_WaitEventCreate(); + msginfo->waitevent = osd_waitevent_create(); if (!msginfo->waitevent) { kfree(msginfo); return -ENOMEM; @@ -808,7 +808,7 @@ int vmbus_request_offers(void) goto Cleanup; } - /* osd_WaitEventWait(msgInfo->waitEvent); */ + /* osd_waitevent_wait(msgInfo->waitEvent); */ /*SpinlockAcquire(gVmbusConnection.channelMsgLock); REMOVE_ENTRY_LIST(&msgInfo->msgListEntry); diff --git a/drivers/staging/hv/connection.c b/drivers/staging/hv/connection.c index 97321d1..c2e298f 100644 --- a/drivers/staging/hv/connection.c +++ b/drivers/staging/hv/connection.c @@ -66,7 +66,7 @@ int VmbusConnect(void) * Setup the vmbus event connection for channel interrupt * abstraction stuff */ - gVmbusConnection.InterruptPage = osd_PageAlloc(1); + gVmbusConnection.InterruptPage = osd_page_alloc(1); if (gVmbusConnection.InterruptPage == NULL) { ret = -1; goto Cleanup; @@ -81,7 +81,7 @@ int VmbusConnect(void) * Setup the monitor notification facility. The 1st page for * parent->child and the 2nd page for child->parent */ - gVmbusConnection.MonitorPages = osd_PageAlloc(2); + gVmbusConnection.MonitorPages = osd_page_alloc(2); if (gVmbusConnection.MonitorPages == NULL) { ret = -1; goto Cleanup; @@ -95,7 +95,7 @@ int VmbusConnect(void) goto Cleanup; } - msgInfo->waitevent = osd_WaitEventCreate(); + msgInfo->waitevent = osd_waitevent_create(); if (!msgInfo->waitevent) { ret = -ENOMEM; goto Cleanup; @@ -134,7 +134,7 @@ int VmbusConnect(void) } /* Wait for the connection response */ - osd_WaitEventWait(msgInfo->waitevent); + osd_waitevent_wait(msgInfo->waitevent); list_del(&msgInfo->msglistentry); @@ -162,12 +162,12 @@ Cleanup: destroy_workqueue(gVmbusConnection.WorkQueue); if (gVmbusConnection.InterruptPage) { - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); gVmbusConnection.InterruptPage = NULL; } if (gVmbusConnection.MonitorPages) { - osd_PageFree(gVmbusConnection.MonitorPages, 2); + osd_page_free(gVmbusConnection.MonitorPages, 2); gVmbusConnection.MonitorPages = NULL; } @@ -202,7 +202,7 @@ int VmbusDisconnect(void) if (ret != 0) goto Cleanup; - osd_PageFree(gVmbusConnection.InterruptPage, 1); + osd_page_free(gVmbusConnection.InterruptPage, 1); /* TODO: iterate thru the msg list and free up */ destroy_workqueue(gVmbusConnection.WorkQueue); diff --git a/drivers/staging/hv/hv.c b/drivers/staging/hv/hv.c index 66f04d8..a34d713 100644 --- a/drivers/staging/hv/hv.c +++ b/drivers/staging/hv/hv.c @@ -228,9 +228,9 @@ int hv_init(void) /* * Allocate the hypercall page memory - * virtaddr = osd_PageAlloc(1); + * virtaddr = osd_page_alloc(1); */ - virtaddr = osd_VirtualAllocExec(PAGE_SIZE); + virtaddr = osd_virtual_alloc_exec(PAGE_SIZE); if (!virtaddr) { DPRINT_ERR(VMBUS, @@ -462,10 +462,10 @@ void hv_synic_init(void *irqarg) Cleanup: if (hv_context.synic_event_page[cpu]) - osd_PageFree(hv_context.synic_event_page[cpu], 1); + osd_page_free(hv_context.synic_event_page[cpu], 1); if (hv_context.synic_message_page[cpu]) - osd_PageFree(hv_context.synic_message_page[cpu], 1); + osd_page_free(hv_context.synic_message_page[cpu], 1); return; } @@ -502,6 +502,6 @@ void hv_synic_cleanup(void *arg) wrmsrl(HV_X64_MSR_SIEFP, siefp.as_uint64); - osd_PageFree(hv_context.synic_message_page[cpu], 1); - osd_PageFree(hv_context.synic_event_page[cpu], 1); + osd_page_free(hv_context.synic_message_page[cpu], 1); + osd_page_free(hv_context.synic_event_page[cpu], 1); } diff --git a/drivers/staging/hv/netvsc.c b/drivers/staging/hv/netvsc.c index 4c2632c..8022781 100644 --- a/drivers/staging/hv/netvsc.c +++ b/drivers/staging/hv/netvsc.c @@ -221,7 +221,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->ReceiveBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->ReceiveBuffer - osd_PageAlloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->ReceiveBufferSize >> PAGE_SHIFT); if (!netDevice->ReceiveBuffer) { DPRINT_ERR(NETVSC, "unable to allocate receive buffer of size %d", @@ -249,7 +249,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendReceiveBuffer..."); @@ -274,7 +274,7 @@ static int NetVscInitializeReceiveBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendReceiveBufferComplete.Status != NvspStatusSuccess) { @@ -350,7 +350,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) /* ASSERT((netDevice->SendBufferSize & (PAGE_SIZE - 1)) == 0); */ netDevice->SendBuffer - osd_PageAlloc(netDevice->SendBufferSize >> PAGE_SHIFT); + osd_page_alloc(netDevice->SendBufferSize >> PAGE_SHIFT); if (!netDevice->SendBuffer) { DPRINT_ERR(NETVSC, "unable to allocate send buffer of size %d", netDevice->SendBufferSize); @@ -375,7 +375,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - /* osd_WaitEventWait(ext->ChannelInitEvent); */ + /* osd_waitevent_wait(ext->ChannelInitEvent); */ /* Notify the NetVsp of the gpadl handle */ DPRINT_INFO(NETVSC, "Sending NvspMessage1TypeSendSendBuffer..."); @@ -400,7 +400,7 @@ static int NetVscInitializeSendBufferWithNetVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Check the response */ if (initPacket->Messages.Version1Messages.SendSendBufferComplete.Status != NvspStatusSuccess) { @@ -480,7 +480,7 @@ static int NetVscDestroyReceiveBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up receive buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->ReceiveBuffer, + osd_page_free(NetDevice->ReceiveBuffer, NetDevice->ReceiveBufferSize >> PAGE_SHIFT); NetDevice->ReceiveBuffer = NULL; } @@ -553,7 +553,7 @@ static int NetVscDestroySendBuffer(struct netvsc_device *NetDevice) DPRINT_INFO(NETVSC, "Freeing up send buffer..."); /* Free up the receive buffer */ - osd_PageFree(NetDevice->SendBuffer, + osd_page_free(NetDevice->SendBuffer, NetDevice->SendBufferSize >> PAGE_SHIFT); NetDevice->SendBuffer = NULL; } @@ -597,7 +597,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(netDevice->ChannelInitEvent); + osd_waitevent_wait(netDevice->ChannelInitEvent); /* Now, check the response */ /* ASSERT(initPacket->Messages.InitMessages.InitComplete.MaximumMdlChainLength <= MAX_MULTIPAGE_BUFFER_COUNT); */ @@ -651,7 +651,7 @@ static int NetVscConnectToVsp(struct hv_device *Device) * packet) since our Vmbus always set the * VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED flag */ - /* osd_WaitEventWait(NetVscChannel->ChannelInitEvent); */ + /* osd_waitevent_wait(NetVscChannel->ChannelInitEvent); */ /* Post the big receive buffer to NetVSP */ ret = NetVscInitializeReceiveBufferWithNetVsp(Device); @@ -710,7 +710,7 @@ static int NetVscOnDeviceAdd(struct hv_device *Device, void *AdditionalInfo) list_add_tail(&packet->ListEntry, &netDevice->ReceivePacketList); } - netDevice->ChannelInitEvent = osd_WaitEventCreate(); + netDevice->ChannelInitEvent = osd_waitevent_create(); if (!netDevice->ChannelInitEvent) { ret = -ENOMEM; goto Cleanup; @@ -855,7 +855,7 @@ static void NetVscOnSendCompletion(struct hv_device *Device, /* Copy the response back */ memcpy(&netDevice->ChannelInitPacket, nvspPacket, sizeof(struct nvsp_message)); - osd_WaitEventSet(netDevice->ChannelInitEvent); + osd_waitevent_set(netDevice->ChannelInitEvent); } else if (nvspPacket->Header.MessageType = NvspMessage1TypeSendRNDISPacketComplete) { /* Get the send context */ diff --git a/drivers/staging/hv/osd.c b/drivers/staging/hv/osd.c index b39ec25..b699ee2 100644 --- a/drivers/staging/hv/osd.c +++ b/drivers/staging/hv/osd.c @@ -49,7 +49,7 @@ struct osd_callback_struct { void *data; }; -void *osd_VirtualAllocExec(unsigned int size) +void *osd_virtual_alloc_exec(unsigned int size) { #ifdef __x86_64__ return __vmalloc(size, GFP_KERNEL, PAGE_KERNEL_EXEC); @@ -60,7 +60,7 @@ void *osd_VirtualAllocExec(unsigned int size) } /** - * osd_PageAlloc() - Allocate pages + * osd_page_alloc() - Allocate pages * @count: Total number of Kernel pages you want to allocate * * Tries to allocate @count number of consecutive free kernel pages. @@ -68,7 +68,7 @@ void *osd_VirtualAllocExec(unsigned int size) * If successfull it will return pointer to the @count pages. * Mainly used by Hyper-V drivers. */ -void *osd_PageAlloc(unsigned int count) +void *osd_page_alloc(unsigned int count) { void *p; @@ -85,26 +85,26 @@ void *osd_PageAlloc(unsigned int count) /* if (p) memset(p, 0, PAGE_SIZE); */ /* return p; */ } -EXPORT_SYMBOL_GPL(osd_PageAlloc); +EXPORT_SYMBOL_GPL(osd_page_alloc); /** - * osd_PageFree() - Free pages + * osd_page_free() - Free pages * @page: Pointer to the first page to be freed * @count: Total number of Kernel pages you free * - * Frees the pages allocated by osd_PageAlloc() + * Frees the pages allocated by osd_page_alloc() * Mainly used by Hyper-V drivers. */ -void osd_PageFree(void *page, unsigned int count) +void osd_page_free(void *page, unsigned int count) { free_pages((unsigned long)page, get_order(count * PAGE_SIZE)); /*struct page* p = virt_to_page(page); __free_page(p);*/ } -EXPORT_SYMBOL_GPL(osd_PageFree); +EXPORT_SYMBOL_GPL(osd_page_free); /** - * osd_WaitEventCreate() - Create the event queue + * osd_waitevent_create() - Create the event queue * * Allocates memory for a &struct osd_waitevent. And then calls * init_waitqueue_head to set up the wait queue for the event. @@ -114,7 +114,7 @@ EXPORT_SYMBOL_GPL(osd_PageFree); * Returns pointer to &struct osd_waitevent * Mainly used by Hyper-V drivers. */ -struct osd_waitevent *osd_WaitEventCreate(void) +struct osd_waitevent *osd_waitevent_create(void) { struct osd_waitevent *wait = kmalloc(sizeof(struct osd_waitevent), GFP_KERNEL); @@ -125,11 +125,11 @@ struct osd_waitevent *osd_WaitEventCreate(void) init_waitqueue_head(&wait->event); return wait; } -EXPORT_SYMBOL_GPL(osd_WaitEventCreate); +EXPORT_SYMBOL_GPL(osd_waitevent_create); /** - * osd_WaitEventSet() - Wake up the process + * osd_waitevent_set() - Wake up the process * @wait_event: Structure to event to be woken up * * @wait_event is of type &struct osd_waitevent @@ -140,15 +140,15 @@ EXPORT_SYMBOL_GPL(osd_WaitEventCreate); * * Only used by Network and Storage Hyper-V drivers. */ -void osd_WaitEventSet(struct osd_waitevent *wait_event) +void osd_waitevent_set(struct osd_waitevent *wait_event) { wait_event->condition = 1; wake_up_interruptible(&wait_event->event); } -EXPORT_SYMBOL_GPL(osd_WaitEventSet); +EXPORT_SYMBOL_GPL(osd_waitevent_set); /** - * osd_WaitEventWait() - Wait for event till condition is true + * osd_waitevent_wait() - Wait for event till condition is true * @wait_event: Structure to event to be put to sleep * * @wait_event is of type &struct osd_waitevent @@ -161,7 +161,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventSet); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWait(struct osd_waitevent *wait_event) +int osd_waitevent_wait(struct osd_waitevent *wait_event) { int ret = 0; @@ -170,10 +170,10 @@ int osd_WaitEventWait(struct osd_waitevent *wait_event) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWait); +EXPORT_SYMBOL_GPL(osd_waitevent_wait); /** - * osd_WaitEventWaitEx() - Wait for event or timeout for process wakeup + * osd_waitevent_waitex() - Wait for event or timeout for process wakeup * @wait_event: Structure to event to be put to sleep * @timeout_in_ms: Total number of Milliseconds to wait before waking up * @@ -187,7 +187,7 @@ EXPORT_SYMBOL_GPL(osd_WaitEventWait); * * Mainly used by Hyper-V drivers. */ -int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) +int osd_waitevent_waitex(struct osd_waitevent *wait_event, u32 timeout_in_ms) { int ret = 0; @@ -197,7 +197,7 @@ int osd_WaitEventWaitEx(struct osd_waitevent *wait_event, u32 timeout_in_ms) wait_event->condition = 0; return ret; } -EXPORT_SYMBOL_GPL(osd_WaitEventWaitEx); +EXPORT_SYMBOL_GPL(osd_waitevent_waitex); static void osd_callback_work(struct work_struct *work) { diff --git a/drivers/staging/hv/osd.h b/drivers/staging/hv/osd.h index ce064e8..cae126f 100644 --- a/drivers/staging/hv/osd.h +++ b/drivers/staging/hv/osd.h @@ -50,18 +50,18 @@ struct osd_waitevent { /* Osd routines */ -extern void *osd_VirtualAllocExec(unsigned int size); +extern void *osd_virtual_alloc_exec(unsigned int size); -extern void *osd_PageAlloc(unsigned int count); -extern void osd_PageFree(void *page, unsigned int count); +extern void *osd_page_alloc(unsigned int count); +extern void osd_page_free(void *page, unsigned int count); -extern struct osd_waitevent *osd_WaitEventCreate(void); -extern void osd_WaitEventSet(struct osd_waitevent *waitEvent); -extern int osd_WaitEventWait(struct osd_waitevent *waitEvent); +extern struct osd_waitevent *osd_waitevent_create(void); +extern void osd_waitevent_set(struct osd_waitevent *wait_event); +extern int osd_waitevent_wait(struct osd_waitevent *wait_event); -/* If >0, waitEvent got signaled. If ==0, timeout. If < 0, error */ -extern int osd_WaitEventWaitEx(struct osd_waitevent *waitEvent, - u32 TimeoutInMs); +/* If >0, wait_event got signaled. If ==0, timeout. If < 0, error */ +extern int osd_waitevent_waitex(struct osd_waitevent *wait_event, + u32 timeout_in_ms); int osd_schedule_callback(struct workqueue_struct *wq, void (*func)(void *), diff --git a/drivers/staging/hv/rndis_filter.c b/drivers/staging/hv/rndis_filter.c index fa2141f..b85c825 100644 --- a/drivers/staging/hv/rndis_filter.c +++ b/drivers/staging/hv/rndis_filter.c @@ -129,7 +129,7 @@ static struct rndis_request *GetRndisRequest(struct rndis_device *Device, if (!request) return NULL; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { kfree(request); return NULL; @@ -313,7 +313,7 @@ static void RndisFilterReceiveResponse(struct rndis_device *Device, } } - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { DPRINT_ERR(NETVSC, "no rndis request found for this response " "(id 0x%x res type 0x%x)", @@ -497,7 +497,7 @@ static int RndisFilterQueryDevice(struct rndis_device *Device, u32 Oid, if (ret != 0) goto Cleanup; - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* Copy the response back */ queryComplete = &request->ResponseMessage.Message.QueryComplete; @@ -572,7 +572,7 @@ static int RndisFilterSetPacketFilter(struct rndis_device *Device, if (ret != 0) goto Cleanup; - ret = osd_WaitEventWaitEx(request->WaitEvent, 2000/*2sec*/); + ret = osd_waitevent_waitex(request->WaitEvent, 2000/*2sec*/); if (!ret) { ret = -1; DPRINT_ERR(NETVSC, "timeout before we got a set response..."); @@ -665,7 +665,7 @@ static int RndisFilterInitDevice(struct rndis_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); initComplete = &request->ResponseMessage.Message.InitializeComplete; status = initComplete->Status; diff --git a/drivers/staging/hv/storvsc.c b/drivers/staging/hv/storvsc.c index 19e87f6..525c8ee 100644 --- a/drivers/staging/hv/storvsc.c +++ b/drivers/staging/hv/storvsc.c @@ -198,7 +198,7 @@ static int StorVscChannelInit(struct hv_device *Device) * channel */ memset(request, 0, sizeof(struct storvsc_request_extension)); - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto nomem; @@ -224,7 +224,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -255,7 +255,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -287,7 +287,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); /* TODO: Check returned version */ if (vstorPacket->Operation != VStorOperationCompleteIo || @@ -323,7 +323,7 @@ static int StorVscChannelInit(struct hv_device *Device) goto Cleanup; } - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); if (vstorPacket->Operation != VStorOperationCompleteIo || vstorPacket->Status != 0) { @@ -473,7 +473,7 @@ static void StorVscOnChannelCallback(void *context) memcpy(&request->VStorPacket, packet, sizeof(struct vstor_packet)); - osd_WaitEventSet(request->WaitEvent); + osd_waitevent_set(request->WaitEvent); } else { StorVscOnReceive(device, (struct vstor_packet *)packet, @@ -622,7 +622,7 @@ int StorVscOnHostReset(struct hv_device *Device) request = &storDevice->ResetRequest; vstorPacket = &request->VStorPacket; - request->WaitEvent = osd_WaitEventCreate(); + request->WaitEvent = osd_waitevent_create(); if (!request->WaitEvent) { ret = -ENOMEM; goto Cleanup; @@ -644,7 +644,7 @@ int StorVscOnHostReset(struct hv_device *Device) } /* FIXME: Add a timeout */ - osd_WaitEventWait(request->WaitEvent); + osd_waitevent_wait(request->WaitEvent); kfree(request->WaitEvent); DPRINT_INFO(STORVSC, "host adapter reset completed"); -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 08/10] staging: hv: Convert camel cased struct fields in ring_buffer.h to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased struct fields in ring_buffer.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 | 10 +++--- drivers/staging/hv/ring_buffer.c | 58 ++++++++++++++++++++----------------- drivers/staging/hv/ring_buffer.h | 30 ++++++++++---------- drivers/staging/hv/vmbus_drv.c | 25 +++++++++------- 4 files changed, 65 insertions(+), 58 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index abc2988..0e554e9 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -213,7 +213,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_gpadlhandle = 0; ret = vmbus_establish_gpadl(newchannel, - newchannel->outbound.RingBuffer, + newchannel->outbound.ring_buffer, send_ringbuffer_size + recv_ringbuffer_size, &newchannel->ringbuffer_gpadlhandle); @@ -227,10 +227,10 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, "size %d recv ring %p size %d, downstreamoffset %d>", newchannel, newchannel->offermsg.child_relid, newchannel->ringbuffer_gpadlhandle, - newchannel->outbound.RingBuffer, - newchannel->outbound.RingSize, - newchannel->inbound.RingBuffer, - newchannel->inbound.RingSize, + newchannel->outbound.ring_buffer, + newchannel->outbound.ring_size, + newchannel->inbound.ring_buffer, + newchannel->inbound.ring_size, send_ringbuffer_size); /* Create and init the channel open message */ diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index d78c569..6095cc5 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -51,11 +51,11 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) u32 read_loc, write_loc; /* Capture the read/write indices before they changed */ - read_loc = rbi->RingBuffer->ReadIndex; - write_loc = rbi->RingBuffer->WriteIndex; + read_loc = rbi->ring_buffer->read_index; + write_loc = rbi->ring_buffer->write_index; - *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->RingDataSize); - *read = rbi->RingDataSize - *write; + *write = BYTES_AVAIL_TO_WRITE(read_loc, write_loc, rbi->ring_datasize); + *read = rbi->ring_datasize - *write; } /*++ @@ -70,7 +70,7 @@ Description: static inline u32 GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->WriteIndex; + u32 next = RingInfo->ring_buffer->write_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -90,7 +90,7 @@ static inline void SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, u32 NextWriteLocation) { - RingInfo->RingBuffer->WriteIndex = NextWriteLocation; + RingInfo->ring_buffer->write_index = NextWriteLocation; } /*++ @@ -105,7 +105,7 @@ Description: static inline u32 GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ @@ -125,11 +125,11 @@ Description: static inline u32 GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) { - u32 next = RingInfo->RingBuffer->ReadIndex; + u32 next = RingInfo->ring_buffer->read_index; /* ASSERT(next < RingInfo->RingDataSize); */ next += Offset; - next %= RingInfo->RingDataSize; + next %= RingInfo->ring_datasize; return next; } @@ -146,7 +146,7 @@ Description: static inline void SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) { - RingInfo->RingBuffer->ReadIndex = NextReadLocation; + RingInfo->ring_buffer->read_index = NextReadLocation; } @@ -162,7 +162,7 @@ Description: static inline void * GetRingBuffer(struct hv_ring_buffer_info *RingInfo) { - return (void *)RingInfo->RingBuffer->Buffer; + return (void *)RingInfo->ring_buffer->buffer; } @@ -178,7 +178,7 @@ Description: static inline u32 GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) { - return RingInfo->RingDataSize; + return RingInfo->ring_datasize; } /*++ @@ -193,7 +193,7 @@ Description: static inline u64 GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) { - return (u64)RingInfo->RingBuffer->WriteIndex << 32; + return (u64)RingInfo->ring_buffer->write_index << 32; } @@ -221,11 +221,11 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) "avail read %u read idx %u write idx %u>>", Prefix, RingInfo, - RingInfo->RingBuffer->Buffer, + RingInfo->ring_buffer->buffer, bytesAvailToWrite, bytesAvailToRead, - RingInfo->RingBuffer->ReadIndex, - RingInfo->RingBuffer->WriteIndex); + RingInfo->ring_buffer->read_index, + RingInfo->ring_buffer->write_index); } @@ -262,16 +262,19 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, u32 bytesAvailToWrite; u32 bytesAvailToRead; - if (RingInfo->RingBuffer) { + if (RingInfo->ring_buffer) { GetRingBufferAvailBytes(RingInfo, &bytesAvailToRead, &bytesAvailToWrite); - debug_info->BytesAvailToRead = bytesAvailToRead; - debug_info->BytesAvailToWrite = bytesAvailToWrite; - debug_info->CurrentReadIndex = RingInfo->RingBuffer->ReadIndex; - debug_info->CurrentWriteIndex = RingInfo->RingBuffer->WriteIndex; - debug_info->CurrentInterruptMask = RingInfo->RingBuffer->InterruptMask; + debug_info->bytes_avail_toread = bytesAvailToRead; + debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->current_read_index + RingInfo->ring_buffer->read_index; + debug_info->current_write_index + RingInfo->ring_buffer->write_index; + debug_info->current_interrupt_mask + RingInfo->ring_buffer->interrupt_mask; } } @@ -287,7 +290,7 @@ Description: --*/ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) { - return rbi->RingBuffer->InterruptMask; + return rbi->ring_buffer->interrupt_mask; } /*++ @@ -306,11 +309,12 @@ int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 Buffe memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->RingBuffer = (struct hv_ring_buffer *)Buffer; - RingInfo->RingBuffer->ReadIndex = RingInfo->RingBuffer->WriteIndex = 0; + RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; + RingInfo->ring_buffer->read_index + RingInfo->ring_buffer->write_index = 0; - RingInfo->RingSize = BufferLen; - RingInfo->RingDataSize = BufferLen - sizeof(struct hv_ring_buffer); + RingInfo->ring_size = BufferLen; + RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); spin_lock_init(&RingInfo->ring_lock); diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index a7f1717..bb4c5bc 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -29,18 +29,18 @@ struct hv_ring_buffer { /* Offset in bytes from the start of ring data below */ - volatile u32 WriteIndex; + volatile u32 write_index; /* Offset in bytes from the start of ring data below */ - volatile u32 ReadIndex; + volatile u32 read_index; - volatile u32 InterruptMask; + volatile u32 interrupt_mask; /* Pad it to PAGE_SIZE so that data starts on page boundary */ - u8 Reserved[4084]; + u8 reserved[4084]; /* NOTE: - * The InterruptMask field is used only for channels but since our + * The interrupt_mask field is used only for channels but since our * vmbus connection also uses this data structure and its data starts * here, we commented out this field. */ @@ -50,24 +50,24 @@ struct hv_ring_buffer { * Ring data starts here + RingDataStartOffset * !!! DO NOT place any fields below this !!! */ - u8 Buffer[0]; + u8 buffer[0]; } __attribute__((packed)); struct hv_ring_buffer_info { - struct hv_ring_buffer *RingBuffer; - u32 RingSize; /* Include the shared header */ + struct hv_ring_buffer *ring_buffer; + u32 ring_size; /* Include the shared header */ spinlock_t ring_lock; - u32 RingDataSize; /* < ringSize */ - u32 RingDataStartOffset; + u32 ring_datasize; /* < ring_size */ + u32 ring_data_startoffset; }; struct hv_ring_buffer_debug_info { - u32 CurrentInterruptMask; - u32 CurrentReadIndex; - u32 CurrentWriteIndex; - u32 BytesAvailToRead; - u32 BytesAvailToWrite; + u32 current_interrupt_mask; + u32 current_read_index; + u32 current_write_index; + u32 bytes_avail_toread; + u32 bytes_avail_towrite; }; diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 2bbf4ec..0965875 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -156,18 +156,21 @@ static void get_channel_info(struct hv_device *device, info->ClientMonitorLatency = debug_info.clientmonitor_latency; info->ClientMonitorConnectionId = debug_info.clientmonitor_connectionid; - info->Inbound.InterruptMask = debug_info.inbound.CurrentInterruptMask; - info->Inbound.ReadIndex = debug_info.inbound.CurrentReadIndex; - info->Inbound.WriteIndex = debug_info.inbound.CurrentWriteIndex; - info->Inbound.BytesAvailToRead = debug_info.inbound.BytesAvailToRead; - info->Inbound.BytesAvailToWrite = debug_info.inbound.BytesAvailToWrite; - - info->Outbound.InterruptMask = debug_info.outbound.CurrentInterruptMask; - info->Outbound.ReadIndex = debug_info.outbound.CurrentReadIndex; - info->Outbound.WriteIndex = debug_info.outbound.CurrentWriteIndex; - info->Outbound.BytesAvailToRead = debug_info.outbound.BytesAvailToRead; + info->Inbound.InterruptMask = debug_info.inbound.current_interrupt_mask; + info->Inbound.ReadIndex = debug_info.inbound.current_read_index; + info->Inbound.WriteIndex = debug_info.inbound.current_write_index; + info->Inbound.BytesAvailToRead = debug_info.inbound.bytes_avail_toread; + info->Inbound.BytesAvailToWrite + debug_info.inbound.bytes_avail_towrite; + + info->Outbound.InterruptMask + debug_info.outbound.current_interrupt_mask; + info->Outbound.ReadIndex = debug_info.outbound.current_read_index; + info->Outbound.WriteIndex = debug_info.outbound.current_write_index; + info->Outbound.BytesAvailToRead + debug_info.outbound.bytes_avail_toread; info->Outbound.BytesAvailToWrite - debug_info.outbound.BytesAvailToWrite; + debug_info.outbound.bytes_avail_towrite; } /* -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 09/10] staging: hv: Convert camel cased local variables in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased local variables in ring_buffer.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 | 4 +- drivers/staging/hv/ring_buffer.c | 337 +++++++++++++++++++------------------- drivers/staging/hv/ring_buffer.h | 26 ++-- 3 files changed, 185 insertions(+), 182 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 0e554e9..97db545 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - DumpRingInfo(&channel->outbound, "Outbound "); - DumpRingInfo(&channel->inbound, "Inbound "); + Dumpring_info(&channel->outbound, "Outbound "); + Dumpring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 6095cc5..705d95f 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -68,11 +68,11 @@ Description: --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *RingInfo) +GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->write_index; + u32 next = ring_info->ring_buffer->write_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -87,10 +87,10 @@ Description: --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *RingInfo, - u32 NextWriteLocation) +SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, + u32 next_write_location) { - RingInfo->ring_buffer->write_index = NextWriteLocation; + ring_info->ring_buffer->write_index = next_write_location; } /*++ @@ -103,11 +103,11 @@ Description: --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *RingInfo) +GetNextReadLocation(struct hv_ring_buffer_info *ring_info) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ + /* ASSERT(next < ring_info->RingDataSize); */ return next; } @@ -123,13 +123,13 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *RingInfo, u32 Offset) +GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) { - u32 next = RingInfo->ring_buffer->read_index; + u32 next = ring_info->ring_buffer->read_index; - /* ASSERT(next < RingInfo->RingDataSize); */ - next += Offset; - next %= RingInfo->ring_datasize; + /* ASSERT(next < ring_info->RingDataSize); */ + next += offset; + next %= ring_info->ring_datasize; return next; } @@ -144,9 +144,10 @@ Description: --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *RingInfo, u32 NextReadLocation) +SetNextReadLocation(struct hv_ring_buffer_info *ring_info, + u32 next_read_location) { - RingInfo->ring_buffer->read_index = NextReadLocation; + ring_info->ring_buffer->read_index = next_read_location; } @@ -160,9 +161,9 @@ Description: --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *RingInfo) +GetRingBuffer(struct hv_ring_buffer_info *ring_info) { - return (void *)RingInfo->ring_buffer->buffer; + return (void *)ring_info->ring_buffer->buffer; } @@ -176,9 +177,9 @@ Description: --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *RingInfo) +GetRingBufferSize(struct hv_ring_buffer_info *ring_info) { - return RingInfo->ring_datasize; + return ring_info->ring_datasize; } /*++ @@ -191,41 +192,41 @@ Description: --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *RingInfo) +GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) { - return (u64)RingInfo->ring_buffer->write_index << 32; + return (u64)ring_info->ring_buffer->write_index << 32; } /*++ Name: - DumpRingInfo() + Dumpring_info() Description: Dump out to console the ring buffer info --*/ -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); DPRINT(VMBUS, DEBUG_RING_LVL, "%s <<ringinfo %p buffer %p avail write %u " "avail read %u read idx %u write idx %u>>", - Prefix, - RingInfo, - RingInfo->ring_buffer->buffer, - bytesAvailToWrite, - bytesAvailToRead, - RingInfo->ring_buffer->read_index, - RingInfo->ring_buffer->write_index); + prefix, + ring_info, + ring_info->ring_buffer->buffer, + bytes_avail_towrite, + bytes_avail_toread, + ring_info->ring_buffer->read_index, + ring_info->ring_buffer->write_index); } @@ -233,17 +234,17 @@ void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix) static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen); + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen); static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset); + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset); @@ -256,25 +257,25 @@ Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; - if (RingInfo->ring_buffer) { - GetRingBufferAvailBytes(RingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + if (ring_info->ring_buffer) { + GetRingBufferAvailBytes(ring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - debug_info->bytes_avail_toread = bytesAvailToRead; - debug_info->bytes_avail_towrite = bytesAvailToWrite; + debug_info->bytes_avail_toread = bytes_avail_toread; + debug_info->bytes_avail_towrite = bytes_avail_towrite; debug_info->current_read_index - RingInfo->ring_buffer->read_index; + ring_info->ring_buffer->read_index; debug_info->current_write_index - RingInfo->ring_buffer->write_index; + ring_info->ring_buffer->write_index; debug_info->current_interrupt_mask - RingInfo->ring_buffer->interrupt_mask; + ring_info->ring_buffer->interrupt_mask; } } @@ -302,21 +303,22 @@ Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, u32 BufferLen) +int RingBufferInit(struct hv_ring_buffer_info *ring_info, + void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) return -EINVAL; - memset(RingInfo, 0, sizeof(struct hv_ring_buffer_info)); + memset(ring_info, 0, sizeof(struct hv_ring_buffer_info)); - RingInfo->ring_buffer = (struct hv_ring_buffer *)Buffer; - RingInfo->ring_buffer->read_index - RingInfo->ring_buffer->write_index = 0; + ring_info->ring_buffer = (struct hv_ring_buffer *)buffer; + ring_info->ring_buffer->read_index + ring_info->ring_buffer->write_index = 0; - RingInfo->ring_size = BufferLen; - RingInfo->ring_datasize = BufferLen - sizeof(struct hv_ring_buffer); + ring_info->ring_size = buflen; + ring_info->ring_datasize = buflen - sizeof(struct hv_ring_buffer); - spin_lock_init(&RingInfo->ring_lock); + spin_lock_init(&ring_info->ring_lock); return 0; } @@ -330,7 +332,7 @@ Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo) +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) { } @@ -343,78 +345,78 @@ Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *OutRingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; - u32 byteAvailToWrite; - u32 byteAvailToRead; - u32 totalBytesToWrite = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 totalbytes_towrite = 0; struct scatterlist *sg; - volatile u32 nextWriteLocation; - u64 prevIndices = 0; + volatile u32 next_write_location; + u64 prev_indices = 0; unsigned long flags; for_each_sg(sglist, sg, sgcount, i) { - totalBytesToWrite += sg->length; + totalbytes_towrite += sg->length; } - totalBytesToWrite += sizeof(u64); + totalbytes_towrite += sizeof(u64); - spin_lock_irqsave(&OutRingInfo->ring_lock, flags); + spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(OutRingInfo, - &byteAvailToRead, - &byteAvailToWrite); + GetRingBufferAvailBytes(outring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Writing %u bytes...", totalBytesToWrite); + DPRINT_DBG(VMBUS, "Writing %u bytes...", totalbytes_towrite); - /* DumpRingInfo(OutRingInfo, "BEFORE "); */ + /* Dumpring_info(Outring_info, "BEFORE "); */ /* If there is only room for the packet, assume it is full. */ /* Otherwise, the next time around, we think the ring buffer */ /* is empty since the read index == write index */ - if (byteAvailToWrite <= totalBytesToWrite) { + if (bytes_avail_towrite <= totalbytes_towrite) { DPRINT_DBG(VMBUS, "No more space left on outbound ring buffer " "(needed %u, avail %u)", - totalBytesToWrite, - byteAvailToWrite); + totalbytes_towrite, + bytes_avail_towrite); - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return -1; } /* Write to the ring buffer */ - nextWriteLocation = GetNextWriteLocation(OutRingInfo); + next_write_location = GetNextWriteLocation(outring_info); for_each_sg(sglist, sg, sgcount, i) { - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prevIndices = GetRingBufferIndices(OutRingInfo); + prev_indices = GetRingBufferIndices(outring_info); - nextWriteLocation = CopyToRingBuffer(OutRingInfo, - nextWriteLocation, - &prevIndices, + next_write_location = CopyToRingBuffer(outring_info, + next_write_location, + &prev_indices, sizeof(u64)); /* Make sure we flush all writes before updating the writeIndex */ mb(); /* Now, update the write location */ - SetNextWriteLocation(OutRingInfo, nextWriteLocation); + SetNextWriteLocation(outring_info, next_write_location); - /* DumpRingInfo(OutRingInfo, "AFTER "); */ + /* Dumpring_info(Outring_info, "AFTER "); */ - spin_unlock_irqrestore(&OutRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&outring_info->ring_lock, flags); return 0; } @@ -428,41 +430,42 @@ Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *InRingInfo, void *Buffer, u32 BufferLen) +int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, + void *Buffer, u32 buflen) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; unsigned long flags; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(Inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { /* DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, + bytes_avail_toread, BufferLen); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return -1; } /* Convert to byte offset */ - nextReadLocation = GetNextReadLocation(InRingInfo); + next_read_location = GetNextReadLocation(Inring_info); - nextReadLocation = CopyFromRingBuffer(InRingInfo, + next_read_location = CopyFromRingBuffer(Inring_info, Buffer, - BufferLen, - nextReadLocation); + buflen, + next_read_location); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&Inring_info->ring_lock, flags); return 0; } @@ -477,52 +480,52 @@ Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, - u32 BufferLen, u32 Offset) +int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, + u32 buflen, u32 offset) { - u32 bytesAvailToWrite; - u32 bytesAvailToRead; - u32 nextReadLocation = 0; - u64 prevIndices = 0; + u32 bytes_avail_towrite; + u32 bytes_avail_toread; + u32 next_read_location = 0; + u64 prev_indices = 0; unsigned long flags; - if (BufferLen <= 0) + if (buflen <= 0) return -EINVAL; - spin_lock_irqsave(&InRingInfo->ring_lock, flags); + spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(InRingInfo, - &bytesAvailToRead, - &bytesAvailToWrite); + GetRingBufferAvailBytes(inring_info, + &bytes_avail_toread, + &bytes_avail_towrite); - DPRINT_DBG(VMBUS, "Reading %u bytes...", BufferLen); + DPRINT_DBG(VMBUS, "Reading %u bytes...", buflen); - /* DumpRingInfo(InRingInfo, "BEFORE "); */ + /* Dumpring_info(Inring_info, "BEFORE "); */ /* Make sure there is something to read */ - if (bytesAvailToRead < BufferLen) { + if (bytes_avail_toread < buflen) { DPRINT_DBG(VMBUS, "got callback but not enough to read " "<avail to read %d read size %d>!!", - bytesAvailToRead, - BufferLen); + bytes_avail_toread, + buflen); - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return -1; } - nextReadLocation = GetNextReadLocationWithOffset(InRingInfo, Offset); + next_read_location = GetNextReadLocationWithOffset(inring_info, offset); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - Buffer, - BufferLen, - nextReadLocation); + next_read_location = CopyFromRingBuffer(inring_info, + buffer, + buflen, + next_read_location); - nextReadLocation = CopyFromRingBuffer(InRingInfo, - &prevIndices, + next_read_location = CopyFromRingBuffer(inring_info, + &prev_indices, sizeof(u64), - nextReadLocation); + next_read_location); /* Make sure all reads are done before we update the read index since */ /* the writer may start writing to the read area once the read index */ @@ -530,11 +533,11 @@ int RingBufferRead(struct hv_ring_buffer_info *InRingInfo, void *Buffer, mb(); /* Update the read index */ - SetNextReadLocation(InRingInfo, nextReadLocation); + SetNextReadLocation(inring_info, next_read_location); - /* DumpRingInfo(InRingInfo, "AFTER "); */ + /* Dumpring_info(Inring_info, "AFTER "); */ - spin_unlock_irqrestore(&InRingInfo->ring_lock, flags); + spin_unlock_irqrestore(&inring_info->ring_lock, flags); return 0; } @@ -552,29 +555,29 @@ Description: --*/ static u32 CopyToRingBuffer( - struct hv_ring_buffer_info *RingInfo, - u32 StartWriteOffset, - void *Src, - u32 SrcLen) + struct hv_ring_buffer_info *ring_info, + u32 start_write_offset, + void *src, + u32 srclen) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); - u32 fragLen; + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); + u32 frag_len; /* wrap-around detected! */ - if (SrcLen > ringBufferSize - StartWriteOffset) { + if (srclen > ring_buffer_size - start_write_offset) { DPRINT_DBG(VMBUS, "wrap-around detected!"); - fragLen = ringBufferSize - StartWriteOffset; - memcpy(ringBuffer + StartWriteOffset, Src, fragLen); - memcpy(ringBuffer, Src + fragLen, SrcLen - fragLen); + frag_len = ring_buffer_size - start_write_offset; + memcpy(ring_buffer + start_write_offset, src, frag_len); + memcpy(ring_buffer, src + frag_len, srclen - frag_len); } else - memcpy(ringBuffer + StartWriteOffset, Src, SrcLen); + memcpy(ring_buffer + start_write_offset, src, srclen); - StartWriteOffset += SrcLen; - StartWriteOffset %= ringBufferSize; + start_write_offset += srclen; + start_write_offset %= ring_buffer_size; - return StartWriteOffset; + return start_write_offset; } @@ -590,33 +593,33 @@ Description: --*/ static u32 CopyFromRingBuffer( - struct hv_ring_buffer_info *RingInfo, - void *Dest, - u32 DestLen, - u32 StartReadOffset) + struct hv_ring_buffer_info *ring_info, + void *dest, + u32 destlen, + u32 start_read_offset) { - void *ringBuffer = GetRingBuffer(RingInfo); - u32 ringBufferSize = GetRingBufferSize(RingInfo); + void *ring_buffer = GetRingBuffer(ring_info); + u32 ring_buffer_size = GetRingBufferSize(ring_info); - u32 fragLen; + u32 frag_len; /* wrap-around detected at the src */ - if (DestLen > ringBufferSize - StartReadOffset) { + if (destlen > ring_buffer_size - start_read_offset) { DPRINT_DBG(VMBUS, "src wrap-around detected!"); - fragLen = ringBufferSize - StartReadOffset; + frag_len = ring_buffer_size - start_read_offset; - memcpy(Dest, ringBuffer + StartReadOffset, fragLen); - memcpy(Dest + fragLen, ringBuffer, DestLen - fragLen); + memcpy(dest, ring_buffer + start_read_offset, frag_len); + memcpy(dest + frag_len, ring_buffer, destlen - frag_len); } else - memcpy(Dest, ringBuffer + StartReadOffset, DestLen); + memcpy(dest, ring_buffer + start_read_offset, destlen); - StartReadOffset += DestLen; - StartReadOffset %= ringBufferSize; + start_read_offset += destlen; + start_read_offset %= ring_buffer_size; - return StartReadOffset; + return start_read_offset; } diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index bb4c5bc..f30be1f 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *RingInfo); +void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *RingInfo, +int RingBufferWrite(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *RingInfo, void *Buffer, - u32 BufferLen); +int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, + u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *RingInfo, - void *Buffer, - u32 BufferLen, - u32 Offset); +int RingBufferRead(struct hv_ring_buffer_info *ring_info, + void *buffer, + u32 buflen, + u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *RingInfo); +u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); -void DumpRingInfo(struct hv_ring_buffer_info *RingInfo, char *Prefix); +void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *RingInfo, +void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Haiyang Zhang
2010-Nov-08 22:04 UTC
[PATCH 10/10] staging: hv: Convert camel cased functions in ring_buffer.c to lower cases
From: Haiyang Zhang <haiyangz at microsoft.com> staging: hv: Convert camel cased functions in ring_buffer.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 | 40 ++++++------ drivers/staging/hv/ring_buffer.c | 123 +++++++++++++++++++------------------ drivers/staging/hv/ring_buffer.h | 16 +++--- 3 files changed, 91 insertions(+), 88 deletions(-) diff --git a/drivers/staging/hv/channel.c b/drivers/staging/hv/channel.c index 97db545..45a627d 100644 --- a/drivers/staging/hv/channel.c +++ b/drivers/staging/hv/channel.c @@ -155,8 +155,8 @@ void vmbus_get_debug_info(struct vmbus_channel *channel, monitorpage->parameter[monitor_group] [monitor_offset].connectionid.u.id; - RingBufferGetDebugInfo(&channel->inbound, &debuginfo->inbound); - RingBufferGetDebugInfo(&channel->outbound, &debuginfo->outbound); + ringbuffer_get_debuginfo(&channel->inbound, &debuginfo->inbound); + ringbuffer_get_debuginfo(&channel->outbound, &debuginfo->outbound); } /* @@ -193,13 +193,13 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->ringbuffer_pagecount = (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT; - ret = RingBufferInit(&newchannel->outbound, out, send_ringbuffer_size); + ret = ringbuffer_init(&newchannel->outbound, out, send_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; } - ret = RingBufferInit(&newchannel->inbound, in, recv_ringbuffer_size); + ret = ringbuffer_init(&newchannel->inbound, in, recv_ringbuffer_size); if (ret != 0) { err = ret; goto errorout; @@ -298,8 +298,8 @@ Cleanup: return 0; errorout: - RingBufferCleanup(&newchannel->outbound); - RingBufferCleanup(&newchannel->inbound); + ringbuffer_cleanup(&newchannel->outbound); + ringbuffer_cleanup(&newchannel->inbound); osd_page_free(out, (send_ringbuffer_size + recv_ringbuffer_size) >> PAGE_SHIFT); kfree(openInfo); @@ -683,8 +683,8 @@ void vmbus_close(struct vmbus_channel *channel) /* TODO: Send a msg to release the childRelId */ /* Cleanup the ring buffers for this channel */ - RingBufferCleanup(&channel->outbound); - RingBufferCleanup(&channel->inbound); + ringbuffer_cleanup(&channel->outbound); + ringbuffer_cleanup(&channel->inbound); osd_page_free(channel->ringbuffer_pages, channel->ringbuffer_pagecount); @@ -752,10 +752,10 @@ int vmbus_sendpacket(struct vmbus_channel *channel, const void *buffer, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -817,10 +817,10 @@ int vmbus_sendpacket_pagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -886,10 +886,10 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, sg_set_buf(&bufferlist[2], &aligned_data, packetlen_aligned - packetlen); - ret = RingBufferWrite(&channel->outbound, bufferlist, 3); + ret = ringbuffer_write(&channel->outbound, bufferlist, 3); /* TODO: We should determine if this is optional */ - if (ret == 0 && !GetRingBufferInterruptMask(&channel->outbound)) + if (ret == 0 && !get_ringbuffer_interrupt_mask(&channel->outbound)) vmbus_setevent(channel); return ret; @@ -923,7 +923,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -956,7 +956,7 @@ int vmbus_recvpacket(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, userlen, + ret = ringbuffer_read(&channel->inbound, buffer, userlen, (desc.DataOffset8 << 3)); spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -983,7 +983,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, spin_lock_irqsave(&channel->inbound_lock, flags); - ret = RingBufferPeek(&channel->inbound, &desc, + ret = ringbuffer_peek(&channel->inbound, &desc, sizeof(struct vmpacket_descriptor)); if (ret != 0) { spin_unlock_irqrestore(&channel->inbound_lock, flags); @@ -1015,7 +1015,7 @@ int vmbus_recvpacket_raw(struct vmbus_channel *channel, void *buffer, *requestid = desc.TransactionId; /* Copy over the entire packet to the user buffer */ - ret = RingBufferRead(&channel->inbound, buffer, packetlen, 0); + ret = ringbuffer_read(&channel->inbound, buffer, packetlen, 0); spin_unlock_irqrestore(&channel->inbound_lock, flags); return 0; @@ -1052,6 +1052,6 @@ void vmbus_ontimer(unsigned long data) static void dump_vmbus_channel(struct vmbus_channel *channel) { DPRINT_DBG(VMBUS, "Channel (%d)", channel->offermsg.child_relid); - Dumpring_info(&channel->outbound, "Outbound "); - Dumpring_info(&channel->inbound, "Inbound "); + dump_ring_info(&channel->outbound, "Outbound "); + dump_ring_info(&channel->inbound, "Inbound "); } diff --git a/drivers/staging/hv/ring_buffer.c b/drivers/staging/hv/ring_buffer.c index 705d95f..4d53392 100644 --- a/drivers/staging/hv/ring_buffer.c +++ b/drivers/staging/hv/ring_buffer.c @@ -38,7 +38,7 @@ /*++ Name: - GetRingBufferAvailBytes() + get_ringbuffer_availbytes() Description: Get number of bytes available to read and to write to @@ -46,7 +46,8 @@ Description: --*/ static inline void -GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) +get_ringbuffer_availbytes(struct hv_ring_buffer_info *rbi, + u32 *read, u32 *write) { u32 read_loc, write_loc; @@ -61,14 +62,14 @@ GetRingBufferAvailBytes(struct hv_ring_buffer_info *rbi, u32 *read, u32 *write) /*++ Name: - GetNextWriteLocation() + get_next_write_location() Description: Get the next write location for the specified ring buffer --*/ static inline u32 -GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) +get_next_write_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->write_index; @@ -80,14 +81,14 @@ GetNextWriteLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - SetNextWriteLocation() + set_next_write_location() Description: Set the next write location for the specified ring buffer --*/ static inline void -SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, +set_next_write_location(struct hv_ring_buffer_info *ring_info, u32 next_write_location) { ring_info->ring_buffer->write_index = next_write_location; @@ -96,14 +97,14 @@ SetNextWriteLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetNextReadLocation() + get_next_read_location() Description: Get the next read location for the specified ring buffer --*/ static inline u32 -GetNextReadLocation(struct hv_ring_buffer_info *ring_info) +get_next_read_location(struct hv_ring_buffer_info *ring_info) { u32 next = ring_info->ring_buffer->read_index; @@ -115,7 +116,7 @@ GetNextReadLocation(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetNextReadLocationWithOffset() + get_next_readlocation_withoffset() Description: Get the next read location + offset for the specified ring buffer. @@ -123,7 +124,8 @@ Description: --*/ static inline u32 -GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) +get_next_readlocation_withoffset(struct hv_ring_buffer_info *ring_info, + u32 offset) { u32 next = ring_info->ring_buffer->read_index; @@ -137,14 +139,14 @@ GetNextReadLocationWithOffset(struct hv_ring_buffer_info *ring_info, u32 offset) /*++ Name: - SetNextReadLocation() + set_next_read_location() Description: Set the next read location for the specified ring buffer --*/ static inline void -SetNextReadLocation(struct hv_ring_buffer_info *ring_info, +set_next_read_location(struct hv_ring_buffer_info *ring_info, u32 next_read_location) { ring_info->ring_buffer->read_index = next_read_location; @@ -154,14 +156,14 @@ SetNextReadLocation(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBuffer() + get_ring_buffer() Description: Get the start of the ring buffer --*/ static inline void * -GetRingBuffer(struct hv_ring_buffer_info *ring_info) +get_ring_buffer(struct hv_ring_buffer_info *ring_info) { return (void *)ring_info->ring_buffer->buffer; } @@ -170,14 +172,14 @@ GetRingBuffer(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferSize() + get_ring_buffersize() Description: Get the size of the ring buffer --*/ static inline u32 -GetRingBufferSize(struct hv_ring_buffer_info *ring_info) +get_ring_buffersize(struct hv_ring_buffer_info *ring_info) { return ring_info->ring_datasize; } @@ -185,14 +187,14 @@ GetRingBufferSize(struct hv_ring_buffer_info *ring_info) /*++ Name: - GetRingBufferIndices() + get_ring_bufferindices() Description: Get the read and write indices as u64 of the specified ring buffer --*/ static inline u64 -GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) +get_ring_bufferindices(struct hv_ring_buffer_info *ring_info) { return (u64)ring_info->ring_buffer->write_index << 32; } @@ -201,18 +203,18 @@ GetRingBufferIndices(struct hv_ring_buffer_info *ring_info) /*++ Name: - Dumpring_info() + dump_ring_info() Description: Dump out to console the ring buffer info --*/ -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix) { u32 bytes_avail_towrite; u32 bytes_avail_toread; - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -233,14 +235,14 @@ void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix) /* Internal routines */ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen); static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, @@ -251,20 +253,20 @@ CopyFromRingBuffer( /*++ Name: - RingBufferGetDebugInfo() + ringbuffer_get_debuginfo() Description: Get various debug metrics for the specified ring buffer --*/ -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info) { u32 bytes_avail_towrite; u32 bytes_avail_toread; if (ring_info->ring_buffer) { - GetRingBufferAvailBytes(ring_info, + get_ringbuffer_availbytes(ring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -283,13 +285,13 @@ void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, /*++ Name: - GetRingBufferInterruptMask() + get_ringbuffer_interrupt_mask() Description: Get the interrupt mask for the specified ring buffer --*/ -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *rbi) { return rbi->ring_buffer->interrupt_mask; } @@ -297,13 +299,13 @@ u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *rbi) /*++ Name: - RingBufferInit() + ringbuffer_init() Description: Initialize the ring buffer --*/ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen) { if (sizeof(struct hv_ring_buffer) != PAGE_SIZE) @@ -326,26 +328,26 @@ int RingBufferInit(struct hv_ring_buffer_info *ring_info, /*++ Name: - RingBufferCleanup() + ringbuffer_cleanup() Description: Cleanup the ring buffer --*/ -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info) +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) { } /*++ Name: - RingBufferWrite() + ringbuffer_write() Description: Write to the ring buffer --*/ -int RingBufferWrite(struct hv_ring_buffer_info *outring_info, +int ringbuffer_write(struct hv_ring_buffer_info *outring_info, struct scatterlist *sglist, u32 sgcount) { int i = 0; @@ -367,7 +369,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, spin_lock_irqsave(&outring_info->ring_lock, flags); - GetRingBufferAvailBytes(outring_info, + get_ringbuffer_availbytes(outring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -390,20 +392,20 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, } /* Write to the ring buffer */ - next_write_location = GetNextWriteLocation(outring_info); + next_write_location = get_next_write_location(outring_info); for_each_sg(sglist, sg, sgcount, i) { - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, sg_virt(sg), sg->length); } /* Set previous packet start */ - prev_indices = GetRingBufferIndices(outring_info); + prev_indices = get_ring_bufferindices(outring_info); - next_write_location = CopyToRingBuffer(outring_info, + next_write_location = copyto_ringbuffer(outring_info, next_write_location, &prev_indices, sizeof(u64)); @@ -412,7 +414,7 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, mb(); /* Now, update the write location */ - SetNextWriteLocation(outring_info, next_write_location); + set_next_write_location(outring_info, next_write_location); /* Dumpring_info(Outring_info, "AFTER "); */ @@ -424,13 +426,13 @@ int RingBufferWrite(struct hv_ring_buffer_info *outring_info, /*++ Name: - RingBufferPeek() + ringbuffer_peek() Description: Read without advancing the read index --*/ -int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, +int ringbuffer_peek(struct hv_ring_buffer_info *Inring_info, void *Buffer, u32 buflen) { u32 bytes_avail_towrite; @@ -440,7 +442,7 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, spin_lock_irqsave(&Inring_info->ring_lock, flags); - GetRingBufferAvailBytes(Inring_info, + get_ringbuffer_availbytes(Inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -458,9 +460,9 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, } /* Convert to byte offset */ - next_read_location = GetNextReadLocation(Inring_info); + next_read_location = get_next_read_location(Inring_info); - next_read_location = CopyFromRingBuffer(Inring_info, + next_read_location = copyfrom_ringbuffer(Inring_info, Buffer, buflen, next_read_location); @@ -474,13 +476,13 @@ int RingBufferPeek(struct hv_ring_buffer_info *Inring_info, /*++ Name: - RingBufferRead() + ringbuffer_read() Description: Read and advance the read index --*/ -int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, +int ringbuffer_read(struct hv_ring_buffer_info *inring_info, void *buffer, u32 buflen, u32 offset) { u32 bytes_avail_towrite; @@ -494,7 +496,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, spin_lock_irqsave(&inring_info->ring_lock, flags); - GetRingBufferAvailBytes(inring_info, + get_ringbuffer_availbytes(inring_info, &bytes_avail_toread, &bytes_avail_towrite); @@ -515,14 +517,15 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, return -1; } - next_read_location = GetNextReadLocationWithOffset(inring_info, offset); + next_read_location + get_next_readlocation_withoffset(inring_info, offset); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, buffer, buflen, next_read_location); - next_read_location = CopyFromRingBuffer(inring_info, + next_read_location = copyfrom_ringbuffer(inring_info, &prev_indices, sizeof(u64), next_read_location); @@ -533,7 +536,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, mb(); /* Update the read index */ - SetNextReadLocation(inring_info, next_read_location); + set_next_read_location(inring_info, next_read_location); /* Dumpring_info(Inring_info, "AFTER "); */ @@ -546,7 +549,7 @@ int RingBufferRead(struct hv_ring_buffer_info *inring_info, void *buffer, /*++ Name: - CopyToRingBuffer() + copyto_ringbuffer() Description: Helper routine to copy from source to ring buffer. @@ -554,14 +557,14 @@ Description: --*/ static u32 -CopyToRingBuffer( +copyto_ringbuffer( struct hv_ring_buffer_info *ring_info, u32 start_write_offset, void *src, u32 srclen) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; /* wrap-around detected! */ @@ -584,7 +587,7 @@ CopyToRingBuffer( /*++ Name: - CopyFromRingBuffer() + copyfrom_ringbuffer() Description: Helper routine to copy to source from ring buffer. @@ -592,14 +595,14 @@ Description: --*/ static u32 -CopyFromRingBuffer( +copyfrom_ringbuffer( struct hv_ring_buffer_info *ring_info, void *dest, u32 destlen, u32 start_read_offset) { - void *ring_buffer = GetRingBuffer(ring_info); - u32 ring_buffer_size = GetRingBufferSize(ring_info); + void *ring_buffer = get_ring_buffer(ring_info); + u32 ring_buffer_size = get_ring_buffersize(ring_info); u32 frag_len; diff --git a/drivers/staging/hv/ring_buffer.h b/drivers/staging/hv/ring_buffer.h index f30be1f..7bd6ecf 100644 --- a/drivers/staging/hv/ring_buffer.h +++ b/drivers/staging/hv/ring_buffer.h @@ -75,28 +75,28 @@ struct hv_ring_buffer_debug_info { /* Interface */ -int RingBufferInit(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_init(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -void RingBufferCleanup(struct hv_ring_buffer_info *ring_info); +void ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info); -int RingBufferWrite(struct hv_ring_buffer_info *ring_info, +int ringbuffer_write(struct hv_ring_buffer_info *ring_info, struct scatterlist *sglist, u32 sgcount); -int RingBufferPeek(struct hv_ring_buffer_info *ring_info, void *buffer, +int ringbuffer_peek(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen); -int RingBufferRead(struct hv_ring_buffer_info *ring_info, +int ringbuffer_read(struct hv_ring_buffer_info *ring_info, void *buffer, u32 buflen, u32 offset); -u32 GetRingBufferInterruptMask(struct hv_ring_buffer_info *ring_info); +u32 get_ringbuffer_interrupt_mask(struct hv_ring_buffer_info *ring_info); -void Dumpring_info(struct hv_ring_buffer_info *ring_info, char *prefix); +void dump_ring_info(struct hv_ring_buffer_info *ring_info, char *prefix); -void RingBufferGetDebugInfo(struct hv_ring_buffer_info *ring_info, +void ringbuffer_get_debuginfo(struct hv_ring_buffer_info *ring_info, struct hv_ring_buffer_debug_info *debug_info); #endif /* _RING_BUFFER_H_ */ -- 1.6.3.2
Seemingly Similar Threads
- [PATCH 01/10] staging: hv: Convert camel cased struct fields in channel_mgmt.h to lower cases
- [PATCH 03/10] staging: hv: Convert camel cased struct fields in hv.h to lower cases
- [PATCH 03/10] staging: hv: Convert camel cased struct fields in hv.h to lower cases
- [PATCH 1/8] staging: hv: Convert camel cased variables in connection.c to lower cases
- [PATCH 1/8] staging: hv: Convert camel cased variables in connection.c to lower cases