ReactOS  0.4.14-dev-50-g13bb5e2
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 static NTSTATUS __stdcall pnp_completion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID conptr) {
42  pnp_stripe* stripe = conptr;
43  pnp_context* context = (pnp_context*)stripe->context;
44 
46 
47  stripe->Status = Irp->IoStatus.Status;
48 
50 
51  if (context->left == 0)
52  KeSetEvent(&context->Event, 0, false);
53 
55 }
56 
59  ULONG num_devices, i;
61  LIST_ENTRY* le;
62 
65 
66  num_devices = (ULONG)min(0xffffffff, Vcb->superblock.num_devices);
67 
68  context.stripes = ExAllocatePoolWithTag(NonPagedPool, sizeof(pnp_stripe) * num_devices, ALLOC_TAG);
69  if (!context.stripes) {
70  ERR("out of memory\n");
72  }
73 
74  RtlZeroMemory(context.stripes, sizeof(pnp_stripe) * num_devices);
75 
76  i = 0;
77  le = Vcb->devices.Flink;
78 
79  while (le != &Vcb->devices) {
82 
83  if (dev->devobj) {
84  context.stripes[i].context = (struct pnp_context*)&context;
85 
86  context.stripes[i].Irp = IoAllocateIrp(dev->devobj->StackSize, false);
87 
88  if (!context.stripes[i].Irp) {
89  uint64_t j;
90 
91  ERR("IoAllocateIrp failed\n");
92 
93  for (j = 0; j < i; j++) {
94  if (context.stripes[j].dev->devobj) {
95  IoFreeIrp(context.stripes[j].Irp);
96  }
97  }
98  ExFreePool(context.stripes);
99 
101  }
102 
103  IrpSp = IoGetNextIrpStackLocation(context.stripes[i].Irp);
106  IrpSp->FileObject = dev->fileobj;
107 
108  context.stripes[i].Irp->UserIosb = &context.stripes[i].iosb;
109 
110  IoSetCompletionRoutine(context.stripes[i].Irp, pnp_completion, &context.stripes[i], true, true, true);
111 
112  context.stripes[i].Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
113  context.stripes[i].dev = dev;
114 
115  context.left++;
116  }
117 
118  le = le->Flink;
119  }
120 
121  if (context.left == 0) {
123  goto end;
124  }
125 
126  for (i = 0; i < num_devices; i++) {
127  if (context.stripes[i].Irp) {
128  IoCallDriver(context.stripes[i].dev->devobj, context.stripes[i].Irp);
129  }
130  }
131 
133 
135 
136  for (i = 0; i < num_devices; i++) {
137  if (context.stripes[i].Irp) {
138  if (context.stripes[i].Status != STATUS_SUCCESS)
139  Status = context.stripes[i].Status;
140  }
141  }
142 
143 end:
144  for (i = 0; i < num_devices; i++) {
145  if (context.stripes[i].Irp) {
146  IoFreeIrp(context.stripes[i].Irp);
147  }
148  }
149 
150  ExFreePool(context.stripes);
151 
152  return Status;
153 }
154 
158 
159  ExAcquireResourceSharedLite(&Vcb->tree_lock, true);
160 
161  ExAcquireResourceExclusiveLite(&Vcb->fileref_lock, true);
162 
163  if (Vcb->root_fileref && Vcb->root_fileref->fcb && (Vcb->root_fileref->open_count > 0 || has_open_children(Vcb->root_fileref))) {
165  goto end;
166  }
167 
169  if (!NT_SUCCESS(Status)) {
170  WARN("send_disks_pnp_message returned %08x\n", Status);
171  goto end;
172  }
173 
174 end:
175  ExReleaseResourceLite(&Vcb->fileref_lock);
176  ExReleaseResourceLite(&Vcb->tree_lock);
177 
178  return STATUS_SUCCESS;
179 }
180 
184 
185  ExAcquireResourceExclusiveLite(&Vcb->tree_lock, true);
186 
187  if (Vcb->root_fileref && Vcb->root_fileref->fcb && (Vcb->root_fileref->open_count > 0 || has_open_children(Vcb->root_fileref))) {
189  goto end;
190  }
191 
193  if (!NT_SUCCESS(Status)) {
194  WARN("send_disks_pnp_message returned %08x\n", Status);
195  goto end;
196  }
197 
198  Vcb->removing = true;
199 
200  if (Vcb->need_write && !Vcb->readonly) {
201  Status = do_write(Vcb, Irp);
202 
203  free_trees(Vcb);
204 
205  if (!NT_SUCCESS(Status)) {
206  ERR("do_write returned %08x\n", Status);
207  goto end;
208  }
209  }
210 
211 
213 end:
214  ExReleaseResourceLite(&Vcb->tree_lock);
215 
216  return Status;
217 }
218 
222 
223  ExAcquireResourceSharedLite(&Vcb->tree_lock, true);
224 
226 
227  if (!NT_SUCCESS(Status))
228  WARN("send_disks_pnp_message returned %08x\n", Status);
229 
230  ExReleaseResourceLite(&Vcb->tree_lock);
231 
232  if (DeviceObject->Vpb->Flags & VPB_MOUNTED) {
234  if (!NT_SUCCESS(Status)) {
235  WARN("FsRtlNotifyVolumeEvent returned %08x\n", Status);
236  }
237 
238  if (Vcb->vde)
239  Vcb->vde->mounted_device = NULL;
240 
241  ExAcquireResourceExclusiveLite(&Vcb->tree_lock, true);
242  Vcb->removing = true;
243  ExReleaseResourceLite(&Vcb->tree_lock);
244 
245  if (Vcb->open_files == 0)
246  uninit(Vcb);
247  }
248 
249  return STATUS_SUCCESS;
250 }
251 
254 
255  TRACE("(%p, %p)\n", DeviceObject, Irp);
256 
257  if (DeviceObject->Vpb->Flags & VPB_MOUNTED) {
258  ExAcquireResourceExclusiveLite(&Vcb->tree_lock, true);
259 
260  if (Vcb->vde)
261  Vcb->vde->mounted_device = NULL;
262 
263  Vcb->removing = true;
264 
265  ExReleaseResourceLite(&Vcb->tree_lock);
266 
267  if (Vcb->open_files == 0)
268  uninit(Vcb);
269  }
270 
271  return STATUS_SUCCESS;
272 }
273 
276  PDEVICE_CAPABILITIES dc = IrpSp->Parameters.DeviceCapabilities.Capabilities;
277 
278  dc->UniqueID = true;
279  dc->SilentInstall = true;
280 
281  return STATUS_SUCCESS;
282 }
283 
286  ULONG num_children;
287  LIST_ENTRY* le;
288  ULONG drsize, i;
289  DEVICE_RELATIONS* dr;
290 
292 
293  num_children = 0;
294 
295  le = pdo_list.Flink;
296  while (le != &pdo_list) {
297  num_children++;
298 
299  le = le->Flink;
300  }
301 
302  drsize = offsetof(DEVICE_RELATIONS, Objects[0]) + (num_children * sizeof(PDEVICE_OBJECT));
304 
305  if (!dr) {
306  ERR("out of memory\n");
308  goto end;
309  }
310 
311  dr->Count = num_children;
312 
313  i = 0;
314  le = pdo_list.Flink;
315  while (le != &pdo_list) {
317 
318  ObReferenceObject(pdode->pdo);
319  dr->Objects[i] = pdode->pdo;
320  i++;
321 
322  le = le->Flink;
323  }
324 
325  Irp->IoStatus.Information = (ULONG_PTR)dr;
326 
328 
329 end:
331 
332  return Status;
333 }
334 
336  WCHAR* out;
337 
338  static const WCHAR ids[] = L"ROOT\\btrfs\0";
339 
341  if (!out) {
342  ERR("out of memory\n");
344  }
345 
346  RtlCopyMemory(out, ids, sizeof(ids));
347 
348  Irp->IoStatus.Information = (ULONG_PTR)out;
349 
350  return STATUS_SUCCESS;
351 }
352 
354  NTSTATUS Status = Irp->IoStatus.Status;
356  bool handled = false;
357 
358  switch (IrpSp->MinorFunction) {
361  handled = true;
362  break;
363 
365  if (IrpSp->Parameters.QueryDeviceRelations.Type != BusRelations || no_pnp)
366  break;
367 
369  handled = true;
370  break;
371 
372  case IRP_MN_QUERY_ID:
373  if (IrpSp->Parameters.QueryId.IdType != BusQueryHardwareIDs)
374  break;
375 
377  handled = true;
378  break;
379  }
380 
381  if (!NT_SUCCESS(Status) && handled) {
382  Irp->IoStatus.Status = Status;
384 
385  return Status;
386  }
387 
388  Irp->IoStatus.Status = Status;
389 
391  return IoCallDriver(bde->attached_device, Irp);
392 }
393 
395  WCHAR name[100], *noff, *out;
396  int i;
397 
398  static const WCHAR pref[] = L"Btrfs\\";
399 
400  RtlCopyMemory(name, pref, sizeof(pref) - sizeof(WCHAR));
401 
402  noff = &name[(sizeof(pref) / sizeof(WCHAR)) - 1];
403  for (i = 0; i < 16; i++) {
404  *noff = hex_digit(pdode->uuid.uuid[i] >> 4); noff++;
405  *noff = hex_digit(pdode->uuid.uuid[i] & 0xf); noff++;
406 
407  if (i == 3 || i == 5 || i == 7 || i == 9) {
408  *noff = '-';
409  noff++;
410  }
411  }
412  *noff = 0;
413 
415  if (!out) {
416  ERR("out of memory\n");
418  }
419 
420  RtlCopyMemory(out, name, (wcslen(name) + 1) * sizeof(WCHAR));
421 
422  Irp->IoStatus.Information = (ULONG_PTR)out;
423 
424  return STATUS_SUCCESS;
425 }
426 
428  WCHAR* out;
429 
430  static const WCHAR ids[] = L"BtrfsVolume\0";
431 
433  if (!out) {
434  ERR("out of memory\n");
436  }
437 
438  RtlCopyMemory(out, ids, sizeof(ids));
439 
440  Irp->IoStatus.Information = (ULONG_PTR)out;
441 
442  return STATUS_SUCCESS;
443 }
444 
447 
448  switch (IrpSp->Parameters.QueryId.IdType) {
449  case BusQueryDeviceID:
450  TRACE("BusQueryDeviceID\n");
451  return pdo_query_device_id(pdode, Irp);
452 
453  case BusQueryHardwareIDs:
454  TRACE("BusQueryHardwareIDs\n");
455  return pdo_query_hardware_ids(Irp);
456 
457  default:
458  break;
459  }
460 
461  return Irp->IoStatus.Status;
462 }
463 
464 typedef struct {
469 
470 _Function_class_(IO_COMPLETION_ROUTINE)
471 static NTSTATUS __stdcall device_usage_completion(PDEVICE_OBJECT DeviceObject, PIRP Irp, PVOID conptr) {
472  device_usage_context* context = conptr;
473 
475 
476  context->Status = Irp->IoStatus.Status;
477 
478  KeSetEvent(&context->Event, 0, false);
479 
481 }
482 
485  LIST_ENTRY* le;
486 
487  TRACE("(%p, %p)\n", pdode, Irp);
488 
490 
491  le = pdode->children.Flink;
492 
493  while (le != &pdode->children) {
495 
496  if (vc->devobj) {
497  PIRP Irp2;
498  PIO_STACK_LOCATION IrpSp2;
500 
501  Irp2 = IoAllocateIrp(vc->devobj->StackSize, false);
502  if (!Irp2) {
503  ERR("out of memory\n");
506  }
507 
508  IrpSp2 = IoGetNextIrpStackLocation(Irp2);
509  IrpSp2->MajorFunction = IRP_MJ_PNP;
511  IrpSp2->Parameters.UsageNotification = IrpSp->Parameters.UsageNotification;
512  IrpSp2->FileObject = vc->fileobj;
513 
514  context.iosb.Status = STATUS_SUCCESS;
515  Irp2->UserIosb = &context.iosb;
516 
518  Irp2->UserEvent = &context.Event;
519 
520  IoSetCompletionRoutine(Irp2, device_usage_completion, &context, true, true, true);
521 
522  context.Status = IoCallDriver(vc->devobj, Irp2);
523 
524  if (context.Status == STATUS_PENDING)
526 
527  if (!NT_SUCCESS(context.Status)) {
528  ERR("IoCallDriver returned %08x\n", context.Status);
530  return context.Status;
531  }
532  }
533 
534  le = le->Flink;
535  }
536 
538 
539  return STATUS_SUCCESS;
540 }
541 
545 
546  switch (IrpSp->MinorFunction) {
547  case IRP_MN_QUERY_ID:
548  return pdo_query_id(pdode, Irp);
549 
550  case IRP_MN_START_DEVICE:
554  return STATUS_SUCCESS;
555 
557  return STATUS_UNSUCCESSFUL;
558 
560  return pdo_device_usage_notification(pdode, Irp);
561 
562  }
563 
564  return Irp->IoStatus.Status;
565 }
566 
570 
571  if (IrpSp->Parameters.UsageNotification.InPath) {
572  switch (IrpSp->Parameters.UsageNotification.Type) {
576  IoAdjustPagingPathCount(&Vcb->page_file_count, IrpSp->Parameters.UsageNotification.InPath);
577  break;
578 
579  default:
580  break;
581  }
582  }
583 
585  return IoCallDriver(Vcb->Vpb->RealDevice, Irp);
586 }
587 
594  bool top_level;
595 
597 
598  top_level = is_top_level(Irp);
599 
600  if (Vcb && Vcb->type == VCB_TYPE_BUS) {
602  goto exit;
603  } else if (Vcb && Vcb->type == VCB_TYPE_VOLUME) {
607  goto exit;
608  } else if (Vcb && Vcb->type == VCB_TYPE_PDO) {
610  goto end;
611  } else if (!Vcb || Vcb->type != VCB_TYPE_FS) {
613  goto end;
614  }
615 
617 
618  switch (IrpSp->MinorFunction) {
621  break;
622 
625  break;
626 
629  break;
630 
633  break;
634 
637  goto exit;
638 
639  default:
640  TRACE("passing minor function 0x%x on\n", IrpSp->MinorFunction);
641 
643  Status = IoCallDriver(Vcb->Vpb->RealDevice, Irp);
644  goto exit;
645  }
646 
647 end:
648  Irp->IoStatus.Status = Status;
649 
651 
652 exit:
653  TRACE("returning %08x\n", Status);
654 
655  if (top_level)
657 
659 
660  return Status;
661 }
NTSTATUS pnp_query_remove_device(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:181
#define IRP_MN_CANCEL_REMOVE_DEVICE
#define VCB_TYPE_PDO
Definition: btrfs_drv.h:660
#define hex_digit(c)
Definition: btrfs_drv.h:1656
#define FSRTL_VOLUME_DISMOUNT
Definition: ntifs_ex.h:439
ERESOURCE pdo_list_lock
Definition: btrfs.c:103
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:427
#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:2055
NTSTATUS do_write(device_extension *Vcb, PIRP Irp)
Definition: flushthread.c:7652
#define IRP_MJ_PNP
Definition: cdrw_usr.h:52
#define WARN(fmt,...)
Definition: debug.h:111
LONG NTSTATUS
Definition: precomp.h:26
Definition: write.c:111
static NTSTATUS pdo_device_usage_notification(pdo_device_extension *pdode, PIRP Irp)
Definition: pnp.c:483
#define VCB_TYPE_FS
Definition: btrfs_drv.h:657
HDC dc
Definition: cylfrac.c:34
pnp_stripe * stripes
Definition: pnp.c:34
GLuint GLuint end
Definition: gl.h:1545
void uninit(_In_ device_extension *Vcb)
Definition: btrfs.c:1970
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
Definition: eventobj.c:159
bool is_top_level(_In_ PIRP Irp)
Definition: btrfs.c:272
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
KEVENT Event
Definition: pnp.c:466
static int dev
Definition: mkdosfs.c:536
#define VCB_TYPE_BUS
Definition: btrfs_drv.h:661
#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:856
#define ALLOC_TAG
Definition: btrfs_drv.h:91
static NTSTATUS pnp_remove_device(PDEVICE_OBJECT DeviceObject)
Definition: pnp.c:219
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
IO_STATUS_BLOCK iosb
Definition: pnp.c:465
#define IRP_MN_QUERY_REMOVE_DEVICE
long LONG
Definition: pedump.c:60
Definition: devices.h:37
uint32_t no_pnp
Definition: btrfs.c:89
_Function_class_(IO_COMPLETION_ROUTINE)
Definition: pnp.c:40
PVOID DeviceExtension
Definition: env_spec_w32.h:418
smooth NULL
Definition: ftsmooth.c:416
#define offsetof(TYPE, MEMBER)
PDEVICE_OBJECT devobj
Definition: btrfs_drv.h:825
_Dispatch_type_(IRP_MJ_PNP)
Definition: pnp.c:588
#define IoCompleteRequest
Definition: irp.c:1240
#define UNUSED(x)
Definition: btrfs_drv.h:86
void free_trees(device_extension *Vcb)
Definition: treefuncs.c:793
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
static NTSTATUS bus_query_capabilities(PIRP Irp)
Definition: pnp.c:274
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
static NTSTATUS bus_pnp(bus_device_extension *bde, PIRP Irp)
Definition: pnp.c:353
NTSTATUS NTAPI FsRtlNotifyVolumeEvent(IN PFILE_OBJECT FileObject, IN ULONG EventCode)
Definition: pnp.c:38
#define IoAdjustPagingPathCount(_Count, _Increment)
NTSTATUS Status
Definition: pnp.c:467
__wchar_t WCHAR
Definition: xmlstorage.h:180
PIRP Irp
Definition: pnp.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define STATUS_PENDING
Definition: ntstatus.h:82
#define VCB_TYPE_VOLUME
Definition: btrfs_drv.h:659
#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
#define __stdcall
Definition: typedefs.h:25
ERESOURCE child_lock
Definition: btrfs_drv.h:861
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:394
PFILE_OBJECT fileobj
Definition: btrfs_drv.h:826
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:284
#define InterlockedDecrement
Definition: armddk.h:52
bool has_open_children(file_ref *fileref)
Definition: fileinfo.c:436
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:155
* PDEVICE_CAPABILITIES
Definition: iotypes.h:928
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:847
Status
Definition: gdiplustypes.h:24
static NTSTATUS pdo_pnp(PDEVICE_OBJECT pdo, PIRP Irp)
Definition: pnp.c:542
#define ERR(fmt,...)
Definition: debug.h:109
uint8_t uuid[16]
Definition: btrfs.h:123
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2745
static NTSTATUS pnp_device_usage_notification(PDEVICE_OBJECT DeviceObject, PIRP Irp)
Definition: pnp.c:567
PDEVICE_OBJECT attached_device
Definition: btrfs_drv.h:817
PFILE_OBJECT FileObject
Definition: iotypes.h:2813
UINT64 uint64_t
Definition: types.h:77
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:57
_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
#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:104
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:566
#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:445
PIRP NTAPI IoAllocateIrp(IN CCHAR StackSize, IN BOOLEAN ChargeQuota)
Definition: irp.c:615
#define IRP_MN_DEVICE_USAGE_NOTIFICATION
void exit(int exitcode)
Definition: _exit.c:33
struct _NAMED_PIPE_CREATE_PARAMETERS * Parameters
Definition: iotypes.h:2772
LIST_ENTRY children
Definition: btrfs_drv.h:862
return STATUS_SUCCESS
Definition: btrfs.c:2966
#define VPB_MOUNTED
Definition: iotypes.h:1764
static NTSTATUS bus_query_hardware_ids(PIRP Irp)
Definition: pnp.c:335
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:252