Remove typedef DEVICE_OBJECT and use a struct named hv_device instead.
Remove typedef PDEVICE_OBJECT which aliases a pointer and use
struct hv_device * instead.
Here is the semantic patch to perform this transformation:
(http://coccinelle.lip6.fr/)
//<smpl>
@rm_PDEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
@rm_DEVICE_OBJECT@
@@
-typedef struct _DEVICE_OBJECT
+struct hv_device
{...}
-DEVICE_OBJECT
;
@fixtypedef_PDEVICE_OBJECT@
typedef PDEVICE_OBJECT;
@@
-PDEVICE_OBJECT
+struct hv_device*
@fixtypedef_DEVICE_OBJECT@
typedef DEVICE_OBJECT;
@@
-DEVICE_OBJECT
+struct hv_device
@fixstruct__DEVICE_OBJECT@
@@
struct
-_DEVICE_OBJECT
+hv_device
//</smpl>
Signed-off-by: Nicolas Palix <npalix@diku.dk>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
/* Static routines */
static int
BlkVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
);
int
BlkVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
)
{
static int
IVmbusChannelOpen(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
u32 SendBufferSize,
u32 RecvRingBufferSize,
void * UserData,
static void
IVmbusChannelClose(
- PDEVICE_OBJECT Device
+ struct hv_device *Device
)
{
VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
static int
IVmbusChannelSendPacket(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
const void * Buffer,
u32 BufferLen,
u64 RequestId,
static int
IVmbusChannelSendPacketPageBuffer(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
PAGE_BUFFER PageBuffers[],
u32 PageCount,
void * Buffer,
static int
IVmbusChannelSendPacketMultiPageBuffer(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
static int
IVmbusChannelRecvPacket (
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
static int
IVmbusChannelRecvPacketRaw(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
static int
IVmbusChannelEstablishGpadl(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* GpadlHandle
static int
IVmbusChannelTeardownGpadl(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
u32 GpadlHandle
)
{
static void
GetChannelInfo(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
DEVICE_INFO *DeviceInfo
)
{
static void
GetChannelInfo(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
DEVICE_INFO *DeviceInfo
);
typedef struct _VMBUS_CHANNEL {
LIST_ENTRY ListEntry;
- DEVICE_OBJECT* DeviceObject;
+ struct hv_device *DeviceObject;
HANDLE PollTimer; /* SA-111 workaround */
/* Internal routines */
static int
NetVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
);
static int
NetVscOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static void
static int
NetVscInitializeSendBufferWithNetVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static int
NetVscInitializeReceiveBufferWithNetVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static int
static int
NetVscConnectToVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static void
NetVscOnSendCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet
);
static int
NetVscOnSend(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
);
static void
NetVscOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet
);
static void
NetVscSendReceiveCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
u64 TransactionId
);
-static inline struct NETVSC_DEVICE *AllocNetDevice(DEVICE_OBJECT *Device)
+static inline struct NETVSC_DEVICE *AllocNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
/* Get the net device object iff exists and its refcount > 1 */
-static inline struct NETVSC_DEVICE *GetOutboundNetDevice(DEVICE_OBJECT *Device)
+static inline struct NETVSC_DEVICE *GetOutboundNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
}
/* Get the net device object iff exists and its refcount > 0 */
-static inline struct NETVSC_DEVICE *GetInboundNetDevice(DEVICE_OBJECT *Device)
+static inline struct NETVSC_DEVICE *GetInboundNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
return netDevice;
}
-static inline void PutNetDevice(DEVICE_OBJECT *Device)
+static inline void PutNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
InterlockedDecrement(&netDevice->RefCount);
}
-static inline struct NETVSC_DEVICE *ReleaseOutboundNetDevice(DEVICE_OBJECT *Device)
+static inline struct NETVSC_DEVICE *ReleaseOutboundNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
return netDevice;
}
-static inline struct NETVSC_DEVICE *ReleaseInboundNetDevice(DEVICE_OBJECT *Device)
+static inline struct NETVSC_DEVICE *ReleaseInboundNetDevice(struct hv_device *Device)
{
struct NETVSC_DEVICE *netDevice;
static int
NetVscInitializeReceiveBufferWithNetVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret=0;
static int
NetVscInitializeSendBufferWithNetVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret=0;
static int
NetVscConnectToVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret=0;
--*/
int
NetVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
)
{
--*/
int
NetVscOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
struct NETVSC_DEVICE *netDevice;
static void
NetVscOnSendCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet
)
{
static int
NetVscOnSend(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
)
{
static void
NetVscOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet
)
{
static void
NetVscSendReceiveCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
u64 TransactionId
)
{
void * Context)
{
NETVSC_PACKET *packet = (NETVSC_PACKET*)Context;
- DEVICE_OBJECT *device = (DEVICE_OBJECT*)packet->Device;
+ struct hv_device *device = (struct hv_device*)packet->Device;
struct NETVSC_DEVICE *netDevice;
u64 transactionId=0;
bool fSendReceiveComp = false;
{
const int netPacketSize=2048;
int ret=0;
- DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context;
+ struct hv_device *device=(struct hv_device*)Context;
struct NETVSC_DEVICE *netDevice;
u32 bytesRecvd;
/* Per netvsc channel-specific */
struct NETVSC_DEVICE {
- DEVICE_OBJECT *Device;
+ struct hv_device *Device;
int RefCount;
static int
RndisFilterOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
);
static int
RndisFilterOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
);
static int
RndisFilterOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static void
static int
RndisFilterOnOpen(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static int
RndisFilterOnClose(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static int
RndisFilterOnSend(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
);
static int
RndisFilterOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
)
{
int
RndisFilterOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
)
{
static int
RndisFilterOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
static int
RndisFilterOnOpen(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret;
static int
RndisFilterOnClose(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret;
static int
RndisFilterOnSend(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
NETVSC_PACKET *Packet
)
{
/* LIST_ENTRY ListEntry; */
STORVSC_REQUEST *Request;
- DEVICE_OBJECT *Device;
+ struct hv_device *Device;
/* Synchronize the request/response if needed */
HANDLE WaitEvent;
/* A storvsc device is a device object that contains a vmbus channel */
typedef struct _STORVSC_DEVICE{
- DEVICE_OBJECT *Device;
+ struct hv_device *Device;
int RefCount; /* 0 indicates the device is being destroyed */
static int
StorVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
);
static int
StorVscOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static int
StorVscOnIORequest(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
STORVSC_REQUEST *Request
);
static int
StorVscOnHostReset(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
static void
static void
StorVscOnIOCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt
);
static void
StorVscOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt
);
static int
StorVscConnectToVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
);
-static inline STORVSC_DEVICE* AllocStorDevice(DEVICE_OBJECT *Device)
+static inline STORVSC_DEVICE* AllocStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
}
/* Get the stordevice object iff exists and its refcount > 1 */
-static inline STORVSC_DEVICE* GetStorDevice(DEVICE_OBJECT *Device)
+static inline STORVSC_DEVICE* GetStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
}
/* Get the stordevice object iff exists and its refcount > 0 */
-static inline STORVSC_DEVICE* MustGetStorDevice(DEVICE_OBJECT *Device)
+static inline STORVSC_DEVICE* MustGetStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
return storDevice;
}
-static inline void PutStorDevice(DEVICE_OBJECT *Device)
+static inline void PutStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
}
/* Drop ref count to 1 to effectively disable GetStorDevice() */
-static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device)
+static inline STORVSC_DEVICE* ReleaseStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
}
/* Drop ref count to 0. No one can use StorDevice object. */
-static inline STORVSC_DEVICE* FinalReleaseStorDevice(DEVICE_OBJECT *Device)
+static inline STORVSC_DEVICE* FinalReleaseStorDevice(struct hv_device *Device)
{
STORVSC_DEVICE *storDevice;
--*/
int
StorVscOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
)
{
return ret;
}
-static int StorVscChannelInit(DEVICE_OBJECT *Device)
+static int StorVscChannelInit(struct hv_device *Device)
{
int ret=0;
STORVSC_DEVICE *storDevice;
int
StorVscConnectToVsp(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret=0;
--*/
int
StorVscOnDeviceRemove(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
STORVSC_DEVICE *storDevice;
void *Context
)
{
-DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context;
+struct hv_device *device=(struct hv_device *)Context;
STORVSC_DRIVER_OBJECT *storDriver;
DPRINT_ENTER(STORVSC);
int
StorVscOnHostReset(
- DEVICE_OBJECT *Device
+ struct hv_device *Device
)
{
int ret=0;
--*/
int
StorVscOnIORequest(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
STORVSC_REQUEST *Request
)
{
static void
StorVscOnIOCompletion(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt
)
static void
StorVscOnReceive(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt
)
)
{
int ret=0;
- DEVICE_OBJECT *device = (DEVICE_OBJECT*)Context;
+ struct hv_device *device = (struct hv_device*)Context;
STORVSC_DEVICE *storDevice;
u32 bytesRecvd;
u64 requestId;
};
static DRIVER_OBJECT* gDriver; /* vmbus driver object */
-static DEVICE_OBJECT* gDevice; /* vmbus root device */
+static struct hv_device* gDevice; /* vmbus root device */
static void
VmbusGetChannelInfo(
- DEVICE_OBJECT *DeviceObject,
+ struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo
);
static int
VmbusOnDeviceAdd(
- DEVICE_OBJECT *Device,
+ struct hv_device *Device,
void *AdditionalInfo
);
static int
VmbusOnDeviceRemove(
- DEVICE_OBJECT* dev
+ struct hv_device *dev
);
static void
--*/
static void
VmbusGetChannelInfo(
- DEVICE_OBJECT *DeviceObject,
+ struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo
)
{
--*/
-DEVICE_OBJECT*
+struct hv_device*
VmbusChildDeviceCreate(
GUID DeviceType,
GUID DeviceInstance,
--*/
int
VmbusChildDeviceAdd(
- DEVICE_OBJECT* ChildDevice)
+ struct hv_device *ChildDevice)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
--*/
void
VmbusChildDeviceRemove(
- DEVICE_OBJECT* ChildDevice)
+ struct hv_device *ChildDevice)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
/* **************
void
VmbusChildDeviceDestroy(
-DEVICE_OBJECT* ChildDevice
+struct hv_device *ChildDevice
)
{
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
--*/
static int
VmbusOnDeviceAdd(
- DEVICE_OBJECT *dev,
+ struct hv_device *dev,
void *AdditionalInfo
)
{
--*/
int VmbusOnDeviceRemove(
- DEVICE_OBJECT* dev
+ struct hv_device *dev
)
{
int ret=0;
/* General vmbus interface */
-static DEVICE_OBJECT*
+static struct hv_device*
VmbusChildDeviceCreate(
GUID deviceType,
GUID deviceInstance,
static int
VmbusChildDeviceAdd(
- DEVICE_OBJECT* Device);
+ struct hv_device *Device);
static void
VmbusChildDeviceRemove(
- DEVICE_OBJECT* Device);
+ struct hv_device *Device);
/* static void */
/* VmbusChildDeviceDestroy( */
-/* DEVICE_OBJECT*); */
+/* struct hv_device *); */
static VMBUS_CHANNEL*
GetChannelFromRelId(
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device);
- DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
struct block_device_context *blkdev=NULL;
STORVSC_DEVICE_INFO device_info;
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device);
- DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags;
/* Data types */
-typedef int (*PFN_ON_OPEN)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_CLOSE)(DEVICE_OBJECT *Device);
+typedef int (*PFN_ON_OPEN)(struct hv_device *Device);
+typedef int (*PFN_ON_CLOSE)(struct hv_device *Device);
-typedef void (*PFN_QUERY_LINKSTATUS)(DEVICE_OBJECT *Device);
-typedef int (*PFN_ON_SEND)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_QUERY_LINKSTATUS)(struct hv_device *Device);
+typedef int (*PFN_ON_SEND)(struct hv_device *dev, PNETVSC_PACKET packet);
typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context);
-typedef int (*PFN_ON_RECVCALLBACK)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet);
-typedef void (*PFN_ON_LINKSTATUS_CHANGED)(DEVICE_OBJECT *dev, u32 Status);
+typedef int (*PFN_ON_RECVCALLBACK)(struct hv_device *dev, PNETVSC_PACKET packet);
+typedef void (*PFN_ON_LINKSTATUS_CHANGED)(struct hv_device *dev, u32 Status);
/* Represent the xfer page packet which contains 1 or more netvsc packet */
typedef struct _XFERPAGE_PACKET {
/* Bookkeeping stuff */
DLIST_ENTRY ListEntry;
- DEVICE_OBJECT *Device;
+ struct hv_device *Device;
bool IsDataPacket;
/*
/* Data types */
-typedef int (*PFN_ON_IO_REQUEST)(PDEVICE_OBJECT Device, PSTORVSC_REQUEST Request);
+typedef int (*PFN_ON_IO_REQUEST)(struct hv_device *Device, PSTORVSC_REQUEST Request);
typedef void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
-typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device);
-typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device);
+typedef int (*PFN_ON_HOST_RESET)(struct hv_device *Device);
+typedef void (*PFN_ON_HOST_RESCAN)(struct hv_device *Device);
/* Matches Windows-end */
/* Fwd declarations */
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
-typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
/* Data types */
#pragma pack(pop)
+struct hv_device;
+
/* All drivers */
-typedef int (*PFN_ON_DEVICEADD)(PDEVICE_OBJECT Device, void* AdditionalInfo);
-typedef int (*PFN_ON_DEVICEREMOVE)(PDEVICE_OBJECT Device);
+typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device, void* AdditionalInfo);
+typedef int (*PFN_ON_DEVICEREMOVE)(struct hv_device *Device);
typedef char** (*PFN_ON_GETDEVICEIDS)(void);
typedef void (*PFN_ON_CLEANUP)(PDRIVER_OBJECT Driver);
/* Vmbus extensions */
-/* typedef int (*PFN_ON_MATCH)(PDEVICE_OBJECT dev, PDRIVER_OBJECT drv); */
-/* typedef int (*PFN_ON_PROBE)(PDEVICE_OBJECT dev); */
+/* typedef int (*PFN_ON_MATCH)(struct hv_device *dev, PDRIVER_OBJECT drv); */
+/* typedef int (*PFN_ON_PROBE)(struct hv_device *dev); */
typedef int (*PFN_ON_ISR)(PDRIVER_OBJECT drv);
typedef void (*PFN_ON_DPC)(PDRIVER_OBJECT drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
-typedef PDEVICE_OBJECT (*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context);
-typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(PDEVICE_OBJECT Device);
-typedef int (*PFN_ON_CHILDDEVICE_ADD)(PDEVICE_OBJECT RootDevice, PDEVICE_OBJECT ChildDevice);
-typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(PDEVICE_OBJECT Device);
+typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context);
+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 void (*PFN_ON_CHILDDEVICE_REMOVE)(struct hv_device *Device);
/* Vmbus channel interface */
typedef void (*VMBUS_CHANNEL_CALLBACK)(void * context);
typedef int (*VMBUS_CHANNEL_OPEN)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
u32 SendBufferSize,
u32 RecvRingBufferSize,
void * UserData,
);
typedef void (*VMBUS_CHANNEL_CLOSE)(
- PDEVICE_OBJECT Device
+ struct hv_device *Device
);
typedef int (*VMBUS_CHANNEL_SEND_PACKET)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
const void * Buffer,
u32 BufferLen,
u64 RequestId,
);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
PAGE_BUFFER PageBuffers[],
u32 PageCount,
void * Buffer,
);
typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer,
void * Buffer,
u32 BufferLen,
);
typedef int (*VMBUS_CHANNEL_RECV_PACKET)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
);
typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer,
u32 BufferLen,
u32* BufferActualLen,
);
typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
void * Buffer, /* from kmalloc() */
u32 BufferLen, /* page-size multiple */
u32* GpadlHandle
);
typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(
- PDEVICE_OBJECT Device,
+ struct hv_device *Device,
u32 GpadlHandle
);
PORT_INFO Outbound;
} DEVICE_INFO;
-typedef void (*VMBUS_GET_CHANNEL_INFO)(PDEVICE_OBJECT Device, DEVICE_INFO* DeviceInfo);
+typedef void (*VMBUS_GET_CHANNEL_INFO)(struct hv_device *Device, DEVICE_INFO* DeviceInfo);
typedef struct _VMBUS_CHANNEL_INTERFACE {
VMBUS_CHANNEL_OPEN Open;
/* Base device object */
-typedef struct _DEVICE_OBJECT {
+struct hv_device {
DRIVER_OBJECT* Driver; /* the driver for this device */
char name[64];
GUID deviceType; /* the device type id of this device */
GUID deviceInstance; /* the device instance id of this device */
void* context;
void* Extension; /* Device extension; */
-} DEVICE_OBJECT;
+};
/* Vmbus driver object */
GUID device_id;
int probe_error;
struct device device;
- DEVICE_OBJECT device_obj;
+ struct hv_device device_obj;
};
/* Inlines */
-static inline struct device_context *to_device_context(DEVICE_OBJECT *device_obj)
+static inline struct device_context *to_device_context(struct hv_device *device_obj)
{
return container_of(device_obj, struct device_context, device_obj);
}
static int netvsc_open(struct net_device *net);
static void netvsc_xmit_completion(void *context);
static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net);
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* Packet);
+static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* Packet);
static int netvsc_close(struct net_device *net);
static struct net_device_stats *netvsc_get_stats(struct net_device *net);
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status);
+static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status);
/* Data types */
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device);
- DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
struct net_device *net = NULL;
struct net_device_context *net_device_ctx;
struct device_context *device_ctx = device_to_device_context(device);
struct net_device *net = dev_get_drvdata(&device_ctx->device);
- DEVICE_OBJECT *device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
DPRINT_ENTER(NETVSC_DRV);
struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
- DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+ struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
DPRINT_ENTER(NETVSC_DRV);
struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
- DEVICE_OBJECT *device_obj = &net_device_ctx->device_ctx->device_obj;
+ struct hv_device *device_obj = &net_device_ctx->device_ctx->device_obj;
DPRINT_ENTER(NETVSC_DRV);
Desc: Link up/down notification
--*/
-static void netvsc_linkstatus_callback(DEVICE_OBJECT *device_obj, unsigned int status)
+static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status)
{
struct device_context* device_ctx = to_device_context(device_obj);
struct net_device* net = dev_get_drvdata(&device_ctx->device);
Desc: Callback when we receive a packet from the "wire" on the specify device
--*/
-static int netvsc_recv_callback(DEVICE_OBJECT *device_obj, NETVSC_PACKET* packet)
+static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* packet)
{
int ret=0;
struct device_context *device_ctx = to_device_context(device_obj);
static int storvsc_device_configure(struct scsi_device *);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd);
static void storvsc_host_rescan_callback(struct work_struct *work);
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj);
+static void storvsc_host_rescan(struct hv_device* device_obj);
static int storvsc_remove(struct device *dev);
static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count, unsigned int len);
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device);
- DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
struct Scsi_Host *host;
struct host_device_context *host_device_ctx;
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device);
- DEVICE_OBJECT* device_obj = &device_ctx->device_obj;
+ struct hv_device *device_obj = &device_ctx->device_obj;
struct Scsi_Host *host = dev_get_drvdata(device);
struct host_device_context *host_device_ctx=(struct host_device_context*)host->hostdata;
--*/
static void storvsc_host_rescan_callback(struct work_struct *work)
{
- DEVICE_OBJECT* device_obj =
+ struct hv_device *device_obj =
&((struct host_device_context*)work)->device_ctx->device_obj;
struct device_context* device_ctx = to_device_context(device_obj);
struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
return 0;
}
-static void storvsc_host_rescan(DEVICE_OBJECT* device_obj)
+static void storvsc_host_rescan(struct hv_device *device_obj)
{
struct device_context* device_ctx = to_device_context(device_obj);
struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
static void vmbus_device_release(struct device *device);
static void vmbus_bus_release(struct device *device);
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context);
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj);
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_unregister(DEVICE_OBJECT* child_device_obj);
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info);
+static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context);
+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 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); */
Desc: Get the vmbus child device info. This is invoked to display various device attributes in sysfs.
--*/
-static void vmbus_child_device_get_info(DEVICE_OBJECT *device_obj, DEVICE_INFO *device_info)
+static void vmbus_child_device_get_info(struct hv_device *device_obj, DEVICE_INFO *device_info)
{
VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
Desc: Creates and registers a new child device on the vmbus.
--*/
-static DEVICE_OBJECT* vmbus_child_device_create(GUID type, GUID instance, void* context)
+static struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context)
{
struct device_context *child_device_ctx;
- DEVICE_OBJECT* child_device_obj;
+ struct hv_device *child_device_obj;
DPRINT_ENTER(VMBUS_DRV);
Desc: Register the child device on the specified bus
--*/
-static int vmbus_child_device_register(DEVICE_OBJECT* root_device_obj, DEVICE_OBJECT* child_device_obj)
+static int vmbus_child_device_register(struct hv_device *root_device_obj, struct hv_device *child_device_obj)
{
int ret=0;
struct device_context *root_device_ctx = to_device_context(root_device_obj);
Desc: Remove the specified child device from the vmbus.
--*/
-static void vmbus_child_device_unregister(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_unregister(struct hv_device *device_obj)
{
struct device_context *device_ctx = to_device_context(device_obj);
Desc: Destroy the specified child device on the vmbus.
--*/
-static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj)
+static void vmbus_child_device_destroy(struct hv_device *device_obj)
{
DPRINT_ENTER(VMBUS_DRV);