Go to the source code of this file.
|
VOID | UDFVRemoveBlock (PUDF_VERIFY_CTX VerifyCtx, PUDF_VERIFY_ITEM vItem) |
|
OSSTATUS | UDFVInit (IN PVCB Vcb) |
|
VOID | UDFVWaitQueued (PUDF_VERIFY_CTX VerifyCtx) |
|
VOID | UDFVRelease (IN PVCB Vcb) |
|
PUDF_VERIFY_ITEM | UDFVStoreBlock (IN PVCB Vcb, IN uint32 LBA, IN PVOID Buffer, PLIST_ENTRY Link) |
|
VOID | UDFVUpdateBlock (IN PVCB Vcb, IN PVOID Buffer, PUDF_VERIFY_ITEM vItem) |
|
OSSTATUS | UDFVWrite (IN PVCB Vcb, IN void *Buffer, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags) |
|
OSSTATUS | UDFVRead (IN PVCB Vcb, IN void *Buffer, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags) |
|
OSSTATUS | UDFVForget (IN PVCB Vcb, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags) |
|
VOID NTAPI | UDFVWorkItem (PVOID Context) |
|
VOID | UDFVVerify (IN PVCB Vcb, IN ULONG Flags) |
|
VOID | UDFVFlush (IN PVCB Vcb) |
|
BOOLEAN __fastcall | UDFCheckArea (IN PVCB Vcb, IN lba_t LBA, IN uint32 BCount) |
|
OSSTATUS __fastcall | UDFRemapPacket (IN PVCB Vcb, IN uint32 Lba, IN BOOLEAN RemapSpared) |
|
OSSTATUS __fastcall | UDFUnmapRange (IN PVCB Vcb, IN uint32 Lba, IN uint32 BCount) |
|
uint32 __fastcall | UDFRelocateSector (IN PVCB Vcb, IN uint32 Lba) |
|
BOOLEAN __fastcall | UDFAreSectorsRelocated (IN PVCB Vcb, IN uint32 Lba, IN uint32 BlockCount) |
|
PEXTENT_MAP __fastcall | UDFRelocateSectors (IN PVCB Vcb, IN uint32 Lba, IN uint32 BlockCount) |
|
◆ MAX_VREQ_RANGES
◆ UDF_BUG_CHECK_ID
◆ PUDF_VERIFY_ITEM
◆ PUDF_VERIFY_REQ
◆ PUDF_VERIFY_REQ_RANGE
◆ UDF_VERIFY_ITEM
◆ UDF_VERIFY_REQ
◆ UDF_VERIFY_REQ_RANGE
◆ UDFAreSectorsRelocated()
Definition at line 982 of file remap.cpp.
987{
988
989 if(
Vcb->SparingTable) {
990
992 BS =
Vcb->SparingBlockSize;
994
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)) ) {
1002 }
1003 }
1004 }
else if(
Vcb->Vat) {
1005
1008 if(Lba < (
root =
Vcb->Partitions[
Vcb->VatPartNdx].PartitionRoot))
1010 if(Lba+BlockCount >=
Vcb->NWA)
1013 for(
i=0;
i<BlockCount;
i++, Map++) {
1018 }
1019 }
1021}
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 UDF_VAT_FREE_ENTRY
Referenced by UDFRelocateSectors().
◆ UDFCheckArea()
Definition at line 763 of file remap.cpp.
768{
776
779 for(
i=0;
i<BCount;
i+=
d) {
780 if(!((LBA+
i) & (
PS-1)) &&
783 } else {
785 }
788 d <<
Vcb->BlockSizeBits,
792
798 }
799 }
801 }
802 return ext_ok;
803}
#define DbgAllocatePoolWithTag(a, b, c)
static unsigned char buff[32768]
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
#define UDFMarkSpaceAsXXXNoProtect(Vcb, FileInfo, Map, asXXX)
Referenced by UDFAllocFreeExtent_(), and UDFRemapPacket().
◆ UDFRelocateSector()
Definition at line 934 of file remap.cpp.
938{
940
941 if(
Vcb->SparingTable) {
942
945
947 BS =
Vcb->SparingBlockSize;
948 _Lba = Lba & ~(
BS-1);
949 for(
i=0;
i<
max;
i++,Map++) {
951 if(_Lba == (orig & ~(
BS-1)) ) {
952
954 }
955 }
956 }
else if(
Vcb->Vat) {
957
960
963 if(Lba < (
root =
Vcb->Partitions[
Vcb->VatPartNdx].PartitionRoot))
964 return Lba;
965 Map = &(
Vcb->Vat[(
i = Lba -
root)]);
966 if((i < Vcb->VatCount) && (
i=(*Map)) ) {
969 } else {
970 return 0x7fffffff;
971 }
972 }
973 }
974 return Lba;
975}
Referenced by UDFRelocateSectors().
◆ UDFRelocateSectors()
Definition at line 1029 of file remap.cpp.
1034{
1036
1040
1042 for(
i=0,
j=1;
i<BlockCount;
i++,
j++) {
1043
1045 (
i==(BlockCount-1)) ) {
1051 } else {
1054 }
1057 }
1058 LastLba = NewLba;
1059 }
1061}
PEXTENT_MAP __fastcall UDFMergeMappings(IN PEXTENT_MAP Extent, IN PEXTENT_MAP Extent2)
BOOLEAN __fastcall UDFAreSectorsRelocated(IN PVCB Vcb, IN uint32 Lba, IN uint32 BlockCount)
uint32 __fastcall UDFRelocateSector(IN PVCB Vcb, IN uint32 Lba)
#define UDFExtentToMapping(e)
#define UDF_NO_EXTENT_MAP
Referenced by UDFTRead(), and UDFTWrite().
◆ UDFRemapPacket()
Definition at line 810 of file remap.cpp.
815{
819
820 if(
Vcb->SparingTable) {
821
823 BS =
Vcb->SparingBlockSize;
824
825
826 if(
Vcb->SparingCountFree == (
ULONG)-1) {
827 UDFPrint((
"calculate free spare areas\n"));
828re_check:
830 Vcb->SparingCountFree = 0;
831 Map =
Vcb->SparingTable;
832 for(
i=0;
i<
max;
i++,Map++) {
835 Vcb->SparingCountFree++;
836 } else {
839 Vcb->SparingTableModified =
TRUE;
840 }
841 }
842 }
843 }
844 if(!
Vcb->SparingCountFree) {
847 }
848
849 Map =
Vcb->SparingTable;
851 for(
i=0;
i<
max;
i++,Map++) {
853 if(Lba == (orig & ~(
BS-1)) ) {
854
855
857 if(!verified) {
859 goto re_check;
860 }
861
862 if(!RemapSpared) {
864 } else {
865
867 Vcb->SparingTableModified =
TRUE;
868 Vcb->SparingCountFree--;
869 break;
870 }
871 }
872 }
873 Map =
Vcb->SparingTable;
874 for(
i=0;
i<
max;
i++,Map++) {
878 Vcb->SparingTableModified =
TRUE;
879 Vcb->SparingCountFree--;
881 }
882 }
885 }
887}
#define SPARING_LOC_CORRUPTED
#define SPARING_LOC_AVAILABLE
BOOLEAN __fastcall UDFCheckArea(IN PVCB Vcb, IN lba_t LBA, IN uint32 BCount)
#define STATUS_UNSUCCESSFUL
#define STATUS_SHARING_VIOLATION
◆ UDFUnmapRange()
Definition at line 894 of file remap.cpp.
899{
902
903 if(
Vcb->SparingTable) {
904
905
907 BS =
Vcb->SparingBlockSize;
908 Map =
Vcb->SparingTable;
909 for(
i=0;
i<
max;
i++,Map++) {
911 switch(orig) {
914 continue;
915 }
916 if(orig >= Lba &&
917 (orig+
BS) <= (Lba+BCount)) {
918
921 Vcb->SparingTableModified =
TRUE;
922 Vcb->SparingCountFree++;
923 }
924 }
925 }
927}
Referenced by UDFMarkSpaceAsXXXNoProtect_().
◆ UDFVFlush()
◆ UDFVForget()
Definition at line 486 of file remap.cpp.
492{
499
502 }
503
505
506 for(
i=0,
n=0;
i<BCount;
i++) {
508
510 }
511 }
512
514
517 }
518
524 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
528
529 break;
530 }
531 }
532 }
533
536
537}
#define UDFReleaseResource(Resource)
#define UDFAcquireResourceExclusive(Resource, CanWait)
VOID UDFVRemoveBlock(PUDF_VERIFY_CTX VerifyCtx, PUDF_VERIFY_ITEM vItem)
struct _LIST_ENTRY * Flink
#define CONTAINING_RECORD(address, type, field)
#define UDFGetBit(arr, bit)
static int Link(const char **args)
◆ UDFVInit()
Definition at line 54 of file remap.cpp.
57{
62
66 }
67
70 if(!
Vcb->VerifyOnWrite) {
73 }
75 UDFPrint((
"Verify is not intended for CD/DVD-R\n"));
77 }
80 }
86 } else {
87 UDFPrint((
"Can't alloc verify bitmap for %x blocks\n",
Vcb->LastPossibleLBA));
89 }
94
96
98
100 if(res_inited) {
102 }
103 }
106}
NTSTATUS ExInitializeResourceLite(PULONG res)
#define KeInitializeEvent(pEvt, foo, foo2)
#define ExDeleteResourceLite(res)
#define InitializeListHead(ListHead)
#define RtlZeroMemory(Destination, Length)
#define STATUS_INSUFFICIENT_RESOURCES
Referenced by UDFCommonDeviceControl(), UDFMountVolume(), and UDFVerifyVolume().
◆ UDFVRead()
Definition at line 375 of file remap.cpp.
383{
392
395
396 }
397
399
400 for(
i=0,
n=0;
i<BCount;
i++) {
402
404 }
405 }
406
408
411 }
412
418 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
423 if(vItem->
crc != crc) {
424 UDFPrint((
"UDFVRead: stored %x != %x\n", vItem->
crc, crc));
427
428 if(!(bm = (
uint32*)(
Vcb->BSBM_Bitmap))) {
429 crc = (
Vcb->LastPossibleLBA+1+7) >> 3;
431 if(bm) {
433 } else {
434 UDFPrint((
"Can't alloc BSBM for %x blocks\n",
Vcb->LastPossibleLBA));
435 }
436 }
437 if(bm) {
440 }
441#ifdef _BROWSE_UDF_
443 if(bm) {
446 }
447#endif
448 } else {
449
450 }
451 } else {
452 UDFPrint((
"UDFVRead: get cached @ %x\n", vItem->
lba));
454 }
456
457 break;
458 }
459 }
460 }
461
463
469 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
473
474 break;
475 }
476 }
477 }
478 }
479
482
483}
#define crc32(crc, buf, len)
#define RtlCopyMemory(Destination, Source, Length)
#define PH_READ_VERIFY_CACHE
#define UDFSetBit(arr, bit)
#define UDFSetUsedBit(arr, bit)
#define PH_FORGET_VERIFIED
#define PH_KEEP_VERIFY_CACHE
#define STATUS_FT_WRITE_RECOVERY
_Must_inspect_result_ _In_ ULONG Flags
Referenced by UDFPhReadSynchronous(), and UDFVWorkItem().
◆ UDFVRelease()
◆ UDFVRemoveBlock()
◆ UDFVStoreBlock()
Definition at line 170 of file remap.cpp.
176{
179
181
183 if(!vItem)
194 return vItem;
195}
#define InsertTailList(ListHead, Entry)
struct _UDF_VERIFY_ITEM * PUDF_VERIFY_ITEM
Referenced by UDFVWrite().
◆ UDFVUpdateBlock()
◆ UDFVVerify()
Definition at line 601 of file remap.cpp.
605{
612
615
617 return;
618 }
621 UDFPrint((
" wait for verify flush\n"));
622 goto wait;
623 }
624 UDFPrint((
" verify flush already queued\n"));
625 return;
626 }
627
630 return;
631 }
632
633 }
636 }
637
640 } else {
643 } else {
645 }
646 }
647
649 prev_lba = -2;
651
654
655
656
657
658
659
660
661
664
665
669 } else {
672 } else {
674 prev_lba = vItem->
lba;
675 }
676 }
677 if((
i == 1) &&
len) {
679 }
682 }
683 if(do_vrf) {
684
685 if(!VerifyReq) {
687 if(VerifyReq) {
690 }
691 }
692 if(VerifyReq) {
693
694 VerifyReq->
vr[VerifyReq->
nReq].
lba = prev_lba;
699 }
700
702
706#ifndef _CONSOLE
709 VerifyReq );
711#else
713#endif
714 } else {
716 }
718 max_len = 0;
719 } else {
720 }
721 }
723 prev_lba = vItem->
lba;
725 }
727 }
728
731 }
733wait:
734 UDFPrint((
"UDFVVerify: wait for completion\n"));
736 }
737
738 return;
739}
#define InterlockedIncrement
struct _UDF_VERIFY_REQ * PUDF_VERIFY_REQ
VOID NTAPI UDFVWorkItem(PVOID Context)
WORK_QUEUE_ITEM VerifyItem
UDF_VERIFY_REQ_RANGE vr[MAX_VREQ_RANGES]
#define UDF_MAX_VERIFY_CACHE
#define UFD_VERIFY_FLAG_WAIT
#define UDF_VERIFY_CACHE_GRAN
#define UFD_VERIFY_FLAG_BG
#define UFD_VERIFY_FLAG_LOCKED
#define UDF_VERIFY_CACHE_LOW
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
#define ExInitializeWorkItem(Item, Routine, Context)
Referenced by UDFCommonWrite(), UDFEjectReqWaiter(), UDFVFlush(), and UDFVWrite().
◆ UDFVWaitQueued()
Definition at line 109 of file remap.cpp.
112{
114
125 }
126 }
127 }
128 return;
129}
#define InterlockedDecrement
#define KeSetEvent(pEvt, foo, foo2)
#define DbgWaitForSingleObject(o, to)
GLubyte GLubyte GLubyte GLubyte w
Referenced by UDFVFlush(), UDFVRelease(), and UDFVVerify().
◆ UDFVWorkItem()
Definition at line 541 of file remap.cpp.
544{
548
550
552#if 1
553 if(
Vcb->SparingCountFree) {
555 for(
i=0;
i<VerifyReq->
nReq;
i++) {
562 }
564 } else {
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));
570 }
571 }
572#else
573 for(
i=0;
i<VerifyReq->
nReq;
i++) {
574 if(
Vcb->SparingCountFree) {
583 } else {
584 UDFPrint((
"!!! No more space for remap !!!\n"));
585 UDFPrint((
" try del from verify cache @ %x\n", VerifyReq->
vr[
i].
lba));
588 }
589 }
590#endif
594 UDFPrint((
" QueuedCount = %d\n",
Vcb->VerifyCtx.QueuedCount));
597 return;
598}
OSSTATUS __fastcall UDFTIOVerify(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T IOBytes, IN uint32 Flags)
OSSTATUS UDFVRead(IN PVCB Vcb, IN void *Buffer, IN uint32 BCount, IN uint32 LBA, IN uint32 Flags)
OSSTATUS WCacheStartDirect__(IN PW_CACHE Cache, IN PVOID Context, IN BOOLEAN Exclusive)
OSSTATUS WCacheEODirect__(IN PW_CACHE Cache, IN PVOID Context)
Referenced by UDFVVerify().
◆ UDFVWrite()
Definition at line 225 of file remap.cpp.
233{
236
240
241
244 }
245
247
248 for(
i=0,
n=0;
i<BCount;
i++) {
250
252 }
253 }
254
256
262 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
267
268 break;
269 }
270 }
271 }
272 } else
274#if 0
275
280 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
281
282 break;
283 }
284 }
285
286
288 prev_lba = vItem->
lba;
289 vItem1 = vItem;
294 if(vItem->
lba > LBA || vItem->
lba >= LBA+BCount) {
295
296 break;
297 }
298 if(vItem->
lba < prev_lba) {
299
300 break;
301 }
302 prev_lba = vItem->
lba;
304 }
305
307
308 } else {
309
310 }
311
312 vItem1 = vItem;
313 for(
i=0;
i<BCount;
i++) {
314 if(vItem->
lba == LBA+
i) {
317 continue;
318 }
319 if(vItem1->lba == LBA+
i) {
322 continue;
323 }
324 if(vItem1->lba > LBA+
i) {
325
328 } else {
330 }
331 }
332#else
338 if(vItem->
lba >= LBA && vItem->
lba < LBA+BCount) {
342
343 break;
344 }
345 }
346 }
347 goto remember_all;
348#endif
349
350 } else {
351remember_all:
352
353 for(
i=0;
i<BCount;
i++) {
356 }
357 }
358
361 }
362
364
366
367
368 }
369
371
372}
PUDF_VERIFY_ITEM UDFVStoreBlock(IN PVCB Vcb, IN uint32 LBA, IN PVOID Buffer, PLIST_ENTRY Link)
VOID UDFVUpdateBlock(IN PVCB Vcb, IN PVOID Buffer, PUDF_VERIFY_ITEM vItem)
struct _LIST_ENTRY * Blink
Referenced by UDFPhWriteSynchronous().