Commit 4193d4f4 authored by Nicolas Palix's avatar Nicolas Palix Committed by Greg Kroah-Hartman

Staging: hv: Remove typedef NETVSC_PACKET and PNETVSC_PACKET

typedef NETVSC_PACKET and PNETVSC_PACKET are removed and their usages
are replace by the use of struct hv_netvsc_packet and
struct hv_netvsc_packet * respectively.

Here is the semantic patch generated to perform this transformation:
(http://coccinelle.lip6.fr/)

//<smpl>
@rm_NETVSC_PACKET@
@@
-typedef struct _NETVSC_PACKET
+struct hv_netvsc_packet
{...}
-NETVSC_PACKET
;

@rm_PNETVSC_PACKET@
@@
-typedef struct _NETVSC_PACKET *PNETVSC_PACKET;
+struct hv_netvsc_packet;

@fixtypedef_NETVSC_PACKET@
typedef NETVSC_PACKET;
@@
-NETVSC_PACKET
+struct hv_netvsc_packet

@fixstruct__NETVSC_PACKET@
@@
struct
-_NETVSC_PACKET
+hv_netvsc_packet

@fixtypedef_PNETVSC_PACKET@
typedef PNETVSC_PACKET;
@@
-PNETVSC_PACKET
+struct hv_netvsc_packet*
//</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 775ef25e
...@@ -93,7 +93,7 @@ NetVscOnSendCompletion( ...@@ -93,7 +93,7 @@ NetVscOnSendCompletion(
static int static int
NetVscOnSend( NetVscOnSend(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
); );
static void static void
...@@ -239,8 +239,8 @@ NetVscInitialize( ...@@ -239,8 +239,8 @@ NetVscInitialize(
DPRINT_ENTER(NETVSC); DPRINT_ENTER(NETVSC);
DPRINT_DBG(NETVSC, "sizeof(NETVSC_PACKET)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(VMTRANSFER_PAGE_PACKET_HEADER)=%zd", DPRINT_DBG(NETVSC, "sizeof(struct hv_netvsc_packet)=%zd, sizeof(NVSP_MESSAGE)=%zd, sizeof(VMTRANSFER_PAGE_PACKET_HEADER)=%zd",
sizeof(NETVSC_PACKET), sizeof(NVSP_MESSAGE), sizeof(VMTRANSFER_PAGE_PACKET_HEADER)); sizeof(struct hv_netvsc_packet), sizeof(NVSP_MESSAGE), sizeof(VMTRANSFER_PAGE_PACKET_HEADER));
/* Make sure we are at least 2 pages since 1 page is used for control */ /* Make sure we are at least 2 pages since 1 page is used for control */
ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1)); ASSERT(driver->RingBufferSize >= (PAGE_SIZE << 1));
...@@ -802,7 +802,7 @@ NetVscOnDeviceAdd( ...@@ -802,7 +802,7 @@ NetVscOnDeviceAdd(
int i; int i;
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
NETVSC_PACKET* packet; struct hv_netvsc_packet *packet;
LIST_ENTRY *entry; LIST_ENTRY *entry;
NETVSC_DRIVER_OBJECT *netDriver = (NETVSC_DRIVER_OBJECT*) Device->Driver;; NETVSC_DRIVER_OBJECT *netDriver = (NETVSC_DRIVER_OBJECT*) Device->Driver;;
...@@ -828,7 +828,7 @@ NetVscOnDeviceAdd( ...@@ -828,7 +828,7 @@ NetVscOnDeviceAdd(
for (i=0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++) for (i=0; i < NETVSC_RECEIVE_PACKETLIST_COUNT; i++)
{ {
packet = kzalloc(sizeof(NETVSC_PACKET) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER)), GFP_KERNEL); packet = kzalloc(sizeof(struct hv_netvsc_packet) + (NETVSC_RECEIVE_SG_COUNT* sizeof(PAGE_BUFFER)), GFP_KERNEL);
if (!packet) if (!packet)
{ {
DPRINT_DBG(NETVSC, "unable to allocate netvsc pkts for receive pool (wanted %d got %d)", NETVSC_RECEIVE_PACKETLIST_COUNT, i); DPRINT_DBG(NETVSC, "unable to allocate netvsc pkts for receive pool (wanted %d got %d)", NETVSC_RECEIVE_PACKETLIST_COUNT, i);
...@@ -885,7 +885,7 @@ Cleanup: ...@@ -885,7 +885,7 @@ Cleanup:
while (!IsListEmpty(&netDevice->ReceivePacketList)) while (!IsListEmpty(&netDevice->ReceivePacketList))
{ {
entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList); entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList);
packet = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); packet = CONTAINING_RECORD(entry, struct hv_netvsc_packet, ListEntry);
kfree(packet); kfree(packet);
} }
...@@ -915,7 +915,7 @@ NetVscOnDeviceRemove( ...@@ -915,7 +915,7 @@ NetVscOnDeviceRemove(
) )
{ {
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
NETVSC_PACKET *netvscPacket; struct hv_netvsc_packet *netvscPacket;
int ret=0; int ret=0;
LIST_ENTRY *entry; LIST_ENTRY *entry;
...@@ -958,7 +958,7 @@ NetVscOnDeviceRemove( ...@@ -958,7 +958,7 @@ NetVscOnDeviceRemove(
while (!IsListEmpty(&netDevice->ReceivePacketList)) while (!IsListEmpty(&netDevice->ReceivePacketList))
{ {
entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList); entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList);
netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); netvscPacket = CONTAINING_RECORD(entry, struct hv_netvsc_packet, ListEntry);
kfree(netvscPacket); kfree(netvscPacket);
} }
...@@ -999,7 +999,7 @@ NetVscOnSendCompletion( ...@@ -999,7 +999,7 @@ NetVscOnSendCompletion(
{ {
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
NVSP_MESSAGE *nvspPacket; NVSP_MESSAGE *nvspPacket;
NETVSC_PACKET *nvscPacket; struct hv_netvsc_packet *nvscPacket;
DPRINT_ENTER(NETVSC); DPRINT_ENTER(NETVSC);
...@@ -1026,7 +1026,7 @@ NetVscOnSendCompletion( ...@@ -1026,7 +1026,7 @@ NetVscOnSendCompletion(
else if (nvspPacket->Header.MessageType == NvspMessage1TypeSendRNDISPacketComplete) else if (nvspPacket->Header.MessageType == NvspMessage1TypeSendRNDISPacketComplete)
{ {
/* Get the send context */ /* Get the send context */
nvscPacket = (NETVSC_PACKET *)(unsigned long)Packet->TransactionId; nvscPacket = (struct hv_netvsc_packet *)(unsigned long)Packet->TransactionId;
ASSERT(nvscPacket); ASSERT(nvscPacket);
/* Notify the layer above us */ /* Notify the layer above us */
...@@ -1048,7 +1048,7 @@ NetVscOnSendCompletion( ...@@ -1048,7 +1048,7 @@ NetVscOnSendCompletion(
static int static int
NetVscOnSend( NetVscOnSend(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
) )
{ {
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
...@@ -1118,7 +1118,7 @@ NetVscOnReceive( ...@@ -1118,7 +1118,7 @@ NetVscOnReceive(
struct NETVSC_DEVICE *netDevice; struct NETVSC_DEVICE *netDevice;
VMTRANSFER_PAGE_PACKET_HEADER *vmxferpagePacket; VMTRANSFER_PAGE_PACKET_HEADER *vmxferpagePacket;
NVSP_MESSAGE *nvspPacket; NVSP_MESSAGE *nvspPacket;
NETVSC_PACKET *netvscPacket=NULL; struct hv_netvsc_packet *netvscPacket=NULL;
LIST_ENTRY* entry; LIST_ENTRY* entry;
unsigned long start; unsigned long start;
unsigned long end, endVirtual; unsigned long end, endVirtual;
...@@ -1183,7 +1183,7 @@ NetVscOnReceive( ...@@ -1183,7 +1183,7 @@ NetVscOnReceive(
while (!IsListEmpty(&netDevice->ReceivePacketList)) while (!IsListEmpty(&netDevice->ReceivePacketList))
{ {
entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList); entry = REMOVE_HEAD_LIST(&netDevice->ReceivePacketList);
netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); netvscPacket = CONTAINING_RECORD(entry, struct hv_netvsc_packet, ListEntry);
INSERT_TAIL_LIST(&listHead, &netvscPacket->ListEntry); INSERT_TAIL_LIST(&listHead, &netvscPacket->ListEntry);
...@@ -1206,7 +1206,7 @@ NetVscOnReceive( ...@@ -1206,7 +1206,7 @@ NetVscOnReceive(
for (i=count; i != 0; i--) for (i=count; i != 0; i--)
{ {
entry = REMOVE_HEAD_LIST(&listHead); entry = REMOVE_HEAD_LIST(&listHead);
netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); netvscPacket = CONTAINING_RECORD(entry, struct hv_netvsc_packet, ListEntry);
INSERT_TAIL_LIST(&netDevice->ReceivePacketList, &netvscPacket->ListEntry); INSERT_TAIL_LIST(&netDevice->ReceivePacketList, &netvscPacket->ListEntry);
} }
...@@ -1233,7 +1233,7 @@ NetVscOnReceive( ...@@ -1233,7 +1233,7 @@ NetVscOnReceive(
for (i=0; i < (count - 1); i++) for (i=0; i < (count - 1); i++)
{ {
entry = REMOVE_HEAD_LIST(&listHead); entry = REMOVE_HEAD_LIST(&listHead);
netvscPacket = CONTAINING_RECORD(entry, NETVSC_PACKET, ListEntry); netvscPacket = CONTAINING_RECORD(entry, struct hv_netvsc_packet, ListEntry);
/* Initialize the netvsc packet */ /* Initialize the netvsc packet */
netvscPacket->XferPagePacket = xferpagePacket; netvscPacket->XferPagePacket = xferpagePacket;
...@@ -1357,7 +1357,7 @@ static void ...@@ -1357,7 +1357,7 @@ static void
NetVscOnReceiveCompletion( NetVscOnReceiveCompletion(
void * Context) void * Context)
{ {
NETVSC_PACKET *packet = (NETVSC_PACKET*)Context; struct hv_netvsc_packet *packet = (struct hv_netvsc_packet*)Context;
struct hv_device *device = (struct hv_device*)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;
......
...@@ -60,7 +60,7 @@ struct NETVSC_DEVICE { ...@@ -60,7 +60,7 @@ struct NETVSC_DEVICE {
int RefCount; int RefCount;
int NumOutstandingSends; int NumOutstandingSends;
/* List of free preallocated NETVSC_PACKET to represent receive packet */ /* List of free preallocated hv_netvsc_packet to represent receive packet */
LIST_ENTRY ReceivePacketList; LIST_ENTRY ReceivePacketList;
spinlock_t receive_packet_list_lock; spinlock_t receive_packet_list_lock;
......
...@@ -68,7 +68,7 @@ typedef struct _RNDIS_REQUEST { ...@@ -68,7 +68,7 @@ typedef struct _RNDIS_REQUEST {
RNDIS_MESSAGE ResponseMessage; RNDIS_MESSAGE ResponseMessage;
/* Simplify allocation by having a netvsc packet inline */ /* Simplify allocation by having a netvsc packet inline */
NETVSC_PACKET Packet; struct hv_netvsc_packet Packet;
PAGE_BUFFER Buffer; PAGE_BUFFER Buffer;
/* FIXME: We assumed a fixed size request here. */ /* FIXME: We assumed a fixed size request here. */
RNDIS_MESSAGE RequestMessage; RNDIS_MESSAGE RequestMessage;
...@@ -107,13 +107,13 @@ static void ...@@ -107,13 +107,13 @@ static void
RndisFilterReceiveData( RndisFilterReceiveData(
RNDIS_DEVICE *Device, RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Message, RNDIS_MESSAGE *Message,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
); );
static int static int
RndisFilterOnReceive( RndisFilterOnReceive(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
); );
static int static int
...@@ -184,7 +184,7 @@ RndisFilterOnClose( ...@@ -184,7 +184,7 @@ RndisFilterOnClose(
static int static int
RndisFilterOnSend( RndisFilterOnSend(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
); );
static void static void
...@@ -345,7 +345,7 @@ RndisFilterSendRequest( ...@@ -345,7 +345,7 @@ RndisFilterSendRequest(
) )
{ {
int ret=0; int ret=0;
NETVSC_PACKET *packet; struct hv_netvsc_packet *packet;
DPRINT_ENTER(NETVSC); DPRINT_ENTER(NETVSC);
...@@ -458,7 +458,7 @@ static void ...@@ -458,7 +458,7 @@ static void
RndisFilterReceiveData( RndisFilterReceiveData(
RNDIS_DEVICE *Device, RNDIS_DEVICE *Device,
RNDIS_MESSAGE *Message, RNDIS_MESSAGE *Message,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
) )
{ {
RNDIS_PACKET *rndisPacket; RNDIS_PACKET *rndisPacket;
...@@ -491,7 +491,7 @@ RndisFilterReceiveData( ...@@ -491,7 +491,7 @@ RndisFilterReceiveData(
static int static int
RndisFilterOnReceive( RndisFilterOnReceive(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
) )
{ {
struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension; struct NETVSC_DEVICE *netDevice = (struct NETVSC_DEVICE*)Device->Extension;
...@@ -1080,7 +1080,7 @@ RndisFilterOnClose( ...@@ -1080,7 +1080,7 @@ RndisFilterOnClose(
static int static int
RndisFilterOnSend( RndisFilterOnSend(
struct hv_device *Device, struct hv_device *Device,
NETVSC_PACKET *Packet struct hv_netvsc_packet *Packet
) )
{ {
int ret=0; int ret=0;
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
/* Fwd declaration */ /* Fwd declaration */
typedef struct _NETVSC_PACKET *PNETVSC_PACKET; struct hv_netvsc_packet;
...@@ -48,10 +48,10 @@ typedef int (*PFN_ON_OPEN)(struct hv_device *Device); ...@@ -48,10 +48,10 @@ typedef int (*PFN_ON_OPEN)(struct hv_device *Device);
typedef int (*PFN_ON_CLOSE)(struct hv_device *Device); typedef int (*PFN_ON_CLOSE)(struct hv_device *Device);
typedef void (*PFN_QUERY_LINKSTATUS)(struct hv_device *Device); typedef void (*PFN_QUERY_LINKSTATUS)(struct hv_device *Device);
typedef int (*PFN_ON_SEND)(struct hv_device *dev, PNETVSC_PACKET packet); typedef int (*PFN_ON_SEND)(struct hv_device *dev, struct hv_netvsc_packet *packet);
typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context); typedef void (*PFN_ON_SENDRECVCOMPLETION)(void * Context);
typedef int (*PFN_ON_RECVCALLBACK)(struct hv_device *dev, PNETVSC_PACKET packet); typedef int (*PFN_ON_RECVCALLBACK)(struct hv_device *dev, struct hv_netvsc_packet *packet);
typedef void (*PFN_ON_LINKSTATUS_CHANGED)(struct hv_device *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 */
...@@ -70,7 +70,7 @@ typedef struct _XFERPAGE_PACKET { ...@@ -70,7 +70,7 @@ typedef struct _XFERPAGE_PACKET {
* Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame * Represent netvsc packet which contains 1 RNDIS and 1 ethernet frame
* within the RNDIS * within the RNDIS
*/ */
typedef struct _NETVSC_PACKET { struct hv_netvsc_packet {
/* Bookkeeping stuff */ /* Bookkeeping stuff */
DLIST_ENTRY ListEntry; DLIST_ENTRY ListEntry;
...@@ -104,7 +104,7 @@ typedef struct _NETVSC_PACKET { ...@@ -104,7 +104,7 @@ typedef struct _NETVSC_PACKET {
u32 PageBufferCount; u32 PageBufferCount;
PAGE_BUFFER PageBuffers[NETVSC_PACKET_MAXPAGE]; PAGE_BUFFER PageBuffers[NETVSC_PACKET_MAXPAGE];
} NETVSC_PACKET; };
/* Represents the net vsc driver */ /* Represents the net vsc driver */
......
...@@ -51,7 +51,7 @@ static int netvsc_remove(struct device *device); ...@@ -51,7 +51,7 @@ 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(struct hv_device *device_obj, NETVSC_PACKET* Packet); static int netvsc_recv_callback(struct hv_device *device_obj, struct hv_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(struct hv_device *device_obj, unsigned int status); static void netvsc_linkstatus_callback(struct hv_device *device_obj, unsigned int status);
...@@ -371,7 +371,7 @@ Desc: Send completion processing ...@@ -371,7 +371,7 @@ Desc: Send completion processing
--*/ --*/
static void netvsc_xmit_completion(void *context) static void netvsc_xmit_completion(void *context)
{ {
NETVSC_PACKET *packet = (NETVSC_PACKET *)context; struct hv_netvsc_packet *packet = (struct hv_netvsc_packet *)context;
struct sk_buff *skb = (struct sk_buff *)(unsigned long)packet->Completion.Send.SendCompletionTid; struct sk_buff *skb = (struct sk_buff *)(unsigned long)packet->Completion.Send.SendCompletionTid;
struct net_device* net; struct net_device* net;
...@@ -412,7 +412,7 @@ static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -412,7 +412,7 @@ static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net)
NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj; NETVSC_DRIVER_OBJECT *net_drv_obj = &net_drv_ctx->drv_obj;
int i=0; int i=0;
NETVSC_PACKET* packet; struct hv_netvsc_packet *packet;
int num_frags; int num_frags;
int retries=0; int retries=0;
...@@ -428,14 +428,14 @@ static int netvsc_start_xmit (struct sk_buff *skb, struct net_device *net) ...@@ -428,14 +428,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; num_frags = skb_shinfo(skb)->nr_frags + 1 + net_drv_obj->AdditionalRequestPageBufferCount;
/* Allocate a netvsc packet based on # of frags. */ /* Allocate a netvsc packet based on # of frags. */
packet = kzalloc(sizeof(NETVSC_PACKET) + (num_frags * sizeof(PAGE_BUFFER)) + net_drv_obj->RequestExtSize, GFP_ATOMIC); packet = kzalloc(sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) + net_drv_obj->RequestExtSize, GFP_ATOMIC);
if (!packet) if (!packet)
{ {
DPRINT_ERR(NETVSC_DRV, "unable to allocate NETVSC_PACKET"); DPRINT_ERR(NETVSC_DRV, "unable to allocate hv_netvsc_packet");
return -1; return -1;
} }
packet->Extension = (void*)(unsigned long)packet + sizeof(NETVSC_PACKET) + (num_frags * sizeof(PAGE_BUFFER)) ; packet->Extension = (void*)(unsigned long)packet + sizeof(struct hv_netvsc_packet) + (num_frags * sizeof(PAGE_BUFFER)) ;
/* Setup the rndis header */ /* Setup the rndis header */
packet->PageBufferCount = num_frags; packet->PageBufferCount = num_frags;
...@@ -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(struct hv_device *device_obj, NETVSC_PACKET* packet) static int netvsc_recv_callback(struct hv_device *device_obj, struct hv_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);
...@@ -581,7 +581,7 @@ static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* pac ...@@ -581,7 +581,7 @@ static int netvsc_recv_callback(struct hv_device *device_obj, NETVSC_PACKET* pac
/* for kmap_atomic */ /* for kmap_atomic */
local_irq_save(flags); local_irq_save(flags);
/* Copy to skb. This copy is needed here since the memory pointed by NETVSC_PACKET */ /* Copy to skb. This copy is needed here since the memory pointed by hv_netvsc_packet */
/* cannot be deallocated */ /* cannot be deallocated */
for (i=0; i<packet->PageBufferCount; i++) for (i=0; i<packet->PageBufferCount; i++)
{ {
......
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