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;
150 Vcb->VCBFlags &= ~UDF_VCB_SKIP_EJECT_CHECK;
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) {
163 Vcb->VCBFlags &= ~UDF_VCB_SKIP_EJECT_CHECK;
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"));
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) )
499 supported_evt_classes &= ~evt_type;
514 UDFPrint((
" EventStat_Class_Media:\n"));
519retry_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"));
622 UDFPrint((
" UDFEjectReqWaiter: UDFCloseAllSystemDelayedInDir\n"));
625#ifdef UDF_DELAYED_CLOSE
626 UDFPrint((
" UDFEjectReqWaiter: UDFCloseAllDelayed\n"));
633 UDFPrint((
" UDFEjectReqWaiter: UDFDoDismountSequence\n"));
636 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_VOLUME_MOUNTED;
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"));
694 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_STOP_WAITER_EVENT;
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) {
828 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_MEDIA_LOCKED;
int64 __fastcall UDFGetFreeSpace(IN PVCB Vcb)
#define SCSI_ADSENSE_LUN_NOT_READY
#define EventStat_MediaEvent_EjectReq
#define EventStat_ExtrnReqEvent_ExtrnReq
#define EventStat_MediaStat_Present
#define EventStat_ExtrnReqEvent_KeyDown
#define EventRetStat_Class_ExternReq
#define EventRetStat_Class_Media
#define EventRetStat_Class_Mask
#define EventStat_ExtrnReqEvent_KeyUp
#define EventStat_Class_ExternalReq
#define EventStat_ExtrnReqEvent_Mask
#define EventStat_MediaEvent_Mask
#define EventStat_Class_Media
#define EventStat_MediaStat_DoorOpen
#define DevCap_lock_state
#define SCSI_SENSE_NOT_READY
#define SCSI_SENSEQ_FORMAT_IN_PROGRESS
#define SCSI_SENSEQ_LONG_WRITE_IN_PROGRESS
struct _PREVENT_MEDIA_REMOVAL_USER_IN * PPREVENT_MEDIA_REMOVAL_USER_IN
#define IOCTL_CDRW_CLOSE_TRK_SES
#define IOCTL_CDRW_TEST_UNIT_READY
struct _GET_EVENT_USER_IN * PGET_EVENT_USER_IN
#define IOCTL_CDRW_GET_EVENT
#define IOCTL_CDRW_GET_LAST_ERROR
#define IOCTL_CDRW_SET_SPEED
#define IOCTL_CDRW_GET_CAPABILITIES
VOID UDFCloseAllDelayed(IN PVCB Vcb)
#define INTEGRITY_TYPE_CLOSE
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)
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)
#define UDFReleaseResource(Resource)
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
#define RtlCompareMemory(s1, s2, l)
#define KeSetEvent(pEvt, foo, foo2)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define KeQuerySystemTime(t)
#define KeDelayExecutionThread(mode, foo, t)
OSSTATUS UDFFlushAllCachedAllocations(IN PVCB Vcb, IN uint32 AllocClass)
ULONG UDFFlushLogicalVolume(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
ULONG UDFFlushADirectory(IN PVCB Vcb, IN PUDF_FILE_INFO FI, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
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
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 EXCEPTION_EXECUTE_HANDLER
VOID UDFPreClrModified(IN PVCB Vcb)
VOID UDFClrModified(IN PVCB Vcb)
OSSTATUS UDFUpdateVolIdent(IN PVCB Vcb, IN UDF_VDS_RECORD Lba, IN PUNICODE_STRING VolIdent)
OSSTATUS UDFUpdateVDS(IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, IN uint32 flags)
OSSTATUS UDFUpdateLogicalVolInt(PVCB Vcb, BOOLEAN Close)
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
#define IOCTL_STORAGE_EJECT_MEDIA
#define IOCTL_STORAGE_MEDIA_REMOVAL
VOID NTAPI IoUnregisterShutdownNotification(PDEVICE_OBJECT DeviceObject)
OSSTATUS UDFDoDismountSequence(IN PVCB Vcb, IN PPREVENT_MEDIA_REMOVAL_USER_IN Buf, IN BOOLEAN Eject)
void NTAPI UDFEjectReqWaiter(IN void *Context)
void UDFKeyWaiter(IN void *Context)
void UDFStopEjectWaiter(PVCB Vcb)
OSSTATUS UDFResetDeviceDriver(IN PVCB Vcb, IN PDEVICE_OBJECT TargetDeviceObject, IN BOOLEAN Unlock)
#define UDFCloseAllSystemDelayedInDir(Vcb, FI)
#define _SEH2_EXCEPT(...)
VOID UDFVFlush(IN PVCB Vcb)
VOID UDFVVerify(IN PVCB Vcb, IN ULONG Flags)
#define UDF_FLUSH_FLAGS_BREAKABLE
struct _UDFEjectWaitContext * PUDFEjectWaitContext
#define UDF_FLUSH_FLAGS_LITE
#define UDF_FLUSH_FLAGS_INTERRUPTED
union _CLOSE_TRK_SES_USER_IN::@935 Byte2
union _CLOSE_TRK_SES_USER_IN::@934 Byte1
union _EVENT_STAT_EXT_REQ_BLOCK::@863 Byte0
GET_EVENT_USER_OUT EjectReqBuffer
GET_CAPABILITIES_USER_OUT DevCap
GET_LAST_ERROR_USER_OUT Error
#define RtlCopyMemory(Destination, Source, Length)
#define UDF_VCB_FLAGS_STOP_WAITER_EVENT
#define UDF_VCB_FLAGS_NO_DELAYED_CLOSE
#define UDF_VCB_FLAGS_REMOVABLE_MEDIA
#define UDFIsDvdMedia(Vcb)
#define UDF_VCB_FLAGS_VOLUME_LOCKED
#define UDF_VCB_FLAGS_UNSAFE_IOCTL
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
#define UDF_VCB_FLAGS_RAW_DISK
#define UDF_VCB_FLAGS_MEDIA_READ_ONLY
#define UDF_VCB_FLAGS_OUR_DEVICE_DRIVER
#define UDF_VCB_LAST_WRITE
#define UDF_VCB_SKIP_EJECT_CHECK
#define UFD_VERIFY_FLAG_BG
#define UDF_PREALLOC_CLASS_DIR
#define UDF_PREALLOC_CLASS_FE
#define UDF_DEFAULT_FE_CHARGE
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_DATA_OVERRUN
#define STATUS_NO_SUCH_DEVICE
#define STATUS_NO_MEDIA_IN_DEVICE
EVENT_STAT_EXT_REQ_BLOCK ExternalReq
EVENT_STAT_MEDIA_BLOCK MediaChange
VOID WCacheFlushAll__(IN PW_CACHE Cache, IN PVOID Context)
OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache, IN PVOID Context, IN lba_t Lba, IN ULONG BCount)
VOID WCacheRelease__(IN PW_CACHE Cache)