memcpy(openMsg->UserData, UserData, UserDataLen);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList,
- &openInfo->MsgListEntry);
+ list_add_tail(&openInfo->MsgListEntry,
+ &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Sending channel open msg...");
Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- REMOVE_ENTRY_LIST(&openInfo->MsgListEntry);
+ list_del(&openInfo->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(openInfo->WaitEvent);
sizeof(struct gpa_range) + pfnCount * sizeof(u64);
msgHeader = kzalloc(msgSize, GFP_KERNEL);
- INITIALIZE_LIST_HEAD(&msgHeader->SubMsgList);
+ INIT_LIST_HEAD(&msgHeader->SubMsgList);
msgHeader->MessageSize = msgSize;
gpaHeader = (struct vmbus_channel_gpadl_header *)msgHeader->Msg;
gpadlBody->Pfn[i] = pfn + pfnSum + i;
/* add to msg header */
- INSERT_TAIL_LIST(&msgHeader->SubMsgList,
- &msgBody->MsgListEntry);
+ list_add_tail(&msgBody->MsgListEntry,
+ &msgHeader->SubMsgList);
pfnSum += pfnCurr;
pfnLeft -= pfnCurr;
}
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_msginfo *subMsgInfo;
u32 msgCount;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
+ struct list_head *curr;
u32 nextGpadlHandle;
unsigned long flags;
int ret;
DumpGpadlHeader(gpadlMsg);
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList,
- &msgInfo->MsgListEntry);
- spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
+ list_add_tail(&msgInfo->MsgListEntry,
+ &gVmbusConnection.ChannelMsgList);
+ spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "buffer %p, size %d msg cnt %d",
Kbuffer, Size, msgCount);
}
if (msgCount > 1) {
- ITERATE_LIST_ENTRIES(anchor, curr, &msgInfo->SubMsgList) {
+ list_for_each(curr, &msgInfo->SubMsgList) {
+
+ /* FIXME: should this use list_entry() instead ? */
subMsgInfo = (struct vmbus_channel_msginfo *)curr;
gpadlBody =
(struct vmbus_channel_gpadl_body *)subMsgInfo->Msg;
Cleanup:
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry);
+ list_del(&msgInfo->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(msgInfo->WaitEvent);
msg->Gpadl = GpadlHandle;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList, &info->MsgListEntry);
+ list_add_tail(&info->MsgListEntry,
+ &gVmbusConnection.ChannelMsgList);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
ret = VmbusPostMessage(msg,
/* Received a torndown response */
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- REMOVE_ENTRY_LIST(&info->MsgListEntry);
+ list_del(&info->MsgListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
kfree(info->WaitEvent);
if (Channel->State == CHANNEL_OPEN_STATE) {
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- REMOVE_ENTRY_LIST(&Channel->ListEntry);
+ list_del(&Channel->ListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
FreeVmbusChannel(Channel);
*/
#include <linux/kernel.h>
#include <linux/mm.h>
+#include <linux/list.h>
#include "osd.h"
#include "logging.h"
#include "VmbusPrivate.h"
{
struct vmbus_channel *newChannel = context;
struct vmbus_channel *channel;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
bool fNew = true;
int ret;
unsigned long flags;
/* Make sure this is a new offer */
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList) {
- channel = CONTAINING_RECORD(curr, struct vmbus_channel,
- ListEntry);
-
+ list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) {
if (!memcmp(&channel->OfferMsg.Offer.InterfaceType,
&newChannel->OfferMsg.Offer.InterfaceType,
sizeof(struct hv_guid)) &&
}
if (fNew)
- INSERT_TAIL_LIST(&gVmbusConnection.ChannelList,
- &newChannel->ListEntry);
+ list_add_tail(&newChannel->ListEntry,
+ &gVmbusConnection.ChannelList);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
newChannel->OfferMsg.ChildRelId);
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- REMOVE_ENTRY_LIST(&newChannel->ListEntry);
+ list_del(&newChannel->ListEntry);
spin_unlock_irqrestore(&gVmbusConnection.channel_lock, flags);
FreeVmbusChannel(newChannel);
static void VmbusChannelOnOpenResult(struct vmbus_channel_message_header *hdr)
{
struct vmbus_channel_open_result *result;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
+ struct list_head *curr;
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_open_channel *openMsg;
*/
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+/* FIXME: this should probably use list_entry() instead */
msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
static void VmbusChannelOnGpadlCreated(struct vmbus_channel_message_header *hdr)
{
struct vmbus_channel_gpadl_created *gpadlCreated;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
+ struct list_head *curr;
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_gpadl_header *gpadlHeader;
*/
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+/* 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 *hdr)
{
struct vmbus_channel_gpadl_torndown *gpadlTorndown;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
+ struct list_head *curr;
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_gpadl_teardown *gpadlTeardown;
*/
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+/* FIXME: this should probably use list_entry() instead */
msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
static void VmbusChannelOnVersionResponse(
struct vmbus_channel_message_header *hdr)
{
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
+ struct list_head *curr;
struct vmbus_channel_msginfo *msgInfo;
struct vmbus_channel_message_header *requestHeader;
struct vmbus_channel_initiate_contact *initiate;
versionResponse = (struct vmbus_channel_version_response *)hdr;
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelMsgList) {
+ list_for_each(curr, &gVmbusConnection.ChannelMsgList) {
+/* FIXME: this should probably use list_entry() instead */
msgInfo = (struct vmbus_channel_msginfo *)curr;
requestHeader = (struct vmbus_channel_message_header *)msgInfo->Msg;
*/
void VmbusChannelReleaseUnattachedChannels(void)
{
- LIST_ENTRY *entry;
- struct vmbus_channel *channel;
+ struct vmbus_channel *channel, *pos;
struct vmbus_channel *start = NULL;
unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- while (!IsListEmpty(&gVmbusConnection.ChannelList)) {
- entry = TOP_LIST_ENTRY(&gVmbusConnection.ChannelList);
- channel = CONTAINING_RECORD(entry, struct vmbus_channel,
- ListEntry);
-
+ list_for_each_entry_safe(channel, pos, &gVmbusConnection.ChannelList,
+ ListEntry) {
if (channel == start)
break;
if (!channel->DeviceObject->Driver) {
- REMOVE_ENTRY_LIST(&channel->ListEntry);
+ list_del(&channel->ListEntry);
DPRINT_INFO(VMBUS,
"Releasing unattached device object %p",
channel->DeviceObject);
#ifndef _CHANNEL_MGMT_H_
#define _CHANNEL_MGMT_H_
-#include "List.h"
+#include <linux/list.h>
#include "RingBuffer.h"
#include "VmbusChannelInterface.h"
#include "VmbusPacketFormat.h"
};
struct vmbus_channel {
- LIST_ENTRY ListEntry;
+ struct list_head ListEntry;
struct hv_device *DeviceObject;
*/
struct vmbus_channel_msginfo {
/* Bookkeeping stuff */
- LIST_ENTRY MsgListEntry;
+ struct list_head MsgListEntry;
/* So far, this is only used to handle gpadl body message */
- LIST_ENTRY SubMsgList;
+ struct list_head SubMsgList;
/* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent;
goto Cleanup;
}
- INITIALIZE_LIST_HEAD(&gVmbusConnection.ChannelMsgList);
+ INIT_LIST_HEAD(&gVmbusConnection.ChannelMsgList);
spin_lock_init(&gVmbusConnection.channelmsg_lock);
- INITIALIZE_LIST_HEAD(&gVmbusConnection.ChannelList);
+ INIT_LIST_HEAD(&gVmbusConnection.ChannelList);
spin_lock_init(&gVmbusConnection.channel_lock);
/*
* receive the response before returning from this routine
*/
spin_lock_irqsave(&gVmbusConnection.channelmsg_lock, flags);
- INSERT_TAIL_LIST(&gVmbusConnection.ChannelMsgList,
- &msgInfo->MsgListEntry);
+ list_add_tail(&msgInfo->MsgListEntry,
+ &gVmbusConnection.ChannelMsgList);
+
spin_unlock_irqrestore(&gVmbusConnection.channelmsg_lock, flags);
DPRINT_DBG(VMBUS, "Vmbus connection - interrupt pfn %llx, "
ret = VmbusPostMessage(msg,
sizeof(struct vmbus_channel_initiate_contact));
if (ret != 0) {
- REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry);
+ list_del(&msgInfo->MsgListEntry);
goto Cleanup;
}
/* Wait for the connection response */
osd_WaitEventWait(msgInfo->WaitEvent);
- REMOVE_ENTRY_LIST(&msgInfo->MsgListEntry);
+ list_del(&msgInfo->MsgListEntry);
/* Check if successful */
if (msgInfo->Response.VersionResponse.VersionSupported) {
{
struct vmbus_channel *channel;
struct vmbus_channel *foundChannel = NULL;
- LIST_ENTRY *anchor;
- LIST_ENTRY *curr;
unsigned long flags;
spin_lock_irqsave(&gVmbusConnection.channel_lock, flags);
- ITERATE_LIST_ENTRIES(anchor, curr, &gVmbusConnection.ChannelList) {
- channel = CONTAINING_RECORD(curr, struct vmbus_channel,
- ListEntry);
-
+ list_for_each_entry(channel, &gVmbusConnection.ChannelList, ListEntry) {
if (channel->OfferMsg.ChildRelId == relId) {
foundChannel = channel;
break;
#include "ChannelMgmt.h"
#include "ChannelInterface.h"
#include "RingBuffer.h"
-#include "List.h"
+#include <linux/list.h>
/*
* is child->parent notification
*/
void *MonitorPages;
- LIST_ENTRY ChannelMsgList;
+ struct list_head ChannelMsgList;
spinlock_t channelmsg_lock;
/* List of channels */
- LIST_ENTRY ChannelList;
+ struct list_head ChannelList;
spinlock_t channel_lock;
struct workqueue_struct *WorkQueue;
struct VMBUS_MSGINFO {
/* Bookkeeping stuff */
- LIST_ENTRY MsgListEntry;
+ struct list_head MsgListEntry;
/* Synchronize the request/response if needed */
struct osd_waitevent *WaitEvent;