Commit ee3d7ddf authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Staging: hv: typedef removal for VmbusApi.h

The function pointers still have ugly names, but the structures
are now cleaned up.

Note, a comment was added where the driver structure is pointing
at a problem that needs to be fixed up later in the code.

Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 54b2b847
......@@ -791,7 +791,7 @@ Description:
--*/
int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
PAGE_BUFFER PageBuffers[],
struct hv_page_buffer PageBuffers[],
u32 PageCount,
void * Buffer,
u32 BufferLen,
......@@ -814,7 +814,7 @@ int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *Channel,
DumpVmbusChannel(Channel);
/* Adjust the size down since VMBUS_CHANNEL_PACKET_PAGE_BUFFER is the largest size we support */
descSize = sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER) - ((MAX_PAGE_BUFFER_COUNT - PageCount)*sizeof(PAGE_BUFFER));
descSize = sizeof(struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER) - ((MAX_PAGE_BUFFER_COUNT - PageCount)*sizeof(struct hv_page_buffer));
packetLen = descSize + BufferLen;
packetLenAligned = ALIGN_UP(packetLen, sizeof(u64));
......@@ -868,7 +868,7 @@ Description:
--*/
int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *Channel,
MULTIPAGE_BUFFER *MultiPageBuffer,
struct hv_multipage_buffer *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
u64 RequestId
......
......@@ -36,7 +36,7 @@ struct VMBUS_CHANNEL_PACKET_PAGE_BUFFER {
u64 TransactionId;
u32 Reserved;
u32 RangeCount;
PAGE_BUFFER Range[MAX_PAGE_BUFFER_COUNT];
struct hv_page_buffer Range[MAX_PAGE_BUFFER_COUNT];
} __attribute__((packed));
/* The format must be the same as VMDATA_GPA_DIRECT */
......@@ -48,7 +48,7 @@ struct VMBUS_CHANNEL_PACKET_MULITPAGE_BUFFER {
u64 TransactionId;
u32 Reserved;
u32 RangeCount; /* Always 1 in this case */
MULTIPAGE_BUFFER Range;
struct hv_multipage_buffer Range;
} __attribute__((packed));
......@@ -70,14 +70,14 @@ extern int VmbusChannelSendPacket(struct vmbus_channel *channel,
u32 Flags);
extern int VmbusChannelSendPacketPageBuffer(struct vmbus_channel *channel,
PAGE_BUFFER PageBuffers[],
struct hv_page_buffer PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
extern int VmbusChannelSendPacketMultiPageBuffer(struct vmbus_channel *channel,
MULTIPAGE_BUFFER *MultiPageBuffer,
struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
......
......@@ -77,7 +77,7 @@ IVmbusChannelSendPacket(
static int
IVmbusChannelSendPacketPageBuffer(
struct hv_device *Device,
PAGE_BUFFER PageBuffers[],
struct hv_page_buffer PageBuffers[],
u32 PageCount,
void * Buffer,
u32 BufferLen,
......@@ -95,7 +95,7 @@ IVmbusChannelSendPacketPageBuffer(
static int
IVmbusChannelSendPacketMultiPageBuffer(
struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer,
struct hv_multipage_buffer *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
u64 RequestId
......@@ -165,7 +165,7 @@ IVmbusChannelTeardownGpadl(
}
void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface)
void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface)
{
ChannelInterface->Open = IVmbusChannelOpen;
ChannelInterface->Close = IVmbusChannelClose;
......@@ -180,7 +180,7 @@ void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface)
}
void GetChannelInfo(struct hv_device *Device, DEVICE_INFO *DeviceInfo)
void GetChannelInfo(struct hv_device *Device, struct hv_device_info *DeviceInfo)
{
struct vmbus_channel_debug_info debugInfo;
......
......@@ -27,8 +27,8 @@
#include "include/VmbusApi.h"
void GetChannelInterface(VMBUS_CHANNEL_INTERFACE *ChannelInterface);
void GetChannelInterface(struct vmbus_channel_interface *ChannelInterface);
void GetChannelInfo(struct hv_device *Device, DEVICE_INFO *DeviceInfo);
void GetChannelInfo(struct hv_device *Device, struct hv_device_info *DeviceInfo);
#endif /* _CHANNEL_INTERFACE_H_ */
......@@ -825,7 +825,7 @@ NetVscOnDeviceAdd(
for (i=0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++)
{
packet = kzalloc(sizeof(struct hv_netvsc_packet) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER)), GFP_KERNEL);
packet = kzalloc(sizeof(struct hv_netvsc_packet) + (NETVSC_RECEIVE_SG_COUNT* sizeof(struct hv_page_buffer)), GFP_KERNEL);
if (!packet)
{
DPRINT_DBG(NETVSC, "unable to allocate netvsc pkts for receive pool (wanted %d got %d)", NETVSC_RECEIVE_PACKETLIST_COUNT, i);
......
......@@ -72,7 +72,7 @@ typedef struct _RNDIS_REQUEST {
/* Simplify allocation by having a netvsc packet inline */
struct hv_netvsc_packet Packet;
PAGE_BUFFER Buffer;
struct hv_page_buffer Buffer;
/* FIXME: We assumed a fixed size request here. */
struct rndis_message RequestMessage;
} RNDIS_REQUEST;
......
......@@ -60,15 +60,12 @@ static struct hv_device* gDevice; /* vmbus root device */
/* Internal routines */
static void
VmbusGetChannelInterface(
VMBUS_CHANNEL_INTERFACE *Interface
);
static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface);
static void
VmbusGetChannelInfo(
struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo
struct hv_device_info *DeviceInfo
);
static void
......@@ -121,7 +118,7 @@ VmbusInitialize(
struct hv_driver *drv
)
{
VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv;
struct vmbus_driver *driver = (struct vmbus_driver *)drv;
int ret=0;
DPRINT_ENTER(VMBUS);
......@@ -192,10 +189,7 @@ Description:
Get the channel interface
--*/
static void
VmbusGetChannelInterface(
VMBUS_CHANNEL_INTERFACE *Interface
)
static void VmbusGetChannelInterface(struct vmbus_channel_interface *Interface)
{
GetChannelInterface(Interface);
}
......@@ -204,7 +198,7 @@ VmbusGetChannelInterface(
/*++;
Name:
VmbusGetChannelInterface()
VmbusGetChannelInfo()
Description:
Get the device info for the specified device object
......@@ -213,7 +207,7 @@ Description:
static void
VmbusGetChannelInfo(
struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo
struct hv_device_info *DeviceInfo
)
{
GetChannelInfo(DeviceObject, DeviceInfo);
......@@ -235,7 +229,7 @@ struct hv_device *VmbusChildDeviceCreate(struct hv_guid *DeviceType,
struct hv_guid *DeviceInstance,
void *Context)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
return vmbusDriver->OnChildDeviceCreate(
DeviceType,
......@@ -255,7 +249,7 @@ Description:
--*/
int VmbusChildDeviceAdd(struct hv_device *ChildDevice)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
return vmbusDriver->OnChildDeviceAdd(gDevice, ChildDevice);
}
......@@ -272,7 +266,7 @@ Description:
--*/
void VmbusChildDeviceRemove(struct hv_device *ChildDevice)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
vmbusDriver->OnChildDeviceRemove(ChildDevice);
}
......@@ -293,9 +287,9 @@ VmbusChildDeviceDestroy(
struct hv_device *ChildDevice
)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
struct vmbus_driver *vmbusDriver = (struct vmbus_driver *)gDriver;
vmbusDriver->OnChildDeviceDestroy(ChildDevice);
vmbusDriver->OnChildDeviceDestroy(ChildDevice);
}
************* */
......@@ -381,7 +375,7 @@ VmbusOnCleanup(
struct hv_driver *drv
)
{
/* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
DPRINT_ENTER(VMBUS);
......@@ -485,7 +479,7 @@ VmbusOnISR(
struct hv_driver *drv
)
{
/* VMBUS_DRIVER_OBJECT* driver = (VMBUS_DRIVER_OBJECT*)drv; */
/* struct vmbus_driver *driver = (struct vmbus_driver *)drv; */
int ret=0;
/* struct page* page; */
......
......@@ -102,7 +102,7 @@ struct hv_netvsc_packet {
u32 TotalDataBufferLength;
/* Points to the send/receive buffer where the ethernet frame is */
u32 PageBufferCount;
PAGE_BUFFER PageBuffers[NETVSC_PACKET_MAXPAGE];
struct hv_page_buffer PageBuffers[NETVSC_PACKET_MAXPAGE];
};
......
......@@ -92,7 +92,7 @@ struct hv_storvsc_request {
/* This points to the memory after DataBuffer */
void * Extension;
MULTIPAGE_BUFFER DataBuffer;
struct hv_multipage_buffer DataBuffer;
};
......
......@@ -31,25 +31,26 @@
#pragma pack(push, 1)
/* Single-page buffer */
typedef struct _PAGE_BUFFER {
struct hv_page_buffer {
u32 Length;
u32 Offset;
u64 Pfn;
} PAGE_BUFFER;
};
/* Multiple-page buffer */
typedef struct _MULTIPAGE_BUFFER {
struct hv_multipage_buffer {
/* Length and Offset determines the # of pfns in the array */
u32 Length;
u32 Offset;
u64 PfnArray[MAX_MULTIPAGE_BUFFER_COUNT];
} MULTIPAGE_BUFFER;
};
/* 0x18 includes the proprietary packet header */
#define MAX_PAGE_BUFFER_PACKET (0x18 + \
(sizeof(PAGE_BUFFER) * \
(sizeof(struct hv_page_buffer) * \
MAX_PAGE_BUFFER_COUNT))
#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + sizeof(MULTIPAGE_BUFFER))
#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + \
sizeof(struct hv_multipage_buffer))
#pragma pack(pop)
......@@ -69,7 +70,7 @@ typedef int (*PFN_ON_ISR)(struct hv_driver *drv);
typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)
typedef struct hv_device * (*PFN_ON_CHILDDEVICE_CREATE)
(struct hv_guid *DeviceType,
struct hv_guid *DeviceInstance,
void *Context);
......@@ -94,14 +95,14 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET)(struct hv_device *Device,
u32 Type,
u32 Flags);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(struct hv_device *Device,
PAGE_BUFFER PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
typedef int(*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
struct hv_page_buffer PageBuffers[],
u32 PageCount,
void *Buffer,
u32 BufferLen,
u64 RequestId);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
(struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer,
struct hv_multipage_buffer *mpb,
void *Buffer,
u32 BufferLen,
u64 RequestId);
......@@ -123,15 +124,15 @@ typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(struct hv_device *Device,
u32 GpadlHandle);
typedef struct _PORT_INFO {
struct hv_dev_port_info {
u32 InterruptMask;
u32 ReadIndex;
u32 WriteIndex;
u32 BytesAvailToRead;
u32 BytesAvailToWrite;
} PORT_INFO;
};
typedef struct _DEVICE_INFO {
struct hv_device_info {
u32 ChannelId;
u32 ChannelState;
struct hv_guid ChannelType;
......@@ -145,14 +146,14 @@ typedef struct _DEVICE_INFO {
u32 ClientMonitorLatency;
u32 ClientMonitorConnectionId;
PORT_INFO Inbound;
PORT_INFO Outbound;
} DEVICE_INFO;
struct hv_dev_port_info Inbound;
struct hv_dev_port_info Outbound;
};
typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device,
DEVICE_INFO *DeviceInfo);
struct hv_device_info *DeviceInfo);
typedef struct _VMBUS_CHANNEL_INTERFACE {
struct vmbus_channel_interface {
VMBUS_CHANNEL_OPEN Open;
VMBUS_CHANNEL_CLOSE Close;
VMBUS_CHANNEL_SEND_PACKET SendPacket;
......@@ -163,9 +164,9 @@ typedef struct _VMBUS_CHANNEL_INTERFACE {
VMBUS_CHANNEL_ESTABLISH_GPADL EstablishGpadl;
VMBUS_CHANNEL_TEARDOWN_GPADL TeardownGpadl;
VMBUS_GET_CHANNEL_INFO GetInfo;
} VMBUS_CHANNEL_INTERFACE;
};
typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(VMBUS_CHANNEL_INTERFACE *Interface);
typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(struct vmbus_channel_interface *i);
/* Base driver object */
struct hv_driver {
......@@ -181,7 +182,7 @@ struct hv_driver {
PFN_ON_GETDEVICEIDS OnGetDeviceIds;
PFN_ON_CLEANUP OnCleanup;
VMBUS_CHANNEL_INTERFACE VmbusChannelInterface;
struct vmbus_channel_interface VmbusChannelInterface;
};
/* Base device object */
......@@ -204,7 +205,7 @@ struct hv_device {
};
/* Vmbus driver object */
typedef struct _VMBUS_DRIVER_OBJECT {
struct vmbus_driver {
/* !! Must be the 1st field !! */
/* FIXME if ^, then someone is doing somthing stupid */
struct hv_driver Base;
......@@ -223,7 +224,7 @@ typedef struct _VMBUS_DRIVER_OBJECT {
VMBUS_GET_CHANNEL_INTERFACE GetChannelInterface;
VMBUS_GET_CHANNEL_INFO GetChannelInfo;
} VMBUS_DRIVER_OBJECT;
};
int VmbusInitialize(struct hv_driver *drv);
......
......@@ -429,14 +429,14 @@ static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net)
num_frags = skb_shinfo(skb)->nr_frags + 1 + net_drv_obj->AdditionalRequestPageBufferCount;
/* Allocate a netvsc packet based on # of frags. */
packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) + net_drv_obj->RequestExtSize, GFP_ATOMIC);
packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(struct hv_page_buffer)) + net_drv_obj->RequestExtSize, GFP_ATOMIC);
if (!packet)
{
DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet");
return -1;
}
packet->Extension = (void*)(unsigned long)packet + sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) ;
packet->Extension = (void*)(unsigned long)packet + sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(struct hv_page_buffer)) ;
/* Setup the rndis header */
packet->PageBufferCount = num_frags;
......
......@@ -76,6 +76,6 @@ static inline struct driver_context *driver_to_driver_context(struct device_driv
int vmbus_child_driver_register(struct driver_context *driver_ctx);
void vmbus_child_driver_unregister(struct driver_context *driver_ctx);
void vmbus_get_interface(VMBUS_CHANNEL_INTERFACE *interface);
void vmbus_get_interface(struct vmbus_channel_interface *interface);
#endif /* _VMBUS_H_ */
......@@ -49,7 +49,7 @@ struct vmbus_driver_context {
/* The driver field is not used in here. Instead, the bus field is */
/* used to represent the driver */
struct driver_context drv_ctx;
VMBUS_DRIVER_OBJECT drv_obj;
struct vmbus_driver drv_obj;
struct bus_type bus;
struct tasklet_struct msg_dpc;
......@@ -79,7 +79,7 @@ static struct hv_device *vmbus_child_device_create(struct hv_guid *type, struct
static void vmbus_child_device_destroy(struct hv_device *device_obj);
static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj);
static void vmbus_child_device_unregister(struct hv_device *child_device_obj);
static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info);
static void vmbus_child_device_get_info(struct hv_device *device_obj, struct hv_device_info *device_info);
/* static ssize_t vmbus_show_class_id(struct device *dev, struct device_attribute *attr, char *buf); */
/* static ssize_t vmbus_show_device_id(struct device *dev, struct device_attribute *attr, char *buf); */
......@@ -159,9 +159,9 @@ Desc: Show the device attribute in sysfs. This is invoked when user does a "cat
static ssize_t vmbus_show_device_attr(struct device *dev, struct device_attribute *dev_attr, char *buf)
{
struct device_context *device_ctx = device_to_device_context(dev);
DEVICE_INFO device_info;
struct hv_device_info device_info;
memset(&device_info, 0, sizeof(DEVICE_INFO));
memset(&device_info, 0, sizeof(struct hv_device_info));
vmbus_child_device_get_info(&device_ctx->device_obj, &device_info);
......@@ -325,7 +325,7 @@ static int vmbus_bus_init(PFN_DRIVERINITIALIZE pfn_drv_init)
unsigned int vector=0;
struct vmbus_driver_context *vmbus_drv_ctx=&g_vmbus_drv;
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
struct device_context *dev_ctx=&g_vmbus_drv.device_ctx;
......@@ -446,7 +446,7 @@ Desc: Terminate the vmbus driver. This routine is opposite of vmbus_bus_init()
--*/
static void vmbus_bus_exit(void)
{
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
struct vmbus_driver_context *vmbus_drv_ctx=&g_vmbus_drv;
struct device_context *dev_ctx=&g_vmbus_drv.device_ctx;
......@@ -484,7 +484,7 @@ Desc: Register a vmbus's child driver
--*/
int vmbus_child_driver_register(struct driver_context* driver_ctx)
{
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
int ret;
DPRINT_ENTER(VMBUS_DRV);
......@@ -534,9 +534,9 @@ Name: vmbus_get_interface()
Desc: Get the vmbus channel interface. This is invoked by child/client driver that sits
above vmbus
--*/
void vmbus_get_interface(VMBUS_CHANNEL_INTERFACE *interface)
void vmbus_get_interface(struct vmbus_channel_interface *interface)
{
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
vmbus_drv_obj->GetChannelInterface(interface);
}
......@@ -550,9 +550,9 @@ Name: vmbus_child_device_get_info()
Desc: Get the vmbus child device info. This is invoked to display various device attributes in sysfs.
--*/
static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info)
static void vmbus_child_device_get_info(struct hv_device *device_obj, struct hv_device_info *device_info)
{
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj;
vmbus_drv_obj->GetChannelInfo(device_obj, device_info);
}
......@@ -1000,7 +1000,7 @@ Desc: Tasklet routine to handle hypervisor messages
--*/
static void vmbus_msg_dpc(unsigned long data)
{
VMBUS_DRIVER_OBJECT* vmbus_drv_obj = (VMBUS_DRIVER_OBJECT*)data;
struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data;
DPRINT_ENTER(VMBUS_DRV);
......@@ -1021,7 +1021,7 @@ Desc: Tasklet routine to handle hypervisor events
--*/
static void vmbus_event_dpc(unsigned long data)
{
VMBUS_DRIVER_OBJECT* vmbus_drv_obj = (VMBUS_DRIVER_OBJECT*)data;
struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data;
DPRINT_ENTER(VMBUS_DRV);
......@@ -1043,7 +1043,7 @@ Desc: ISR routine
static irqreturn_t vmbus_isr(int irq, void* dev_id)
{
int ret=0;
VMBUS_DRIVER_OBJECT* vmbus_driver_obj = &g_vmbus_drv.drv_obj;
struct vmbus_driver *vmbus_driver_obj = &g_vmbus_drv.drv_obj;
DPRINT_ENTER(VMBUS_DRV);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment