Commit 3d3b5518 authored by Nicolas Palix's avatar Nicolas Palix Committed by Greg Kroah-Hartman

Staging: hv: Transform PDEVICE_OBJECT and DEVICE_OBJECT typedefs into their corresponding structs

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: default avatarNicolas Palix <npalix@diku.dk>
Cc: Hank Janssen <hjanssen@microsoft.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent df8d9b1f
...@@ -34,7 +34,7 @@ static const GUID gBlkVscDeviceType={ ...@@ -34,7 +34,7 @@ static const GUID gBlkVscDeviceType={
/* Static routines */ /* Static routines */
static int static int
BlkVscOnDeviceAdd( BlkVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
); );
...@@ -77,7 +77,7 @@ BlkVscInitialize( ...@@ -77,7 +77,7 @@ BlkVscInitialize(
int int
BlkVscOnDeviceAdd( BlkVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
) )
{ {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
static int static int
IVmbusChannelOpen( IVmbusChannelOpen(
PDEVICE_OBJECT Device, struct hv_device *Device,
u32 SendBufferSize, u32 SendBufferSize,
u32 RecvRingBufferSize, u32 RecvRingBufferSize,
void * UserData, void * UserData,
...@@ -46,7 +46,7 @@ IVmbusChannelOpen( ...@@ -46,7 +46,7 @@ IVmbusChannelOpen(
static void static void
IVmbusChannelClose( IVmbusChannelClose(
PDEVICE_OBJECT Device struct hv_device *Device
) )
{ {
VmbusChannelClose((VMBUS_CHANNEL*)Device->context); VmbusChannelClose((VMBUS_CHANNEL*)Device->context);
...@@ -55,7 +55,7 @@ IVmbusChannelClose( ...@@ -55,7 +55,7 @@ IVmbusChannelClose(
static int static int
IVmbusChannelSendPacket( IVmbusChannelSendPacket(
PDEVICE_OBJECT Device, struct hv_device *Device,
const void * Buffer, const void * Buffer,
u32 BufferLen, u32 BufferLen,
u64 RequestId, u64 RequestId,
...@@ -73,7 +73,7 @@ IVmbusChannelSendPacket( ...@@ -73,7 +73,7 @@ IVmbusChannelSendPacket(
static int static int
IVmbusChannelSendPacketPageBuffer( IVmbusChannelSendPacketPageBuffer(
PDEVICE_OBJECT Device, struct hv_device *Device,
PAGE_BUFFER PageBuffers[], PAGE_BUFFER PageBuffers[],
u32 PageCount, u32 PageCount,
void * Buffer, void * Buffer,
...@@ -91,7 +91,7 @@ IVmbusChannelSendPacketPageBuffer( ...@@ -91,7 +91,7 @@ IVmbusChannelSendPacketPageBuffer(
static int static int
IVmbusChannelSendPacketMultiPageBuffer( IVmbusChannelSendPacketMultiPageBuffer(
PDEVICE_OBJECT Device, struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer, MULTIPAGE_BUFFER *MultiPageBuffer,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
...@@ -107,7 +107,7 @@ IVmbusChannelSendPacketMultiPageBuffer( ...@@ -107,7 +107,7 @@ IVmbusChannelSendPacketMultiPageBuffer(
static int static int
IVmbusChannelRecvPacket ( IVmbusChannelRecvPacket (
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
u32* BufferActualLen, u32* BufferActualLen,
...@@ -123,7 +123,7 @@ IVmbusChannelRecvPacket ( ...@@ -123,7 +123,7 @@ IVmbusChannelRecvPacket (
static int static int
IVmbusChannelRecvPacketRaw( IVmbusChannelRecvPacketRaw(
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
u32* BufferActualLen, u32* BufferActualLen,
...@@ -139,7 +139,7 @@ IVmbusChannelRecvPacketRaw( ...@@ -139,7 +139,7 @@ IVmbusChannelRecvPacketRaw(
static int static int
IVmbusChannelEstablishGpadl( IVmbusChannelEstablishGpadl(
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
u32* GpadlHandle u32* GpadlHandle
...@@ -153,7 +153,7 @@ IVmbusChannelEstablishGpadl( ...@@ -153,7 +153,7 @@ IVmbusChannelEstablishGpadl(
static int static int
IVmbusChannelTeardownGpadl( IVmbusChannelTeardownGpadl(
PDEVICE_OBJECT Device, struct hv_device *Device,
u32 GpadlHandle u32 GpadlHandle
) )
{ {
...@@ -182,7 +182,7 @@ GetChannelInterface( ...@@ -182,7 +182,7 @@ GetChannelInterface(
static void static void
GetChannelInfo( GetChannelInfo(
PDEVICE_OBJECT Device, struct hv_device *Device,
DEVICE_INFO *DeviceInfo DEVICE_INFO *DeviceInfo
) )
{ {
......
...@@ -34,7 +34,7 @@ GetChannelInterface( ...@@ -34,7 +34,7 @@ GetChannelInterface(
static void static void
GetChannelInfo( GetChannelInfo(
PDEVICE_OBJECT Device, struct hv_device *Device,
DEVICE_INFO *DeviceInfo DEVICE_INFO *DeviceInfo
); );
......
...@@ -45,7 +45,7 @@ typedef enum { ...@@ -45,7 +45,7 @@ typedef enum {
typedef struct _VMBUS_CHANNEL { typedef struct _VMBUS_CHANNEL {
LIST_ENTRY ListEntry; LIST_ENTRY ListEntry;
DEVICE_OBJECT* DeviceObject; struct hv_device *DeviceObject;
HANDLE PollTimer; /* SA-111 workaround */ HANDLE PollTimer; /* SA-111 workaround */
......
...@@ -40,13 +40,13 @@ static const GUID gNetVscDeviceType={ ...@@ -40,13 +40,13 @@ static const GUID gNetVscDeviceType={
/* Internal routines */ /* Internal routines */
static int static int
NetVscOnDeviceAdd( NetVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
); );
static int static int
NetVscOnDeviceRemove( NetVscOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static void static void
...@@ -61,12 +61,12 @@ NetVscOnChannelCallback( ...@@ -61,12 +61,12 @@ NetVscOnChannelCallback(
static int static int
NetVscInitializeSendBufferWithNetVsp( NetVscInitializeSendBufferWithNetVsp(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static int static int
NetVscInitializeReceiveBufferWithNetVsp( NetVscInitializeReceiveBufferWithNetVsp(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static int static int
...@@ -81,24 +81,24 @@ NetVscDestroyReceiveBuffer( ...@@ -81,24 +81,24 @@ NetVscDestroyReceiveBuffer(
static int static int
NetVscConnectToVsp( NetVscConnectToVsp(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static void static void
NetVscOnSendCompletion( NetVscOnSendCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet VMPACKET_DESCRIPTOR *Packet
); );
static int static int
NetVscOnSend( NetVscOnSend(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
); );
static void static void
NetVscOnReceive( NetVscOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet VMPACKET_DESCRIPTOR *Packet
); );
...@@ -109,11 +109,11 @@ NetVscOnReceiveCompletion( ...@@ -109,11 +109,11 @@ NetVscOnReceiveCompletion(
static void static void
NetVscSendReceiveCompletion( NetVscSendReceiveCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
u64 TransactionId 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; struct NETVSC_DEVICE *netDevice;
...@@ -139,7 +139,7 @@ static inline void FreeNetDevice(struct NETVSC_DEVICE *Device) ...@@ -139,7 +139,7 @@ static inline void FreeNetDevice(struct NETVSC_DEVICE *Device)
/* Get the net device object iff exists and its refcount > 1 */ /* 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; struct NETVSC_DEVICE *netDevice;
...@@ -157,7 +157,7 @@ static inline struct NETVSC_DEVICE *GetOutboundNetDevice(DEVICE_OBJECT *Device) ...@@ -157,7 +157,7 @@ static inline struct NETVSC_DEVICE *GetOutboundNetDevice(DEVICE_OBJECT *Device)
} }
/* Get the net device object iff exists and its refcount > 0 */ /* 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; struct NETVSC_DEVICE *netDevice;
...@@ -174,7 +174,7 @@ static inline struct NETVSC_DEVICE *GetInboundNetDevice(DEVICE_OBJECT *Device) ...@@ -174,7 +174,7 @@ static inline struct NETVSC_DEVICE *GetInboundNetDevice(DEVICE_OBJECT *Device)
return netDevice; return netDevice;
} }
static inline void PutNetDevice(DEVICE_OBJECT *Device) static inline void PutNetDevice(struct hv_device *Device)
{ {
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
...@@ -184,7 +184,7 @@ static inline void PutNetDevice(DEVICE_OBJECT *Device) ...@@ -184,7 +184,7 @@ static inline void PutNetDevice(DEVICE_OBJECT *Device)
InterlockedDecrement(&netDevice->RefCount); 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; struct NETVSC_DEVICE *netDevice;
...@@ -201,7 +201,7 @@ static inline struct NETVSC_DEVICE *ReleaseOutboundNetDevice(DEVICE_OBJECT *Devi ...@@ -201,7 +201,7 @@ static inline struct NETVSC_DEVICE *ReleaseOutboundNetDevice(DEVICE_OBJECT *Devi
return 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; struct NETVSC_DEVICE *netDevice;
...@@ -268,7 +268,7 @@ NetVscInitialize( ...@@ -268,7 +268,7 @@ NetVscInitialize(
static int static int
NetVscInitializeReceiveBufferWithNetVsp( NetVscInitializeReceiveBufferWithNetVsp(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret=0; int ret=0;
...@@ -397,7 +397,7 @@ NetVscInitializeReceiveBufferWithNetVsp( ...@@ -397,7 +397,7 @@ NetVscInitializeReceiveBufferWithNetVsp(
static int static int
NetVscInitializeSendBufferWithNetVsp( NetVscInitializeSendBufferWithNetVsp(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret=0; int ret=0;
...@@ -661,7 +661,7 @@ NetVscDestroySendBuffer( ...@@ -661,7 +661,7 @@ NetVscDestroySendBuffer(
static int static int
NetVscConnectToVsp( NetVscConnectToVsp(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret=0; int ret=0;
...@@ -794,7 +794,7 @@ NetVscDisconnectFromVsp( ...@@ -794,7 +794,7 @@ NetVscDisconnectFromVsp(
--*/ --*/
int int
NetVscOnDeviceAdd( NetVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
) )
{ {
...@@ -911,7 +911,7 @@ NetVscOnDeviceAdd( ...@@ -911,7 +911,7 @@ NetVscOnDeviceAdd(
--*/ --*/
int int
NetVscOnDeviceRemove( NetVscOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
...@@ -993,7 +993,7 @@ NetVscOnCleanup( ...@@ -993,7 +993,7 @@ NetVscOnCleanup(
static void static void
NetVscOnSendCompletion( NetVscOnSendCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet VMPACKET_DESCRIPTOR *Packet
) )
{ {
...@@ -1047,7 +1047,7 @@ NetVscOnSendCompletion( ...@@ -1047,7 +1047,7 @@ NetVscOnSendCompletion(
static int static int
NetVscOnSend( NetVscOnSend(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
) )
{ {
...@@ -1111,7 +1111,7 @@ NetVscOnSend( ...@@ -1111,7 +1111,7 @@ NetVscOnSend(
static void static void
NetVscOnReceive( NetVscOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
VMPACKET_DESCRIPTOR *Packet VMPACKET_DESCRIPTOR *Packet
) )
{ {
...@@ -1304,7 +1304,7 @@ NetVscOnReceive( ...@@ -1304,7 +1304,7 @@ NetVscOnReceive(
static void static void
NetVscSendReceiveCompletion( NetVscSendReceiveCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
u64 TransactionId u64 TransactionId
) )
{ {
...@@ -1358,7 +1358,7 @@ NetVscOnReceiveCompletion( ...@@ -1358,7 +1358,7 @@ NetVscOnReceiveCompletion(
void * Context) void * Context)
{ {
NETVSC_PACKET *packet = (NETVSC_PACKET*)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; struct NETVSC_DEVICE *netDevice;
u64 transactionId=0; u64 transactionId=0;
bool fSendReceiveComp = false; bool fSendReceiveComp = false;
...@@ -1417,7 +1417,7 @@ NetVscOnChannelCallback( ...@@ -1417,7 +1417,7 @@ NetVscOnChannelCallback(
{ {
const int netPacketSize=2048; const int netPacketSize=2048;
int ret=0; int ret=0;
DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context; struct hv_device *device=(struct hv_device*)Context;
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
u32 bytesRecvd; u32 bytesRecvd;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
/* Per netvsc channel-specific */ /* Per netvsc channel-specific */
struct NETVSC_DEVICE { struct NETVSC_DEVICE {
DEVICE_OBJECT *Device; struct hv_device *Device;
int RefCount; int RefCount;
......
...@@ -112,7 +112,7 @@ RndisFilterReceiveData( ...@@ -112,7 +112,7 @@ RndisFilterReceiveData(
static int static int
RndisFilterOnReceive( RndisFilterOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
); );
...@@ -157,13 +157,13 @@ RndisFilterCloseDevice( ...@@ -157,13 +157,13 @@ RndisFilterCloseDevice(
static int static int
RndisFilterOnDeviceAdd( RndisFilterOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
); );
static int static int
RndisFilterOnDeviceRemove( RndisFilterOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static void static void
...@@ -173,17 +173,17 @@ RndisFilterOnCleanup( ...@@ -173,17 +173,17 @@ RndisFilterOnCleanup(
static int static int
RndisFilterOnOpen( RndisFilterOnOpen(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static int static int
RndisFilterOnClose( RndisFilterOnClose(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static int static int
RndisFilterOnSend( RndisFilterOnSend(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
); );
...@@ -490,7 +490,7 @@ RndisFilterReceiveData( ...@@ -490,7 +490,7 @@ RndisFilterReceiveData(
static int static int
RndisFilterOnReceive( RndisFilterOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
) )
{ {
...@@ -928,7 +928,7 @@ RndisFilterCloseDevice( ...@@ -928,7 +928,7 @@ RndisFilterCloseDevice(
int int
RndisFilterOnDeviceAdd( RndisFilterOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
) )
{ {
...@@ -1007,7 +1007,7 @@ RndisFilterOnDeviceAdd( ...@@ -1007,7 +1007,7 @@ RndisFilterOnDeviceAdd(
static int static int
RndisFilterOnDeviceRemove( RndisFilterOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension; struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
...@@ -1042,7 +1042,7 @@ RndisFilterOnCleanup( ...@@ -1042,7 +1042,7 @@ RndisFilterOnCleanup(
static int static int
RndisFilterOnOpen( RndisFilterOnOpen(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret; int ret;
...@@ -1060,7 +1060,7 @@ RndisFilterOnOpen( ...@@ -1060,7 +1060,7 @@ RndisFilterOnOpen(
static int static int
RndisFilterOnClose( RndisFilterOnClose(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret; int ret;
...@@ -1079,7 +1079,7 @@ RndisFilterOnClose( ...@@ -1079,7 +1079,7 @@ RndisFilterOnClose(
static int static int
RndisFilterOnSend( RndisFilterOnSend(
DEVICE_OBJECT *Device, struct hv_device *Device,
NETVSC_PACKET *Packet NETVSC_PACKET *Packet
) )
{ {
......
...@@ -44,7 +44,7 @@ typedef struct _STORVSC_REQUEST_EXTENSION { ...@@ -44,7 +44,7 @@ typedef struct _STORVSC_REQUEST_EXTENSION {
/* LIST_ENTRY ListEntry; */ /* LIST_ENTRY ListEntry; */
STORVSC_REQUEST *Request; STORVSC_REQUEST *Request;
DEVICE_OBJECT *Device; struct hv_device *Device;
/* Synchronize the request/response if needed */ /* Synchronize the request/response if needed */
HANDLE WaitEvent; HANDLE WaitEvent;
...@@ -55,7 +55,7 @@ typedef struct _STORVSC_REQUEST_EXTENSION { ...@@ -55,7 +55,7 @@ typedef struct _STORVSC_REQUEST_EXTENSION {
/* A storvsc device is a device object that contains a vmbus channel */ /* A storvsc device is a device object that contains a vmbus channel */
typedef struct _STORVSC_DEVICE{ typedef struct _STORVSC_DEVICE{
DEVICE_OBJECT *Device; struct hv_device *Device;
int RefCount; /* 0 indicates the device is being destroyed */ int RefCount; /* 0 indicates the device is being destroyed */
...@@ -96,24 +96,24 @@ static const GUID gStorVscDeviceType={ ...@@ -96,24 +96,24 @@ static const GUID gStorVscDeviceType={
static int static int
StorVscOnDeviceAdd( StorVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
); );
static int static int
StorVscOnDeviceRemove( StorVscOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static int static int
StorVscOnIORequest( StorVscOnIORequest(
DEVICE_OBJECT *Device, struct hv_device *Device,
STORVSC_REQUEST *Request STORVSC_REQUEST *Request
); );
static int static int
StorVscOnHostReset( StorVscOnHostReset(
DEVICE_OBJECT *Device struct hv_device *Device
); );
static void static void
...@@ -128,24 +128,24 @@ StorVscOnChannelCallback( ...@@ -128,24 +128,24 @@ StorVscOnChannelCallback(
static void static void
StorVscOnIOCompletion( StorVscOnIOCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
VSTOR_PACKET *VStorPacket, VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt STORVSC_REQUEST_EXTENSION *RequestExt
); );
static void static void
StorVscOnReceive( StorVscOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
VSTOR_PACKET *VStorPacket, VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt STORVSC_REQUEST_EXTENSION *RequestExt
); );
static int static int
StorVscConnectToVsp( 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; STORVSC_DEVICE *storDevice;
...@@ -170,7 +170,7 @@ static inline void FreeStorDevice(STORVSC_DEVICE *Device) ...@@ -170,7 +170,7 @@ static inline void FreeStorDevice(STORVSC_DEVICE *Device)
} }
/* Get the stordevice object iff exists and its refcount > 1 */ /* 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; STORVSC_DEVICE *storDevice;
...@@ -188,7 +188,7 @@ static inline STORVSC_DEVICE* GetStorDevice(DEVICE_OBJECT *Device) ...@@ -188,7 +188,7 @@ static inline STORVSC_DEVICE* GetStorDevice(DEVICE_OBJECT *Device)
} }
/* Get the stordevice object iff exists and its refcount > 0 */ /* 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; STORVSC_DEVICE *storDevice;
...@@ -205,7 +205,7 @@ static inline STORVSC_DEVICE* MustGetStorDevice(DEVICE_OBJECT *Device) ...@@ -205,7 +205,7 @@ static inline STORVSC_DEVICE* MustGetStorDevice(DEVICE_OBJECT *Device)
return storDevice; return storDevice;
} }
static inline void PutStorDevice(DEVICE_OBJECT *Device) static inline void PutStorDevice(struct hv_device *Device)
{ {
STORVSC_DEVICE *storDevice; STORVSC_DEVICE *storDevice;
...@@ -217,7 +217,7 @@ static inline void PutStorDevice(DEVICE_OBJECT *Device) ...@@ -217,7 +217,7 @@ static inline void PutStorDevice(DEVICE_OBJECT *Device)
} }
/* Drop ref count to 1 to effectively disable GetStorDevice() */ /* 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; STORVSC_DEVICE *storDevice;
...@@ -234,7 +234,7 @@ static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device) ...@@ -234,7 +234,7 @@ static inline STORVSC_DEVICE* ReleaseStorDevice(DEVICE_OBJECT *Device)
} }
/* Drop ref count to 0. No one can use StorDevice object. */ /* 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; STORVSC_DEVICE *storDevice;
...@@ -317,7 +317,7 @@ StorVscInitialize( ...@@ -317,7 +317,7 @@ StorVscInitialize(
--*/ --*/
int int
StorVscOnDeviceAdd( StorVscOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
) )
{ {
...@@ -365,7 +365,7 @@ StorVscOnDeviceAdd( ...@@ -365,7 +365,7 @@ StorVscOnDeviceAdd(
return ret; return ret;
} }
static int StorVscChannelInit(DEVICE_OBJECT *Device) static int StorVscChannelInit(struct hv_device *Device)
{ {
int ret=0; int ret=0;
STORVSC_DEVICE *storDevice; STORVSC_DEVICE *storDevice;
...@@ -529,7 +529,7 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device) ...@@ -529,7 +529,7 @@ static int StorVscChannelInit(DEVICE_OBJECT *Device)
int int
StorVscConnectToVsp( StorVscConnectToVsp(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret=0; int ret=0;
...@@ -574,7 +574,7 @@ StorVscConnectToVsp( ...@@ -574,7 +574,7 @@ StorVscConnectToVsp(
--*/ --*/
int int
StorVscOnDeviceRemove( StorVscOnDeviceRemove(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
STORVSC_DEVICE *storDevice; STORVSC_DEVICE *storDevice;
...@@ -619,7 +619,7 @@ StorVscOnTargetRescan( ...@@ -619,7 +619,7 @@ StorVscOnTargetRescan(
void *Context void *Context
) )
{ {
DEVICE_OBJECT *device=(DEVICE_OBJECT*)Context; struct hv_device *device=(struct hv_device *)Context;
STORVSC_DRIVER_OBJECT *storDriver; STORVSC_DRIVER_OBJECT *storDriver;
DPRINT_ENTER(STORVSC); DPRINT_ENTER(STORVSC);
...@@ -633,7 +633,7 @@ DPRINT_EXIT(STORVSC); ...@@ -633,7 +633,7 @@ DPRINT_EXIT(STORVSC);
int int
StorVscOnHostReset( StorVscOnHostReset(
DEVICE_OBJECT *Device struct hv_device *Device
) )
{ {
int ret=0; int ret=0;
...@@ -703,7 +703,7 @@ StorVscOnHostReset( ...@@ -703,7 +703,7 @@ StorVscOnHostReset(
--*/ --*/
int int
StorVscOnIORequest( StorVscOnIORequest(
DEVICE_OBJECT *Device, struct hv_device *Device,
STORVSC_REQUEST *Request STORVSC_REQUEST *Request
) )
{ {
...@@ -817,7 +817,7 @@ StorVscOnCleanup( ...@@ -817,7 +817,7 @@ StorVscOnCleanup(
static void static void
StorVscOnIOCompletion( StorVscOnIOCompletion(
DEVICE_OBJECT *Device, struct hv_device *Device,
VSTOR_PACKET *VStorPacket, VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt STORVSC_REQUEST_EXTENSION *RequestExt
) )
...@@ -887,7 +887,7 @@ StorVscOnIOCompletion( ...@@ -887,7 +887,7 @@ StorVscOnIOCompletion(
static void static void
StorVscOnReceive( StorVscOnReceive(
DEVICE_OBJECT *Device, struct hv_device *Device,
VSTOR_PACKET *VStorPacket, VSTOR_PACKET *VStorPacket,
STORVSC_REQUEST_EXTENSION *RequestExt STORVSC_REQUEST_EXTENSION *RequestExt
) )
...@@ -925,7 +925,7 @@ StorVscOnChannelCallback( ...@@ -925,7 +925,7 @@ StorVscOnChannelCallback(
) )
{ {
int ret=0; int ret=0;
DEVICE_OBJECT *device = (DEVICE_OBJECT*)Context; struct hv_device *device = (struct hv_device*)Context;
STORVSC_DEVICE *storDevice; STORVSC_DEVICE *storDevice;
u32 bytesRecvd; u32 bytesRecvd;
u64 requestId; u64 requestId;
......
...@@ -46,7 +46,7 @@ static const GUID gVmbusDeviceId={ ...@@ -46,7 +46,7 @@ static const GUID gVmbusDeviceId={
}; };
static DRIVER_OBJECT* gDriver; /* vmbus driver object */ static DRIVER_OBJECT* gDriver; /* vmbus driver object */
static DEVICE_OBJECT* gDevice; /* vmbus root device */ static struct hv_device* gDevice; /* vmbus root device */
...@@ -60,7 +60,7 @@ VmbusGetChannelInterface( ...@@ -60,7 +60,7 @@ VmbusGetChannelInterface(
static void static void
VmbusGetChannelInfo( VmbusGetChannelInfo(
DEVICE_OBJECT *DeviceObject, struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo DEVICE_INFO *DeviceInfo
); );
...@@ -71,13 +71,13 @@ VmbusGetChannelOffers( ...@@ -71,13 +71,13 @@ VmbusGetChannelOffers(
static int static int
VmbusOnDeviceAdd( VmbusOnDeviceAdd(
DEVICE_OBJECT *Device, struct hv_device *Device,
void *AdditionalInfo void *AdditionalInfo
); );
static int static int
VmbusOnDeviceRemove( VmbusOnDeviceRemove(
DEVICE_OBJECT* dev struct hv_device *dev
); );
static void static void
...@@ -205,7 +205,7 @@ VmbusGetChannelInterface( ...@@ -205,7 +205,7 @@ VmbusGetChannelInterface(
--*/ --*/
static void static void
VmbusGetChannelInfo( VmbusGetChannelInfo(
DEVICE_OBJECT *DeviceObject, struct hv_device *DeviceObject,
DEVICE_INFO *DeviceInfo DEVICE_INFO *DeviceInfo
) )
{ {
...@@ -224,7 +224,7 @@ VmbusGetChannelInfo( ...@@ -224,7 +224,7 @@ VmbusGetChannelInfo(
--*/ --*/
DEVICE_OBJECT* struct hv_device*
VmbusChildDeviceCreate( VmbusChildDeviceCreate(
GUID DeviceType, GUID DeviceType,
GUID DeviceInstance, GUID DeviceInstance,
...@@ -250,7 +250,7 @@ VmbusChildDeviceCreate( ...@@ -250,7 +250,7 @@ VmbusChildDeviceCreate(
--*/ --*/
int int
VmbusChildDeviceAdd( VmbusChildDeviceAdd(
DEVICE_OBJECT* ChildDevice) struct hv_device *ChildDevice)
{ {
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver; VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
...@@ -269,7 +269,7 @@ VmbusChildDeviceAdd( ...@@ -269,7 +269,7 @@ VmbusChildDeviceAdd(
--*/ --*/
void void
VmbusChildDeviceRemove( VmbusChildDeviceRemove(
DEVICE_OBJECT* ChildDevice) struct hv_device *ChildDevice)
{ {
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver; VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
...@@ -289,7 +289,7 @@ VmbusChildDeviceRemove( ...@@ -289,7 +289,7 @@ VmbusChildDeviceRemove(
/* ************** /* **************
void void
VmbusChildDeviceDestroy( VmbusChildDeviceDestroy(
DEVICE_OBJECT* ChildDevice struct hv_device *ChildDevice
) )
{ {
VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver; VMBUS_DRIVER_OBJECT* vmbusDriver = (VMBUS_DRIVER_OBJECT*)gDriver;
...@@ -309,7 +309,7 @@ vmbusDriver->OnChildDeviceDestroy(ChildDevice); ...@@ -309,7 +309,7 @@ vmbusDriver->OnChildDeviceDestroy(ChildDevice);
--*/ --*/
static int static int
VmbusOnDeviceAdd( VmbusOnDeviceAdd(
DEVICE_OBJECT *dev, struct hv_device *dev,
void *AdditionalInfo void *AdditionalInfo
) )
{ {
...@@ -347,7 +347,7 @@ VmbusOnDeviceAdd( ...@@ -347,7 +347,7 @@ VmbusOnDeviceAdd(
--*/ --*/
int VmbusOnDeviceRemove( int VmbusOnDeviceRemove(
DEVICE_OBJECT* dev struct hv_device *dev
) )
{ {
int ret=0; int ret=0;
......
...@@ -117,7 +117,7 @@ extern struct VMBUS_CONNECTION gVmbusConnection; ...@@ -117,7 +117,7 @@ extern struct VMBUS_CONNECTION gVmbusConnection;
/* General vmbus interface */ /* General vmbus interface */
static DEVICE_OBJECT* static struct hv_device*
VmbusChildDeviceCreate( VmbusChildDeviceCreate(
GUID deviceType, GUID deviceType,
GUID deviceInstance, GUID deviceInstance,
...@@ -125,15 +125,15 @@ VmbusChildDeviceCreate( ...@@ -125,15 +125,15 @@ VmbusChildDeviceCreate(
static int static int
VmbusChildDeviceAdd( VmbusChildDeviceAdd(
DEVICE_OBJECT* Device); struct hv_device *Device);
static void static void
VmbusChildDeviceRemove( VmbusChildDeviceRemove(
DEVICE_OBJECT* Device); struct hv_device *Device);
/* static void */ /* static void */
/* VmbusChildDeviceDestroy( */ /* VmbusChildDeviceDestroy( */
/* DEVICE_OBJECT*); */ /* struct hv_device *); */
static VMBUS_CHANNEL* static VMBUS_CHANNEL*
GetChannelFromRelId( GetChannelFromRelId(
......
...@@ -263,7 +263,7 @@ static int blkvsc_probe(struct device *device) ...@@ -263,7 +263,7 @@ static int blkvsc_probe(struct device *device)
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj; STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device); 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; struct block_device_context *blkdev=NULL;
STORVSC_DEVICE_INFO device_info; STORVSC_DEVICE_INFO device_info;
...@@ -772,7 +772,7 @@ static int blkvsc_remove(struct device *device) ...@@ -772,7 +772,7 @@ static int blkvsc_remove(struct device *device)
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj; STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &blkvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device); 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); struct block_device_context *blkdev = dev_get_drvdata(device);
unsigned long flags; unsigned long flags;
......
...@@ -44,15 +44,15 @@ typedef struct _NETVSC_PACKET *PNETVSC_PACKET; ...@@ -44,15 +44,15 @@ typedef struct _NETVSC_PACKET *PNETVSC_PACKET;
/* Data types */ /* Data types */
typedef int (*PFN_ON_OPEN)(DEVICE_OBJECT *Device); typedef int (*PFN_ON_OPEN)(struct hv_device *Device);
typedef int (*PFN_ON_CLOSE)(DEVICE_OBJECT *Device); typedef int (*PFN_ON_CLOSE)(struct hv_device *Device);
typedef void (*PFN_QUERY_LINKSTATUS)(DEVICE_OBJECT *Device); typedef void (*PFN_QUERY_LINKSTATUS)(struct hv_device *Device);
typedef int (*PFN_ON_SEND)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet); typedef int (*PFN_ON_SEND)(struct hv_device *dev, PNETVSC_PACKET packet);
typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context); typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context);
typedef int (*PFN_ON_RECVCALLBACK)(DEVICE_OBJECT *dev, PNETVSC_PACKET packet); typedef int (*PFN_ON_RECVCALLBACK)(struct hv_device *dev, PNETVSC_PACKET packet);
typedef void (*PFN_ON_LINKSTATUS_CHANGED)(DEVICE_OBJECT *dev, u32 Status); typedef void (*PFN_ON_LINKSTATUS_CHANGED)(struct hv_device *dev, u32 Status);
/* Represent the xfer page packet which contains 1 or more netvsc packet */ /* Represent the xfer page packet which contains 1 or more netvsc packet */
typedef struct _XFERPAGE_PACKET { typedef struct _XFERPAGE_PACKET {
...@@ -74,7 +74,7 @@ typedef struct _NETVSC_PACKET { ...@@ -74,7 +74,7 @@ typedef struct _NETVSC_PACKET {
/* Bookkeeping stuff */ /* Bookkeeping stuff */
DLIST_ENTRY ListEntry; DLIST_ENTRY ListEntry;
DEVICE_OBJECT *Device; struct hv_device *Device;
bool IsDataPacket; bool IsDataPacket;
/* /*
......
...@@ -56,11 +56,11 @@ typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST; ...@@ -56,11 +56,11 @@ typedef struct _STORVSC_REQUEST* PSTORVSC_REQUEST;
/* Data types */ /* 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 void (*PFN_ON_IO_REQUEST_COMPLTN)(PSTORVSC_REQUEST Request);
typedef int (*PFN_ON_HOST_RESET)(PDEVICE_OBJECT Device); typedef int (*PFN_ON_HOST_RESET)(struct hv_device *Device);
typedef void (*PFN_ON_HOST_RESCAN)(PDEVICE_OBJECT Device); typedef void (*PFN_ON_HOST_RESCAN)(struct hv_device *Device);
/* Matches Windows-end */ /* Matches Windows-end */
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
/* Fwd declarations */ /* Fwd declarations */
typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT; typedef struct _DRIVER_OBJECT *PDRIVER_OBJECT;
typedef struct _DEVICE_OBJECT *PDEVICE_OBJECT;
/* Data types */ /* Data types */
...@@ -69,29 +68,31 @@ typedef struct _MULTIPAGE_BUFFER { ...@@ -69,29 +68,31 @@ typedef struct _MULTIPAGE_BUFFER {
#pragma pack(pop) #pragma pack(pop)
struct hv_device;
/* All drivers */ /* All drivers */
typedef int (*PFN_ON_DEVICEADD)(PDEVICE_OBJECT Device, void* AdditionalInfo); typedef int (*PFN_ON_DEVICEADD)(struct hv_device *Device, void* AdditionalInfo);
typedef int (*PFN_ON_DEVICEREMOVE)(PDEVICE_OBJECT 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)(PDRIVER_OBJECT Driver); typedef void (*PFN_ON_CLEANUP)(PDRIVER_OBJECT Driver);
/* Vmbus extensions */ /* Vmbus extensions */
/* typedef int (*PFN_ON_MATCH)(PDEVICE_OBJECT dev, PDRIVER_OBJECT drv); */ /* typedef int (*PFN_ON_MATCH)(struct hv_device *dev, PDRIVER_OBJECT drv); */
/* typedef int (*PFN_ON_PROBE)(PDEVICE_OBJECT dev); */ /* typedef int (*PFN_ON_PROBE)(struct hv_device *dev); */
typedef int (*PFN_ON_ISR)(PDRIVER_OBJECT drv); typedef int (*PFN_ON_ISR)(PDRIVER_OBJECT drv);
typedef void (*PFN_ON_DPC)(PDRIVER_OBJECT drv); typedef void (*PFN_ON_DPC)(PDRIVER_OBJECT drv);
typedef void (*PFN_GET_CHANNEL_OFFERS)(void); typedef void (*PFN_GET_CHANNEL_OFFERS)(void);
typedef PDEVICE_OBJECT (*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context); typedef struct hv_device *(*PFN_ON_CHILDDEVICE_CREATE)(GUID DeviceType, GUID DeviceInstance, void *Context);
typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(PDEVICE_OBJECT Device); typedef void (*PFN_ON_CHILDDEVICE_DESTROY)(struct hv_device *Device);
typedef int (*PFN_ON_CHILDDEVICE_ADD)(PDEVICE_OBJECT RootDevice, PDEVICE_OBJECT ChildDevice); typedef int (*PFN_ON_CHILDDEVICE_ADD)(struct hv_device *RootDevice, struct hv_device *ChildDevice);
typedef void (*PFN_ON_CHILDDEVICE_REMOVE)(PDEVICE_OBJECT 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)( typedef int (*VMBUS_CHANNEL_OPEN)(
PDEVICE_OBJECT Device, struct hv_device *Device,
u32 SendBufferSize, u32 SendBufferSize,
u32 RecvRingBufferSize, u32 RecvRingBufferSize,
void * UserData, void * UserData,
...@@ -101,11 +102,11 @@ typedef int (*VMBUS_CHANNEL_OPEN)( ...@@ -101,11 +102,11 @@ typedef int (*VMBUS_CHANNEL_OPEN)(
); );
typedef void (*VMBUS_CHANNEL_CLOSE)( typedef void (*VMBUS_CHANNEL_CLOSE)(
PDEVICE_OBJECT Device struct hv_device *Device
); );
typedef int (*VMBUS_CHANNEL_SEND_PACKET)( typedef int (*VMBUS_CHANNEL_SEND_PACKET)(
PDEVICE_OBJECT Device, struct hv_device *Device,
const void * Buffer, const void * Buffer,
u32 BufferLen, u32 BufferLen,
u64 RequestId, u64 RequestId,
...@@ -114,7 +115,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET)( ...@@ -114,7 +115,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET)(
); );
typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)( typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(
PDEVICE_OBJECT Device, struct hv_device *Device,
PAGE_BUFFER PageBuffers[], PAGE_BUFFER PageBuffers[],
u32 PageCount, u32 PageCount,
void * Buffer, void * Buffer,
...@@ -123,7 +124,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)( ...@@ -123,7 +124,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET_PAGEBUFFER)(
); );
typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)( typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)(
PDEVICE_OBJECT Device, struct hv_device *Device,
MULTIPAGE_BUFFER *MultiPageBuffer, MULTIPAGE_BUFFER *MultiPageBuffer,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
...@@ -131,7 +132,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)( ...@@ -131,7 +132,7 @@ typedef int (*VMBUS_CHANNEL_SEND_PACKET_MULTIPAGEBUFFER)(
); );
typedef int (*VMBUS_CHANNEL_RECV_PACKET)( typedef int (*VMBUS_CHANNEL_RECV_PACKET)(
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
u32* BufferActualLen, u32* BufferActualLen,
...@@ -139,7 +140,7 @@ typedef int (*VMBUS_CHANNEL_RECV_PACKET)( ...@@ -139,7 +140,7 @@ typedef int (*VMBUS_CHANNEL_RECV_PACKET)(
); );
typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)( typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)(
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, void * Buffer,
u32 BufferLen, u32 BufferLen,
u32* BufferActualLen, u32* BufferActualLen,
...@@ -147,14 +148,14 @@ typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)( ...@@ -147,14 +148,14 @@ typedef int (*VMBUS_CHANNEL_RECV_PACKET_PAW)(
); );
typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)( typedef int (*VMBUS_CHANNEL_ESTABLISH_GPADL)(
PDEVICE_OBJECT Device, struct hv_device *Device,
void * Buffer, /* from kmalloc() */ void * Buffer, /* from kmalloc() */
u32 BufferLen, /* page-size multiple */ u32 BufferLen, /* page-size multiple */
u32* GpadlHandle u32* GpadlHandle
); );
typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)( typedef int (*VMBUS_CHANNEL_TEARDOWN_GPADL)(
PDEVICE_OBJECT Device, struct hv_device *Device,
u32 GpadlHandle u32 GpadlHandle
); );
...@@ -186,7 +187,7 @@ typedef struct _DEVICE_INFO { ...@@ -186,7 +187,7 @@ typedef struct _DEVICE_INFO {
PORT_INFO Outbound; PORT_INFO Outbound;
} DEVICE_INFO; } 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 { typedef struct _VMBUS_CHANNEL_INTERFACE {
VMBUS_CHANNEL_OPEN Open; VMBUS_CHANNEL_OPEN Open;
...@@ -218,14 +219,14 @@ typedef struct _DRIVER_OBJECT { ...@@ -218,14 +219,14 @@ typedef struct _DRIVER_OBJECT {
/* Base device object */ /* Base device object */
typedef struct _DEVICE_OBJECT { struct hv_device {
DRIVER_OBJECT* Driver; /* the driver for this device */ DRIVER_OBJECT* Driver; /* the driver for this device */
char name[64]; char name[64];
GUID deviceType; /* the device type id of this device */ GUID deviceType; /* the device type id of this device */
GUID deviceInstance; /* the device instance id of this device */ GUID deviceInstance; /* the device instance id of this device */
void* context; void* context;
void* Extension; /* Device extension; */ void* Extension; /* Device extension; */
} DEVICE_OBJECT; };
/* Vmbus driver object */ /* Vmbus driver object */
......
...@@ -53,7 +53,7 @@ struct device_context { ...@@ -53,7 +53,7 @@ struct device_context {
GUID device_id; GUID device_id;
int probe_error; int probe_error;
struct device device; struct device device;
DEVICE_OBJECT device_obj; struct hv_device device_obj;
}; };
...@@ -64,7 +64,7 @@ struct device_context { ...@@ -64,7 +64,7 @@ struct device_context {
/* Inlines */ /* 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); return container_of(device_obj, struct device_context, device_obj);
} }
......
...@@ -51,10 +51,10 @@ static int netvsc_remove(struct device *device); ...@@ -51,10 +51,10 @@ static int netvsc_remove(struct device *device);
static int netvsc_open(struct net_device *net); static int netvsc_open(struct net_device *net);
static void netvsc_xmit_completion(void *context); static void netvsc_xmit_completion(void *context);
static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net); 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 int netvsc_close(struct net_device *net);
static struct net_device_stats *netvsc_get_stats(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 */ /* Data types */
...@@ -172,7 +172,7 @@ static int netvsc_probe(struct device *device) ...@@ -172,7 +172,7 @@ static int netvsc_probe(struct device *device)
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj; NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device); 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 *net = NULL;
struct net_device_context *net_device_ctx; struct net_device_context *net_device_ctx;
...@@ -249,7 +249,7 @@ static int netvsc_remove(struct device *device) ...@@ -249,7 +249,7 @@ static int netvsc_remove(struct device *device)
struct device_context *device_ctx = device_to_device_context(device); struct device_context *device_ctx = device_to_device_context(device);
struct net_device *net = dev_get_drvdata(&device_ctx->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); DPRINT_ENTER(NETVSC_DRV);
...@@ -302,7 +302,7 @@ static int netvsc_open(struct net_device *net) ...@@ -302,7 +302,7 @@ static int netvsc_open(struct net_device *net)
struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx; struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj; 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); DPRINT_ENTER(NETVSC_DRV);
...@@ -344,7 +344,7 @@ static int netvsc_close(struct net_device *net) ...@@ -344,7 +344,7 @@ static int netvsc_close(struct net_device *net)
struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx; struct netvsc_driver_context *net_drv_ctx = (struct netvsc_driver_context*)driver_ctx;
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj; 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); DPRINT_ENTER(NETVSC_DRV);
...@@ -515,7 +515,7 @@ Name: netvsc_linkstatus_callback() ...@@ -515,7 +515,7 @@ Name: netvsc_linkstatus_callback()
Desc: Link up/down notification 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 device_context* device_ctx = to_device_context(device_obj);
struct net_device* net = dev_get_drvdata(&device_ctx->device); struct net_device* net = dev_get_drvdata(&device_ctx->device);
...@@ -549,7 +549,7 @@ Name: netvsc_recv_callback() ...@@ -549,7 +549,7 @@ Name: netvsc_recv_callback()
Desc: Callback when we receive a packet from the "wire" on the specify 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; int ret=0;
struct device_context *device_ctx = to_device_context(device_obj); struct device_context *device_ctx = to_device_context(device_obj);
......
...@@ -82,7 +82,7 @@ static int storvsc_device_alloc(struct scsi_device *); ...@@ -82,7 +82,7 @@ static int storvsc_device_alloc(struct scsi_device *);
static int storvsc_device_configure(struct scsi_device *); static int storvsc_device_configure(struct scsi_device *);
static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd); 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_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 int storvsc_remove(struct device *dev);
static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count, unsigned int len); static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count, unsigned int len);
...@@ -233,7 +233,7 @@ static int storvsc_probe(struct device *device) ...@@ -233,7 +233,7 @@ static int storvsc_probe(struct device *device)
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj; STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device); 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 Scsi_Host *host;
struct host_device_context *host_device_ctx; struct host_device_context *host_device_ctx;
...@@ -336,7 +336,7 @@ static int storvsc_remove(struct device *device) ...@@ -336,7 +336,7 @@ static int storvsc_remove(struct device *device)
STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj; STORVSC_DRIVER_OBJECT* storvsc_drv_obj = &storvsc_drv_ctx->drv_obj;
struct device_context *device_ctx = device_to_device_context(device); 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 Scsi_Host *host = dev_get_drvdata(device);
struct host_device_context *host_device_ctx=(struct host_device_context*)host->hostdata; struct host_device_context *host_device_ctx=(struct host_device_context*)host->hostdata;
...@@ -912,7 +912,7 @@ Desc: Rescan the scsi HBA ...@@ -912,7 +912,7 @@ Desc: Rescan the scsi HBA
--*/ --*/
static void storvsc_host_rescan_callback(struct work_struct *work) 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 host_device_context*)work)->device_ctx->device_obj;
struct device_context* device_ctx = to_device_context(device_obj); struct device_context* device_ctx = to_device_context(device_obj);
struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device); struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
...@@ -1076,7 +1076,7 @@ static int storvsc_report_luns(struct scsi_device *sdev, unsigned int luns[], un ...@@ -1076,7 +1076,7 @@ static int storvsc_report_luns(struct scsi_device *sdev, unsigned int luns[], un
return 0; 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 device_context* device_ctx = to_device_context(device_obj);
struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device); struct Scsi_Host *host = dev_get_drvdata(&device_ctx->device);
......
...@@ -75,11 +75,11 @@ static irqreturn_t vmbus_isr(int irq, void* dev_id); ...@@ -75,11 +75,11 @@ static irqreturn_t vmbus_isr(int irq, void* dev_id);
static void vmbus_device_release(struct device *device); static void vmbus_device_release(struct device *device);
static void vmbus_bus_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 struct hv_device *vmbus_child_device_create(GUID type, GUID instance, void* context);
static void vmbus_child_device_destroy(DEVICE_OBJECT* device_obj); static void vmbus_child_device_destroy(struct hv_device *device_obj);
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);
static void vmbus_child_device_unregister(DEVICE_OBJECT* child_device_obj); static void vmbus_child_device_unregister(struct hv_device *child_device_obj);
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);
/* static ssize_t vmbus_show_class_id(struct device *dev, struct device_attribute *attr, char *buf); */ /* 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); */ /* static ssize_t vmbus_show_device_id(struct device *dev, struct device_attribute *attr, char *buf); */
...@@ -542,7 +542,7 @@ Name: vmbus_child_device_get_info() ...@@ -542,7 +542,7 @@ Name: vmbus_child_device_get_info()
Desc: Get the vmbus child device info. This is invoked to display various device attributes in sysfs. 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; VMBUS_DRIVER_OBJECT *vmbus_drv_obj=&g_vmbus_drv.drv_obj;
...@@ -557,10 +557,10 @@ Name: vmbus_child_device_create() ...@@ -557,10 +557,10 @@ Name: vmbus_child_device_create()
Desc: Creates and registers a new child device on the vmbus. 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; struct device_context *child_device_ctx;
DEVICE_OBJECT* child_device_obj; struct hv_device *child_device_obj;
DPRINT_ENTER(VMBUS_DRV); DPRINT_ENTER(VMBUS_DRV);
...@@ -601,7 +601,7 @@ Name: vmbus_child_device_register() ...@@ -601,7 +601,7 @@ Name: vmbus_child_device_register()
Desc: Register the child device on the specified bus 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; int ret=0;
struct device_context *root_device_ctx = to_device_context(root_device_obj); struct device_context *root_device_ctx = to_device_context(root_device_obj);
...@@ -655,7 +655,7 @@ Name: vmbus_child_device_unregister() ...@@ -655,7 +655,7 @@ Name: vmbus_child_device_unregister()
Desc: Remove the specified child device from the vmbus. 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); struct device_context *device_ctx = to_device_context(device_obj);
...@@ -680,7 +680,7 @@ Name: vmbus_child_device_destroy() ...@@ -680,7 +680,7 @@ Name: vmbus_child_device_destroy()
Desc: Destroy the specified child device on the vmbus. 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); 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