Staging: hv: coding style cleanups for VmbusApi.h
typedefs still need to be fixed up. Cc: Hank Janssen <hjanssen@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
1732a1e8a4
commit
54b2b847f5
1 changed files with 129 additions and 155 deletions
|
@ -25,17 +25,9 @@
|
||||||
#ifndef _VMBUS_API_H_
|
#ifndef _VMBUS_API_H_
|
||||||
#define _VMBUS_API_H_
|
#define _VMBUS_API_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Defines */
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_PAGE_BUFFER_COUNT 16
|
#define MAX_PAGE_BUFFER_COUNT 16
|
||||||
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
|
#define MAX_MULTIPAGE_BUFFER_COUNT 32 /* 128K */
|
||||||
|
|
||||||
/* Data types */
|
|
||||||
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
|
||||||
/* Single-page buffer */
|
/* Single-page buffer */
|
||||||
|
@ -54,7 +46,9 @@ typedef struct _MULTIPAGE_BUFFER {
|
||||||
} MULTIPAGE_BUFFER;
|
} MULTIPAGE_BUFFER;
|
||||||
|
|
||||||
/* 0x18 includes the proprietary packet header */
|
/* 0x18 includes the proprietary packet header */
|
||||||
#define MAX_PAGE_BUFFER_PACKET (0x18 + (sizeof(PAGE_BUFFER) * MAX_PAGE_BUFFER_COUNT))
|
#define MAX_PAGE_BUFFER_PACKET (0x18 + \
|
||||||
|
(sizeof(PAGE_BUFFER) * \
|
||||||
|
MAX_PAGE_BUFFER_COUNT))
|
||||||
#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + sizeof(MULTIPAGE_BUFFER))
|
#define MAX_MULTIPAGE_BUFFER_PACKET (0x18 + sizeof(MULTIPAGE_BUFFER))
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,93 +58,69 @@ struct hv_driver;
|
||||||
struct hv_device;
|
struct hv_device;
|
||||||
|
|
||||||
/* All drivers */
|
/* All drivers */
|
||||||
typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device, void* AdditionalInfo);
|
typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device,
|
||||||
|
void *AdditionalInfo);
|
||||||
typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device);
|
typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device);
|
||||||
typedef char** (*PFN_ON_GETDEVICEIDS)(void);
|
typedef char** (*PFN_ON_GETDEVICEIDS)(void);
|
||||||
typedef void (*PFN_ON_CLEANUP)(struct hv_driver *Driver);
|
typedef void (*PFN_ON_CLEANUP)(struct hv_driver *Driver);
|
||||||
|
|
||||||
/* Vmbus extensions */
|
/* Vmbus extensions */
|
||||||
/* typedef int (*PFN_ON_MATCH)(struct hv_device *dev, struct hv_driver *drv); */
|
|
||||||
/* typedef int (*PFN_ON_PROBE)(struct hv_device *dev); */
|
|
||||||
typedef int (*PFN_ON_ISR)(struct hv_driver *drv);
|
typedef int (*PFN_ON_ISR)(struct hv_driver *drv);
|
||||||
typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
|
typedef void (*PFN_ON_DPC)(struct hv_driver *drv);
|
||||||
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
|
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
|
||||||
|
|
||||||
typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(struct hv_guid *DeviceType, struct hv_guid *DeviceInstance, void *Context);
|
typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)
|
||||||
|
(struct hv_guid *DeviceType,
|
||||||
|
struct hv_guid *DeviceInstance,
|
||||||
|
void *Context);
|
||||||
typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(struct hv_device *Device);
|
typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(struct hv_device *Device);
|
||||||
typedef int (*PFN_ON_CHILDDEVICE_ADD)(struct hv_device *RootDevice, struct hv_device *ChildDevice);
|
typedef int (*PFN_ON_CHILDDEVICE_ADD)(struct hv_device *RootDevice,
|
||||||
|
struct hv_device *ChildDevice);
|
||||||
typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(struct hv_device *Device);
|
typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(struct hv_device *Device);
|
||||||
|
|
||||||
/* Vmbus channel interface */
|
/* Vmbus channel interface */
|
||||||
typedef void (*VMBUS_CHANNEL_CALLBACK)(void *context);
|
typedef void (*VMBUS_CHANNEL_CALLBACK)(void *context);
|
||||||
|
typedef int (*VMBUS_CHANNEL_OPEN)(struct hv_device *Device, u32 SendBufferSize,
|
||||||
typedef int (*VMBUS_CHANNEL_OPEN)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
u32 SendBufferSize,
|
|
||||||
u32 RecvRingBufferSize,
|
u32 RecvRingBufferSize,
|
||||||
void *UserData,
|
void *UserData,
|
||||||
u32 UserDataLen,
|
u32 UserDataLen,
|
||||||
VMBUS_CHANNEL_CALLBACK ChannelCallback,
|
VMBUS_CHANNEL_CALLBACK ChannelCallback,
|
||||||
void * Context
|
void *Context);
|
||||||
);
|
typedef void (*VMBUS_CHANNEL_CLOSE)(struct hv_device *Device);
|
||||||
|
typedef int (*VMBUS_CHANNEL_SEND_PACKET)(struct hv_device *Device,
|
||||||
typedef void (*VMBUS_CHANNEL_CLOSE)(
|
|
||||||
struct hv_device *Device
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (*VMBUS_CHANNEL_SEND_PACKET)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
const void *Buffer,
|
const void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u64 RequestId,
|
u64 RequestId,
|
||||||
u32 Type,
|
u32 Type,
|
||||||
u32 Flags
|
u32 Flags);
|
||||||
);
|
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(struct hv_device *Device,
|
||||||
|
|
||||||
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
PAGE_BUFFER PageBuffers[],
|
PAGE_BUFFER PageBuffers[],
|
||||||
u32 PageCount,
|
u32 PageCount,
|
||||||
void *Buffer,
|
void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u64 RequestId
|
u64 RequestId);
|
||||||
);
|
typedef int(*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)
|
||||||
|
(struct hv_device *Device,
|
||||||
typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
MULTIPAGE_BUFFER *MultiPageBuffer,
|
MULTIPAGE_BUFFER *MultiPageBuffer,
|
||||||
void *Buffer,
|
void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u64 RequestId
|
u64 RequestId);
|
||||||
);
|
typedef int (*VMBUS_CHANNEL_RECV_PACKET)(struct hv_device *Device,
|
||||||
|
|
||||||
typedef int (*VMBUS_CHANNEL_RECV_PACKET)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
void *Buffer,
|
void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u32 *BufferActualLen,
|
u32 *BufferActualLen,
|
||||||
u64* RequestId
|
u64 *RequestId);
|
||||||
);
|
typedef int(*VMBUS_CHANNEL_RECV_PACKET_PAW)(struct hv_device *Device,
|
||||||
|
|
||||||
typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
void *Buffer,
|
void *Buffer,
|
||||||
u32 BufferLen,
|
u32 BufferLen,
|
||||||
u32 *BufferActualLen,
|
u32 *BufferActualLen,
|
||||||
u64* RequestId
|
u64 *RequestId);
|
||||||
);
|
typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)(struct hv_device *Device,
|
||||||
|
void *Buffer,
|
||||||
typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)(
|
u32 BufferLen,
|
||||||
struct hv_device *Device,
|
u32 *GpadlHandle);
|
||||||
void * Buffer, /* from kmalloc() */
|
typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(struct hv_device *Device,
|
||||||
u32 BufferLen, /* page-size multiple */
|
u32 GpadlHandle);
|
||||||
u32* GpadlHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(
|
|
||||||
struct hv_device *Device,
|
|
||||||
u32 GpadlHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct _PORT_INFO {
|
typedef struct _PORT_INFO {
|
||||||
|
@ -161,7 +131,6 @@ typedef struct _PORT_INFO {
|
||||||
u32 BytesAvailToWrite;
|
u32 BytesAvailToWrite;
|
||||||
} PORT_INFO;
|
} PORT_INFO;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _DEVICE_INFO {
|
typedef struct _DEVICE_INFO {
|
||||||
u32 ChannelId;
|
u32 ChannelId;
|
||||||
u32 ChannelState;
|
u32 ChannelState;
|
||||||
|
@ -180,7 +149,8 @@ typedef struct _DEVICE_INFO {
|
||||||
PORT_INFO Outbound;
|
PORT_INFO Outbound;
|
||||||
} DEVICE_INFO;
|
} DEVICE_INFO;
|
||||||
|
|
||||||
typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device, DEVICE_INFO* DeviceInfo);
|
typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device,
|
||||||
|
DEVICE_INFO *DeviceInfo);
|
||||||
|
|
||||||
typedef struct _VMBUS_CHANNEL_INTERFACE {
|
typedef struct _VMBUS_CHANNEL_INTERFACE {
|
||||||
VMBUS_CHANNEL_OPEN Open;
|
VMBUS_CHANNEL_OPEN Open;
|
||||||
|
@ -200,31 +170,44 @@ typedef void (*VMBUS_GET_CHANNEL_INTERFACE)(VMBUS_CHANNEL_INTERFACE *Interface);
|
||||||
/* Base driver object */
|
/* Base driver object */
|
||||||
struct hv_driver {
|
struct hv_driver {
|
||||||
const char *name;
|
const char *name;
|
||||||
struct hv_guid deviceType; /* the device type supported by this driver */
|
|
||||||
|
/* the device type supported by this driver */
|
||||||
|
struct hv_guid deviceType;
|
||||||
|
|
||||||
PFN_ON_DEVICEADD OnDeviceAdd;
|
PFN_ON_DEVICEADD OnDeviceAdd;
|
||||||
PFN_ON_DEVICEREMOVE OnDeviceRemove;
|
PFN_ON_DEVICEREMOVE OnDeviceRemove;
|
||||||
PFN_ON_GETDEVICEIDS OnGetDeviceIds; /* device ids supported by this driver */
|
|
||||||
|
/* device ids supported by this driver */
|
||||||
|
PFN_ON_GETDEVICEIDS OnGetDeviceIds;
|
||||||
PFN_ON_CLEANUP OnCleanup;
|
PFN_ON_CLEANUP OnCleanup;
|
||||||
|
|
||||||
VMBUS_CHANNEL_INTERFACE VmbusChannelInterface;
|
VMBUS_CHANNEL_INTERFACE VmbusChannelInterface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Base device object */
|
/* Base device object */
|
||||||
struct hv_device {
|
struct hv_device {
|
||||||
struct hv_driver *Driver; /* the driver for this device */
|
/* the driver for this device */
|
||||||
char name[64];
|
struct hv_driver *Driver;
|
||||||
struct hv_guid deviceType; /* the device type id of this device */
|
|
||||||
struct hv_guid deviceInstance; /* the device instance id of this device */
|
|
||||||
void* context;
|
|
||||||
void* Extension; /* Device extension; */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
char name[64];
|
||||||
|
|
||||||
|
/* the device type id of this device */
|
||||||
|
struct hv_guid deviceType;
|
||||||
|
|
||||||
|
/* the device instance id of this device */
|
||||||
|
struct hv_guid deviceInstance;
|
||||||
|
|
||||||
|
void *context;
|
||||||
|
|
||||||
|
/* Device extension; */
|
||||||
|
void *Extension;
|
||||||
|
};
|
||||||
|
|
||||||
/* Vmbus driver object */
|
/* Vmbus driver object */
|
||||||
typedef struct _VMBUS_DRIVER_OBJECT {
|
typedef struct _VMBUS_DRIVER_OBJECT {
|
||||||
struct hv_driver Base; /* !! Must be the 1st field !! */
|
/* !! Must be the 1st field !! */
|
||||||
|
/* FIXME if ^, then someone is doing somthing stupid */
|
||||||
|
struct hv_driver Base;
|
||||||
|
|
||||||
/* Set by the caller */
|
/* Set by the caller */
|
||||||
PFN_ON_CHILDDEVICE_CREATE OnChildDeviceCreate;
|
PFN_ON_CHILDDEVICE_CREATE OnChildDeviceCreate;
|
||||||
|
@ -233,8 +216,6 @@ typedef struct _VMBUS_DRIVER_OBJECT {
|
||||||
PFN_ON_CHILDDEVICE_REMOVE OnChildDeviceRemove;
|
PFN_ON_CHILDDEVICE_REMOVE OnChildDeviceRemove;
|
||||||
|
|
||||||
/* Set by the callee */
|
/* Set by the callee */
|
||||||
/* PFN_ON_MATCH OnMatch; */
|
|
||||||
/* PFN_ON_PROBE OnProbe; */
|
|
||||||
PFN_ON_ISR OnIsr;
|
PFN_ON_ISR OnIsr;
|
||||||
PFN_ON_DPC OnMsgDpc;
|
PFN_ON_DPC OnMsgDpc;
|
||||||
PFN_ON_DPC OnEventDpc;
|
PFN_ON_DPC OnEventDpc;
|
||||||
|
@ -244,13 +225,6 @@ typedef struct _VMBUS_DRIVER_OBJECT {
|
||||||
VMBUS_GET_CHANNEL_INFO GetChannelInfo;
|
VMBUS_GET_CHANNEL_INFO GetChannelInfo;
|
||||||
} VMBUS_DRIVER_OBJECT;
|
} VMBUS_DRIVER_OBJECT;
|
||||||
|
|
||||||
|
int VmbusInitialize(struct hv_driver *drv);
|
||||||
|
|
||||||
/* Interface */
|
|
||||||
|
|
||||||
int
|
|
||||||
VmbusInitialize(
|
|
||||||
struct hv_driver *drv
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif /* _VMBUS_API_H_ */
|
#endif /* _VMBUS_API_H_ */
|
||||||
|
|
Loading…
Reference in a new issue