18 #define UDF_BUG_CHECK_ID UDF_FILE_PHYS_EJECT 61 UDFPrint((
" UDFEjectReqWaiter: start\n"));
62 uint8 supported_evt_classes = 0;
66 uint32 space_check_counter = 0x7fffffff;
71 TargetDevObj =
Vcb->TargetDeviceObject;
72 UseEvent =
Vcb->UseEvent;
76 UDFPrint((
" Eject Button ignored\n"));
79 UDFPrint((
" Reading events... (0)\n"));
80 if(supported_evt_classes) {
83 if( !(supported_evt_classes &
evt_type) )
110 supported_evt_classes = 0;
133 UDFPrint((
" UDFEjectReqWaiter: exit 3\n"));
136 BM_FlushPriod =
Vcb->BM_FlushPriod;
137 Tree_FlushPriod =
Vcb->Tree_FlushPriod;
140 if(space_check_counter > 2) {
147 if(
Vcb->LowFreeSpace && !OldLowFreeSpace) {
149 Vcb->Tree_FlushTime = Tree_FlushPriod+1;
152 OldLowFreeSpace =
Vcb->LowFreeSpace;
153 space_check_counter = 0;
155 space_check_counter++;
160 SkipEject = (SkipEjectCount <=
Vcb->SkipEjectCountLimit);
161 SkipFlush = (SkipEjectCount <=
Vcb->SkipCountLimit);
162 if(SkipEject || SkipFlush) {
177 Vcb->Tree_FlushTime = 0;
185 if(SkipEject && SkipFlush) {
217 UDFPrint((
"SK=%x ASC=%x, ASCQ=%x, IE=%x\n",
218 Error->SenseKey,
Error->AdditionalSenseCode,
Error->AdditionalSenseCodeQualifier,
Error->LastError));
224 if((!
Vcb->Modified &&
231 UDFPrint((
" UDFEjectReqWaiter: Unexpected write-in-progress on !Modified volume\n"));
244 UDFPrint((
" UDFEjectReqWaiter: Unexpected tray unlock encountered. Try to re-lock\n"));
262 Vcb->LastModifiedTrack = 0;
271 (BM_FlushPriod || Tree_FlushPriod)) {
275 Vcb->BM_FlushTime +=
d;
276 Vcb->Tree_FlushTime +=
d;
282 UDFPrint((
" SkipCount=%x, SkipCountLimit=%x\n",
284 Vcb->SkipCountLimit));
286 if( Tree_FlushPriod &&
287 (Tree_FlushPriod < Vcb->Tree_FlushTime)) {
289 UDFPrint((
" Tree_FlushPriod %I64x, Vcb->Tree_FlushTime %I64x\n",
291 Vcb->Tree_FlushTime));
311 UDFPrint((
"UDF: Flushing Directory Tree....\n"));
313 (BM_FlushPriod < Vcb->BM_FlushTime)) {
326 Vcb->Tree_FlushTime = 0;
329 (BM_FlushPriod < Vcb->BM_FlushTime)) {
331 UDFPrint((
" BM_FlushPriod %I64x, Vcb->BM_FlushTime %I64x\n",
365 #ifndef UDF_READ_ONLY_BUILD 372 if(
Vcb->VerifyOnWrite) {
373 UDFPrint((
"UDF: Flushing cache for verify\n"));
379 UDFPrint((
"UDF: Flushing Free Space Bitmap....\n"));
384 UDFPrint((
"Error updating Main VDS\n"));
386 UDFPrint((
"Error updating Reserve VDS\n"));
398 #endif //UDF_READ_ONLY_BUILD 402 Vcb->BM_FlushTime = 0;
418 if(!
Vcb->Tree_FlushTime &&
429 UDFPrint((
" UDFEjectReqWaiter: check removable media\n"));
437 UDFPrint((
" Eject Button ignored\n"));
478 if(supported_evt_classes) {
481 if( !(supported_evt_classes &
evt_type) )
514 UDFPrint((
" EventStat_Class_Media:\n"));
519 retry_media_presence_check:
531 UDFPrint((
" Buggy GET_EVENT media presence flag %x\n",
535 goto retry_media_presence_check;
538 UDFPrint((
" Unexpected media loss. Check device status\n"));
552 UDFPrint((
" EventStat_Class_ExternalReq:\n"));
567 if(!supported_evt_classes) {
575 UDFPrint((
" Reading Media Event...\n"));
614 UDFPrint((
" UDFEjectReqWaiter: ejecting...\n"));
615 #ifdef UDF_DELAYED_CLOSE 617 UDFPrint((
" UDFEjectReqWaiter: set UDF_VCB_FLAGS_NO_DELAYED_CLOSE\n"));
620 #endif //UDF_DELAYED_CLOSE 622 UDFPrint((
" UDFEjectReqWaiter: UDFCloseAllSystemDelayedInDir\n"));
625 #ifdef UDF_DELAYED_CLOSE 626 UDFPrint((
" UDFEjectReqWaiter: UDFCloseAllDelayed\n"));
629 #endif //UDF_DELAYED_CLOSE 633 UDFPrint((
" UDFEjectReqWaiter: UDFDoDismountSequence\n"));
643 UDFPrint((
" UDFEjectReqWaiter: set WaiterStopped\n"));
648 UDFPrint((
" UDFEjectReqWaiter: exit 1\n"));
675 UDFPrint((
" UDFStopEjectWaiter: try\n"));
678 if(
Vcb->EjectWaiter) {
679 UDFPrint((
" UDFStopEjectWaiter: set flag\n"));
691 UDFPrint((
" UDFStopEjectWaiter: wait\n"));
699 UDFPrint((
" UDFStopEjectWaiter: exit\n"));
716 UDFPrint((
"UDFDoDismountSequence:\n"));
721 while(
Vcb->BGWriters) {
732 UDFPrint((
" cleanup tray-lock (%d+2):\n",
Vcb->MediaLockCount));
733 for(
i=0;
i<
Vcb->MediaLockCount+2;
i++) {
734 Buf->PreventMediaRemoval =
FALSE;
736 Vcb->TargetDeviceObject,
745 if(!
Vcb->ForgetVolume) {
749 UDFPrint((
" Restore drive speed on dismount\n"));
750 Vcb->SpeedBuf.ReadSpeed =
Vcb->MaxReadSpeed;
751 Vcb->SpeedBuf.WriteSpeed =
Vcb->MaxWriteSpeed;
753 Vcb->TargetDeviceObject,
769 UDFPrint((
" Stop background formatting\n"));
776 Vcb->TargetDeviceObject,
805 Vcb->TargetDeviceObject,
822 if(
Vcb->ShutdownRegistered) {
#define KeQuerySystemTime(t)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define IOCTL_CDRW_SET_SPEED
#define UDF_VCB_FLAGS_MEDIA_READ_ONLY
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
union _EVENT_STAT_EXT_REQ_BLOCK::@843 Byte0
#define STATUS_NO_MEDIA_IN_DEVICE
#define UDF_FLUSH_FLAGS_BREAKABLE
ULONG UDFFlushADirectory(IN PVCB Vcb, IN PUDF_FILE_INFO FI, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
NTSTATUS NTAPI UDFPhSendIOCTL(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
#define UDFCloseAllSystemDelayedInDir(Vcb, FI)
VOID WCacheRelease__(IN PW_CACHE Cache)
#define EventStat_MediaEvent_EjectReq
#define STATUS_DATA_OVERRUN
#define IOCTL_STORAGE_MEDIA_REMOVAL
int64 __fastcall UDFGetFreeSpace(IN PVCB Vcb)
#define EventRetStat_Class_Media
#define INTEGRITY_TYPE_CLOSE
#define UDFReleaseResource(Resource)
#define EventStat_MediaStat_Present
OSSTATUS UDFUpdateVDS(IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, IN uint32 flags)
#define UDF_FLUSH_FLAGS_LITE
#define STATUS_INVALID_DEVICE_REQUEST
EVENT_STAT_MEDIA_BLOCK MediaChange
union _CLOSE_TRK_SES_USER_IN::@915 Byte2
union _CLOSE_TRK_SES_USER_IN::@914 Byte1
#define UDF_FLUSH_FLAGS_INTERRUPTED
#define SCSI_ADSENSE_LUN_NOT_READY
void UDFKeyWaiter(IN void *Context)
#define EventStat_ExtrnReqEvent_KeyDown
#define UDF_PREALLOC_CLASS_FE
#define UDFIsDvdMedia(Vcb)
LONG NTAPI KeSetEvent(IN PKEVENT Event, IN KPRIORITY Increment, IN BOOLEAN Wait)
#define SCSI_SENSE_NOT_READY
NTSTATUS NTAPI KeWaitForSingleObject(IN PVOID Object, IN KWAIT_REASON WaitReason, IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Timeout OPTIONAL)
struct _PREVENT_MEDIA_REMOVAL_USER_IN * PPREVENT_MEDIA_REMOVAL_USER_IN
#define UDF_VCB_FLAGS_REMOVABLE_MEDIA
#define EventStat_ExtrnReqEvent_ExtrnReq
#define DevCap_lock_state
OSSTATUS UDFUpdateVolIdent(IN PVCB Vcb, IN UDF_VDS_RECORD Lba, IN PUNICODE_STRING VolIdent)
#define UDF_DEFAULT_FE_CHARGE
#define UDF_VCB_FLAGS_RAW_DISK
NTSTATUS NTAPI UDFTSendIOCTL(IN ULONG IoControlCode, IN PVCB Vcb, IN PVOID InputBuffer, IN ULONG InputBufferLength, OUT PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN OverrideVerify, OUT PIO_STATUS_BLOCK Iosb OPTIONAL)
VOID WCacheFlushAll__(IN PW_CACHE Cache, IN PVOID Context)
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
OSSTATUS UDFUpdateLogicalVolInt(PVCB Vcb, BOOLEAN Close)
struct _UDFEjectWaitContext * PUDFEjectWaitContext
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
OSSTATUS UDFFlushAllCachedAllocations(IN PVCB Vcb, IN uint32 AllocClass)
#define EventRetStat_Class_ExternReq
#define UDF_VCB_FLAGS_UNSAFE_IOCTL
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
#define IOCTL_STORAGE_EJECT_MEDIA
#define EventStat_ExtrnReqEvent_KeyUp
#define EventStat_Class_Media
#define UFD_VERIFY_FLAG_BG
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
#define UDF_VCB_SKIP_EJECT_CHECK
struct _GET_EVENT_USER_IN * PGET_EVENT_USER_IN
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
#define UDF_VCB_FLAGS_MEDIA_LOCKED
#define STATUS_NO_SUCH_DEVICE
#define EXCEPTION_EXECUTE_HANDLER
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
#define IOCTL_CDRW_GET_LAST_ERROR
VOID NTAPI IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
#define EventStat_MediaEvent_Mask
GET_EVENT_USER_OUT EjectReqBuffer
#define IOCTL_CDRW_GET_EVENT
GET_LAST_ERROR_USER_OUT Error
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
#define UDF_VCB_FLAGS_NO_DELAYED_CLOSE
EVENT_STAT_EXT_REQ_BLOCK ExternalReq
void UDFStopEjectWaiter(PVCB Vcb)
#define IOCTL_CDRW_GET_CAPABILITIES
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
#define EventStat_MediaStat_DoorOpen
#define UDF_VCB_FLAGS_STOP_WAITER_EVENT
#define IOCTL_CDRW_CLOSE_TRK_SES
#define IOCTL_CDRW_TEST_UNIT_READY
OSSTATUS UDFDoDismountSequence(IN PVCB Vcb, IN PPREVENT_MEDIA_REMOVAL_USER_IN Buf, IN BOOLEAN Eject)
GET_CAPABILITIES_USER_OUT DevCap
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
#define UDF_VCB_LAST_WRITE
#define EventStat_Class_ExternalReq
#define EventStat_ExtrnReqEvent_Mask
#define UDF_PREALLOC_CLASS_DIR
#define EventRetStat_Class_Mask
ULONG UDFFlushLogicalVolume(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
VOID UDFCloseAllDelayed(IN PVCB Vcb)
VOID UDFVFlush(IN PVCB Vcb)
OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache, IN PVOID Context, IN lba_t Lba, IN ULONG BCount)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
void NTAPI UDFEjectReqWaiter(IN void *Context)
#define RtlCopyMemory(Destination, Source, Length)
#define _SEH2_EXCEPT(...)
VOID UDFVVerify(IN PVCB Vcb, IN ULONG Flags)
#define RtlCompareMemory(s1, s2, l)
VOID UDFPreClrModified(IN PVCB Vcb)
#define UDF_VCB_FLAGS_VOLUME_LOCKED
VOID UDFClrModified(IN PVCB Vcb)