ReactOS  0.4.14-dev-115-g4576127
pdo.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for pdo.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

NTSTATUS PortCreatePdo (_In_ PFDO_DEVICE_EXTENSION FdoDeviceExtension, _In_ ULONG Bus, _In_ ULONG Target, _In_ ULONG Lun, _Out_ PPDO_DEVICE_EXTENSION *PdoDeviceExtension)
 
NTSTATUS PortDeletePdo (_In_ PPDO_DEVICE_EXTENSION PdoExtension)
 
NTSTATUS NTAPI PortPdoScsi (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 
NTSTATUS NTAPI PortPdoPnp (_In_ PDEVICE_OBJECT DeviceObject, _In_ PIRP Irp)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file pdo.c.

Function Documentation

◆ PortCreatePdo()

NTSTATUS PortCreatePdo ( _In_ PFDO_DEVICE_EXTENSION  FdoDeviceExtension,
_In_ ULONG  Bus,
_In_ ULONG  Target,
_In_ ULONG  Lun,
_Out_ PPDO_DEVICE_EXTENSION PdoDeviceExtension 
)

Definition at line 19 of file pdo.c.

25 {
26  PPDO_DEVICE_EXTENSION DeviceExtension = NULL;
30 
31  DPRINT("PortCreatePdo(%p %p)\n",
32  FdoDeviceExtension, PdoDeviceExtension);
33 
34  /* Create the port device */
35  Status = IoCreateDevice(FdoDeviceExtension->Device->DriverObject,
36  sizeof(PDO_DEVICE_EXTENSION),
37  NULL,
40  FALSE,
41  &Pdo);
42  if (!NT_SUCCESS(Status))
43  {
44  DPRINT1("IoCreateDevice() failed (Status 0x%lX)\n", Status);
45  return Status;
46  }
47 
48  /* Initialize the device */
51 
52  DeviceExtension = (PPDO_DEVICE_EXTENSION)Pdo->DeviceExtension;
53  RtlZeroMemory(DeviceExtension, sizeof(PDO_DEVICE_EXTENSION));
54 
55  DeviceExtension->ExtensionType = PdoExtension;
56 
57  DeviceExtension->Device = Pdo;
58  DeviceExtension->FdoExtension = FdoDeviceExtension;
59  DeviceExtension->PnpState = dsStopped;
60 
61  /* Add the PDO to the PDO list*/
62  KeAcquireInStackQueuedSpinLock(&FdoDeviceExtension->PdoListLock,
63  &LockHandle);
64  InsertHeadList(&FdoDeviceExtension->PdoListHead,
65  &DeviceExtension->PdoListEntry);
66  FdoDeviceExtension->PdoCount++;
68 
69  DeviceExtension->Bus = Bus;
70  DeviceExtension->Target = Target;
71  DeviceExtension->Lun = Lun;
72 
73 
74  // FIXME: More initialization
75 
76 
77  /* The device has been initialized */
79 
80  *PdoDeviceExtension = DeviceExtension;
81 
82  return STATUS_SUCCESS;
83 }
#define DO_DEVICE_INITIALIZING
Definition: env_spec_w32.h:399
#define DO_POWER_PAGABLE
_In_ ULONG _In_ BOOLEAN _In_ ULONG _In_ UCHAR _In_ UCHAR _In_ UCHAR Lun
Definition: classpnp.h:1117
_In_ PDEVICE_OBJECT Pdo
Definition: classpnp.h:301
FORCEINLINE VOID InsertHeadList(_Inout_ PLIST_ENTRY ListHead, _Inout_ __drv_aliasesMem PLIST_ENTRY Entry)
Definition: rtlfuncs.h:201
LONG NTSTATUS
Definition: precomp.h:26
DEVICE_STATE PnpState
Definition: precomp.h:127
struct _PDO_DEVICE_EXTENSION * PPDO_DEVICE_EXTENSION
#define FILE_DEVICE_MASS_STORAGE
Definition: imports.h:62
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:130
#define DO_DIRECT_IO
Definition: env_spec_w32.h:396
PFDO_DEVICE_EXTENSION FdoExtension
Definition: precomp.h:126
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define FILE_AUTOGENERATED_DEVICE_NAME
Definition: iotypes.h:138
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:166
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
LIST_ENTRY PdoListEntry
Definition: precomp.h:128
_Must_inspect_result_ typedef _In_ ULONG _In_ BOOLEAN Target
Definition: iotypes.h:1068
PDEVICE_OBJECT Device
Definition: precomp.h:125
Status
Definition: gdiplustypes.h:24
EXTENSION_TYPE ExtensionType
Definition: precomp.h:123
#define DPRINT1
Definition: precomp.h:8
NTSTATUS NTAPI IoCreateDevice(IN PDRIVER_OBJECT DriverObject, IN ULONG DeviceExtensionSize, IN PUNICODE_STRING DeviceName, IN DEVICE_TYPE DeviceType, IN ULONG DeviceCharacteristics, IN BOOLEAN Exclusive, OUT PDEVICE_OBJECT *DeviceObject)
Definition: device.c:1031
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define FILE_DEVICE_SECURE_OPEN
Definition: cdrw_usr.h:46
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by PortFdoScanBus().

◆ PortDeletePdo()

NTSTATUS PortDeletePdo ( _In_ PPDO_DEVICE_EXTENSION  PdoExtension)

Definition at line 87 of file pdo.c.

89 {
91 
92  DPRINT("PortDeletePdo(%p)\n", PdoExtension);
93 
94  /* Remove the PDO from the PDO list*/
95  KeAcquireInStackQueuedSpinLock(&PdoExtension->FdoExtension->PdoListLock,
96  &LockHandle);
97  RemoveEntryList(&PdoExtension->PdoListEntry);
98  PdoExtension->FdoExtension->PdoCount--;
100 
101  if (PdoExtension->InquiryBuffer)
102  {
104  PdoExtension->InquiryBuffer = NULL;
105  }
106 
107 
108  // FIXME: More uninitialization
109 
110 
111  /* Delete the PDO */
112  IoDeleteDevice(PdoExtension->Device);
113 
114  return STATUS_SUCCESS;
115 }
VOID FASTCALL KeAcquireInStackQueuedSpinLock(IN PKSPIN_LOCK SpinLock, IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:130
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
VOID FASTCALL KeReleaseInStackQueuedSpinLock(IN PKLOCK_QUEUE_HANDLE LockHandle)
Definition: spinlock.c:166
VOID NTAPI IoDeleteDevice(IN PDEVICE_OBJECT DeviceObject)
Definition: device.c:1251
*LockHandle LockHandle _Out_ PKLOCK_QUEUE_HANDLE LockHandle
Definition: kefuncs.h:742
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define TAG_INQUIRY_DATA
Definition: precomp.h:32

Referenced by PortFdoScanBus().

◆ PortPdoPnp()

NTSTATUS NTAPI PortPdoPnp ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp 
)

Definition at line 135 of file pdo.c.

138 {
139  DPRINT1("PortPdoPnp(%p %p)\n", DeviceObject, Irp);
140 
141  Irp->IoStatus.Information = 0;
142  Irp->IoStatus.Status = STATUS_SUCCESS;
144  return STATUS_SUCCESS;
145 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by PortDispatchPnp().

◆ PortPdoScsi()

NTSTATUS NTAPI PortPdoScsi ( _In_ PDEVICE_OBJECT  DeviceObject,
_In_ PIRP  Irp 
)

Definition at line 120 of file pdo.c.

123 {
124  DPRINT1("PortPdoScsi(%p %p)\n", DeviceObject, Irp);
125 
126  Irp->IoStatus.Information = 0;
127  Irp->IoStatus.Status = STATUS_SUCCESS;
129  return STATUS_SUCCESS;
130 }
_In_ PIRP Irp
Definition: csq.h:116
#define IoCompleteRequest
Definition: irp.c:1240
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
#define DPRINT1
Definition: precomp.h:8
#define IO_NO_INCREMENT
Definition: iotypes.h:566
return STATUS_SUCCESS
Definition: btrfs.c:2966

Referenced by PortDispatchScsi().