20#define UDF_BUG_CHECK_ID UDF_FILE_UDF_INFO_REMAP
35#define MAX_VREQ_RANGES 128
70 if(!
Vcb->VerifyOnWrite) {
75 UDFPrint((
"Verify is not intended for CD/DVD-R\n"));
87 UDFPrint((
"Can't alloc verify bitmap for %x blocks\n",
Vcb->LastPossibleLBA));
144 UDFPrint((
"UDFVRelease: wait for completion\n"));
248 for(
i=0,
n=0;
i<BCount;
i++) {
262 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
280 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
288 prev_lba = vItem->
lba;
294 if(vItem->
lba > LBA || vItem->
lba >= LBA+BCount) {
298 if(vItem->
lba < prev_lba) {
302 prev_lba = vItem->
lba;
313 for(
i=0;
i<BCount;
i++) {
314 if(vItem->
lba == LBA+
i) {
319 if(vItem1->lba == LBA+
i) {
324 if(vItem1->lba > LBA+
i) {
338 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
353 for(
i=0;
i<BCount;
i++) {
400 for(
i=0,
n=0;
i<BCount;
i++) {
418 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
423 if(vItem->
crc != crc) {
424 UDFPrint((
"UDFVRead: stored %x != %x\n", vItem->
crc, crc));
428 if(!(bm = (
uint32*)(
Vcb->BSBM_Bitmap))) {
429 crc = (
Vcb->LastPossibleLBA+1+7) >> 3;
434 UDFPrint((
"Can't alloc BSBM for %x blocks\n",
Vcb->LastPossibleLBA));
452 UDFPrint((
"UDFVRead: get cached @ %x\n", vItem->
lba));
469 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
506 for(
i=0,
n=0;
i<BCount;
i++) {
524 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
553 if(
Vcb->SparingCountFree) {
555 for(
i=0;
i<VerifyReq->
nReq;
i++) {
565 for(
i=0;
i<VerifyReq->
nReq;
i++) {
566 UDFPrint((
"!!! No more space for remap !!!\n"));
567 UDFPrint((
" try del from verify cache @ %x\n", VerifyReq->
vr[
i].
lba));
573 for(
i=0;
i<VerifyReq->
nReq;
i++) {
574 if(
Vcb->SparingCountFree) {
584 UDFPrint((
"!!! No more space for remap !!!\n"));
585 UDFPrint((
" try del from verify cache @ %x\n", VerifyReq->
vr[
i].
lba));
594 UDFPrint((
" QueuedCount = %d\n",
Vcb->VerifyCtx.QueuedCount));
621 UDFPrint((
" wait for verify flush\n"));
624 UDFPrint((
" verify flush already queued\n"));
674 prev_lba = vItem->
lba;
677 if((
i == 1) &&
len) {
694 VerifyReq->
vr[VerifyReq->
nReq].
lba = prev_lba;
723 prev_lba = vItem->
lba;
734 UDFPrint((
"UDFVVerify: wait for completion\n"));
752 UDFPrint((
"UDFVFlush: wait for completion\n"));
757 UDFPrint((
"UDFVFlush: wait for completion (2)\n"));
779 for(
i=0;
i<BCount;
i+=
d) {
780 if(!((LBA+
i) & (
PS-1)) &&
788 d <<
Vcb->BlockSizeBits,
820 if(
Vcb->SparingTable) {
823 BS =
Vcb->SparingBlockSize;
826 if(
Vcb->SparingCountFree == (
ULONG)-1) {
827 UDFPrint((
"calculate free spare areas\n"));
830 Vcb->SparingCountFree = 0;
831 Map =
Vcb->SparingTable;
832 for(
i=0;
i<
max;
i++,Map++) {
835 Vcb->SparingCountFree++;
839 Vcb->SparingTableModified =
TRUE;
844 if(!
Vcb->SparingCountFree) {
849 Map =
Vcb->SparingTable;
851 for(
i=0;
i<
max;
i++,Map++) {
853 if(Lba == (orig & ~(
BS-1)) ) {
867 Vcb->SparingTableModified =
TRUE;
868 Vcb->SparingCountFree--;
873 Map =
Vcb->SparingTable;
874 for(
i=0;
i<
max;
i++,Map++) {
878 Vcb->SparingTableModified =
TRUE;
879 Vcb->SparingCountFree--;
903 if(
Vcb->SparingTable) {
907 BS =
Vcb->SparingBlockSize;
908 Map =
Vcb->SparingTable;
909 for(
i=0;
i<
max;
i++,Map++) {
917 (orig+
BS) <= (Lba+BCount)) {
921 Vcb->SparingTableModified =
TRUE;
922 Vcb->SparingCountFree++;
941 if(
Vcb->SparingTable) {
947 BS =
Vcb->SparingBlockSize;
948 _Lba = Lba & ~(
BS-1);
949 for(
i=0;
i<
max;
i++,Map++) {
951 if(_Lba == (orig & ~(
BS-1)) ) {
956 }
else if(
Vcb->Vat) {
963 if(Lba < (
root =
Vcb->Partitions[
Vcb->VatPartNdx].PartitionRoot))
965 Map = &(
Vcb->Vat[(
i = Lba -
root)]);
966 if((i < Vcb->VatCount) && (
i=(*Map)) ) {
989 if(
Vcb->SparingTable) {
992 BS =
Vcb->SparingBlockSize;
995 Map =
Vcb->SparingTable;
996 for(
i=0;
i<
Vcb->SparingCount;
i++,Map++) {
998 ((Lba+BlockCount-1 >= orig) && (Lba+BlockCount-1 < orig +
BS)) ||
999 ((orig >= Lba) && (orig < Lba+BlockCount)) ||
1000 ((orig+
BS >= Lba) && (orig+
BS < Lba+BlockCount)) ) {
1004 }
else if(
Vcb->Vat) {
1008 if(Lba < (
root =
Vcb->Partitions[
Vcb->VatPartNdx].PartitionRoot))
1010 if(Lba+BlockCount >=
Vcb->NWA)
1013 for(
i=0;
i<BlockCount;
i++, Map++) {
1042 for(
i=0,
j=1;
i<BlockCount;
i++,
j++) {
1045 (
i==(BlockCount-1)) ) {
#define InterlockedIncrement
#define InterlockedDecrement
#define crc32(crc, buf, len)
#define RemoveEntryList(Entry)
#define InsertTailList(ListHead, Entry)
#define UDFReleaseResource(Resource)
NTSTATUS ExInitializeResourceLite(PULONG res)
#define DbgAllocatePoolWithTag(a, b, c)
#define KeInitializeEvent(pEvt, foo, foo2)
#define KeSetEvent(pEvt, foo, foo2)
#define DbgWaitForSingleObject(o, to)
#define UDFAcquireResourceExclusive(Resource, CanWait)
#define ExDeleteResourceLite(res)
#define InitializeListHead(ListHead)
PEXTENT_MAP __fastcall UDFMergeMappings(IN PEXTENT_MAP Extent, IN PEXTENT_MAP Extent2)
static unsigned char buff[32768]
GLubyte GLubyte GLubyte GLubyte w
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 SPARING_LOC_CORRUPTED
#define UDF_VAT_FREE_ENTRY
#define SPARING_LOC_AVAILABLE
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
OSSTATUS __fastcall UDFTIOVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T IOBytes, IN uint32 Flags)
PUDF_VERIFY_ITEM UDFVStoreBlock(IN PVCB Vcb, IN uint32 LBA, IN PVOID Buffer, PLIST_ENTRY Link)
OSSTATUS __fastcall UDFUnmapRange(IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount)
BOOLEAN __fastcall UDFAreSectorsRelocated(IN PVCB Vcb, IN uint32 Lba, IN uint32 BlockCount)
OSSTATUS UDFVWrite(IN PVCB Vcb, IN void *Buffer, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags)
VOID UDFVWaitQueued(PUDF_VERIFY_CTX VerifyCtx)
struct _UDF_VERIFY_REQ_RANGE * PUDF_VERIFY_REQ_RANGE
BOOLEAN __fastcall UDFCheckArea(IN PVCB Vcb, IN lba_t LBA, IN uint32 BCount)
struct _UDF_VERIFY_REQ * PUDF_VERIFY_REQ
VOID UDFVRemoveBlock(PUDF_VERIFY_CTX VerifyCtx, PUDF_VERIFY_ITEM vItem)
PEXTENT_MAP __fastcall UDFRelocateSectors(IN PVCB Vcb, IN uint32 Lba, IN uint32 BlockCount)
uint32 __fastcall UDFRelocateSector(IN PVCB Vcb, IN uint32 Lba)
OSSTATUS UDFVRead(IN PVCB Vcb, IN void *Buffer, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags)
struct _UDF_VERIFY_REQ UDF_VERIFY_REQ
struct _UDF_VERIFY_ITEM UDF_VERIFY_ITEM
VOID NTAPI UDFVWorkItem(PVOID Context)
VOID UDFVFlush(IN PVCB Vcb)
VOID UDFVVerify(IN PVCB Vcb, IN ULONG Flags)
struct _UDF_VERIFY_ITEM * PUDF_VERIFY_ITEM
OSSTATUS __fastcall UDFRemapPacket(IN PVCB Vcb, IN uint32 Lba, IN BOOLEAN RemapSpared)
VOID UDFVUpdateBlock(IN PVCB Vcb, IN PVOID Buffer, PUDF_VERIFY_ITEM vItem)
struct _UDF_VERIFY_REQ_RANGE UDF_VERIFY_REQ_RANGE
VOID UDFVRelease(IN PVCB Vcb)
OSSTATUS UDFVInit(IN PVCB Vcb)
OSSTATUS UDFVForget(IN PVCB Vcb, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags)
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
WORK_QUEUE_ITEM VerifyItem
UDF_VERIFY_REQ_RANGE vr[MAX_VREQ_RANGES]
#define RtlCopyMemory(Destination, Source, Length)
#define RtlZeroMemory(Destination, Length)
#define CONTAINING_RECORD(address, type, field)
#define UDF_MAX_VERIFY_CACHE
#define UFD_VERIFY_FLAG_WAIT
#define UDF_VERIFY_CACHE_GRAN
#define UFD_VERIFY_FLAG_BG
#define PH_READ_VERIFY_CACHE
#define UDFMarkSpaceAsXXXNoProtect(Vcb, FileInfo, Map, asXXX)
#define UDFGetBit(arr, bit)
#define UFD_VERIFY_FLAG_LOCKED
#define UDF_VERIFY_CACHE_LOW
#define UDFExtentToMapping(e)
#define UDFSetBit(arr, bit)
#define UDFSetUsedBit(arr, bit)
#define PH_FORGET_VERIFIED
#define UFD_VERIFY_FLAG_FORCE
#define PH_KEEP_VERIFY_CACHE
#define UDFClrBit(arr, bit)
#define UDF_NO_EXTENT_MAP
#define STATUS_UNSUCCESSFUL
#define STATUS_FT_WRITE_RECOVERY
#define STATUS_SHARING_VIOLATION
#define STATUS_INSUFFICIENT_RESOURCES
static int Link(const char **args)
OSSTATUS WCacheStartDirect__(IN PW_CACHE Cache, IN PVOID Context, IN BOOLEAN Exclusive)
OSSTATUS WCacheEODirect__(IN PW_CACHE Cache, IN PVOID Context)
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
_Must_inspect_result_ _In_ ULONG Flags
#define ExInitializeWorkItem(Item, Routine, Context)