ReactOS  0.4.13-dev-99-g7e18b6d
pnp.c
Go to the documentation of this file.
1 /* Copyright (c) Mark Harmstone 2016-17
2  *
3  * This file is part of WinBtrfs.
4  *
5  * WinBtrfs is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Lesser General Public Licence as published by
7  * the Free Software Foundation, either version 3 of the Licence, or
8  * (at your option) any later version.
9  *
10  * WinBtrfs is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public Licence for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public Licence
16  * along with WinBtrfs. If not, see <http://www.gnu.org/licenses/>. */
17 
18 #include "btrfs_drv.h"
19 
20 struct pnp_context;
21 
22 typedef struct {
28 } pnp_stripe;
29 
30 typedef struct {
35 } pnp_context;
36 
38 extern LIST_ENTRY pdo_list;
39 
40 _Function_class_(IO_COMPLETION_ROUTINE)
41 #ifdef __REACTOS__
42 static NTSTATUS NTAPI pnp_completion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID conptr) {
43 #else
44 static NTSTATUS pnp_completion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID conptr) {
45 #endif
46  pnp_stripe* stripe = conptr;
47  pnp_context* context = (pnp_context*)stripe->context;
48 
50 
51  stripe->Status = Irp->IoStatus.Status;
52 
54 
55  if (context->left == 0)
56  KeSetEvent(&context->Event, 0, FALSE);
57 
59 }
60 
63  ULONG num_devices, i;
65  LIST_ENTRY* le;
66 
69 
70  num_devices = (ULONG)min(0xffffffff, Vcb->superblock.num_devices);
71 
72  context.stripes = ExAllocatePoolWithTag(NonPagedPool, sizeof(pnp_stripe) * num_devices, ALLOC_TAG);
73  if (!context.stripes) {
74  ERR("out of memory\n");
76  }
77 
78  RtlZeroMemory(context.stripes, sizeof(pnp_stripe) * num_devices);
79 
80  i = 0;
81  le = Vcb->devices.Flink;
82 
83  while (le != &Vcb->devices) {
86 
87  if (dev->devobj) {
88  context.stripes[i].context = (struct pnp_context*)&context;
89 
90  context.stripes[i].Irp = IoAllocateIrp(dev->devobj->StackSize, FALSE);
91 
92  if (!context.stripes[i].Irp) {
93  UINT64 j;
94 
95  ERR("IoAllocateIrp failed\n");
96 
97  for (j = 0; j < i; j++) {
98  if (context.stripes[j].dev->devobj) {
99  IoFreeIrp(context.stripes[j].Irp);
100  }
101  }
102  ExFreePool(context.stripes);
103 
105  }
106 
107  IrpSp = IoGetNextIrpStackLocation(context.stripes[i].Irp);
110 
111  context.stripes[i].Irp->UserIosb = &context.stripes[i].iosb;
112 
113  IoSetCompletionRoutine(context.stripes[i].Irp, pnp_completion, &context.stripes[i], TRUE, TRUE, TRUE);
114 
115  context.stripes[i].Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
116  context.stripes[i].dev = dev;
117 
118  context.left++;
119  }
120 
121  le = le->Flink;
122  }
123 
124  if (context.left == 0) {
126  goto end;
127  }
128 
129  for (i = 0; i < num_devices; i++) {
130  if (context.stripes[i].Irp) {
131  IoCallDriver(context.stripes[i].dev->devobj, context.stripes[i].Irp);
132  }
133  }
134 
136 
138 
139  for (i = 0; i < num_devices; i++) {
140  if (context.stripes[i].Irp) {
141  if (context.stripes[i].Status != STATUS_SUCCESS)
142  Status = context.stripes[i].Status;
143  }
144  }
145 
146 end:
147  for (i = 0; i < num_devices; i++) {
148  if (context.stripes[i].Irp) {
149  IoFreeIrp(context.stripes[i].Irp);
150  }
151  }
152 
153  ExFreePool(context.stripes);
154 
155  return Status;
156 }
157 
161 
162  ExAcquireResourceSharedLite(&Vcb->tree_lock, TRUE);
163 
164  acquire_fcb_lock_exclusive(Vcb);
165 
166  if (Vcb->root_fileref && Vcb->root_fileref->fcb && (Vcb->root_fileref->open_count > 0 || has_open_children(Vcb->root_fileref))) {
168  goto end;
169  }
170 
172  if (!NT_SUCCESS(Status)) {
173  WARN("send_disks_pnp_message returned %08x\n", Status);
174  goto end;
175  }
176 
177 end:
178  release_fcb_lock(Vcb);
179  ExReleaseResourceLite(&Vcb->tree_lock);
180 
181  return STATUS_SUCCESS;
182 }
183 
187 
189 
190  acquire_fcb_lock_exclusive(Vcb);
191 
192  if (Vcb->root_fileref && Vcb->root_fileref->fcb && (Vcb->root_fileref->open_count > 0 || has_open_children(Vcb->root_fileref))) {
194  goto end;
195  }
196 
198  if (!NT_SUCCESS(Status)) {
199  WARN("send_disks_pnp_message returned %08x\n", Status);
200  goto end;
201  }
202 
203  Vcb->removing = TRUE;
204 
205  if (Vcb->need_write && !Vcb->readonly) {
206  Status = do_write(Vcb, Irp);
207 
208  free_trees(Vcb);
209 
210  if (!NT_SUCCESS(Status)) {
211  ERR("do_write returned %08x\n", Status);
212  goto end;
213  }
214  }
215 
216 
218 end:
219  release_fcb_lock(Vcb);
220 
221  ExReleaseResourceLite(&Vcb->tree_lock);
222 
223  return Status;
224 }
225 
229 
230  ExAcquireResourceSharedLite(&Vcb->tree_lock, TRUE);
231 
233 
234  if (!NT_SUCCESS(Status))
235  WARN("send_disks_pnp_message returned %08x\n", Status);
236 
237  ExReleaseResourceLite(&Vcb->tree_lock);
238 
239  if (DeviceObject->Vpb->Flags & VPB_MOUNTED) {
241  if (!NT_SUCCESS(Status)) {
242  WARN("FsRtlNotifyVolumeEvent returned %08x\n", Status);
243  }
244 
245  if (Vcb->vde)
246  Vcb->vde->mounted_device = NULL;
247 
249  Vcb->removing = TRUE;
250  ExReleaseResourceLite(&Vcb->tree_lock);
251 
252  if (Vcb->open_files == 0)
253  uninit(Vcb);
254  }
255 
256  return STATUS_SUCCESS;
257 }
258 
261 
262  TRACE("(%p, %p)\n", DeviceObject, Irp);
263 
264  if (DeviceObject->Vpb->Flags & VPB_MOUNTED) {
266 
267  if (Vcb->vde)
268  Vcb->vde->mounted_device = NULL;
269 
270  Vcb->removing = TRUE;
271 
272  ExReleaseResourceLite(&Vcb->tree_lock);
273 
274  if (Vcb->open_files == 0)
275  uninit(Vcb);
276  }
277 
278  return STATUS_SUCCESS;
279 }
280 
283  PDEVICE_CAPABILITIES dc = IrpSp->Parameters.DeviceCapabilities.Capabilities;
284 
285  dc->UniqueID = TRUE;
286  dc->SilentInstall = TRUE;
287 
288  Irp->IoStatus.Status = STATUS_SUCCESS;
289 }
290 
293  ULONG num_children;
294  LIST_ENTRY* le;
295  ULONG drsize, i;
296  DEVICE_RELATIONS* dr;
297 
299 
300  num_children = 0;
301 
302  le = pdo_list.Flink;
303  while (le != &pdo_list) {
304  num_children++;
305 
306  le = le->Flink;
307  }
308 
309  drsize = offsetof(DEVICE_RELATIONS, Objects[0]) + (num_children * sizeof(PDEVICE_OBJECT));
311 
312  if (!dr) {
313  ERR("out of memory\n");
315  goto end;
316  }
317 
318  dr->Count = num_children;
319 
320  i = 0;
321  le = pdo_list.Flink;
322  while (le != &pdo_list) {
324 
325  ObReferenceObject(pdode->pdo);
326  dr->Objects[i] = pdode->pdo;
327  i++;
328 
329  le = le->Flink;
330  }
331 
332  Irp->IoStatus.Information = (ULONG_PTR)dr;
333 
335 
336 end:
338 
339  Irp->IoStatus.Status = Status;
341 
342  return Status;
343 }
344 
346  WCHAR* out;
347 
348  static const WCHAR ids[] = L"ROOT\\btrfs\0";
349 
351  if (!out) {
352  ERR("out of memory\n");
354  }
355 
356  RtlCopyMemory(out, ids, sizeof(ids));
357 
358  Irp->IoStatus.Information = (ULONG_PTR)out;
359 
360  return STATUS_SUCCESS;
361 }
362 
365 
366  switch (IrpSp->MinorFunction) {
369  break;
370 
372  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations || no_pnp)
373  break;
374 
376 
377  case IRP_MN_QUERY_ID:
378  {
380 
381  if (IrpSp->Parameters.QueryId.IdType != BusQueryHardwareIDs)
382  break;
383 
385 
386  Irp->IoStatus.Status = Status;
388 
389  return Status;
390  }
391  }
392 
394  return IoCallDriver(cde->attached_device, Irp);
395 }
396 
398  WCHAR name[100], *noff, *out;
399  int i;
400 
401  static const WCHAR pref[] = L"Btrfs\\";
402 
403  RtlCopyMemory(name, pref, sizeof(pref) - sizeof(WCHAR));
404 
405  noff = &name[(sizeof(pref) / sizeof(WCHAR)) - 1];
406  for (i = 0; i < 16; i++) {
407  *noff = hex_digit(pdode->uuid.uuid[i] >> 4); noff++;
408  *noff = hex_digit(pdode->uuid.uuid[i] & 0xf); noff++;
409 
410  if (i == 3 || i == 5 || i == 7 || i == 9) {
411  *noff = '-';
412  noff++;
413  }
414  }
415  *noff = 0;
416 
418  if (!out) {
419  ERR("out of memory\n");
421  }
422 
423  RtlCopyMemory(out, name, (wcslen(name) + 1) * sizeof(WCHAR));
424 
425  Irp->IoStatus.Information = (ULONG_PTR)out;
426 
427  return STATUS_SUCCESS;
428 }
429 
431  WCHAR* out;
432 
433  static const WCHAR ids[] = L"BtrfsVolume\0";
434 
436  if (!out) {
437  ERR("out of memory\n");
439  }
440 
441  RtlCopyMemory(out, ids, sizeof(ids));
442 
443  Irp->IoStatus.Information = (ULONG_PTR)out;
444 
445  return STATUS_SUCCESS;
446 }
447 
450 
451  switch (IrpSp->Parameters.QueryId.IdType) {
452  case BusQueryDeviceID:
453  TRACE("BusQueryDeviceID\n");
454  return pdo_query_device_id(pdode, Irp);
455 
456  case BusQueryHardwareIDs:
457  TRACE("BusQueryHardwareIDs\n");
458  return pdo_query_hardware_ids(Irp);
459 
460  default:
461  break;
462  }
463 
464  return Irp->IoStatus.Status;
465 }
466 
470 
471  switch (IrpSp->MinorFunction) {
472  case IRP_MN_QUERY_ID:
473  return pdo_query_id(pdode, Irp);
474 
475  case IRP_MN_START_DEVICE:
479  return STATUS_SUCCESS;
480 
482  return STATUS_UNSUCCESSFUL;
483  }
484 
485  return Irp->IoStatus.Status;
486 }
487 
494  BOOL top_level;
495 
497 
498  top_level = is_top_level(Irp);
499 
500  if (Vcb && Vcb->type == VCB_TYPE_CONTROL) {
502  goto exit;
503  } else if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
506  Status = IoCallDriver(vde->pdo, Irp);
507  goto exit;
508  } else if (Vcb && Vcb->type == VCB_TYPE_PDO) {
510  goto end;
511  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
513  goto end;
514  }
515 
517 
518  switch (IrpSp->MinorFunction) {
521  break;
522 
525  break;
526 
529  break;
530 
533  break;
534 
535  default:
536  TRACE("passing minor function 0x%x on\n", IrpSp->MinorFunction);
537 
539  Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
540  goto exit;
541  }
542 
543 end:
544  Irp->IoStatus.Status = Status;
545 
547 
548 exit:
549  TRACE("returning %08x\n", Status);
550 
551  if (top_level)
553 
555 
556  return Status;
557 }
NTSTATUS pnp_query_remove_device(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:184
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define VCB_TYPE_PDO
Definition: btrfs_drv.h:630
#define hex_digit(c)
Definition: btrfs_drv.h:1686
#define FSRTL_VOLUME_DISMOUNT
Definition: ntifs_ex.h:439
ERESOURCE pdo_list_lock
Definition: btrfs.c:93
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define IRP_MN_REMOVE_DEVICE
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IRP_MN_QUERY_ID
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
#define STATUS_NOT_IMPLEMENTED
Definition: ntstatus.h:225
static NTSTATUS pdo_query_hardware_ids(PIRP Irp)
Definition: pnp.c:430
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:63
Definition: http.c:6587
NTSTATUS Status
Definition: pnp.c:26
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _DEVICE_OBJECT * PDEVICE_OBJECT
PDEVICE_OBJECT Objects[1]
Definition: iotypes.h:2054
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7287
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
UINT8 uuid[16]
Definition: btrfs.h:119
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
UINT32 no_pnp
Definition: btrfs.c:83
Definition: write.c:115
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:831
#define VCB_TYPE_FS
Definition: btrfs_drv.h:627
HDC dc
Definition: cylfrac.c:34
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:804
pnp_stripe * stripes
Definition: pnp.c:34
GLuint GLuint end
Definition: gl.h:1545
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:1752
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
Definition: wait.c:416
static int dev
Definition: mkdosfs.c:536
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:515
BOOLEAN NTAPI ExAcquireResourceExclusiveLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:770
PDEVICE_OBJECT pdo
Definition: btrfs_drv.h:843
#define ALLOC_TAG
Definition: btrfs_drv.h:86
static NTSTATUS pnp_remove_device(PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:226
GLuint * ids
Definition: glext.h:5907
NTSTATUS Status
Definition: pnp.c:32
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
#define IRP_MN_QUERY_REMOVE_DEVICE
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
Definition: devices.h:37
_Function_class_(IO_COMPLETION_ROUTINE)
Definition: pnp.c:40
PVOID DeviceExtension
Definition: env_spec_w32.h:418
static NTSTATUS bus_pnp(control_device_extension *cde, PIRP Irp)
Definition: pnp.c:363
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
_Dispatch_type_(IRP_MJ_PNP)
Definition: pnp.c:488
#define IoCompleteRequest
Definition: irp.c:1240
#define UNUSED(x)
Definition: btrfs_drv.h:81
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:777
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IO_STATUS_BLOCK iosb
Definition: pnp.c:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
struct pnp_context * context
Definition: pnp.c:23
Definition: pnp.c:22
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define IRP_MN_SURPRISE_REMOVAL
Definition: ntifs_ex.h:408
#define TRACE(s)
Definition: solgame.cpp:4
NTSTATUS NTAPI FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, IN ULONG EventCode)
Definition: pnp.c:38
__wchar_t WCHAR
Definition: xmlstorage.h:180
PIRP Irp
Definition: pnp.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:629
static void bus_query_capabilities(PIRP Irp)
Definition: pnp.c:281
#define Vcb
Definition: cdprocs.h:1425
#define IRP_MN_START_DEVICE
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
LONG left
Definition: pnp.c:33
unsigned char UCHAR
Definition: xmlstorage.h:181
static NTSTATUS pdo_query_device_id(pdo_device_extension *pdode, PIRP Irp)
Definition: pnp.c:397
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
static const WCHAR L[]
Definition: oid.c:1250
static NTSTATUS bus_query_device_relations(PIRP Irp)
Definition: pnp.c:291
#define InterlockedDecrement
Definition: armddk.h:52
Definition: typedefs.h:117
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2647
DRIVER_DISPATCH(nfs41_FsdDispatch)
static NTSTATUS pnp_cancel_remove_device(PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:158
* PDEVICE_CAPABILITIES
Definition: iotypes.h:927
#define VCB_TYPE_CONTROL
Definition: btrfs_drv.h:628
Status
Definition: gdiplustypes.h:24
static NTSTATUS pdo_pnp(PDEVICE_OBJECT pdo, PIRP Irp)
Definition: pnp.c:467
#define ERR(fmt,...)
Definition: debug.h:109
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
device * dev
Definition: pnp.c:27
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
static NTSTATUS send_disks_pnp_message(device_extension *Vcb, UCHAR minor)
Definition: pnp.c:61
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4157
#define min(a, b)
Definition: monoChain.cc:55
Definition: list.h:27
NTSTATUS NTAPI IoCallDriver(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp)
Definition: irp.c:1218
BOOL is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:256
#define IRP_MN_QUERY_DEVICE_RELATIONS
#define IoSkipCurrentIrpStackLocation(Irp)
Definition: ntifs_ex.h:421
BOOLEAN NTAPI ExAcquireResourceSharedLite(IN PERESOURCE Resource, IN BOOLEAN Wait)
Definition: resource.c:885
LIST_ENTRY pdo_list
Definition: btrfs.c:94
Definition: name.c:36
#define ObReferenceObject
Definition: obfuncs.h:204
VOID NTAPI IoFreeIrp(IN PIRP Irp)
Definition: irp.c:1666
ULONG ERESOURCE
Definition: env_spec_w32.h:594
#define STATUS_NOT_SUPPORTED
Definition: ntstatus.h:409
unsigned int ULONG
Definition: retypes.h:1
#define IO_NO_INCREMENT
Definition: iotypes.h:565
#define minor(rdev)
Definition: propsheet.cpp:880
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define ULONG_PTR
Definition: config.h:101
static NTSTATUS pdo_query_id(pdo_device_extension *pdode, PIRP Irp)
Definition: pnp.c:448
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
BOOL has_open_children(file_ref *fileref)
Definition: fileinfo.c:291
void exit(int exitcode)
Definition: _exit.c:33
unsigned long long UINT64
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2771
return STATUS_SUCCESS
Definition: btrfs.c:2725
#define VPB_MOUNTED
Definition: iotypes.h:1763
static NTSTATUS bus_query_hardware_ids(PIRP Irp)
Definition: pnp.c:345
KEVENT Event
Definition: pnp.c:31
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
#define IRP_MN_QUERY_CAPABILITIES
NTSTATUS pnp_surprise_removal(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:259