win-pvdrivers

changeset 119:4f25a9922d0b

correct easy-to-fix warnings in all drivers
author Andy Grover <andy.grover@oracle.com>
date Mon Jan 14 14:32:57 2008 -0800 (2008-01-14)
parents cd5a1abb427d
children ff4d2a86b063
files xenenum/xenenum.c xennet/xennet.c xenvbd/xenvbd.c xenvbd/xenvbd.h
line diff
     1.1 --- a/xenenum/xenenum.c	Mon Jan 14 23:13:12 2008 +1100
     1.2 +++ b/xenenum/xenenum.c	Mon Jan 14 14:32:57 2008 -0800
     1.3 @@ -289,7 +289,6 @@ XenEnum_D0EntryPostInterruptsEnabled(WDF
     1.4    char *msg;
     1.5    char buffer[128];
     1.6    int i;
     1.7 -  LARGE_INTEGER WaitTimeout;
     1.8  
     1.9    UNREFERENCED_PARAMETER(Device);
    1.10    UNREFERENCED_PARAMETER(PreviousState);
    1.11 @@ -367,6 +366,8 @@ XenEnum_D0Exit(
    1.12  static NTSTATUS
    1.13  XenEnum_DeviceUsageNotification(WDFDEVICE Device, WDF_SPECIAL_FILE_TYPE NotificationType, BOOLEAN IsInNotificationPath)
    1.14  {
    1.15 +  UNREFERENCED_PARAMETER(Device);
    1.16 +
    1.17    KdPrint((__DRIVER_NAME " --> DeviceUsageNotification\n"));
    1.18  
    1.19    switch (NotificationType)
    1.20 @@ -411,8 +412,6 @@ XenEnum_WatchHandler(char *Path, PVOID D
    1.21    XENPCI_IDENTIFICATION_DESCRIPTION IdentificationDescription;
    1.22    char **Bits;
    1.23    int Count;
    1.24 -  char TmpPath[128];
    1.25 -  char *Value;
    1.26    ANSI_STRING AnsiBuf;
    1.27    WDFCHILDLIST ChildList;
    1.28    WDFDEVICE Device = Data;
     2.1 --- a/xennet/xennet.c	Mon Jan 14 23:13:12 2008 +1100
     2.2 +++ b/xennet/xennet.c	Mon Jan 14 14:32:57 2008 -0800
     2.3 @@ -110,7 +110,7 @@ struct xennet_info
     2.4    ULONG rx_max_target;
     2.5    ULONG rx_min_target;
     2.6  
     2.7 -  ULONG rx_outstanding;
     2.8 +  LONG rx_outstanding;
     2.9  
    2.10    /* stats */
    2.11    ULONG64 stat_tx_ok;
    2.12 @@ -411,7 +411,6 @@ XenNet_RxBufferCheck(struct xennet_info 
    2.13    PNDIS_BUFFER buffer;
    2.14    int moretodo;
    2.15    KIRQL OldIrql;
    2.16 -  PNDIS_TCP_IP_CHECKSUM_PACKET_INFO csum_info;
    2.17    struct netif_rx_response *rxrsp = NULL;
    2.18    int more_frags = 0;
    2.19    NDIS_STATUS status;
     3.1 --- a/xenvbd/xenvbd.c	Mon Jan 14 23:13:12 2008 +1100
     3.2 +++ b/xenvbd/xenvbd.c	Mon Jan 14 14:32:57 2008 -0800
     3.3 @@ -7,6 +7,8 @@
     3.4  #include <xen_public.h>
     3.5  #include <io/xenbus.h>
     3.6  
     3.7 +#pragma warning(disable: 4127)
     3.8 +
     3.9  #define wmb() KeMemoryBarrier()
    3.10  #define mb() KeMemoryBarrier()
    3.11  
    3.12 @@ -114,12 +116,13 @@ XenVbd_Interrupt(PKINTERRUPT Interrupt, 
    3.13  {
    3.14    PXENVBD_TARGET_DATA TargetData = (PXENVBD_TARGET_DATA)DeviceExtension;
    3.15  
    3.16 +  UNREFERENCED_PARAMETER(Interrupt);
    3.17 +
    3.18  //  KdPrint((__DRIVER_NAME " --> Interrupt\n"));
    3.19  
    3.20    TargetData->PendingInterrupt = TRUE;
    3.21  
    3.22  //  KdPrint((__DRIVER_NAME " <-- Interrupt\n"));
    3.23 -  return;
    3.24  }
    3.25  
    3.26  static VOID
    3.27 @@ -130,20 +133,12 @@ XenVbd_HwScsiInterruptTarget(PVOID Devic
    3.28    RING_IDX i, rp;
    3.29    int j;
    3.30    blkif_response_t *rep;
    3.31 -  char *DataBuffer;
    3.32 -  int more_to_do;
    3.33    int BlockCount;
    3.34 -  KIRQL Irql;
    3.35 -  int notify;
    3.36 -  KAPC_STATE ApcState;
    3.37 -  PIRP Irp;
    3.38 -  PXENVBD_DEVICE_DATA DeviceData;
    3.39 +  PXENVBD_DEVICE_DATA DeviceData = (PXENVBD_DEVICE_DATA)TargetData->DeviceData;
    3.40 +  int more_to_do = TRUE;
    3.41  
    3.42  //  KdPrint((__DRIVER_NAME " --> HwScsiInterruptTarget\n"));
    3.43  
    3.44 -  DeviceData = (PXENVBD_DEVICE_DATA)TargetData->DeviceData;
    3.45 -  more_to_do = TRUE;
    3.46 -
    3.47    while (more_to_do)
    3.48    {
    3.49      rp = TargetData->Ring.sring->rsp_prod;
    3.50 @@ -191,9 +186,7 @@ XenVbd_HwScsiInterruptTarget(PVOID Devic
    3.51      }
    3.52    }
    3.53  
    3.54 -//  KdPrint((__DRIVER_NAME " <-- HwScsiInterruptTarget\n"));
    3.55 -
    3.56 -  return FALSE;
    3.57 +  //  KdPrint((__DRIVER_NAME " <-- HwScsiInterruptTarget\n"));
    3.58  }
    3.59  
    3.60  static BOOLEAN
    3.61 @@ -235,10 +228,7 @@ XenVbd_BackEndStateHandler(char *Path, P
    3.62    grant_ref_t ref;
    3.63    blkif_sring_t *SharedRing;
    3.64    ULONG PFN;
    3.65 -  //XENVBD_DEVICE_IDENTIFICATION_DESCRIPTION Description;
    3.66 -  KIRQL OldIrql;
    3.67 -  NTSTATUS status;
    3.68 -  int i;
    3.69 +  ULONG i;
    3.70  
    3.71    KdPrint((__DRIVER_NAME " --> BackEndStateHandler\n"));
    3.72    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
    3.73 @@ -416,7 +406,7 @@ XenVbd_WatchHandler(char *Path, PVOID De
    3.74    int CurrentBus, CurrentTarget;
    3.75    PXENVBD_TARGET_DATA TargetData, VacantTarget;
    3.76    KIRQL OldIrql;
    3.77 -  int i, j;
    3.78 +  int i;
    3.79  
    3.80    KdPrint((__DRIVER_NAME " --> WatchHandler (DeviceData = %08x)\n", DeviceData));
    3.81    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
    3.82 @@ -500,7 +490,10 @@ XenVbd_HwScsiFindAdapter(PVOID DeviceExt
    3.83    char **VbdDevices;
    3.84    char *msg;
    3.85    char buffer[128];
    3.86 -  LARGE_INTEGER WaitTimeout;
    3.87 +
    3.88 +  UNREFERENCED_PARAMETER(HwContext);
    3.89 +  UNREFERENCED_PARAMETER(BusInformation);
    3.90 +  UNREFERENCED_PARAMETER(ArgumentString);
    3.91  
    3.92    KeInitializeSpinLock(&DeviceData->Lock);
    3.93    KdPrint((__DRIVER_NAME " --> HwScsiFindAdapter\n"));
    3.94 @@ -518,7 +511,7 @@ XenVbd_HwScsiFindAdapter(PVOID DeviceExt
    3.95      switch (i)
    3.96      {
    3.97      case 0:
    3.98 -      DeviceData->XenDeviceData = (PXENPCI_XEN_DEVICE_DATA)AccessRange->RangeStart.QuadPart;
    3.99 +      DeviceData->XenDeviceData = (PVOID)(ULONG_PTR)AccessRange->RangeStart.QuadPart;
   3.100        KdPrint((__DRIVER_NAME "     Mapped to virtual address %08x\n", DeviceData->XenDeviceData));
   3.101        KdPrint((__DRIVER_NAME "     Magic = %08x\n", DeviceData->XenDeviceData->Magic));
   3.102        if (DeviceData->XenDeviceData->Magic != XEN_DATA_MAGIC)
   3.103 @@ -629,8 +622,6 @@ XenVbd_CheckBusChangedTimer(PVOID Device
   3.104  static BOOLEAN
   3.105  XenVbd_HwScsiInitialize(PVOID DeviceExtension)
   3.106  {
   3.107 -  PXENVBD_DEVICE_DATA DeviceData = (PXENVBD_DEVICE_DATA)DeviceExtension;
   3.108 -
   3.109    KdPrint((__DRIVER_NAME " --> HwScsiInitialize\n"));
   3.110    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.111  
   3.112 @@ -644,7 +635,12 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
   3.113  static ULONG
   3.114  XenVbd_FillModePage(PXENVBD_DEVICE_DATA DeviceData, UCHAR PageCode, PUCHAR DataBuffer, ULONG BufferLength, PULONG Offset)
   3.115  {
   3.116 -  PMODE_RIGID_GEOMETRY_PAGE ModeRigidGeometry;
   3.117 +  //PMODE_RIGID_GEOMETRY_PAGE ModeRigidGeometry;
   3.118 +
   3.119 +  UNREFERENCED_PARAMETER(DeviceData);
   3.120 +  UNREFERENCED_PARAMETER(DataBuffer);
   3.121 +  UNREFERENCED_PARAMETER(BufferLength);
   3.122 +  UNREFERENCED_PARAMETER(Offset);
   3.123  
   3.124    switch (PageCode)
   3.125    {
   3.126 @@ -686,14 +682,7 @@ XenVbd_PutSrbOnRing(PXENVBD_TARGET_DATA 
   3.127    //PUCHAR DataBuffer;
   3.128    blkif_request_t *req;
   3.129    int i;
   3.130 -  int j;
   3.131    int BlockCount;
   3.132 -  int sect_offset;
   3.133 -  PVOID CurrentVirtual;
   3.134 -  ULONG CurrentLength;
   3.135 -  ULONG SegmentLength;
   3.136 -  SCSI_PHYSICAL_ADDRESS PageAddress;
   3.137 -  int Iterations;
   3.138    PXENVBD_DEVICE_DATA DeviceData = (PXENVBD_DEVICE_DATA)TargetData->DeviceData;
   3.139  
   3.140  // can use SRB_STATUS_BUSY to push the SRB back to windows...
   3.141 @@ -725,7 +714,7 @@ XenVbd_PutSrbOnRing(PXENVBD_TARGET_DATA 
   3.142  //  KdPrint((__DRIVER_NAME "     DataBuffer = %08X\n", Srb->DataBuffer));
   3.143  //  KdPrint((__DRIVER_NAME "     BlockCount = %08X\n", BlockCount));
   3.144  
   3.145 -  req->nr_segments = (BlockCount * TargetData->BytesPerSector + PAGE_SIZE - 1) / PAGE_SIZE;
   3.146 +  req->nr_segments = (UINT8)((BlockCount * TargetData->BytesPerSector + PAGE_SIZE - 1) / PAGE_SIZE);
   3.147  //  KdPrint((__DRIVER_NAME "     req->nr_segments = %08X\n", req->nr_segments));
   3.148  
   3.149    for (i = 0; i < req->nr_segments; i++)
   3.150 @@ -735,9 +724,9 @@ XenVbd_PutSrbOnRing(PXENVBD_TARGET_DATA 
   3.151        0, MmGetMdlPfnArray(TargetData->shadow[req->id].Mdl)[i], FALSE);
   3.152      req->seg[i].first_sect = 0;
   3.153      if (i == req->nr_segments - 1)
   3.154 -      req->seg[i].last_sect = (BlockCount - 1) % (PAGE_SIZE / TargetData->BytesPerSector);
   3.155 +      req->seg[i].last_sect = (UINT8)((BlockCount - 1) % (PAGE_SIZE / TargetData->BytesPerSector));
   3.156      else
   3.157 -      req->seg[i].last_sect = PAGE_SIZE / TargetData->BytesPerSector - 1;
   3.158 +      req->seg[i].last_sect = (UINT8)(PAGE_SIZE / TargetData->BytesPerSector - 1);
   3.159  //    KdPrint((__DRIVER_NAME "     Page %d, first_sect = %d, last_sect = %d\n", i, req->seg[i].first_sect, req->seg[i].last_sect));
   3.160    }
   3.161    if (Srb->Cdb[0] == SCSIOP_WRITE)
   3.162 @@ -756,10 +745,7 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   3.163    PXENVBD_DEVICE_DATA DeviceData = (PXENVBD_DEVICE_DATA)DeviceExtension;
   3.164    PXENVBD_TARGET_DATA TargetData;
   3.165    unsigned int i;
   3.166 -  KIRQL KIrql;
   3.167    int notify;
   3.168 -  SCSI_PHYSICAL_ADDRESS ScsiPhysicalAddress;
   3.169 -  ULONG Length;
   3.170  
   3.171  //  KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
   3.172  //  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.173 @@ -1069,6 +1055,10 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   3.174  static BOOLEAN
   3.175  XenVbd_HwScsiResetBus(PVOID DeviceExtension, ULONG PathId)
   3.176  {
   3.177 +  UNREFERENCED_PARAMETER(DeviceExtension);
   3.178 +  UNREFERENCED_PARAMETER(PathId);
   3.179 +
   3.180 +
   3.181    KdPrint((__DRIVER_NAME " --> HwScsiResetBus\n"));
   3.182    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.183  
   3.184 @@ -1081,6 +1071,10 @@ XenVbd_HwScsiResetBus(PVOID DeviceExtens
   3.185  static BOOLEAN
   3.186  XenVbd_HwScsiAdapterState(PVOID DeviceExtension, PVOID Context, BOOLEAN SaveState)
   3.187  {
   3.188 +  UNREFERENCED_PARAMETER(DeviceExtension);
   3.189 +  UNREFERENCED_PARAMETER(Context);
   3.190 +  UNREFERENCED_PARAMETER(SaveState);
   3.191 +
   3.192    KdPrint((__DRIVER_NAME " --> HwScsiAdapterState\n"));
   3.193    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.194  
   3.195 @@ -1095,6 +1089,8 @@ XenVbd_HwScsiAdapterControl(PVOID Device
   3.196    SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
   3.197    PSCSI_SUPPORTED_CONTROL_TYPE_LIST SupportedControlTypeList;
   3.198  
   3.199 +  UNREFERENCED_PARAMETER(DeviceExtension);
   3.200 +
   3.201    KdPrint((__DRIVER_NAME " --> HwScsiAdapterControl\n"));
   3.202    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.203  
     4.1 --- a/xenvbd/xenvbd.h	Mon Jan 14 23:13:12 2008 +1100
     4.2 +++ b/xenvbd/xenvbd.h	Mon Jan 14 14:32:57 2008 -0800
     4.3 @@ -85,7 +85,7 @@ struct
     4.4  
     4.5    int BusChangePending;
     4.6  
     4.7 -  int EnumeratedDevices;
     4.8 +  LONG EnumeratedDevices;
     4.9    int TotalInitialDevices;
    4.10  } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;
    4.11