ReactOS  0.4.14-dev-614-gbfd8a84
udf_info.h File Reference
#include "ecma_167.h"
#include "osta_misc.h"
#include "udf_rel.h"
#include "wcache.h"
Include dependency graph for udf_info.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define HASH_POSIX   0x01
 
#define HASH_ULFN   0x02
 
#define HASH_DOS   0x04
 
#define HASH_ALL   0x07
 
#define HASH_KEEP_NAME   0x08
 
#define UDFExtentToMapping(e)   UDFExtentToMapping_(e)
 
#define UDFDOSName__(Vcb, DosName, UdfName, FileInfo)   UDFDOSName(Vcb, DosName, UdfName, (FileInfo) && ((FileInfo)->Index < 2));
 
#define UDFCheckSpaceAllocation(Vcb, FileInfo, Map, asXXX)   {;}
 
#define UDFMarkSpaceAsXXXNoProtect(Vcb, FileInfo, Map, asXXX)   UDFMarkSpaceAsXXXNoProtect_(Vcb, Map, asXXX);
 
#define UDFMarkSpaceAsXXX(Vcb, FileInfo, Map, asXXX)   UDFMarkSpaceAsXXX_(Vcb, Map, asXXX);
 
#define AS_FREE   0x00
 
#define AS_USED   0x01
 
#define AS_DISCARDED   0x02
 
#define AS_BAD   0x04
 
#define UDFAllocFreeExtent(v, l, ss, sl, e, af)   UDFAllocFreeExtent_(v, l, ss, sl, e, af)
 
#define UDF_PREALLOC_CLASS_FE   0x00
 
#define UDF_PREALLOC_CLASS_DIR   0x01
 
#define FLUSH_FE_KEEP   FALSE
 
#define FLUSH_FE_FOR_DEL   TRUE
 
#define UDF_FSPACE_BM   0x00
 
#define UDF_ZSPACE_BM   0x01
 
#define UDFMarkAllocatedAsNotAllocated(Vcb, Off, Len, Ext)   UDFMarkAllocatedAsNotXXX(Vcb, Off, Len, Ext, TRUE)
 
#define UDFMarkRecordedAsAllocated(Vcb, Off, Len, Ext)   UDFMarkAllocatedAsNotXXX(Vcb, Off, Len, Ext, FALSE)
 
#define UDFZeroExtent__(Vcb, Ext, Off, Len, Dir, WB)   UDFZeroExtent(Vcb, Ext, Off, Len, FALSE, Dir, WB)
 
#define UDFSparseExtent__(Vcb, Ext, Off, Len, Dir, WB)   UDFZeroExtent(Vcb, Ext, Off, Len, TRUE, Dir, WB)
 
#define UDFIncFileLinkCount(fi)   UDFChangeFileLinkCount(fi, TRUE)
 
#define UDFDecFileLinkCount(fi)   UDFChangeFileLinkCount(fi, FALSE)
 
#define UDFSetEntityID_imp(eID, Str)   UDFSetEntityID_imp_(eID, (uint8*)(Str), sizeof(Str));
 
#define UDFIncFileCounter(Vcb)   UDFChangeFileCounter(Vcb, TRUE, TRUE);
 
#define UDFDecFileCounter(Vcb)   UDFChangeFileCounter(Vcb, TRUE, FALSE);
 
#define UDFIncDirCounter(Vcb)   UDFChangeFileCounter(Vcb, FALSE, TRUE);
 
#define UDFDecDirCounter(Vcb)   UDFChangeFileCounter(Vcb, FALSE, FALSE);
 
#define UDF_FREE_NOTHING   0x00
 
#define UDF_FREE_FILEINFO   0x01
 
#define UDF_FREE_DLOC   0x02
 
#define UDFIsDeleted(DirNdx)   (((DirNdx)->FileCharacteristics & FILE_DELETED) ? TRUE : FALSE)
 
#define UDFIsADirectory(FileInfo)   (((FileInfo) && ((FileInfo)->Dloc) && ((FileInfo)->Dloc->DirIndex || ((FileInfo)->FileIdent && ((FileInfo)->FileIdent->fileCharacteristics & FILE_DIRECTORY)))) ? TRUE : FALSE)
 
#define UDFGetFileAllocationSize(Vcb, FileInfo)   (((FileInfo)->Dloc->DataLoc.Mapping) ? UDFGetExtentLength((FileInfo)->Dloc->DataLoc.Mapping) : Vcb->LBlockSize)
 
#define UDFIsFlushed(FI)
 
#define UDFIsFileCached__(Vcb, FileInfo, Offset, Length, ForWrite)   (UDFIsExtentCached(Vcb, &((FileInfo)->Dloc->DataLoc), Offset, Length, ForWrite))
 
#define UDFGetLVIDiUse(Vcb)
 
#define UDFIsAStreamDir(FI)   ((FI) && ((FI)->Dloc) && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_IS_SDIR))
 
#define UDFHasAStreamDir(FI)   ((FI) && ((FI)->Dloc) && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_HAS_SDIR))
 
#define UDFIsAStream(FI)   ((FI) && UDFIsAStreamDir((FI)->ParentFile))
 
#define UDFIsSDirDeleted(FI)   ((FI) && (FI)->Dloc && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_IS_DEL_SDIR))
 
#define UDFGetPartNumByPartNdx(Vcb, pi)   (Vcb->Partitions[pi].PartitionNum)
 
#define UDFStreamsSupported(Vcb)   (Vcb->maxUDFWriteRev >= 0x0200)
 
#define UDFNtAclSupported(Vcb)   (Vcb->maxUDFWriteRev >= 0x0200)
 
#define UDFReferenceFile__(fi)
 
#define UDFReferenceFileEx__(fi, i)
 
#define UDFDereferenceFile__(fi)
 
#define UDFIsDirEmpty__(fi)   UDFIsDirEmpty((fi)->Dloc->DirIndex)
 
#define UDFIsDirOpened__(fi)   (fi->OpenCount)
 
#define UDFSetFileAllocMode__(fi, mode)
 
#define UDFGetFileAllocMode__(fi)   ((fi)->Dloc->DataLoc.Flags & EXTENT_FLAG_ALLOC_MASK)
 
#define UDFGetFileICBAllocMode__(fi)   (((PFILE_ENTRY)((fi)->Dloc->FileEntry))->icbTag.flags & ICB_FLAG_ALLOC_MASK)
 
#define UDF_DIR_INDEX_FRAME_SH   9
 
#define UDF_DIR_INDEX_FRAME   ((uint_di)(1 << UDF_DIR_INDEX_FRAME_SH))
 
#define UDF_DIR_INDEX_FRAME_GRAN   (32)
 
#define UDF_DIR_INDEX_FRAME_GRAN_MASK   (UDF_DIR_INDEX_FRAME_GRAN-1)
 
#define AlignDirIndex(n)   ((n+UDF_DIR_INDEX_FRAME_GRAN_MASK) & ~(UDF_DIR_INDEX_FRAME_GRAN_MASK))
 
#define UDFDirIndexGetLastIndex(di)   ((((di)->FrameCount - 1) << UDF_DIR_INDEX_FRAME_SH) + (di)->LastFrameCount)
 
#define UDFGetBit(arr, bit)   ( (BOOLEAN) ( ((((uint32*)(arr))[(bit)>>5]) >> ((bit)&31)) &1 ) )
 
#define UDFSetBit(arr, bit)   ( (((uint32*)(arr))[(bit)>>5]) |= (((uint32)1) << ((bit)&31)) )
 
#define UDFClrBit(arr, bit)   ( (((uint32*)(arr))[(bit)>>5]) &= (~(((uint32)1) << ((bit)&31))) )
 
#define UDFSetBits(arr, bit, bc)
 
#define UDFClrBits(arr, bit, bc)
 
#define UDFGetUsedBit(arr, bit)   (!UDFGetBit(arr,bit))
 
#define UDFGetFreeBit(arr, bit)   UDFGetBit(arr,bit)
 
#define UDFSetUsedBit(arr, bit)   UDFClrBit(arr,bit)
 
#define UDFSetFreeBit(arr, bit)   UDFSetBit(arr,bit)
 
#define UDFSetUsedBits(arr, bit, bc)   UDFClrBits(arr,bit,bc)
 
#define UDFSetFreeBits(arr, bit, bc)   UDFSetBits(arr,bit,bc)
 
#define UDFGetBadBit(arr, bit)   UDFGetBit(arr,bit)
 
#define UDFGetZeroBit(arr, bit)   UDFGetBit(arr,bit)
 
#define UDFSetZeroBit(arr, bit)   UDFSetBit(arr,bit)
 
#define UDFClrZeroBit(arr, bit)   UDFClrBit(arr,bit)
 
#define UDFSetZeroBits(arr, bit, bc)   UDFSetBits(arr,bit,bc)
 
#define UDFClrZeroBits(arr, bit, bc)   UDFClrBits(arr,bit,bc)
 
#define UDFSetFreeBitOwner(Vcb, i)
 
#define UDFSetUsedBitOwner(Vcb, i, o)
 
#define UDFCheckUsedBitOwner(Vcb, i, o)
 
#define UDFCheckFreeBitOwner(Vcb, i)
 
#define UDFRegisterFsStructure(Vcb, Lba, Length)   {NOTHING;}
 
#define UDF_MAX_VERIFY_CACHE   (8*1024*1024/2048)
 
#define UDF_VERIFY_CACHE_LOW   (4*1024*1024/2048)
 
#define UDF_VERIFY_CACHE_GRAN   (512*1024/2048)
 
#define UDF_SYS_CACHE_STOP_THR   (10*1024*1024/2048)
 
#define PH_FORGET_VERIFIED   0x00800000
 
#define PH_READ_VERIFY_CACHE   0x00400000
 
#define PH_KEEP_VERIFY_CACHE   0x00200000
 
#define UFD_VERIFY_FLAG_FORCE   0x01
 
#define UFD_VERIFY_FLAG_WAIT   0x02
 
#define UFD_VERIFY_FLAG_BG   0x04
 
#define UFD_VERIFY_FLAG_LOCKED   0x10
 

Functions

uint32 UDFMemRealloc (IN int8 *OldBuff, IN uint32 OldLength, OUT int8 **NewBuff, IN uint32 NewLength)
 
uint32 UDFExtentOffsetToLba (IN PVCB Vcb, IN PEXTENT_AD Extent, IN int64 Offset, OUT uint32 *SectorOffset, OUT PSIZE_T AvailLength, OUT uint32 *Flags, OUT uint32 *Index)
 
ULONG UDFLocateLbaInExtent (IN PVCB Vcb, IN PEXTENT_MAP Extent, IN lba_t lba)
 
OSSTATUS UDFReadExtent (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, OUT int8 *Buffer, OUT PSIZE_T ReadBytes)
 
OSSTATUS UDFReadExtentLocation (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, OUT PEXTENT_MAP *_SubExtInfo, IN OUT uint32 *_SubExtInfoSz, OUT int64 *_NextOffset)
 
int64 UDFGetExtentLength (IN PEXTENT_MAP Extent)
 
void __fastcall UDFDecompressUnicode (IN OUT PUNICODE_STRING UName, IN uint8 *CS0, IN SIZE_T Length, OUT uint16 *valueCRC)
 
uint8 UDFBuildHashEntry (IN PVCB Vcb, IN PUNICODE_STRING Name, OUT PHASH_ENTRY hashes, IN uint8 Mask)
 
PDIR_INDEX_ITEM UDFDirIndexGetFrame (IN PDIR_INDEX_HDR hDirNdx, IN uint32 Frame, OUT uint32 *FrameLen, OUT uint_di *Index, IN uint_di Rel)
 
void UDFDirIndexFree (PDIR_INDEX_HDR hDirNdx)
 
OSSTATUS UDFDirIndexGrow (IN PDIR_INDEX_HDR *_hDirNdx, IN uint_di d)
 
OSSTATUS UDFDirIndexTrunc (IN PDIR_INDEX_HDR *_hDirNdx, IN uint_di d)
 
BOOLEAN UDFDirIndexInitScan (IN PUDF_FILE_INFO DirInfo, OUT PUDF_DIR_SCAN_CONTEXT Context, IN uint_di Index)
 
PDIR_INDEX_ITEM UDFDirIndexScan (PUDF_DIR_SCAN_CONTEXT Context, PUDF_FILE_INFO *_FileInfo)
 
OSSTATUS UDFIndexDirectory (IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFFindFile (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN BOOLEAN NotDeleted, IN PUNICODE_STRING Name, IN PUDF_FILE_INFO DirInfo, IN OUT uint_di *Index)
 
__inline OSSTATUS UDFFindFile__ (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN PUNICODE_STRING Name, IN PUDF_FILE_INFO DirInfo)
 
uint32 UDFGetMappingLength (IN PEXTENT_MAP Extent)
 
PEXTENT_MAP __fastcall UDFMergeMappings (IN PEXTENT_MAP Extent, IN PEXTENT_MAP Extent2)
 
PEXTENT_MAP UDFShortAllocDescToMapping (IN PVCB Vcb, IN uint32 PartNum, IN PLONG_AD AllocDesc, IN uint32 AllocDescLength, IN uint32 SubCallCount, OUT PEXTENT_INFO AllocLoc)
 
PEXTENT_MAP UDFLongAllocDescToMapping (IN PVCB Vcb, IN PLONG_AD AllocDesc, IN uint32 AllocDescLength, IN uint32 SubCallCount, OUT PEXTENT_INFO AllocLoc)
 
PEXTENT_MAP UDFExtAllocDescToMapping (IN PVCB Vcb, IN PLONG_AD AllocDesc, IN uint32 AllocDescLength, IN uint32 SubCallCount, OUT PEXTENT_INFO AllocLoc)
 
PEXTENT_MAP UDFReadMappingFromXEntry (IN PVCB Vcb, IN uint32 PartNum, IN tag *XEntry, IN OUT uint32 *Offset, OUT PEXTENT_INFO AllocLoc)
 
OSSTATUS UDFReadFileEntry (IN PVCB Vcb, IN long_ad *Icb, IN OUT PFILE_ENTRY FileEntry, IN OUT uint16 *Ident)
 
OSSTATUS UDFFindLastFileSet (IN PVCB Vcb, IN lb_addr *Addr, IN OUT PFILE_SET_DESC FileSetDesc)
 
OSSTATUS UDFLoadSparingTable (IN PVCB Vcb, IN PSPARABLE_PARTITION_MAP PartMap)
 
PEXTENT_MAP __fastcall UDFExtentToMapping_ (IN PEXTENT_AD Extent)
 
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)
 
BOOLEAN UDFUnicodeInString (IN uint8 *string, IN WCHAR ch)
 
BOOLEAN __fastcall UDFIsIllegalChar (IN WCHAR ch)
 
void __fastcall UDFDOSName (IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
 
void __fastcall UDFDOSName201 (IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
 
void __fastcall UDFDOSName200 (IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact, IN BOOLEAN Mode150)
 
void __fastcall UDFDOSName100 (IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
 
SIZE_T UDFGetBitmapLen (uint32 *Bitmap, SIZE_T Offs, SIZE_T Lim)
 
SIZE_T UDFFindMinSuitableExtent (IN PVCB Vcb, IN uint32 Length, IN uint32 SearchStart, IN uint32 SearchLim, OUT uint32 *MaxExtLen, IN uint8 AllocFlags)
 
void UDFMarkSpaceAsXXXNoProtect_ (IN PVCB Vcb, IN PEXTENT_MAP Map, IN uint32 asXXX)
 
void UDFMarkSpaceAsXXX_ (IN PVCB Vcb, IN PEXTENT_MAP Map, IN uint32 asXXX)
 
OSSTATUS UDFAllocFreeExtent_ (IN PVCB Vcb, IN int64 Length, IN uint32 SearchStart, IN uint32 SearchLim, OUT PEXTENT_INFO Extent, IN uint8 AllocFlags)
 
uint32 __fastcall UDFGetPartFreeSpace (IN PVCB Vcb, IN uint32 partNum)
 
OSSTATUS UDFGetCachedAllocation (IN PVCB Vcb, IN uint32 ParentLocation, OUT PEXTENT_INFO Ext, OUT uint32 *Items, IN uint32 AllocClass)
 
OSSTATUS UDFStoreCachedAllocation (IN PVCB Vcb, IN uint32 ParentLocation, IN PEXTENT_INFO Ext, IN uint32 Items, IN uint32 AllocClass)
 
OSSTATUS UDFFlushAllCachedAllocations (IN PVCB Vcb, IN uint32 AllocClass)
 
OSSTATUS UDFAllocateFESpace (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN uint32 PartNum, IN PEXTENT_INFO FEExtInfo, IN uint32 Len)
 
void UDFFreeFESpace (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN PEXTENT_INFO FEExtInfo)
 
void UDFFlushFESpace (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc, IN BOOLEAN Discard=FLUSH_FE_KEEP)
 
void UDFFreeFileAllocation (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN PUDF_FILE_INFO FileInfo)
 
uint32 UDFPhysLbaToPart (IN PVCB Vcb, IN uint32 PartNum, IN uint32 Addr)
 
void UDFSetUpTag (IN PVCB Vcb, IN tag *Tag, IN uint16 DataLen, IN uint32 TagLoc)
 
OSSTATUS UDFBuildShortAllocDescs (IN PVCB Vcb, IN uint32 PartNum, OUT int8 **Buff, IN uint32 InitSz, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFBuildLongAllocDescs (IN PVCB Vcb, IN uint32 PartNum, OUT int8 **Buff, IN uint32 InitSz, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFBuildFileEntry (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN PUDF_FILE_INFO FileInfo, IN uint32 PartNum, IN uint16 AllocMode, IN uint32 ExtAttrSz, IN BOOLEAN Extended)
 
uint32 __fastcall UDFGetPartNumByPhysLba (IN PVCB Vcb, IN uint32 Lba)
 
OSSTATUS UDFAddXSpaceBitmap (IN PVCB Vcb, IN uint32 PartNum, IN PSHORT_AD bm, IN ULONG bm_type)
 
OSSTATUS UDFDelXSpaceBitmap (IN PVCB Vcb, IN uint32 PartNum, IN PSHORT_AD bm)
 
OSSTATUS UDFBuildFreeSpaceBitmap (IN PVCB Vcb, IN uint32 PartNdx, IN PPARTITION_HEADER_DESC phd, IN uint32 Lba)
 
OSSTATUS UDFLoadExtInfo (IN PVCB Vcb, IN PFILE_ENTRY fe, IN PLONG_AD fe_loc, IN OUT PEXTENT_INFO FExtInfo, IN OUT PEXTENT_INFO AExtInfo)
 
void __fastcall UDFCompressUnicode (IN PUNICODE_STRING UName, IN OUT uint8 **_CS0, IN OUT PSIZE_T Length)
 
OSSTATUS UDFBuildFileIdent (IN PVCB Vcb, IN PUNICODE_STRING fn, IN PLONG_AD FileEntryIcb, IN uint32 ImpUseLen, OUT PFILE_IDENT_DESC *_FileId, OUT uint32 *FileIdLen)
 
OSSTATUS UDFMarkAllocatedAsRecorded (IN PVCB Vcb, IN int64 Offset, IN uint32 Length, IN PEXTENT_INFO ExtInfo)
 
OSSTATUS UDFMarkNotAllocatedAsAllocated (IN PVCB Vcb, IN int64 Offset, IN uint32 Length, IN PEXTENT_INFO ExtInfo)
 
OSSTATUS UDFMarkAllocatedAsNotXXX (IN PVCB Vcb, IN int64 Offset, IN uint32 Length, IN PEXTENT_INFO ExtInfo, IN BOOLEAN Deallocate)
 
OSSTATUS UDFWriteExtent (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, IN int8 *Buffer, OUT PSIZE_T WrittenBytes)
 
OSSTATUS UDFZeroExtent (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Deallocate, IN BOOLEAN Direct, OUT PSIZE_T WrittenBytes)
 
uint32 __fastcall UDFPartStart (PVCB Vcb, uint32 PartNum)
 
uint32 __fastcall UDFPartEnd (PVCB Vcb, uint32 PartNum)
 
OSSTATUS UDFResizeExtent (IN PVCB Vcb, IN uint32 PartNum, IN int64 Length, IN BOOLEAN AlwaysInIcb, OUT PEXTENT_INFO ExtInfo)
 
OSSTATUS UDFBuildAllocDescs (IN PVCB Vcb, IN uint32 PartNum, IN OUT PUDF_FILE_INFO FileInfo, OUT int8 **AllocData)
 
void UDFSetFileSize (IN PUDF_FILE_INFO FileInfo, IN int64 Size)
 
void UDFSetFileSizeInDirNdx (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 *ASize)
 
int64 UDFGetFileSize (IN PUDF_FILE_INFO FileInfo)
 
int64 UDFGetFileSizeFromDirNdx (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
void UDFSetAllocDescLen (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
void UDFChangeFileLinkCount (IN PUDF_FILE_INFO FileInfo, IN BOOLEAN Increase)
 
void UDFSetEntityID_imp_ (IN EntityID *eID, IN uint8 *Str, IN uint32 Len)
 
uint16 UDFGetFileLinkCount (IN PUDF_FILE_INFO FileInfo)
 
void UDFReadEntityID_Domain (PVCB Vcb, EntityID *eID)
 
uint32 UDFGetFileEALength (IN PUDF_FILE_INFO FileInfo)
 
void UDFSetFileUID (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
int64 UDFGetFileUID (IN PUDF_FILE_INFO FileInfo)
 
void UDFChangeFileCounter (IN PVCB Vcb, IN BOOLEAN FileCounter, IN BOOLEAN Increase)
 
OSSTATUS UDFWriteFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, IN int8 *Buffer, OUT PSIZE_T WrittenBytes)
 
OSSTATUS UDFUnlinkFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN BOOLEAN FreeSpace)
 
OSSTATUS UDFUnlinkAllFilesInDir (IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo)
 
OSSTATUS UDFOpenFile__ (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN BOOLEAN NotDeleted, IN PUNICODE_STRING fn, IN PUDF_FILE_INFO DirInfo, OUT PUDF_FILE_INFO *_FileInfo, IN uint_di *IndexToOpen)
 
OSSTATUS UDFOpenRootFile__ (IN PVCB Vcb, IN lb_addr *RootLoc, OUT PUDF_FILE_INFO FileInfo)
 
uint32 UDFCleanUpFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFCreateFile__ (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN PUNICODE_STRING fn, IN uint32 ExtAttrSz, IN uint32 ImpUseLen, IN BOOLEAN Extended, IN BOOLEAN CreateNew, IN OUT PUDF_FILE_INFO DirInfo, OUT PUDF_FILE_INFO *_FileInfo)
 
__inline OSSTATUS UDFReadFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN SIZE_T Length, IN BOOLEAN Direct, OUT int8 *Buffer, OUT PSIZE_T ReadBytes)
 
__inline OSSTATUS UDFReadFileLocation__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, OUT PEXTENT_MAP *SubExtInfo, IN OUT uint32 *SubExtInfoSz, OUT int64 *NextOffset)
 
__inline OSSTATUS UDFZeroFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN uint32 Length, IN BOOLEAN Direct, OUT uint32 *ReadBytes)
 
__inline OSSTATUS UDFSparseFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 Offset, IN uint32 Length, IN BOOLEAN Direct, OUT uint32 *ReadBytes)
 
OSSTATUS UDFPadLastSector (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo)
 
OSSTATUS UDFCloseFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFPrepareXSpaceBitmap (IN PVCB Vcb, IN OUT PSHORT_AD XSpaceBitmap, IN OUT PEXTENT_INFO XSBMExtInfo, IN OUT int8 **XSBM, IN OUT uint32 *XSl)
 
OSSTATUS UDFUpdateXSpaceBitmaps (IN PVCB Vcb, IN uint32 PartNum, IN PPARTITION_HEADER_DESC phd)
 
OSSTATUS UDFUpdatePartDesc (PVCB Vcb, int8 *Buf)
 
OSSTATUS UDFUpdateLogicalVolInt (PVCB Vcb, BOOLEAN Close)
 
OSSTATUS UDFUpdateUSpaceDesc (IN PVCB Vcb, int8 *Buf)
 
OSSTATUS UDFUpdateVDS (IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, IN uint32 flags)
 
OSSTATUS UDFUmount__ (IN PVCB Vcb)
 
OSSTATUS UDFRenameMoveFile__ (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN OUT BOOLEAN *Replace, IN PUNICODE_STRING fn, IN OUT PUDF_FILE_INFO DirInfo1, IN OUT PUDF_FILE_INFO DirInfo2, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFResizeFile__ (IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo, IN int64 NewLength)
 
OSSTATUS UDFRecordDirectory__ (IN PVCB Vcb, IN OUT PUDF_FILE_INFO DirInfo)
 
OSSTATUS UDFPackDirectory__ (IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFReTagDirectory (IN PVCB Vcb, IN OUT PUDF_FILE_INFO FileInfo)
 
OSSTATUS UDFLoadVAT (IN PVCB Vcb, IN uint32 PartNdx)
 
int64 __fastcall UDFGetFreeSpace (IN PVCB Vcb)
 
int64 __fastcall UDFGetTotalSpace (IN PVCB Vcb)
 
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo (IN PUDF_FILE_INFO FileInfo)
 
BOOLEAN UDFIsDirEmpty (IN PDIR_INDEX_HDR hCurDirNdx)
 
OSSTATUS UDFFlushFE (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN uint32 PartNum)
 
OSSTATUS UDFFlushFI (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN uint32 PartNum)
 
OSSTATUS UDFFlushFile__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN ULONG FlushFlags=0)
 
BOOLEAN UDFCompareFileInfo (IN PUDF_FILE_INFO f1, IN PUDF_FILE_INFO f2)
 
void __fastcall UDFPackMapping (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo)
 
BOOLEAN UDFIsExtentCached (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo, IN int64 Offset, IN uint32 Length, IN BOOLEAN ForWrite)
 
ULONG UDFIsBlockAllocated (IN void *_Vcb, IN uint32 Lba)
 
OSSTATUS UDFUpdateVolIdent (IN PVCB Vcb, IN UDF_VDS_RECORD Lba, IN PUNICODE_STRING VolIdent)
 
uint16 __fastcall UDFUnicodeCksum (PWCHAR s, uint32 n)
 
uint16 __fastcall UDFUnicodeCksum150 (PWCHAR s, uint32 n)
 
uint32 __fastcall crc32 (IN uint8 *s, IN uint32 len)
 
uint16 __fastcall UDFCrc (IN uint8 *Data, IN SIZE_T Size)
 
OSSTATUS UDFReadTagged (IN PVCB Vcb, IN int8 *Buf, IN uint32 Block, IN uint32 Location, OUT uint16 *Ident)
 
uint32 __fastcall UDFPartLbaToPhys (IN PVCB Vcb, IN lb_addr *Addr)
 
lba_t UDFFindAnchor (PVCB Vcb)
 
uint32 UDFFindVRS (PVCB Vcb)
 
void UDFLoadPVolDesc (PVCB Vcb, int8 *Buf)
 
OSSTATUS UDFLoadLogicalVolInt (PDEVICE_OBJECT DeviceObject, PVCB Vcb, extent_ad loc)
 
OSSTATUS UDFLoadLogicalVol (PDEVICE_OBJECT DeviceObject, PVCB Vcb, int8 *Buf, lb_addr *fileset)
 
OSSTATUS UDFLoadPartDesc (PVCB Vcb, int8 *Buf)
 
OSSTATUS UDFReadVDS (IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, IN PUDF_VDS_RECORD vds, IN int8 *Buf)
 
OSSTATUS UDFProcessSequence (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, OUT lb_addr *fileset)
 
OSSTATUS UDFVerifySequence (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb, IN uint32 block, IN uint32 lastblock, OUT lb_addr *fileset)
 
void UDFLoadFileset (IN PVCB Vcb, IN PFILE_SET_DESC fset, OUT lb_addr *root, OUT lb_addr *sysstream)
 
OSSTATUS UDFLoadPartition (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb, OUT lb_addr *fileset)
 
OSSTATUS UDFGetDiskInfoAndVerify (IN PDEVICE_OBJECT DeviceObject, IN PVCB Vcb)
 
OSSTATUS UDFHardLinkFile__ (IN PVCB Vcb, IN BOOLEAN IgnoreCase, IN OUT BOOLEAN *Replace, IN PUNICODE_STRING fn, IN OUT PUDF_FILE_INFO DirInfo1, IN OUT PUDF_FILE_INFO DirInfo2, IN OUT PUDF_FILE_INFO FileInfo)
 
LONG UDFFindDloc (IN PVCB Vcb, IN uint32 Lba)
 
LONG UDFFindFreeDloc (IN PVCB Vcb, IN uint32 Lba)
 
OSSTATUS UDFAcquireDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
 
OSSTATUS UDFReleaseDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
 
OSSTATUS UDFStoreDloc (IN PVCB Vcb, IN PUDF_FILE_INFO fi, IN uint32 Lba)
 
OSSTATUS UDFRemoveDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
 
OSSTATUS UDFUnlinkDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
 
void UDFFreeDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
 
void UDFRelocateDloc (IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc, IN uint32 NewLba)
 
void UDFReleaseDlocList (IN PVCB Vcb)
 
PUDF_FILE_INFO UDFLocateParallelFI (PUDF_FILE_INFO di, uint_di i, PUDF_FILE_INFO fi)
 
PUDF_FILE_INFO UDFLocateAnyParallelFI (PUDF_FILE_INFO fi)
 
void UDFInsertLinkedFile (PUDF_FILE_INFO fi, PUDF_FILE_INFO fi2)
 
OSSTATUS UDFCreateRootFile__ (IN PVCB Vcb, IN uint32 PartNum, IN uint32 ExtAttrSz, IN uint32 ImpUseLen, IN BOOLEAN Extended, OUT PUDF_FILE_INFO *_FileInfo)
 
OSSTATUS UDFCreateStreamDir__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, OUT PUDF_FILE_INFO *_SDirInfo)
 
OSSTATUS UDFOpenStreamDir__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, OUT PUDF_FILE_INFO *_SDirInfo)
 
OSSTATUS UDFRecordVAT (IN PVCB Vcb)
 
OSSTATUS UDFModifyVAT (IN PVCB Vcb, IN uint32 Lba, IN uint32 Length)
 
OSSTATUS UDFUpdateVAT (IN void *_Vcb, IN uint32 Lba, IN uint32 *RelocTab, IN uint32 BCount)
 
OSSTATUS __fastcall UDFUnPackMapping (IN PVCB Vcb, IN PEXTENT_INFO ExtInfo)
 
OSSTATUS UDFConvertFEToNonInICB (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN uint8 NewAllocMode)
 
OSSTATUS UDFConvertFEToExtended (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
uint32 __fastcall UDFPartLen (PVCB Vcb, uint32 PartNum)
 
OSSTATUS UDFPretendFileDeleted__ (IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo)
 
__inline PDIR_INDEX_ITEM UDFDirIndex (IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
 
OSSTATUS UDFVInit (IN PVCB Vcb)
 
VOID UDFVRelease (IN PVCB Vcb)
 
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 UDFVVerify (IN PVCB Vcb, IN ULONG Flags)
 
VOID UDFVFlush (IN PVCB Vcb)
 
__inline BOOLEAN __fastcall UDFVIsStored (IN PVCB Vcb, IN lba_t lba)
 
BOOLEAN __fastcall UDFCheckArea (IN PVCB Vcb, IN lba_t LBA, IN uint32 BCount)
 

Variables

const char hexChar []
 

Macro Definition Documentation

◆ AlignDirIndex

Definition at line 1093 of file udf_info.h.

◆ AS_BAD

#define AS_BAD   0x04

Definition at line 329 of file udf_info.h.

◆ AS_DISCARDED

#define AS_DISCARDED   0x02

Definition at line 328 of file udf_info.h.

◆ AS_FREE

#define AS_FREE   0x00

Definition at line 326 of file udf_info.h.

◆ AS_USED

#define AS_USED   0x01

Definition at line 327 of file udf_info.h.

◆ FLUSH_FE_FOR_DEL

#define FLUSH_FE_FOR_DEL   TRUE

Definition at line 396 of file udf_info.h.

◆ FLUSH_FE_KEEP

#define FLUSH_FE_KEEP   FALSE

Definition at line 395 of file udf_info.h.

◆ HASH_ALL

#define HASH_ALL   0x07

Definition at line 78 of file udf_info.h.

◆ HASH_DOS

#define HASH_DOS   0x04

Definition at line 77 of file udf_info.h.

◆ HASH_KEEP_NAME

#define HASH_KEEP_NAME   0x08

Definition at line 79 of file udf_info.h.

◆ HASH_POSIX

#define HASH_POSIX   0x01

Definition at line 75 of file udf_info.h.

◆ HASH_ULFN

#define HASH_ULFN   0x02

Definition at line 76 of file udf_info.h.

◆ PH_FORGET_VERIFIED

#define PH_FORGET_VERIFIED   0x00800000

Definition at line 1270 of file udf_info.h.

◆ PH_KEEP_VERIFY_CACHE

#define PH_KEEP_VERIFY_CACHE   0x00200000

Definition at line 1272 of file udf_info.h.

◆ PH_READ_VERIFY_CACHE

#define PH_READ_VERIFY_CACHE   0x00400000

Definition at line 1271 of file udf_info.h.

◆ UDF_DIR_INDEX_FRAME

#define UDF_DIR_INDEX_FRAME   ((uint_di)(1 << UDF_DIR_INDEX_FRAME_SH))

Definition at line 1089 of file udf_info.h.

◆ UDF_DIR_INDEX_FRAME_GRAN

#define UDF_DIR_INDEX_FRAME_GRAN   (32)

Definition at line 1091 of file udf_info.h.

◆ UDF_DIR_INDEX_FRAME_GRAN_MASK

#define UDF_DIR_INDEX_FRAME_GRAN_MASK   (UDF_DIR_INDEX_FRAME_GRAN-1)

Definition at line 1092 of file udf_info.h.

◆ UDF_DIR_INDEX_FRAME_SH

#define UDF_DIR_INDEX_FRAME_SH   9

Definition at line 1084 of file udf_info.h.

◆ UDF_FREE_DLOC

#define UDF_FREE_DLOC   0x02

Definition at line 650 of file udf_info.h.

◆ UDF_FREE_FILEINFO

#define UDF_FREE_FILEINFO   0x01

Definition at line 649 of file udf_info.h.

◆ UDF_FREE_NOTHING

#define UDF_FREE_NOTHING   0x00

Definition at line 648 of file udf_info.h.

◆ UDF_FSPACE_BM

#define UDF_FSPACE_BM   0x00

Definition at line 445 of file udf_info.h.

◆ UDF_MAX_VERIFY_CACHE

#define UDF_MAX_VERIFY_CACHE   (8*1024*1024/2048)

Definition at line 1255 of file udf_info.h.

◆ UDF_PREALLOC_CLASS_DIR

#define UDF_PREALLOC_CLASS_DIR   0x01

Definition at line 356 of file udf_info.h.

◆ UDF_PREALLOC_CLASS_FE

#define UDF_PREALLOC_CLASS_FE   0x00

Definition at line 355 of file udf_info.h.

◆ UDF_SYS_CACHE_STOP_THR

#define UDF_SYS_CACHE_STOP_THR   (10*1024*1024/2048)

Definition at line 1258 of file udf_info.h.

◆ UDF_VERIFY_CACHE_GRAN

#define UDF_VERIFY_CACHE_GRAN   (512*1024/2048)

Definition at line 1257 of file udf_info.h.

◆ UDF_VERIFY_CACHE_LOW

#define UDF_VERIFY_CACHE_LOW   (4*1024*1024/2048)

Definition at line 1256 of file udf_info.h.

◆ UDF_ZSPACE_BM

#define UDF_ZSPACE_BM   0x01

Definition at line 446 of file udf_info.h.

◆ UDFAllocFreeExtent

#define UDFAllocFreeExtent (   v,
  l,
  ss,
  sl,
  e,
  af 
)    UDFAllocFreeExtent_(v, l, ss, sl, e, af)

Definition at line 347 of file udf_info.h.

◆ UDFCheckFreeBitOwner

#define UDFCheckFreeBitOwner (   Vcb,
  i 
)

Definition at line 1238 of file udf_info.h.

◆ UDFCheckSpaceAllocation

#define UDFCheckSpaceAllocation (   Vcb,
  FileInfo,
  Map,
  asXXX 
)    {;}

Definition at line 281 of file udf_info.h.

◆ UDFCheckUsedBitOwner

#define UDFCheckUsedBitOwner (   Vcb,
  i,
 
)

Definition at line 1237 of file udf_info.h.

◆ UDFClrBit

#define UDFClrBit (   arr,
  bit 
)    ( (((uint32*)(arr))[(bit)>>5]) &= (~(((uint32)1) << ((bit)&31))) )

Definition at line 1182 of file udf_info.h.

◆ UDFClrBits

#define UDFClrBits (   arr,
  bit,
  bc 
)
Value:
{uint32 j; \
for(j=0;j<bc;j++) { \
UDFClrBit(arr, (bit)+j); \
}}
LPBATCH_CONTEXT bc
Definition: batch.c:66
unsigned int uint32
Definition: types.h: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 GLint GLint j
Definition: glfuncs.h:250

Definition at line 1190 of file udf_info.h.

◆ UDFClrZeroBit

#define UDFClrZeroBit (   arr,
  bit 
)    UDFClrBit(arr,bit)

Definition at line 1209 of file udf_info.h.

◆ UDFClrZeroBits

#define UDFClrZeroBits (   arr,
  bit,
  bc 
)    UDFClrBits(arr,bit,bc)

Definition at line 1211 of file udf_info.h.

◆ UDFDecDirCounter

#define UDFDecDirCounter (   Vcb)    UDFChangeFileCounter(Vcb, FALSE, FALSE);

Definition at line 617 of file udf_info.h.

◆ UDFDecFileCounter

#define UDFDecFileCounter (   Vcb)    UDFChangeFileCounter(Vcb, TRUE, FALSE);

Definition at line 615 of file udf_info.h.

◆ UDFDecFileLinkCount

#define UDFDecFileLinkCount (   fi)    UDFChangeFileLinkCount(fi, FALSE)

Definition at line 581 of file udf_info.h.

◆ UDFDereferenceFile__

#define UDFDereferenceFile__ (   fi)
Value:
{ \
UDFInterlockedDecrement((PLONG)&((fi)->RefCount)); \
UDFInterlockedDecrement((PLONG)&((fi)->Dloc->LinkRefCount)); \
if((fi)->ParentFile) { \
UDFInterlockedDecrement((PLONG)&((fi)->ParentFile->OpenCount)); \
} \
}
signed int * PLONG
Definition: retypes.h:5

Definition at line 1061 of file udf_info.h.

◆ UDFDirIndexGetLastIndex

#define UDFDirIndexGetLastIndex (   di)    ((((di)->FrameCount - 1) << UDF_DIR_INDEX_FRAME_SH) + (di)->LastFrameCount)

Definition at line 1122 of file udf_info.h.

◆ UDFDOSName__

#define UDFDOSName__ (   Vcb,
  DosName,
  UdfName,
  FileInfo 
)    UDFDOSName(Vcb, DosName, UdfName, (FileInfo) && ((FileInfo)->Index < 2));

Definition at line 217 of file udf_info.h.

◆ UDFExtentToMapping

#define UDFExtentToMapping (   e)    UDFExtentToMapping_(e)

Definition at line 181 of file udf_info.h.

◆ UDFGetBadBit

#define UDFGetBadBit (   arr,
  bit 
)    UDFGetBit(arr,bit)

Definition at line 1205 of file udf_info.h.

◆ UDFGetBit

#define UDFGetBit (   arr,
  bit 
)    ( (BOOLEAN) ( ((((uint32*)(arr))[(bit)>>5]) >> ((bit)&31)) &1 ) )

Definition at line 1180 of file udf_info.h.

◆ UDFGetFileAllocationSize

#define UDFGetFileAllocationSize (   Vcb,
  FileInfo 
)    (((FileInfo)->Dloc->DataLoc.Mapping) ? UDFGetExtentLength((FileInfo)->Dloc->DataLoc.Mapping) : Vcb->LBlockSize)

Definition at line 797 of file udf_info.h.

◆ UDFGetFileAllocMode__

#define UDFGetFileAllocMode__ (   fi)    ((fi)->Dloc->DataLoc.Flags & EXTENT_FLAG_ALLOC_MASK)

Definition at line 1079 of file udf_info.h.

◆ UDFGetFileICBAllocMode__

#define UDFGetFileICBAllocMode__ (   fi)    (((PFILE_ENTRY)((fi)->Dloc->FileEntry))->icbTag.flags & ICB_FLAG_ALLOC_MASK)

Definition at line 1081 of file udf_info.h.

◆ UDFGetFreeBit

#define UDFGetFreeBit (   arr,
  bit 
)    UDFGetBit(arr,bit)

Definition at line 1199 of file udf_info.h.

◆ UDFGetLVIDiUse

#define UDFGetLVIDiUse (   Vcb)
Value:
( ((Vcb) && (Vcb)->LVid) ? \
( ((int8*)(Vcb->LVid+1)) + \
Vcb->LVid->numOfPartitions*2*sizeof(uint32))) \
: NULL)
unsigned int uint32
Definition: types.h:32
smooth NULL
Definition: ftsmooth.c:416
#define Vcb
Definition: cdprocs.h:1425
char int8
Definition: platform.h:10

Definition at line 884 of file udf_info.h.

◆ UDFGetPartNumByPartNdx

#define UDFGetPartNumByPartNdx (   Vcb,
  pi 
)    (Vcb->Partitions[pi].PartitionNum)

Definition at line 1028 of file udf_info.h.

◆ UDFGetUsedBit

#define UDFGetUsedBit (   arr,
  bit 
)    (!UDFGetBit(arr,bit))

Definition at line 1198 of file udf_info.h.

◆ UDFGetZeroBit

#define UDFGetZeroBit (   arr,
  bit 
)    UDFGetBit(arr,bit)

Definition at line 1207 of file udf_info.h.

◆ UDFHasAStreamDir

#define UDFHasAStreamDir (   FI)    ((FI) && ((FI)->Dloc) && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_HAS_SDIR))

Definition at line 1000 of file udf_info.h.

◆ UDFIncDirCounter

#define UDFIncDirCounter (   Vcb)    UDFChangeFileCounter(Vcb, FALSE, TRUE);

Definition at line 616 of file udf_info.h.

◆ UDFIncFileCounter

#define UDFIncFileCounter (   Vcb)    UDFChangeFileCounter(Vcb, TRUE, TRUE);

Definition at line 614 of file udf_info.h.

◆ UDFIncFileLinkCount

#define UDFIncFileLinkCount (   fi)    UDFChangeFileLinkCount(fi, TRUE)

Definition at line 580 of file udf_info.h.

◆ UDFIsADirectory

#define UDFIsADirectory (   FileInfo)    (((FileInfo) && ((FileInfo)->Dloc) && ((FileInfo)->Dloc->DirIndex || ((FileInfo)->FileIdent && ((FileInfo)->FileIdent->fileCharacteristics & FILE_DIRECTORY)))) ? TRUE : FALSE)

Definition at line 792 of file udf_info.h.

◆ UDFIsAStream

#define UDFIsAStream (   FI)    ((FI) && UDFIsAStreamDir((FI)->ParentFile))

Definition at line 1002 of file udf_info.h.

◆ UDFIsAStreamDir

#define UDFIsAStreamDir (   FI)    ((FI) && ((FI)->Dloc) && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_IS_SDIR))

Definition at line 998 of file udf_info.h.

◆ UDFIsDeleted

#define UDFIsDeleted (   DirNdx)    (((DirNdx)->FileCharacteristics & FILE_DELETED) ? TRUE : FALSE)

Definition at line 788 of file udf_info.h.

◆ UDFIsDirEmpty__

#define UDFIsDirEmpty__ (   fi)    UDFIsDirEmpty((fi)->Dloc->DirIndex)

Definition at line 1070 of file udf_info.h.

◆ UDFIsDirOpened__

#define UDFIsDirOpened__ (   fi)    (fi->OpenCount)

Definition at line 1071 of file udf_info.h.

◆ UDFIsFileCached__

#define UDFIsFileCached__ (   Vcb,
  FileInfo,
  Offset,
  Length,
  ForWrite 
)    (UDFIsExtentCached(Vcb, &((FileInfo)->Dloc->DataLoc), Offset, Length, ForWrite))

Definition at line 839 of file udf_info.h.

◆ UDFIsFlushed

#define UDFIsFlushed (   FI)
Value:
( FI && \
!(FI->Dloc->FE_Flags & UDF_FE_FLAG_FE_MODIFIED) && \
!(FI->Dloc->DataLoc.Modified) && \
!(FI->Dloc->AllocLoc.Modified) &&\
!(FI->Dloc->FELoc.Modified) && \
!(UDFGetDirIndexByFileInfo(FI)[FI->Index].FI_Flags & UDF_FI_FLAG_FI_MODIFIED) )
#define UDF_FI_FLAG_FI_MODIFIED
FileIdent was modified & should be flushed.
Definition: udf_rel.h:217
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092

Definition at line 814 of file udf_info.h.

◆ UDFIsSDirDeleted

#define UDFIsSDirDeleted (   FI)    ((FI) && (FI)->Dloc && ((FI)->Dloc->FE_Flags & UDF_FE_FLAG_IS_DEL_SDIR))

Definition at line 1004 of file udf_info.h.

◆ UDFMarkAllocatedAsNotAllocated

#define UDFMarkAllocatedAsNotAllocated (   Vcb,
  Off,
  Len,
  Ext 
)    UDFMarkAllocatedAsNotXXX(Vcb, Off, Len, Ext, TRUE)

Definition at line 503 of file udf_info.h.

◆ UDFMarkRecordedAsAllocated

#define UDFMarkRecordedAsAllocated (   Vcb,
  Off,
  Len,
  Ext 
)    UDFMarkAllocatedAsNotXXX(Vcb, Off, Len, Ext, FALSE)

Definition at line 516 of file udf_info.h.

◆ UDFMarkSpaceAsXXX

#define UDFMarkSpaceAsXXX (   Vcb,
  FileInfo,
  Map,
  asXXX 
)    UDFMarkSpaceAsXXX_(Vcb, Map, asXXX);

Definition at line 322 of file udf_info.h.

◆ UDFMarkSpaceAsXXXNoProtect

#define UDFMarkSpaceAsXXXNoProtect (   Vcb,
  FileInfo,
  Map,
  asXXX 
)    UDFMarkSpaceAsXXXNoProtect_(Vcb, Map, asXXX);

Definition at line 302 of file udf_info.h.

◆ UDFNtAclSupported

#define UDFNtAclSupported (   Vcb)    (Vcb->maxUDFWriteRev >= 0x0200)

Definition at line 1040 of file udf_info.h.

◆ UDFReferenceFile__

#define UDFReferenceFile__ (   fi)
Value:
{ \
UDFInterlockedIncrement((PLONG)&((fi)->RefCount)); \
UDFInterlockedIncrement((PLONG)&((fi)->Dloc->LinkRefCount)); \
if((fi)->ParentFile) { \
UDFInterlockedIncrement((PLONG)&((fi)->ParentFile->OpenCount)); \
} \
}
signed int * PLONG
Definition: retypes.h:5

Definition at line 1043 of file udf_info.h.

◆ UDFReferenceFileEx__

#define UDFReferenceFileEx__ (   fi,
  i 
)
Value:
{ \
UDFInterlockedExchangeAdd((PLONG)&((fi)->RefCount),i); \
UDFInterlockedExchangeAdd((PLONG)&((fi)->Dloc->LinkRefCount),i); \
if((fi)->ParentFile) { \
UDFInterlockedExchangeAdd((PLONG)&((fi)->ParentFile->OpenCount),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 i
Definition: glfuncs.h:248
signed int * PLONG
Definition: retypes.h:5

Definition at line 1052 of file udf_info.h.

◆ UDFRegisterFsStructure

#define UDFRegisterFsStructure (   Vcb,
  Lba,
  Length 
)    {NOTHING;}

Definition at line 1250 of file udf_info.h.

◆ UDFSetBit

#define UDFSetBit (   arr,
  bit 
)    ( (((uint32*)(arr))[(bit)>>5]) |= (((uint32)1) << ((bit)&31)) )

Definition at line 1181 of file udf_info.h.

◆ UDFSetBits

#define UDFSetBits (   arr,
  bit,
  bc 
)
Value:
{uint32 j; \
for(j=0;j<bc;j++) { \
UDFSetBit(arr, (bit)+j); \
}}
LPBATCH_CONTEXT bc
Definition: batch.c:66
unsigned int uint32
Definition: types.h: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 GLint GLint j
Definition: glfuncs.h:250

Definition at line 1184 of file udf_info.h.

◆ UDFSetEntityID_imp

#define UDFSetEntityID_imp (   eID,
  Str 
)    UDFSetEntityID_imp_(eID, (uint8*)(Str), sizeof(Str));

Definition at line 598 of file udf_info.h.

◆ UDFSetFileAllocMode__

#define UDFSetFileAllocMode__ (   fi,
  mode 
)
Value:
{ \
(fi)->Dloc->DataLoc.Flags = \
((fi)->Dloc->DataLoc.Flags & ~EXTENT_FLAG_ALLOC_MASK) | (mode & EXTENT_FLAG_ALLOC_MASK); \
}
#define EXTENT_FLAG_ALLOC_MASK
Definition: udf_rel.h:78
GLenum mode
Definition: glext.h:6217

Definition at line 1073 of file udf_info.h.

◆ UDFSetFreeBit

#define UDFSetFreeBit (   arr,
  bit 
)    UDFSetBit(arr,bit)

Definition at line 1201 of file udf_info.h.

◆ UDFSetFreeBitOwner

#define UDFSetFreeBitOwner (   Vcb,
  i 
)

Definition at line 1235 of file udf_info.h.

◆ UDFSetFreeBits

#define UDFSetFreeBits (   arr,
  bit,
  bc 
)    UDFSetBits(arr,bit,bc)

Definition at line 1203 of file udf_info.h.

◆ UDFSetUsedBit

#define UDFSetUsedBit (   arr,
  bit 
)    UDFClrBit(arr,bit)

Definition at line 1200 of file udf_info.h.

◆ UDFSetUsedBitOwner

#define UDFSetUsedBitOwner (   Vcb,
  i,
 
)

Definition at line 1236 of file udf_info.h.

◆ UDFSetUsedBits

#define UDFSetUsedBits (   arr,
  bit,
  bc 
)    UDFClrBits(arr,bit,bc)

Definition at line 1202 of file udf_info.h.

◆ UDFSetZeroBit

#define UDFSetZeroBit (   arr,
  bit 
)    UDFSetBit(arr,bit)

Definition at line 1208 of file udf_info.h.

◆ UDFSetZeroBits

#define UDFSetZeroBits (   arr,
  bit,
  bc 
)    UDFSetBits(arr,bit,bc)

Definition at line 1210 of file udf_info.h.

◆ UDFSparseExtent__

#define UDFSparseExtent__ (   Vcb,
  Ext,
  Off,
  Len,
  Dir,
  WB 
)    UDFZeroExtent(Vcb, Ext, Off, Len, TRUE, Dir, WB)

Definition at line 542 of file udf_info.h.

◆ UDFStreamsSupported

#define UDFStreamsSupported (   Vcb)    (Vcb->maxUDFWriteRev >= 0x0200)

Definition at line 1037 of file udf_info.h.

◆ UDFZeroExtent__

#define UDFZeroExtent__ (   Vcb,
  Ext,
  Off,
  Len,
  Dir,
  WB 
)    UDFZeroExtent(Vcb, Ext, Off, Len, FALSE, Dir, WB)

Definition at line 539 of file udf_info.h.

◆ UFD_VERIFY_FLAG_BG

#define UFD_VERIFY_FLAG_BG   0x04

Definition at line 1304 of file udf_info.h.

◆ UFD_VERIFY_FLAG_FORCE

#define UFD_VERIFY_FLAG_FORCE   0x01

Definition at line 1302 of file udf_info.h.

◆ UFD_VERIFY_FLAG_LOCKED

#define UFD_VERIFY_FLAG_LOCKED   0x10

Definition at line 1305 of file udf_info.h.

◆ UFD_VERIFY_FLAG_WAIT

#define UFD_VERIFY_FLAG_WAIT   0x02

Definition at line 1303 of file udf_info.h.

Function Documentation

◆ crc32()

uint32 __fastcall crc32 ( IN uint8 s,
IN uint32  len 
)

Definition at line 4290 of file udf_info.cpp.

4294 {
4295 #if defined(_X86_) && defined(_MSC_VER) && !defined(__clang__)
4296 // uint32 _Size = len;
4297 
4298  __asm {
4299  push ebx
4300  push ecx
4301  push edx
4302  push esi
4303 
4304  xor eax,eax
4305  mov esi,ecx // ESI <- s
4306  mov ecx,edx // ECX <- len
4307 
4308  jecxz EO_CRC
4309 
4310  lea ebx,[crc32_tab]
4311  xor edx,edx
4312 
4313 CRC_loop:
4314 
4315  mov dl,al
4316  xor dl,[esi]
4317  shr eax,8
4318  xor eax,[dword ptr ebx+edx*4]
4319  inc esi
4320  loop CRC_loop
4321 
4322 EO_CRC:
4323 
4324  pop esi
4325  pop edx
4326  pop ecx
4327  pop ebx
4328 
4329  ret
4330  }
4331 #else // NO X86 optimization , use generic C/C++
4332  uint32 i;
4333  uint32 crc32val = 0;
4334 
4335  for(i=0; i<len; i++, s++) {
4336  crc32val =
4337  crc32_tab[(crc32val ^ (*s)) & 0xff] ^ (crc32val >> 8);
4338  }
4339  return crc32val;
4340 #endif // _X86_
4341 } // end crc32()
static void xor(unsigned char *dst, const unsigned char *a, const unsigned char *b, const int count)
Definition: crypt_des.c:251
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx eax jnz xchgl ecx incl TEMP esi
Definition: synth_sse3d.h:103
static const uint32 crc32_tab[]
Definition: udf_info.cpp:86
unsigned int uint32
Definition: types.h:32
static calc_node_t * pop(void)
Definition: rpn_ieee.c:90
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
static PVOID ptr
Definition: dispmode.c:27
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
Definition: synth_sse3d.h:85
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl ebx
Definition: synth_sse3d.h:83
int ret
GLenum GLsizei len
Definition: glext.h:6722
GLdouble s
Definition: gl.h:2039
ecx edi ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx
Definition: synth_sse3d.h:85
static void push(calc_node_t *op)
Definition: rpn_ieee.c:113

◆ UDFAcquireDloc()

OSSTATUS UDFAcquireDloc ( IN PVCB  Vcb,
IN PUDF_DATALOC_INFO  Dloc 
)

Definition at line 1206 of file dirtree.cpp.

1210 {
1211  UDFAcquireResourceExclusive(&(Vcb->DlocResource2),TRUE);
1212  if(Dloc->FE_Flags & UDF_FE_FLAG_UNDER_INIT) {
1213  UDFReleaseResource(&(Vcb->DlocResource2));
1214  return STATUS_SHARING_PAUSED;
1215  }
1216  Dloc->FE_Flags |= UDF_FE_FLAG_UNDER_INIT;
1217  UDFReleaseResource(&(Vcb->DlocResource2));
1218  return STATUS_SUCCESS;
1219 } // end UDFAcquireDloc()
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define TRUE
Definition: types.h:120
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
#define Vcb
Definition: cdprocs.h:1425
#define STATUS_SHARING_PAUSED
Definition: udferr_usr.h:165
#define UDF_FE_FLAG_UNDER_INIT
Dloc is being initialized, don't touch it now.
Definition: udf_rel.h:335
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFStoreDloc().

◆ UDFAddXSpaceBitmap()

OSSTATUS UDFAddXSpaceBitmap ( IN PVCB  Vcb,
IN uint32  PartNum,
IN PSHORT_AD  bm,
IN ULONG  bm_type 
)

Definition at line 1569 of file mount.cpp.

1575 {
1576  int8* tmp;
1577  int8* tmp_bm;
1578  uint32 i, lim, j, lba, l, lim2, l2, k;
1579  lb_addr locAddr;
1580  OSSTATUS status;
1581  uint16 Ident;
1582  uint32 flags;
1583  SIZE_T Length;
1584  SIZE_T ReadBytes;
1585  BOOLEAN bit_set;
1586 
1588  UDFPrint(("UDFAddXSpaceBitmap: at block=%x, partition=%d\n",
1589  bm->extPosition,
1590  PartNum));
1591 
1592  if(!(Length = (bm->extLength & UDF_EXTENT_LENGTH_MASK))) return STATUS_SUCCESS;
1593  i=UDFPartStart(Vcb, PartNum);
1594  flags = bm->extLength >> 30;
1595  if(!flags /*|| flags == EXTENT_NOT_RECORDED_ALLOCATED*/) {
1596  tmp = (int8*)DbgAllocatePool(NonPagedPool, max(Length, Vcb->BlockSize));
1597  if(!tmp) return STATUS_INSUFFICIENT_RESOURCES;
1598  locAddr.partitionReferenceNum = (uint16)PartNum;
1599  locAddr.logicalBlockNum = bm->extPosition;
1600  // read header of the Bitmap
1601  if(!OS_SUCCESS(status = UDFReadTagged(Vcb, tmp, lba = UDFPartLbaToPhys(Vcb, &(locAddr)),
1602  locAddr.logicalBlockNum, &Ident)) ) {
1603 err_addxsbm_1:
1604  DbgFreePool(tmp);
1605  return status;
1606  }
1607  if(Ident != TID_SPACE_BITMAP_DESC) {
1609  goto err_addxsbm_1;
1610  }
1611  UDFRegisterFsStructure(Vcb, lba, Vcb->BlockSize);
1612  // read the whole Bitmap
1613  if(!OS_SUCCESS(status = UDFReadData(Vcb, FALSE, ((uint64)lba)<<Vcb->BlockSizeBits, Length, FALSE, tmp, &ReadBytes)))
1614  goto err_addxsbm_1;
1616  lim = min(i + ((lim2 = ((PSPACE_BITMAP_DESC)tmp)->numOfBits) << Vcb->LB2B_Bits), Vcb->FSBM_BitCount);
1617  tmp_bm = tmp + sizeof(SPACE_BITMAP_DESC);
1618  j = 0;
1619  for(;(l = UDFGetBitmapLen((uint32*)tmp_bm, j, lim2)) && (i<lim);) {
1620  // expand LBlocks to Sectors...
1621  l2 = l << Vcb->LB2B_Bits;
1622  // ...and mark them
1623  if(bm_type == UDF_FSPACE_BM) {
1624  bit_set = UDFGetFreeBit(tmp_bm, j);
1625  for(k=0;(k<l2) && (i<lim);k++) {
1626  if(bit_set) {
1627  // FREE block
1628  UDFSetFreeBit(Vcb->FSBM_Bitmap, i);
1630  UDFSetZeroBit(Vcb->ZSBM_Bitmap, i);
1631  } else {
1632  // USED block
1633  UDFClrZeroBit(Vcb->ZSBM_Bitmap, i);
1634  }
1635  i++;
1636  }
1637  } else {
1638  bit_set = UDFGetZeroBit(tmp_bm, j);
1639  for(k=0;(k<l2) && (i<lim);k++) {
1640  if(bit_set) {
1641  // ZERO block
1642  UDFSetZeroBit(Vcb->ZSBM_Bitmap, i);
1643  } else {
1644  // DATA block
1645  UDFClrZeroBit(Vcb->ZSBM_Bitmap, i);
1646  }
1647  i++;
1648  }
1649  }
1650  j += l;
1651  }
1652  DbgFreePool(tmp);
1653 /* } else if((bm->extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED) {
1654  i=Vcb->Partitions[PartNum].PartitionRoot;
1655  lim = i + Vcb->Partitions[PartNum].PartitionLen;
1656  for(;i<lim;i++) {
1657  UDFSetUsedBit(Vcb->FSBM_Bitmap, i);
1658  }*/
1659  }
1660  return STATUS_SUCCESS;
1661 } // end UDFAddXSpaceBitmap()
unsigned long long uint64
Definition: platform.h:18
#define DbgAllocatePool
Definition: env_spec_w32.h:332
#define max(a, b)
Definition: svc.c:63
#define UDFPrint(Args)
Definition: udffs.h:225
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
unsigned int uint32
Definition: types.h:32
#define UDFSetFreeBit(arr, bit)
Definition: udf_info.h:1201
#define UDFRegisterFsStructure(Vcb, Lba, Length)
Definition: udf_info.h:1250
#define UDF_FSPACE_BM
Definition: udf_info.h:445
OSSTATUS UDFReadData(IN PVCB Vcb, IN BOOLEAN Translate, IN LONGLONG Offset, IN ULONG Length, IN BOOLEAN Direct, OUT PCHAR Buffer, OUT PSIZE_T ReadBytes)
#define lba
struct _SPACE_BITMAP_DESC SPACE_BITMAP_DESC
#define UDFSetFreeBitOwner(Vcb, i)
Definition: udf_info.h:1235
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
uint32 __fastcall UDFPartLbaToPhys(IN PVCB Vcb, IN lb_addr *Addr)
Definition: alloc.cpp:114
#define OSSTATUS
Definition: env_spec_w32.h:57
unsigned char BOOLEAN
uint32 __fastcall UDFPartStart(PVCB Vcb, uint32 PartNum)
Definition: alloc.cpp:222
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
#define DbgFreePool
Definition: env_spec_w32.h:334
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
r l[0]
Definition: byte_order.h:167
#define UDFSetZeroBit(arr, bit)
Definition: udf_info.h:1208
#define UDFClrZeroBit(arr, bit)
Definition: udf_info.h:1209
#define Vcb
Definition: cdprocs.h:1425
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
GLbitfield flags
Definition: glext.h:7161
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define TID_SPACE_BITMAP_DESC
Definition: ecma_167.h:173
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short uint16
Definition: types.h:30
uint32 logicalBlockNum
Definition: ecma_167.h:362
#define min(a, b)
Definition: monoChain.cc:55
OSSTATUS UDFReadTagged(PVCB Vcb, int8 *Buf, uint32 Block, uint32 Location, uint16 *Ident)
Definition: udf_info.cpp:4586
uint16 partitionReferenceNum
Definition: ecma_167.h:363
#define UDF_CHECK_BITMAP_RESOURCE(Vcb)
Definition: udffs.h:264
#define STATUS_DISK_CORRUPT_ERROR
Definition: udferr_usr.h:147
#define UDFGetZeroBit(arr, bit)
Definition: udf_info.h:1207
#define UDFGetFreeBit(arr, bit)
Definition: udf_info.h:1199
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148
SIZE_T __stdcall UDFGetBitmapLen(uint32 *Bitmap, SIZE_T Offs, SIZE_T Lim)
Definition: alloc.cpp:496
int k
Definition: mpi.c:3369
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFBuildFreeSpaceBitmap().

◆ UDFAllocateFESpace()

OSSTATUS UDFAllocateFESpace ( IN PVCB  Vcb,
IN PUDF_FILE_INFO  DirInfo,
IN uint32  PartNum,
IN PEXTENT_INFO  FEExtInfo,
IN uint32  Len 
)

Definition at line 1563 of file extent.cpp.

1570 {
1571 #ifdef UDF_FE_ALLOCATION_CHARGE // UDF_FE_ALLOCATION_CHARGE
1572  OSSTATUS status;
1573  PEXTENT_INFO Ext;
1574  EXTENT_AD Extent;
1575  BOOLEAN retry = FALSE;
1576  uint32 i, lim;
1577 
1578 /*
1579  1. #Dir1#->*File* -> Dir1's FECharge
1580  2. #Dir1#->*Dir* -> Dir1's FECharge
1581  3. #Dir1#->*SDir* -> Dir1's FECharge
1582  4. Dir1->#SDir#->*Stream* -> Dir1's FEChargeSDir
1583  5. Dir1->#File#->*SDir* -> Dir1's FEChargeSDir
1584  6. Dir1->#Dir#->*SDir* -> (see p.2)
1585  7. Dir1->File->#SDir#->*Stream* -> Dir1's FEChargeSDir
1586  8. Dir1->Dir->#SDir#->*Stream* -> (see p.4)
1587 
1588 ## ~ DirInfo
1589 ** ~ Object to be created
1590 
1591 */
1592 
1593 // ASSERT(!FEExtInfo->Mapping);
1594  // check if DirInfo we are called with is a Directory
1595  // (it can be a file with SDir)
1596  if(!DirInfo || !DirInfo->Dloc->DirIndex ||
1597  ((lim = ((DirInfo->Dloc->FE_Flags & UDF_FE_FLAG_IS_SDIR) ? Vcb->FEChargeSDir : Vcb->FECharge)) <= 1))
1598 #endif // UDF_FE_ALLOCATION_CHARGE
1599  return UDFAllocFreeExtent(Vcb, Len,
1600  UDFPartStart(Vcb, PartNum), UDFPartEnd(Vcb, PartNum), FEExtInfo, EXTENT_FLAG_VERIFY);
1601 #ifdef UDF_FE_ALLOCATION_CHARGE // UDF_FE_ALLOCATION_CHARGE
1602 
1603  Ext = &(DirInfo->Dloc->DirIndex->FECharge);
1604 
1605  while(TRUE) {
1606 
1607  if(!Ext->Mapping) {
1608  ULONG p_start;
1609  ULONG p_end;
1610  ULONG fe_loc;
1611  ULONG l1, l2;
1612 
1613  p_start = UDFPartStart(Vcb, PartNum);
1614  p_end = UDFPartEnd(Vcb, PartNum);
1615  fe_loc = DirInfo->Dloc->FELoc.Mapping[0].extLocation;
1616 
1618  if(OS_SUCCESS(status)) {
1619  // do nothing, even do not unpack
1620  } else
1621  if(Vcb->LowFreeSpace) {
1622  status = UDFAllocFreeExtent(Vcb, Len << Vcb->LBlockSizeBits,p_start, p_end, FEExtInfo, EXTENT_FLAG_VERIFY);
1623  if(OS_SUCCESS(status)) {
1624  UDFPrint(("FE @ %x (1)\n", FEExtInfo->Mapping[0].extLocation ));
1625  }
1626  return status;
1627  } else {
1628  if(fe_loc > p_start + 512*16) {
1629  l1 = fe_loc - 512*16;
1630  } else {
1631  l1 = p_start;
1632  }
1633  if(fe_loc + 512*16 < p_end) {
1634  l2 = fe_loc + 512*16;
1635  } else {
1636  l2 = p_end;
1637  }
1638  status = UDFAllocFreeExtent(Vcb, lim << Vcb->LBlockSizeBits, l1, l2, Ext, EXTENT_FLAG_VERIFY);
1639  if(!OS_SUCCESS(status)) {
1640  status = UDFAllocFreeExtent(Vcb, lim << Vcb->LBlockSizeBits, (p_start+fe_loc)/2, (fe_loc+p_end)/2, Ext, EXTENT_FLAG_VERIFY);
1641  }
1642  if(!OS_SUCCESS(status)) {
1643  status = UDFAllocFreeExtent(Vcb, lim << Vcb->LBlockSizeBits, p_start, p_end, Ext, EXTENT_FLAG_VERIFY);
1644  }
1645  if(!OS_SUCCESS(status)) {
1646  status = UDFAllocFreeExtent(Vcb, lim << Vcb->LBlockSizeBits, p_start+1024, p_end-1024, Ext, EXTENT_FLAG_VERIFY);
1647  }
1648  if(!OS_SUCCESS(status = UDFAllocFreeExtent(Vcb, lim << Vcb->LBlockSizeBits, p_start, p_end, Ext, EXTENT_FLAG_VERIFY) )) {
1649  // can't pre-allocate space for multiple FEs. Try single FE
1650  UDFPrint(("allocate single FE entry\n"));
1652  p_start, p_end, FEExtInfo, EXTENT_FLAG_VERIFY);
1653  if(OS_SUCCESS(status)) {
1654  UDFPrint(("FE @ %x (2)\n", FEExtInfo->Mapping[0].extLocation ));
1655  }
1656  return status;
1657  }
1659  if(!OS_SUCCESS(status)) {
1660  MyFreePool__(Ext->Mapping);
1661  Ext->Mapping = NULL;
1662  return status;
1663  }
1664  }
1665  }
1666 
1667  for(i=0;i<lim;i++) {
1668  if( (Ext->Mapping[i].extLength >> 30) == EXTENT_NOT_RECORDED_ALLOCATED ) {
1669  Ext->Mapping[i].extLength &= UDF_EXTENT_LENGTH_MASK; // EXTENT_RECORDED_ALLOCATED
1670 
1671  Extent.extLength = Vcb->LBlockSize | (EXTENT_NOT_RECORDED_ALLOCATED << 30);
1672  Extent.extLocation = Ext->Mapping[i].extLocation;
1673 
1674  if(Vcb->BSBM_Bitmap) {
1675  uint32 lba = Ext->Mapping[i].extLocation;
1676  if(UDFGetBadBit((uint32*)(Vcb->BSBM_Bitmap), lba)) {
1677  UDFPrint(("Remove BB @ %x from FE charge\n", lba));
1678  Ext->Mapping[i].extLength |= (EXTENT_NOT_RECORDED_NOT_ALLOCATED << 30);
1679  Ext->Mapping[i].extLocation = 0;
1680  continue;
1681  }
1682  }
1683 
1684  FEExtInfo->Mapping = UDFExtentToMapping(&Extent);
1685  if(!FEExtInfo->Mapping) {
1686  ASSERT(!(Ext->Mapping[i].extLength >> 30));
1687  Ext->Mapping[i].extLength |= (EXTENT_NOT_RECORDED_ALLOCATED << 30);
1689  }
1690  UDFPrint(("FE @ %x (3)\n", FEExtInfo->Mapping[0].extLocation ));
1691  FEExtInfo->Length = Len;
1692  FEExtInfo->Offset = 0;
1693  FEExtInfo->Modified = TRUE;
1694  return STATUS_SUCCESS;
1695  }
1696  }
1697 
1698  if(Vcb->LowFreeSpace) {
1700  UDFPartStart(Vcb, PartNum), UDFPartEnd(Vcb, PartNum), FEExtInfo, EXTENT_FLAG_VERIFY);
1701  if(OS_SUCCESS(status)) {
1702  UDFPrint(("FE @ %x (4)\n", FEExtInfo->Mapping[0].extLocation ));
1703  }
1704  return status;
1705  }
1706  if(retry)
1708 
1709  // we can get here if there are no free slots in
1710  // preallocated FE charge. So, we should release
1711  // memory and try to allocate space for new FE charge.
1712  MyFreePool__(Ext->Mapping);
1713  Ext->Mapping = NULL;
1714  retry = TRUE;
1715  }
1717 #endif // UDF_FE_ALLOCATION_CHARGE
1718 
1719 } // end UDFAllocateFESpace()
#define EXTENT_FLAG_VERIFY
Definition: udf_rel.h:81
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
unsigned int uint32
Definition: types.h:32
#define UDF_FE_FLAG_IS_SDIR
File is a StreamDir.
Definition: udf_rel.h:327
#define UDF_PREALLOC_CLASS_FE
Definition: udf_info.h:355
OSSTATUS __fastcall UDFUnPackMapping(IN PVCB Vcb, IN PEXTENT_INFO ExtInfo)
Definition: extent.cpp:2860
#define lba
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
#define OSSTATUS
Definition: env_spec_w32.h:57
unsigned char BOOLEAN
#define EXTENT_NOT_RECORDED_NOT_ALLOCATED
Definition: ecma_167.h:369
smooth NULL
Definition: ftsmooth.c:416
uint32 __fastcall UDFPartStart(PVCB Vcb, uint32 PartNum)
Definition: alloc.cpp:222
#define UDFGetBadBit(arr, bit)
Definition: udf_info.h:1205
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define EXTENT_NOT_RECORDED_ALLOCATED
Definition: ecma_167.h:368
#define Len
Definition: deflate.h:82
OSSTATUS UDFGetCachedAllocation(IN PVCB Vcb, IN uint32 ParentLocation, OUT PEXTENT_INFO Ext, OUT uint32 *Items, IN uint32 AllocClass)
Definition: extent.cpp:1417
#define UDFExtentToMapping(e)
Definition: udf_info.h:181
static struct proto Ext[]
Definition: mkg3states.c:87
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
uint32 __fastcall UDFPartEnd(PVCB Vcb, uint32 PartNum)
Definition: alloc.cpp:242
unsigned int ULONG
Definition: retypes.h:1
#define UDFAllocFreeExtent(v, l, ss, sl, e, af)
Definition: udf_info.h:347
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148
Definition: ps.c:97

Referenced by UDFBuildFileEntry(), and UDFFlushFE().

◆ UDFAllocFreeExtent_()

OSSTATUS UDFAllocFreeExtent_ ( IN PVCB  Vcb,
IN int64  Length,
IN uint32  SearchStart,
IN uint32  SearchLim,
OUT PEXTENT_INFO  Extent,
IN uint8  AllocFlags 
)

Definition at line 963 of file alloc.cpp.

975 {
976  EXTENT_AD Ext;
977  PEXTENT_MAP Map = NULL;
978  uint32 len, LBS, BSh, blen;
979 
980  LBS = Vcb->LBlockSize;
981  BSh = Vcb->BlockSizeBits;
982  blen = (uint32)(((Length+LBS-1) & ~((int64)LBS-1)) >> BSh);
983  ExtInfo->Mapping = NULL;
984  ExtInfo->Offset = 0;
985 
986  ASSERT(blen <= (uint32)(UDF_MAX_EXTENT_LENGTH >> BSh));
987 
988  UDFAcquireResourceExclusive(&(Vcb->BitMapResource1),TRUE);
989 
990  if(blen > (SearchLim - SearchStart)) {
991  goto no_free_space_err;
992  }
993  // walk through the free space bitmap & find a single extent or a set of
994  // frags giving in sum the Length specified
995  while(blen) {
996  Ext.extLocation = UDFFindMinSuitableExtent(Vcb, blen, SearchStart,
997  SearchLim, &len, AllocFlags);
998 
999 // ASSERT(len <= (uint32)(UDF_MAX_EXTENT_LENGTH >> BSh));
1000  if(len >= blen) {
1001  // complete search
1002  Ext.extLength = blen<<BSh;
1003  blen = 0;
1004  } else if(len) {
1005  // we need still some frags to complete request &
1006  // probably we have the opportunity to do it
1007  Ext.extLength = len<<BSh;
1008  blen -= len;
1009  } else {
1010 no_free_space_err:
1011  // no more free space. abort
1012  if(ExtInfo->Mapping) {
1013  UDFMarkSpaceAsXXXNoProtect(Vcb, 0, ExtInfo->Mapping, AS_DISCARDED); // free
1014  MyFreePool__(ExtInfo->Mapping);
1015  ExtInfo->Mapping = NULL;
1016  }
1017  UDFReleaseResource(&(Vcb->BitMapResource1));
1018  ExtInfo->Length = 0;//UDFGetExtentLength(ExtInfo->Mapping);
1019  AdPrint((" DISK_FULL\n"));
1020  return STATUS_DISK_FULL;
1021  }
1022  // append the frag found to mapping
1023  ASSERT(!(Ext.extLength >> 30));
1024  ASSERT(Ext.extLocation);
1025 
1026  // mark newly allocated blocks as zero-filled
1027  UDFSetZeroBits(Vcb->ZSBM_Bitmap, Ext.extLocation, (Ext.extLength & UDF_EXTENT_LENGTH_MASK) >> BSh);
1028 
1029  if(AllocFlags & EXTENT_FLAG_VERIFY) {
1030  if(!UDFCheckArea(Vcb, Ext.extLocation, Ext.extLength >> BSh)) {
1031  AdPrint(("newly allocated extent contains BB\n"));
1032  UDFMarkSpaceAsXXXNoProtect(Vcb, 0, ExtInfo->Mapping, AS_DISCARDED); // free
1033  UDFMarkBadSpaceAsUsed(Vcb, Ext.extLocation, Ext.extLength >> BSh); // bad -> bad+used
1034  // roll back
1035  blen += Ext.extLength>>BSh;
1036  continue;
1037  }
1038  }
1039 
1040  Ext.extLength |= EXTENT_NOT_RECORDED_ALLOCATED << 30;
1041  if(!(ExtInfo->Mapping)) {
1042  // create new
1043 #ifdef UDF_TRACK_ALLOC_FREE_EXTENT
1044  ExtInfo->Mapping = UDFExtentToMapping_(&Ext, src, line);
1045 #else // UDF_TRACK_ALLOC_FREE_EXTENT
1046  ExtInfo->Mapping = UDFExtentToMapping(&Ext);
1047 #endif // UDF_TRACK_ALLOC_FREE_EXTENT
1048  if(!ExtInfo->Mapping) {
1049  BrutePoint();
1050  UDFReleaseResource(&(Vcb->BitMapResource1));
1051  ExtInfo->Length = 0;
1053  }
1054  UDFMarkSpaceAsXXXNoProtect(Vcb, 0, ExtInfo->Mapping, AS_USED); // used
1055  } else {
1056  // update existing
1057  Map = UDFExtentToMapping(&Ext);
1058  if(!Map) {
1059  BrutePoint();
1060  UDFReleaseResource(&(Vcb->BitMapResource1));
1061  ExtInfo->Length = UDFGetExtentLength(ExtInfo->Mapping);
1063  }
1064  UDFMarkSpaceAsXXXNoProtect(Vcb, 0, Map, AS_USED); // used
1065  ExtInfo->Mapping = UDFMergeMappings(ExtInfo->Mapping, Map);
1066  MyFreePool__(Map);
1067  }
1068  if(!ExtInfo->Mapping) {
1069  BrutePoint();
1070  UDFReleaseResource(&(Vcb->BitMapResource1));
1071  ExtInfo->Length = 0;
1073  }
1074  }
1075  UDFReleaseResource(&(Vcb->BitMapResource1));
1076  ExtInfo->Length = Length;
1077  return STATUS_SUCCESS;
1078 } // end UDFAllocFreeExtent_()
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define EXTENT_FLAG_VERIFY
Definition: udf_rel.h:81
#define TRUE
Definition: types.h:120
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define AdPrint(_x_)
Definition: env_spec_w32.h:292
unsigned int uint32
Definition: types.h:32
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
long long int64
Definition: platform.h:13
void UDFMarkBadSpaceAsUsed(IN PVCB Vcb, IN lba_t lba, IN ULONG len)
Definition: alloc.cpp:761
#define UDFSetZeroBits(arr, bit, bc)
Definition: udf_info.h:1210
SIZE_T UDFFindMinSuitableExtent(IN PVCB Vcb, IN uint32 Length, IN uint32 SearchStart, IN uint32 SearchLim, OUT uint32 *MaxExtLen, IN uint8 AllocFlags)
Definition: alloc.cpp:556
smooth NULL
Definition: ftsmooth.c:416
#define UDFMarkSpaceAsXXXNoProtect(Vcb, FileInfo, Map, asXXX)
Definition: udf_info.h:302
PEXTENT_MAP __fastcall UDFExtentToMapping_(IN PEXTENT_AD Extent)
Definition: extent.cpp:189
Definition: parser.c:48
int64 UDFGetExtentLength(IN PEXTENT_MAP Extent)
Definition: extent.cpp:142
PEXTENT_MAP __fastcall UDFMergeMappings(IN PEXTENT_MAP Extent, IN PEXTENT_MAP Extent2)
Definition: extent.cpp:266
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define BrutePoint()
Definition: env_spec_w32.h:504
#define EXTENT_NOT_RECORDED_ALLOCATED
Definition: ecma_167.h:368
#define UDFExtentToMapping(e)
Definition: udf_info.h:181
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static struct proto Ext[]
Definition: mkg3states.c:87
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define UDF_MAX_EXTENT_LENGTH
Definition: udf_rel.h:511
GLenum GLsizei len
Definition: glext.h:6722
GLenum src
Definition: glext.h:6340
#define AS_USED
Definition: udf_info.h:327
#define AS_DISCARDED
Definition: udf_info.h:328
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
return STATUS_SUCCESS
Definition: btrfs.c:2938
BOOLEAN __fastcall UDFCheckArea(IN PVCB Vcb, IN lba_t LBA, IN uint32 BCount)
Definition: remap.cpp:763
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148

◆ UDFAreSectorsRelocated()

BOOLEAN __fastcall UDFAreSectorsRelocated ( IN PVCB  Vcb,
IN uint32  Lba,
IN uint32  BlockCount 
)

Definition at line 982 of file remap.cpp.

987 {
988 
989  if(Vcb->SparingTable) {
990  // use sparing table for relocation
991  uint32 i, BS, orig;
992  BS = Vcb->SparingBlockSize;
993  PSPARING_MAP Map;
994 
995  Map = Vcb->SparingTable;
996  for(i=0;i<Vcb->SparingCount;i++,Map++) {
997  if( ((Lba >= (orig = Map->origLocation)) && (Lba < orig + BS)) ||
998  ((Lba+BlockCount-1 >= orig) && (Lba+BlockCount-1 < orig + BS)) ||
999  ((orig >= Lba) && (orig < Lba+BlockCount)) ||
1000  ((orig+BS >= Lba) && (orig+BS < Lba+BlockCount)) ) {
1001  return TRUE;
1002  }
1003  }
1004  } else if(Vcb->Vat) {
1005  // use VAT for relocation
1006  uint32 i, root, j;
1007  uint32* Map;
1008  if(Lba < (root = Vcb->Partitions[Vcb->VatPartNdx].PartitionRoot))
1009  return FALSE;
1010  if(Lba+BlockCount >= Vcb->NWA)
1011  return TRUE;
1012  Map = &(Vcb->Vat[Lba-root/*+i*/]);
1013  for(i=0; i<BlockCount; i++, Map++) {
1014  if((j = (*Map)) &&
1015  (j != Lba-root+i) &&
1016  ((j != UDF_VAT_FREE_ENTRY) || ((Lba+i) < Vcb->LastLBA)))
1017  return TRUE;
1018  }
1019  }
1020  return FALSE;
1021 } // end UDFAreSectorsRelocated()
#define TRUE
Definition: types.h:120
uint32 origLocation
Definition: osta_misc.h:191
unsigned int uint32
Definition: types.h:32
struct _root root
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
#define UDF_VAT_FREE_ENTRY
Definition: osta_misc.h:71
struct _ACPI_EFI_BOOT_SERVICES * BS
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
#define Vcb
Definition: cdprocs.h:1425

Referenced by UDFRelocateSectors().

◆ UDFBuildAllocDescs()

OSSTATUS UDFBuildAllocDescs ( IN PVCB  Vcb,
IN uint32  PartNum,
IN OUT PUDF_FILE_INFO  FileInfo,
OUT int8 **  AllocData 
)

Definition at line 2628 of file extent.cpp.

2634 {
2635 // PEXTENT_MAP InMap;
2636 // uint32 i=0;
2637  int8* Allocs;
2638  uint16 AllocMode;
2639  uint32 InitSz;
2640  OSSTATUS status;
2641 
2643  AdPrint(("BuildAllocDesc\n"));
2644  // get space available in the 1st LBlock after FE
2645  InitSz = Vcb->LBlockSize - FileInfo->Dloc->FileEntryLen;
2646  Allocs = (int8*)MyAllocatePool__(NonPagedPool, InitSz);
2647  if(!Allocs) {
2648  *AllocData = NULL;
2649  AdPrint(("BuildAllocDesc: cant alloc %x bytes for Allocs\n", InitSz));
2651  }
2652  RtlZeroMemory(Allocs, InitSz);
2653 // InMap = FileInfo->Dloc->DataLoc.Mapping;
2654  UDFCheckSpaceAllocation(Vcb, 0, InMap, AS_USED); // check if used
2655 
2656  // TODO: move data from mapped locations here
2657 
2658  AllocMode = ((PFILE_ENTRY)(FileInfo->Dloc->FileEntry))->icbTag.flags & ICB_FLAG_ALLOC_MASK;
2659  switch(AllocMode) {
2660  case ICB_FLAG_AD_IN_ICB: {
2661  MyFreePool__(Allocs);
2662  ASSERT(!FileInfo->Dloc->AllocLoc.Mapping);
2663  Allocs = NULL;
2665  break;
2666  }
2667  case ICB_FLAG_AD_SHORT: {
2668  status = UDFBuildShortAllocDescs(Vcb, PartNum, &Allocs, InitSz, FileInfo);
2669  break;
2670  }
2671  case ICB_FLAG_AD_LONG: {
2672  status = UDFBuildLongAllocDescs(Vcb, PartNum, &Allocs, InitSz, FileInfo);
2673  break;
2674  }
2675 /* case ICB_FLAG_AD_EXTENDED: {
2676  status = UDFBuildExtAllocDescs(Vcb, PartNum, &Allocs, InitSz, FileInfo);
2677  break;
2678  }*/
2679  default: {
2680  MyFreePool__(Allocs);
2681  Allocs = NULL;
2683  }
2684  }
2685 
2686  *AllocData = Allocs;
2687  UDFCheckSpaceAllocation(Vcb, 0, FileInfo->Dloc->DataLoc.Mapping, AS_USED); // check if used
2688 
2689  return status;
2690 } // end UDFBuildAllocDescs()
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define AdPrint(_x_)
Definition: env_spec_w32.h:292
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
OSSTATUS UDFBuildShortAllocDescs(IN PVCB Vcb, IN uint32 PartNum, OUT int8 **Buff, IN uint32 InitSz, IN OUT PUDF_FILE_INFO FileInfo)
Definition: extent.cpp:825
unsigned int uint32
Definition: types.h:32
#define ICB_FLAG_AD_LONG
Definition: ecma_167.h:494
struct _FILE_ENTRY * PFILE_ENTRY
#define UDFCheckSpaceAllocation(Vcb, FileInfo, Map, asXXX)
Definition: udf_info.h:281
#define OSSTATUS
Definition: env_spec_w32.h:57
#define ICB_FLAG_AD_SHORT
Definition: ecma_167.h:493
smooth NULL
Definition: ftsmooth.c:416
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
#define ICB_FLAG_AD_IN_ICB
Definition: ecma_167.h:496
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
#define AS_USED
Definition: udf_info.h:327
unsigned short uint16
Definition: types.h:30
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
#define ICB_FLAG_ALLOC_MASK
Definition: ecma_167.h:480
OSSTATUS UDFBuildLongAllocDescs(IN PVCB Vcb, IN uint32 PartNum, OUT int8 **Buff, IN uint32 InitSz, IN OUT PUDF_FILE_INFO FileInfo)
Definition: extent.cpp:1012
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFFlushFE().

◆ UDFBuildFileEntry()

OSSTATUS UDFBuildFileEntry ( IN PVCB  Vcb,
IN PUDF_FILE_INFO  DirInfo,
IN PUDF_FILE_INFO  FileInfo,
IN uint32  PartNum,
IN uint16  AllocMode,
IN uint32  ExtAttrSz,
IN BOOLEAN  Extended 
)

Definition at line 971 of file udf_info.cpp.

980 {
981  PFILE_ENTRY FileEntry;
983 // EntityID* eID;
984  uint32 l;
985  EXTENT_INFO _FEExtInfo;
986  uint16* lcp;
987 
988  ASSERT(!PartNum);
989  ASSERT(!ExtAttrSz);
990  // calculate the length required
991  l = (Extended ? sizeof(EXTENDED_FILE_ENTRY) : sizeof(FILE_ENTRY)) + ExtAttrSz;
992  if(l > Vcb->LBlockSize) return STATUS_INVALID_PARAMETER;
993  // allocate block for FE
994  if(!OS_SUCCESS(status = UDFAllocateFESpace(Vcb, DirInfo, PartNum, &_FEExtInfo, l) ))
995  return status;
996  // remember FE location for future hard link creation
997  ASSERT(UDFFindDloc(Vcb, _FEExtInfo.Mapping[0].extLocation) == (-1));
998  if(!OS_SUCCESS(status = UDFStoreDloc(Vcb, FileInfo, _FEExtInfo.Mapping[0].extLocation))) {
1000  UDFFreeFESpace(Vcb, DirInfo, &_FEExtInfo); // free
1001  MyFreePool__(_FEExtInfo.Mapping);
1002  return status;
1003  }
1005  if(!FileEntry) {
1006  UDFRemoveDloc(Vcb, FileInfo->Dloc);
1007  FileInfo->Dloc = NULL;
1008  UDFFreeFESpace(Vcb, DirInfo, &_FEExtInfo); // free
1009  MyFreePool__(_FEExtInfo.Mapping);
1011  }
1012  FileInfo->Dloc->FELoc = _FEExtInfo;
1013 
1014  RtlZeroMemory((int8*)FileEntry, l);
1015  // set up in-memory FE structure
1016  FileEntry->icbTag.flags = AllocMode;
1017  FileEntry->icbTag.fileType = UDF_FILE_TYPE_REGULAR;
1018  FileEntry->icbTag.numEntries = 1;
1019 // if(DirInfo && DirInfo->Dloc && DirInfo->Dloc
1020  FileEntry->icbTag.strategyType = 4;
1021 // FileEntry->icbTag.strategyParameter = 0;
1022  FileEntry->descTag.tagIdent = Extended ? TID_EXTENDED_FILE_ENTRY : TID_FILE_ENTRY;
1023  FileEntry->descTag.tagLocation = UDFPhysLbaToPart(Vcb, PartNum, _FEExtInfo.Mapping[0].extLocation);
1024  FileEntry->uid = Vcb->DefaultUID;
1025  FileEntry->gid = Vcb->DefaultGID;
1026 
1027  if(Extended) {
1028 // eID = &(((PEXTENDED_FILE_ENTRY)FileEntry)->impIdent);
1029  lcp = &(((PEXTENDED_FILE_ENTRY)FileEntry)->fileLinkCount);
1030  ((PEXTENDED_FILE_ENTRY)FileEntry)->checkpoint = 1;
1031  } else {
1032 // eID = &(FileEntry->impIdent);
1033  lcp = &(FileEntry->fileLinkCount);
1034  ((PFILE_ENTRY)FileEntry)->checkpoint = 1;
1035  }
1036 
1037 #if 0
1039 #endif
1040 
1041  /*RtlCopyMemory((int8*)&(eID->ident), UDF_ID_DEVELOPER, sizeof(UDF_ID_DEVELOPER) );
1042  iis = (impIdentSuffix*)&(eID->identSuffix);
1043  iis->OSClass = UDF_OS_CLASS_WINNT;
1044  iis->OSIdent = UDF_OS_ID_WINNT;*/
1045 
1046  *lcp = 0xffff;
1047 
1048  FileInfo->Dloc->FileEntry = (tag*)FileEntry;
1049  FileInfo->Dloc->FileEntryLen = l;
1050 
1051  FileInfo->Dloc->FE_Flags |= UDF_FE_FLAG_FE_MODIFIED;
1052 
1053  return STATUS_SUCCESS;
1054 } // end UDFBuildFileEntry()
uint16 tagIdent
Definition: ecma_167.h:139
OSSTATUS UDFAllocateFESpace(IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN uint32 PartNum, IN PEXTENT_INFO FEExtInfo, IN uint32 Len)
Definition: extent.cpp:1563
uint32 gid
Definition: ecma_167.h:517
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
struct _EXTENDED_FILE_ENTRY EXTENDED_FILE_ENTRY
#define UDFSetEntityID_imp(eID, Str)
Definition: udf_info.h:598
unsigned int uint32
Definition: types.h:32
uint16 fileLinkCount
Definition: ecma_167.h:519
struct _FILE_ENTRY * PFILE_ENTRY
uint32 extLocation
Definition: ecma_167.h:129
Definition: ecma_167.h:138
uint16 numEntries
Definition: ecma_167.h:456
uint32 tagLocation
Definition: ecma_167.h:146
#define MEM_FE_TAG
Definition: udf_rel.h:486
PEXTENT_MAP Mapping
Definition: udf_rel.h:66
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
#define UDF_ID_DEVELOPER
Definition: osta_misc.h:20
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
void UDFFreeFESpace(IN PVCB Vcb, IN PUDF_FILE_INFO DirInfo, IN PEXTENT_INFO FEExtInfo)
Definition: extent.cpp:1725
OSSTATUS UDFStoreDloc(IN PVCB Vcb, IN PUDF_FILE_INFO fi, IN uint32 Lba)
Definition: dirtree.cpp:1240
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
r l[0]
Definition: byte_order.h:167
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define UDF_FILE_TYPE_REGULAR
Definition: ecma_167.h:469
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
Definition: ecma_167.h:513
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define STATUS_SHARING_PAUSED
Definition: udferr_usr.h:165
uint32 uid
Definition: ecma_167.h:516
Definition: shlfileop.cpp:55
#define MyAllocatePoolTag__(type, size, tag)
Definition: mem_tools.h:150
OSSTATUS UDFRemoveDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
Definition: dirtree.cpp:1299
tag descTag
Definition: ecma_167.h:514
icbtag icbTag
Definition: ecma_167.h:515
unsigned short uint16
Definition: types.h:30
uint16 flags
Definition: ecma_167.h:460
uint16 strategyType
Definition: ecma_167.h:454
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
uint8 fileType
Definition: ecma_167.h:458
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
LONG UDFFindDloc(IN PVCB Vcb, IN uint32 Lba)
Definition: dirtree.cpp:1127
#define TID_FILE_ENTRY
Definition: ecma_167.h:170
return STATUS_SUCCESS
Definition: btrfs.c:2938
static SERVICE_STATUS status
Definition: service.c:31
uint32 UDFPhysLbaToPart(IN PVCB Vcb, IN uint32 PartNum, IN uint32 Addr)
Definition: alloc.cpp:46
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFCreateFile__(), and UDFCreateRootFile__().

◆ UDFBuildFileIdent()

OSSTATUS UDFBuildFileIdent ( IN PVCB  Vcb,
IN PUNICODE_STRING  fn,
IN PLONG_AD  FileEntryIcb,
IN uint32  ImpUseLen,
OUT PFILE_IDENT_DESC _FileId,
OUT uint32 FileIdLen 
)

Definition at line 1107 of file udf_info.cpp.

1115 {
1116  PFILE_IDENT_DESC FileId;
1117  uint8* CS0;
1118  SIZE_T Nlen;
1119  uint32 l;
1120  // prepare filename
1121  UDFCompressUnicode(fn, &CS0, &Nlen);
1122  if(!CS0) return STATUS_INSUFFICIENT_RESOURCES;
1123  if(Nlen < 2) {
1124  Nlen = 0;
1125  } else
1126  if(Nlen > UDF_NAME_LEN) {
1127  if(CS0) MyFreePool__(CS0);
1129  }
1130  // allocate memory for FI
1131  l = (sizeof(FILE_IDENT_DESC) + Nlen + ImpUseLen + 3) & ~((uint32)3);
1133  if(!FileId) {
1134  if(CS0) MyFreePool__(CS0);
1136  }
1137  // fill FI structure
1138  RtlZeroMemory( (int8*)FileId, l);
1139  RtlCopyMemory( ((int8*)(FileId+1))+ImpUseLen, CS0, Nlen);
1141  FileId->fileVersionNum = 1;
1142  FileId->lengthOfImpUse = (uint16)ImpUseLen;
1143  FileId->lengthFileIdent = (uint8)Nlen;
1144  FileId->icb = *FileEntryIcb;
1145  *_FileId = FileId;
1146  *FileIdLen = l;
1147 
1148  if(CS0) MyFreePool__(CS0);
1149  return STATUS_SUCCESS;
1150 } // end UDFBuildFileIdent()
uint16 tagIdent
Definition: ecma_167.h:139
struct _FILE_IDENT_DESC * PFILE_IDENT_DESC
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
struct _FILE_IDENT_DESC FILE_IDENT_DESC
#define UDF_NAME_LEN
Definition: osta_misc.h:314
static GLenum _GLUfuncptr fn
Definition: wgl_font.c:159
unsigned int uint32
Definition: types.h:32
#define MEM_FID_TAG
Definition: udf_rel.h:488
uint8 lengthFileIdent
Definition: ecma_167.h:429
r l[0]
Definition: byte_order.h:167
#define MyFreePool__(addr)
Definition: mem_tools.h:152
void __fastcall UDFCompressUnicode(IN PUNICODE_STRING UName, IN OUT uint8 **_CS0, IN OUT PSIZE_T Length)
Definition: udf_info.cpp:240
unsigned char uint8
Definition: types.h:28
uint16 lengthOfImpUse
Definition: ecma_167.h:431
uint16 fileVersionNum
Definition: ecma_167.h:427
#define TID_FILE_IDENT_DESC
Definition: ecma_167.h:166
#define MyAllocatePoolTag__(type, size, tag)
Definition: mem_tools.h:150
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short uint16
Definition: types.h:30
#define STATUS_OBJECT_NAME_INVALID
Definition: udferr_usr.h:148
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
return STATUS_SUCCESS
Definition: btrfs.c:2938
char int8
Definition: platform.h:10

Referenced by UDFCreateFile__(), and UDFRecordDirectory__().

◆ UDFBuildFreeSpaceBitmap()

OSSTATUS UDFBuildFreeSpaceBitmap ( IN PVCB  Vcb,
IN uint32  PartNdx,
IN PPARTITION_HEADER_DESC  phd,
IN uint32  Lba 
)

Definition at line 1910 of file mount.cpp.

1916 {
1917  OSSTATUS status;
1918  uint32 i, l;
1919  uint16 Ident;
1920  int8* AllocDesc;
1922  lb_addr locAddr;
1923  uint32 PartNum;
1924 
1925  PartNum = UDFGetPartNumByPartNdx(Vcb, PartNdx);
1926  if(!(Vcb->FSBM_Bitmap)) {
1927  // init Bitmap buffer if necessary
1928  Vcb->FSBM_Bitmap = (int8*)DbgAllocatePool(NonPagedPool, (i = (Vcb->LastPossibleLBA+1+7)>>3) );
1929  if(!(Vcb->FSBM_Bitmap)) return STATUS_INSUFFICIENT_RESOURCES;
1930 
1931  Vcb->ZSBM_Bitmap = (int8*)DbgAllocatePool(NonPagedPool, (i = (Vcb->LastPossibleLBA+1+7)>>3) );
1932  if(!(Vcb->ZSBM_Bitmap)) {
1933 #ifdef UDF_TRACK_ONDISK_ALLOCATION_OWNERS
1934 free_fsbm:
1935 #endif //UDF_TRACK_ONDISK_ALLOCATION_OWNERS
1936  MyFreePool__(Vcb->FSBM_Bitmap);
1937  Vcb->FSBM_Bitmap = NULL;
1939  }
1940 
1941  RtlZeroMemory(Vcb->FSBM_Bitmap, i);
1942  RtlZeroMemory(Vcb->ZSBM_Bitmap, i);
1943 #ifdef UDF_TRACK_ONDISK_ALLOCATION_OWNERS
1944  Vcb->FSBM_Bitmap_owners = (uint32*)DbgAllocatePool(NonPagedPool, (Vcb->LastPossibleLBA+1)*sizeof(uint32));
1945  if(!(Vcb->FSBM_Bitmap_owners)) {
1946  MyFreePool__(Vcb->ZSBM_Bitmap);
1947  Vcb->ZSBM_Bitmap = NULL;
1948  goto free_fsbm;
1949  }
1950  RtlFillMemory(Vcb->FSBM_Bitmap_owners, (Vcb->LastPossibleLBA+1)*sizeof(uint32), 0xff);
1951 #endif //UDF_TRACK_ONDISK_ALLOCATION_OWNERS
1952  Vcb->FSBM_ByteCount = i;
1953  Vcb->FSBM_BitCount = Vcb->LastPossibleLBA+1;
1954  }
1955  // read info for partition header (if any)
1956  if(phd) {
1957  // read unallocated Bitmap
1958  if(!OS_SUCCESS(status = UDFAddXSpaceBitmap(Vcb, PartNum, &(phd->unallocatedSpaceBitmap), UDF_FSPACE_BM)))
1959  return status;
1960  // read freed Bitmap
1961  if(!OS_SUCCESS(status = UDFAddXSpaceBitmap(Vcb, PartNum, &(phd->freedSpaceBitmap), UDF_ZSPACE_BM)))
1962  return status;
1963  }
1964  // read UnallocatedSpaceDesc & convert to Bitmap
1965  if(Lba) {
1966  if(!(AllocDesc = (int8*)MyAllocatePool__(NonPagedPool, Vcb->LBlockSize + sizeof(EXTENT_AD) )))
1968  RtlZeroMemory(((int8*)AllocDesc) + Vcb->LBlockSize, sizeof(EXTENT_AD));
1969  if(!OS_SUCCESS(status = UDFReadTagged(Vcb, AllocDesc, Lba, Lba, &Ident)) ||
1970  !(Extent = (PEXTENT_MAP)MyAllocatePool__(NonPagedPool, l = (((PUNALLOC_SPACE_DESC)AllocDesc)->numAllocDescs+1) * sizeof(EXTENT_AD) ))) {
1971  MyFreePool__(AllocDesc);
1972  return status;
1973  }
1974  UDFRegisterFsStructure(Vcb, Lba, Vcb->BlockSize);
1975  RtlCopyMemory((int8*)Extent, AllocDesc+sizeof(UNALLOC_SPACE_DESC), (((PUNALLOC_SPACE_DESC)AllocDesc)->numAllocDescs+1) * sizeof(EXTENT_AD) );
1976  locAddr.partitionReferenceNum = (uint16)PartNum;
1977  // read extent is recorded with relative addresses
1978  // so, we should convert it to suitable form
1979  for(i=0; Extent[i].extLength; i++) {
1980  locAddr.logicalBlockNum = Extent[i].extLocation;
1981  Extent[i].extLocation = UDFPartLbaToPhys(Vcb, &locAddr);
1982  if(Extent[i].extLocation == LBA_OUT_OF_EXTENT) {
1983  BrutePoint();
1984  MyFreePool__(AllocDesc);
1986  }
1987  if((Extent[i].extLocation >> 30) == EXTENT_NEXT_EXTENT_ALLOCDESC) {
1988  // load continuation
1989  Lba = Extent[i].extLocation & UDF_EXTENT_LENGTH_MASK;
1990  if(!OS_SUCCESS(status = UDFReadTagged(Vcb, AllocDesc, Lba, Lba, &Ident)) ||
1991  !(Extent = (PEXTENT_MAP)MyAllocatePool__(NonPagedPool, (((PUNALLOC_SPACE_DESC)AllocDesc)->numAllocDescs+1) * sizeof(EXTENT_AD) ))) {
1992  MyFreePool__(AllocDesc);
1993  return status;
1994  }
1995  if(Ident == TID_UNALLOC_SPACE_DESC) {
1996  UDFRegisterFsStructure(Vcb, Lba, Vcb->BlockSize);
1997  if(!(l = MyReallocPool__((int8*)Extent, l, (int8**)&Extent, i*sizeof(EXTENT_MAP)))) {
1999  MyFreePool__(AllocDesc);
2001  }
2002  Extent[i].extLength =
2003  Extent[i].extLocation = 0;
2004  Extent = UDFMergeMappings(Extent, (PEXTENT_MAP)(AllocDesc+sizeof(UNALLOC_SPACE_DESC)) );
2005 #ifdef UDF_DBG
2006  } else {
2007  UDFPrint(("Broken unallocated space descriptor sequence\n"));
2008 #endif // UDF_DBG
2009  }
2010  }
2011  }
2012  UDFMarkSpaceAsXXX(Vcb, (-1), Extent, AS_USED); // mark as used
2014  MyFreePool__(AllocDesc);
2015  }
2016  return status;
2017 } // end UDFVerifyFreeSpaceBitmap()
OSSTATUS UDFAddXSpaceBitmap(IN PVCB Vcb, IN uint32 PartNum, IN PSHORT_AD bm, IN ULONG bm_type)
Definition: mount.cpp:1569
#define DbgAllocatePool
Definition: env_spec_w32.h:332
#define UDFPrint(Args)
Definition: udffs.h:225
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define TID_UNALLOC_SPACE_DESC
Definition: ecma_167.h:160
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
unsigned int uint32
Definition: types.h:32
ULONG MyReallocPool__(PCHAR addr, ULONG len, PCHAR *pnewaddr, ULONG newlen)
Definition: mem_tools.h:224
#define UDFRegisterFsStructure(Vcb, Lba, Length)
Definition: udf_info.h:1250
#define UDF_FSPACE_BM
Definition: udf_info.h:445
#define UDF_ZSPACE_BM
Definition: udf_info.h:446
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
uint32 __fastcall UDFPartLbaToPhys(IN PVCB Vcb, IN lb_addr *Addr)
Definition: alloc.cpp:114
#define OSSTATUS
Definition: env_spec_w32.h:57
smooth NULL
Definition: ftsmooth.c:416
#define MyAllocatePool__(type, size)
Definition: mem_tools.h:149
r l[0]
Definition: byte_order.h:167
PEXTENT_MAP __fastcall UDFMergeMappings(IN PEXTENT_MAP Extent, IN PEXTENT_MAP Extent2)
Definition: extent.cpp:266
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define BrutePoint()
Definition: env_spec_w32.h:504
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define AS_USED
Definition: udf_info.h:327
#define UDFMarkSpaceAsXXX(Vcb, FileInfo, Map, asXXX)
Definition: udf_info.h:322
unsigned short uint16
Definition: types.h:30
uint32 logicalBlockNum
Definition: ecma_167.h:362
OSSTATUS UDFReadTagged(PVCB Vcb, int8 *Buf, uint32 Block, uint32 Location, uint16 *Ident)
Definition: udf_info.cpp:4586
uint16 partitionReferenceNum
Definition: ecma_167.h:363
#define EXTENT_NEXT_EXTENT_ALLOCDESC
Definition: ecma_167.h:370
#define STATUS_DISK_CORRUPT_ERROR
Definition: udferr_usr.h:147
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
#define UDFGetPartNumByPartNdx(Vcb, pi)
Definition: udf_info.h:1028
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593
static SERVICE_STATUS status
Definition: service.c:31
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148
char int8
Definition: platform.h:10
#define LBA_OUT_OF_EXTENT
Definition: udf_rel.h:426
Definition: ps.c:97

Referenced by UDFLoadPartDesc(), and UDFProcessSequence().

◆ UDFBuildHashEntry()

uint8 UDFBuildHashEntry ( IN PVCB  Vcb,
IN PUNICODE_STRING  Name,
OUT PHASH_ENTRY  hashes,
IN uint8  Mask 
)

Definition at line 429 of file dirtree.cpp.

435 {
436  UNICODE_STRING UName;
437  WCHAR ShortNameBuffer[13];
438  uint8 RetFlags = 0;
439 
440  if(!Name->Buffer) return 0;
441 
442  if(Mask & HASH_POSIX)
443  hashes->hPosix = crc32((uint8*)(Name->Buffer), Name->Length);
444 
445  if(Mask & HASH_ULFN) {
446 /* if(OS_SUCCESS(MyInitUnicodeString(&UName, L"")) &&
447  OS_SUCCESS(MyAppendUnicodeStringToStringTag(&UName, Name, MEM_USDIRHASH_TAG))) {*/
448  if(OS_SUCCESS(MyCloneUnicodeString(&UName, Name))) {
449  RtlUpcaseUnicodeString(&UName, &UName, FALSE);
450  /* if(!RtlCompareUnicodeString(Name, &UName, FALSE)) {
451  RetFlags |= UDF_FI_FLAG_LFN;
452  }*/
453  hashes->hLfn = crc32((uint8*)(UName.Buffer), UName.Length);
454  } else {
455  BrutePoint();
456  }
457  MyFreePool__(UName.Buffer);
458  }
459 
460  if(Mask & HASH_DOS) {
461  UName.Buffer = (PWCHAR)(&ShortNameBuffer);
462  UName.MaximumLength = 13*sizeof(WCHAR);
463  UDFDOSName(Vcb, &UName, Name, (Mask & HASH_KEEP_NAME) ? TRUE : FALSE);
464  if(!RtlCompareUnicodeString(Name, &UName, TRUE)) {
465  RetFlags |= UDF_FI_FLAG_DOS;
466  }
467  hashes->hDos = crc32((uint8*)(UName.Buffer), UName.Length);
468  }
469  return RetFlags;
470 } // UDFBuildHashEntry()
#define TRUE
Definition: types.h:120
#define HASH_DOS
Definition: udf_info.h:77
NTSTATUS RtlUpcaseUnicodeString(PUNICODE_STRING dst, PUNICODE_STRING src, BOOLEAN Alloc)
Definition: string_lib.cpp:46
USHORT MaximumLength
Definition: env_spec_w32.h:370
#define HASH_POSIX
Definition: udf_info.h:75
uint32_t crc32
Definition: btrfs.c:4138
uint16_t * PWCHAR
Definition: typedefs.h:54
NTSTATUS MyCloneUnicodeString(IN PUNICODE_STRING Str1, IN PUNICODE_STRING Str2)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define BrutePoint()
Definition: env_spec_w32.h:504
void __fastcall UDFDOSName(IN PVCB Vcb, IN OUT PUNICODE_STRING DosName, IN PUNICODE_STRING UdfName, IN BOOLEAN KeepIntact)
Definition: udf_info.cpp:427
unsigned char uint8
Definition: types.h:28
ULONG RtlCompareUnicodeString(PUNICODE_STRING s1, PUNICODE_STRING s2, BOOLEAN UpCase)
Definition: string_lib.cpp:31
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define HASH_ULFN
Definition: udf_info.h:76
#define HASH_KEEP_NAME
Definition: udf_info.h:79
#define UDF_FI_FLAG_DOS
Definition: udf_rel.h:225

Referenced by UDFBlankMount(), UDFCreateFile__(), UDFFindFile(), UDFIndexDirectory(), UDFQueryDirectory(), and UDFRenameMoveFile__().

◆ UDFBuildLongAllocDescs()

OSSTATUS UDFBuildLongAllocDescs ( IN PVCB  Vcb,
IN uint32  PartNum,
OUT int8 **  Buff,
IN uint32  InitSz,
IN OUT PUDF_FILE_INFO  FileInfo 
)

Definition at line 1012 of file extent.cpp.

1019 {
1020  uint32 i, j;
1021  uint32 len=0;
1022  PEXTENT_MAP Extent = FileInfo->Dloc->DataLoc.Mapping;
1023  PEXTENT_INFO AllocExtent = &(FileInfo->Dloc->AllocLoc);
1024  PLONG_AD Alloc;
1025  uint32 NewLen;
1026  OSSTATUS status;
1027  uint32 ph_len=0; // in general, this should be uint64,
1028  // but we need its lower part only
1029 #ifdef UDF_ALLOW_FRAG_AD
1030  uint32 ac, len2, ts;
1031  uint32 TagLoc, prevTagLoc;
1032  uint32 LBS = Vcb->LBlockSize;
1033  uint32 LBSh = Vcb->BlockSizeBits;
1034  uint32 BufOffs;
1035  uint32 ExtOffs = AllocExtent->Offset;
1036  PLONG_AD saved_Alloc;
1037  uint32 TagLen = 0;
1038  tag* Tag = NULL;
1039 #endif //UDF_ALLOW_FRAG_AD
1040 
1042  ExtPrint(("UDFBuildLongAllocDescs: FE %x\n", FileInfo->Dloc->FELoc.Mapping[0].extLocation));
1043  // calculate length
1044  //for(len=0; i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK); len++, ph_len+=i);
1045  for(len=0; (i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK)); len++, ph_len+=i) {
1046  ExtPrint(("bLnExt: type %x, loc %x, len %x\n",
1047  Extent[len].extLength >> 30, Extent[len].extLocation, Extent[len].extLength & UDF_EXTENT_LENGTH_MASK));
1048  }
1051  // fill contiguous AllocDesc buffer (decribing UserData)
1052  for(i=0;i<len;i++) {
1053  Alloc[i].extLength = Extent[i].extLength;
1054  Alloc[i].extLocation.logicalBlockNum = UDFPhysLbaToPart(Vcb, PartNum, Extent[i].extLocation);
1055  Alloc[i].extLocation.partitionReferenceNum = (uint16)PartNum;
1056  RtlZeroMemory(&(Alloc[i].impUse), sizeof(Alloc[i].impUse));
1057  }
1058  if((Vcb->CompatFlags & UDF_VCB_IC_W2K_COMPAT_ALLOC_DESCS) && i) {
1059  Alloc[i-1].extLength -= (ph_len - (ULONG)(FileInfo->Dloc->DataLoc.Length)) &
1060  (Vcb->LBlockSize-1);
1061  ExtPrint(("bLnExt: cut tail -> %x\n",
1062  Alloc[i-1].extLength & UDF_EXTENT_LENGTH_MASK));
1063  }
1064  RtlZeroMemory(&(Alloc[i]), sizeof(LONG_AD));
1065  j = len*sizeof(LONG_AD); // required space
1066  len = (InitSz & ~(sizeof(LONG_AD)-1)); // space available in 1st block
1067  ASSERT(len == InitSz);
1068 
1069  // Ok. Let's init AllocLoc
1070  if(!(FileInfo->Dloc->AllocLoc.Mapping)) {
1071  FileInfo->Dloc->AllocLoc.Mapping = (PEXTENT_MAP)MyAllocatePoolTag__(NonPagedPool, 2 * sizeof(EXTENT_MAP), MEM_EXTMAP_TAG);
1072  if(!(FileInfo->Dloc->AllocLoc.Mapping)) {
1075  }
1076  // allocation descriptors are located in the same sector as FileEntry
1077  // (at least their 1st part), just after it
1078  FileInfo->Dloc->AllocLoc.Mapping[0] = FileInfo->Dloc->FELoc.Mapping[0];
1079  FileInfo->Dloc->AllocLoc.Offset = FileInfo->Dloc->FileEntryLen;
1080  FileInfo->Dloc->AllocLoc.Length = 0;
1081  // set terminator
1082  FileInfo->Dloc->AllocLoc.Mapping[1].extLength =
1083  FileInfo->Dloc->AllocLoc.Mapping[1].extLocation = 0;
1084  }
1085 
1086  if(j <= len) {
1087  // we needn't allocating additional blocks to store AllocDescs
1088  RtlCopyMemory(*Buff, (int8*)Alloc, j);
1089  NewLen = j;
1091  } else {
1092 #ifndef UDF_ALLOW_FRAG_AD
1093  AdPrint((" DISK_FULL\n"));
1094  return STATUS_DISK_FULL;
1095 #else //UDF_ALLOW_FRAG_AD
1096  BufOffs = 0;
1097  TagLoc = prevTagLoc = 0;
1098  // calculate the space available for LONG_ADs in each block
1099  ac = (LBS - (sizeof(ALLOC_EXT_DESC) + sizeof(LONG_AD))) & ~(sizeof(LONG_AD)-1);
1100  len2 = len;
1101  // tail size
1102  ts = InitSz - len2;
1103  len -= sizeof(LONG_AD);
1104  // calculate actual AllocSequence length (in LBlocks)
1105  NewLen = ( ((j - len + ac - 1) / ac) << LBSh) + InitSz + sizeof(LONG_AD);
1106  MyFreePool__(*Buff);
1107  (*Buff) = (int8*)MyAllocatePoolTag__(NonPagedPool, NewLen, MEM_LNGAD_TAG);
1108  if(!(*Buff)) {
1110  goto lad_alloc_err;
1111  }
1112  if(UDFGetExtentLength(AllocExtent->Mapping) < NewLen) {
1113  status = UDFResizeExtent(Vcb, PartNum, NewLen, TRUE, AllocExtent);
1114  if(!OS_SUCCESS(status)) {
1115 lad_alloc_err:
1117  return status;
1118  }
1119  }
1120  ExtOffs = AllocExtent->Offset;
1121  RtlZeroMemory(*Buff, NewLen);
1122  NewLen = 0; // recorded length
1123  saved_Alloc = Alloc;
1124  len2 = len+sizeof(LONG_AD);
1125  // fill buffer sector by sector (adding links at the end of each one)
1126  while(TRUE) {
1127 
1128  // j - remained AllocDescs length (in bytes)
1129  // len - bytes available for in AllocDescs each block
1130 
1131  // leave space for terminator or pointer to next part of sequence
1132  if(j == len2) {
1133  // if we have only 1 LONG_AD that we can fit in last sector
1134  // we shall do it instead of recording link & allocating new block
1135  len =
1136  TagLen = len2;
1137  }
1138  RtlCopyMemory( (*Buff)+BufOffs, (int8*)Alloc, len);
1139  Alloc = (PLONG_AD)((int8*)Alloc + len);
1140  j -= len;
1141  BufOffs += len;
1142  if(Tag) {
1143  // Set up Tag for AllocDesc
1144  Tag->tagIdent = TID_ALLOC_EXTENT_DESC;
1145  UDFSetUpTag(Vcb, Tag, (uint16)TagLen, TagLoc);
1146  prevTagLoc = TagLoc;
1147  }
1148  if(!j) {
1149  // terminate loop
1150  NewLen = BufOffs;
1151  break;
1152  }
1153  len = ac;
1154  if(j <= (len + sizeof(LONG_AD)))
1155  len = j - sizeof(LONG_AD);
1156  len2 = len+sizeof(LONG_AD);
1157  // we have more than 1 LONG_AD that we can't fit in current block
1158  // so we shall set up pointer to the next block
1159  ((PLONG_AD)((*Buff)+BufOffs))->extLength = /*LBS*/ len2 |
1161  ((PLONG_AD)((*Buff)+BufOffs))->extLocation.logicalBlockNum = TagLoc =
1162  UDFPhysLbaToPart(Vcb, PartNum,
1163  UDFExtentOffsetToLba(Vcb, AllocExtent->Mapping,
1164  ExtOffs+BufOffs+sizeof(LONG_AD)+ts,
1165  NULL, NULL, NULL, NULL) );
1166  ((PLONG_AD)((*Buff)+BufOffs))->extLocation.partitionReferenceNum = (uint16)PartNum;
1167  // reflect additional (link) block & LBlock tail (if any)
1168  BufOffs += ts+sizeof(LONG_AD);
1169  // init AllocDesc
1170  ( (PALLOC_EXT_DESC) ((*Buff)+BufOffs))->lengthAllocDescs = len2;
1171  ( (PALLOC_EXT_DESC) ((*Buff)+BufOffs))->previousAllocExtLocation = prevTagLoc;
1172  Tag = (tag*)((*Buff)+BufOffs);
1173  TagLen = len2;
1174  ts = LBS-len2-sizeof(ALLOC_EXT_DESC);
1175  BufOffs += sizeof(ALLOC_EXT_DESC);
1176  }
1177  MyFreePool__(saved_Alloc);
1178 #endif //UDF_ALLOW_FRAG_AD
1179  }
1180  status = UDFResizeExtent(Vcb, PartNum, NewLen, TRUE, AllocExtent);
1181  return status;
1182 } // end UDFBuildLongAllocDescs()
PEXTENT_AD PEXTENT_MAP
Definition: ecma_167.h:135
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TID_ALLOC_EXTENT_DESC
Definition: ecma_167.h:167
#define AdPrint(_x_)
Definition: env_spec_w32.h:292
#define MEM_LNGAD_TAG
Definition: udf_rel.h:495
unsigned int uint32
Definition: types.h:32
OSSTATUS UDFResizeExtent(IN PVCB Vcb, IN uint32 PartNum, IN int64 Length, IN BOOLEAN AlwaysInIcb, OUT PEXTENT_INFO ExtInfo)
Definition: extent.cpp:2235
void UDFSetUpTag(IN PVCB Vcb, IN tag *Tag, IN uint16 DataLen, IN uint32 TagLoc)
Definition: udf_info.cpp:936
#define MEM_EXTMAP_TAG
Definition: udf_rel.h:492
Definition: ecma_167.h:138
long_ad LONG_AD
Definition: ecma_167.h:379
uint32 UDFExtentOffsetToLba(IN PVCB Vcb, IN PEXTENT_MAP Extent, IN int64 Offset, OUT uint32 *SectorOffset, OUT PSIZE_T AvailLength, OUT uint32 *Flags, OUT uint32 *Index)
Definition: extent.cpp:28
PEXTENT_MAP Mapping
Definition: udf_rel.h:66
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
#define OSSTATUS
Definition: env_spec_w32.h:57
static const char * ts(int t)
smooth NULL
Definition: ftsmooth.c:416
int64 UDFGetExtentLength(IN PEXTENT_MAP Extent)
Definition: extent.cpp:142
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
struct _ALLOC_EXT_DESC ALLOC_EXT_DESC
LONG_AD * PLONG_AD
Definition: ecma_167.h:380
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define UDF_VCB_IC_W2K_COMPAT_ALLOC_DESCS
Definition: udf_common.h:501
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
struct _ALLOC_EXT_DESC * PALLOC_EXT_DESC
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
uint32 Offset
Definition: udf_rel.h:65
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define ExtPrint(_x_)
Definition: env_spec_w32.h:294
GLenum GLsizei len
Definition: glext.h:6722
#define MyAllocatePoolTag__(type, size, tag)
Definition: mem_tools.h:150
unsigned short uint16
Definition: types.h:30
#define EXTENT_NEXT_EXTENT_ALLOCDESC
Definition: ecma_167.h:370
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static SERVICE_STATUS status
Definition: service.c:31
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148
uint32 UDFPhysLbaToPart(IN PVCB Vcb, IN uint32 PartNum, IN uint32 Addr)
Definition: alloc.cpp:46
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFBuildAllocDescs().

◆ UDFBuildShortAllocDescs()

OSSTATUS UDFBuildShortAllocDescs ( IN PVCB  Vcb,
IN uint32  PartNum,
OUT int8 **  Buff,
IN uint32  InitSz,
IN OUT PUDF_FILE_INFO  FileInfo 
)

Definition at line 825 of file extent.cpp.

832 {
833  uint32 i, j;
834  uint32 len=0;
835  PEXTENT_MAP Extent = FileInfo->Dloc->DataLoc.Mapping;
836  PEXTENT_INFO AllocExtent = &(FileInfo->Dloc->AllocLoc);
838  uint32 NewLen;
840  uint32 ph_len=0; // in general, this should be uint64,
841  // but we need its lower part only
842 #ifdef UDF_ALLOW_FRAG_AD
843  uint32 ts, ac, len2;
844  uint32 LBS = Vcb->LBlockSize;
845  uint32 LBSh = Vcb->BlockSizeBits;
846  uint32 TagLen = 0;
847  tag* Tag = NULL;
848  PSHORT_AD saved_Alloc;
849  uint32 TagLoc, prevTagLoc;
850  uint32 BufOffs;
851  uint32 ExtOffs;
852  uint32 saved_NewLen;
853 #endif //UDF_ALLOW_FRAG_AD
854 
856  ExtPrint(("UDFBuildShortAllocDescs: FE %x\n", FileInfo->Dloc->FELoc.Mapping[0].extLocation));
857  // calculate length
858  for(len=0; (i=(Extent[len].extLength & UDF_EXTENT_LENGTH_MASK)); len++, ph_len+=i) {
859  ExtPrint(("bShExt: type %x, loc %x, len %x\n",
860  Extent[len].extLength >> 30, Extent[len].extLocation, Extent[len].extLength & UDF_EXTENT_LENGTH_MASK));
861  }
863  if(!Alloc) {
864  BrutePoint();
866  }
867  // fill contiguous AllocDesc buffer (decribing UserData)
868  for(i=0;i<len;i++) {
869  Alloc[i].extLength = Extent[i].extLength;
870  Alloc[i].extPosition = UDFPhysLbaToPart(Vcb, PartNum, Extent[i].extLocation);
871  }
872  if((Vcb->CompatFlags & UDF_VCB_IC_W2K_COMPAT_ALLOC_DESCS) && i) {
873  Alloc[i-1].extLength -= (ph_len - (ULONG)(FileInfo->Dloc->DataLoc.Length)) &
874  (Vcb->LBlockSize-1);
875  ExtPrint(("bShExt: cut tail -> %x\n",
876  Alloc[i-1].extLength & UDF_EXTENT_LENGTH_MASK));
877  }
878  Alloc[i].extLength =
879  Alloc[i].extPosition = 0;
880  j = len*sizeof(SHORT_AD); // required space
881  len = (InitSz & ~(sizeof(SHORT_AD)-1)); // space available in 1st block
882  ASSERT(len == InitSz);
883 
884  // Ok. Let's init AllocLoc
885  if(!(FileInfo->Dloc->AllocLoc.Mapping)) {
886  FileInfo->Dloc->AllocLoc.Mapping = (PEXTENT_MAP)MyAllocatePoolTag__(NonPagedPool, 2 * sizeof(EXTENT_MAP), MEM_EXTMAP_TAG);
887  if(!(FileInfo->Dloc->AllocLoc.Mapping)) {
888  BrutePoint();
891  }
892  // allocation descriptors are located in the same sector as FileEntry
893  // (at least their 1st part), just after it
894  FileInfo->Dloc->AllocLoc.Mapping[0] = FileInfo->Dloc->FELoc.Mapping[0];
895  FileInfo->Dloc->AllocLoc.Offset = FileInfo->Dloc->FileEntryLen;
896  FileInfo->Dloc->AllocLoc.Length = 0;
897  // set terminator
898  FileInfo->Dloc->AllocLoc.Mapping[1].extLength =
899  FileInfo->Dloc->AllocLoc.Mapping[1].extLocation = 0;
900  }
901 
902  if(j <= len) {
903  // we needn't allocating additional blocks to store AllocDescs
904  AdPrint(("in-ICB AllocDescs, j=%x\n",j));
905  RtlCopyMemory(*Buff, (int8*)Alloc, j);
906  NewLen = j;
908  } else {
909 #ifndef UDF_ALLOW_FRAG_AD
910  AdPrint((" DISK_FULL\n"));
911  return STATUS_DISK_FULL;
912 #else //UDF_ALLOW_FRAG_AD
913  AdPrint(("multi-block AllocDescs, j=%x\n",j));
914  BufOffs = 0;
915  TagLoc = prevTagLoc = 0;
916  // calculate the space available for SHORT_ADs in each block
917  ac = (LBS - (sizeof(ALLOC_EXT_DESC) + sizeof(SHORT_AD))) & ~(sizeof(SHORT_AD)-1);
918  len2 = len;
919  // tail size
920  ts = InitSz - len2;
921  len -= sizeof(SHORT_AD);
922  // calculate actual AllocSequence length (in bytes)
923  NewLen = ( ((j - len + ac - 1) / ac) << LBSh) + InitSz + sizeof(SHORT_AD);
924  MyFreePool__(*Buff);
925  (*Buff) = (int8*)MyAllocatePoolTag__(NonPagedPool, NewLen, MEM_SHAD_TAG);
926  if(!(*Buff)) {
928  UDFPrint(("UDFResizeExtent() failed (%x)\n",status));
929  BrutePoint();
930  goto sh_alloc_err;
931  }
932  if(UDFGetExtentLength(AllocExtent->Mapping) < NewLen) {
933  status = UDFResizeExtent(Vcb, PartNum, NewLen, TRUE, AllocExtent);
934  if(!OS_SUCCESS(status)) {
935  UDFPrint(("UDFResizeExtent(2) failed (%x)\n",status));
936  BrutePoint();
937 sh_alloc_err:
939  return status;
940  }
941  }
942  ExtOffs = AllocExtent->Offset;
943  RtlZeroMemory(*Buff, NewLen);
944  saved_NewLen = NewLen;
945  NewLen = 0; // recorded length
946  saved_Alloc = Alloc;
947  // fill buffer sector by sector (adding links at the end of each one)
948  while(TRUE) {
949 
950  // j - remained AllocDescs length (in bytes)
951  // len - bytes available for AllocDescs in current block
952  // ac - bytes available for AllocDescs in each block
953 
954  // leave space for terminator or pointer to next part of sequence
955  if(j == len2) {
956  // if we have only 1 SHORT_AD that we can fit in last sector
957  // we shall do it instead of recording link & allocating new block
958  len =
959  TagLen = len2;
960  }
961  ASSERT(saved_NewLen >= (BufOffs + len));
962  RtlCopyMemory( (*Buff)+BufOffs, (int8*)Alloc, len);
963  Alloc = (PSHORT_AD)((int8*)Alloc + len);
964  j -= len;
965  BufOffs += len;
966  if(Tag) {
967  // Set up Tag for AllocDesc
968  Tag->tagIdent = TID_ALLOC_EXTENT_DESC;
969  UDFSetUpTag(Vcb, Tag, (uint16)TagLen, TagLoc);
970  prevTagLoc = TagLoc;
971  }
972  if(!j) {
973  // terminate loop
974  NewLen = BufOffs;
975  break;
976  }
977  len = ac;
978  if(j <= (len + sizeof(SHORT_AD)))
979  len = j - sizeof(SHORT_AD);
980  len2 = len + sizeof(SHORT_AD);
981  // we have more than 1 SHORT_AD that we can't fit in current block
982  // so we shall set up pointer to the next block
983  ((PSHORT_AD)((*Buff)+BufOffs))->extLength = /*LBS*/ len2 |
985  ((PSHORT_AD)((*Buff)+BufOffs))->extPosition = TagLoc =
986  UDFPhysLbaToPart(Vcb, PartNum,
987  UDFExtentOffsetToLba(Vcb, AllocExtent->Mapping,
988  ExtOffs+BufOffs+sizeof(SHORT_AD)+ts,
989  NULL, NULL, NULL, NULL) );
990  // reflect additional (link) block & LBlock tail (if any)
991  BufOffs += ts+sizeof(SHORT_AD);
992  // init AllocDesc
993  ( (PALLOC_EXT_DESC) ((*Buff)+BufOffs))->lengthAllocDescs = len2;
994  ( (PALLOC_EXT_DESC) ((*Buff)+BufOffs))->previousAllocExtLocation = prevTagLoc;
995  Tag = (tag*)((*Buff)+BufOffs);
996  TagLen = len2;
997  ts = LBS-len2-sizeof(ALLOC_EXT_DESC);
998  BufOffs += sizeof(ALLOC_EXT_DESC);
999  }
1000  MyFreePool__(saved_Alloc);
1001 #endif //UDF_ALLOW_FRAG_AD
1002  }
1003  status = UDFResizeExtent(Vcb, PartNum, NewLen, TRUE, AllocExtent);
1004  return status;
1005 } // end UDFBuildShortAllocDescs()
PEXTENT_AD PEXTENT_MAP
Definition: ecma_167.h:135
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define TID_ALLOC_EXTENT_DESC
Definition: ecma_167.h:167
#define AdPrint(_x_)
Definition: env_spec_w32.h:292
struct _SHORT_AD SHORT_AD
unsigned int uint32
Definition: types.h:32
OSSTATUS UDFResizeExtent(IN PVCB Vcb, IN uint32 PartNum, IN int64 Length, IN BOOLEAN AlwaysInIcb, OUT PEXTENT_INFO ExtInfo)
Definition: extent.cpp:2235
void UDFSetUpTag(IN PVCB Vcb, IN tag *Tag, IN uint16 DataLen, IN uint32 TagLoc)
Definition: udf_info.cpp:936
#define MEM_EXTMAP_TAG
Definition: udf_rel.h:492
Definition: ecma_167.h:138
uint32 UDFExtentOffsetToLba(IN PVCB Vcb, IN PEXTENT_MAP Extent, IN int64 Offset, OUT uint32 *SectorOffset, OUT PSIZE_T AvailLength, OUT uint32 *Flags, OUT uint32 *Index)
Definition: extent.cpp:28
PEXTENT_MAP Mapping
Definition: udf_rel.h:66
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
#define OSSTATUS
Definition: env_spec_w32.h:57
static const char * ts(int t)
smooth NULL
Definition: ftsmooth.c:416
int64 UDFGetExtentLength(IN PEXTENT_MAP Extent)
Definition: extent.cpp:142
struct _SHORT_AD * PSHORT_AD
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
struct _ALLOC_EXT_DESC ALLOC_EXT_DESC
#define Vcb
Definition: cdprocs.h:1425
#define MyFreePool__(addr)
Definition: mem_tools.h:152
#define UDF_VCB_IC_W2K_COMPAT_ALLOC_DESCS
Definition: udf_common.h:501
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
#define BrutePoint()
Definition: env_spec_w32.h:504
struct _ALLOC_EXT_DESC * PALLOC_EXT_DESC
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
uint32 Offset
Definition: udf_rel.h:65
#define OS_SUCCESS(a)
Definition: env_spec_w32.h:56
#define ExtPrint(_x_)
Definition: env_spec_w32.h:294
GLenum GLsizei len
Definition: glext.h:6722
#define MyAllocatePoolTag__(type, size, tag)
Definition: mem_tools.h:150
unsigned short uint16
Definition: types.h:30
#define MEM_SHAD_TAG
Definition: udf_rel.h:494
#define EXTENT_NEXT_EXTENT_ALLOCDESC
Definition: ecma_167.h:370
IN ULONG IN ULONG Tag
Definition: evtlib.h:159
#define STATUS_DISK_FULL
Definition: udferr_usr.h:155
unsigned int ULONG
Definition: retypes.h:1
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
static SERVICE_STATUS status
Definition: service.c:31
#define UDF_EXTENT_LENGTH_MASK
Definition: osta_misc.h:148
uint32 UDFPhysLbaToPart(IN PVCB Vcb, IN uint32 PartNum, IN uint32 Addr)
Definition: alloc.cpp:46
char int8
Definition: platform.h:10
Definition: ps.c:97

Referenced by UDFBuildAllocDescs().

◆ UDFChangeFileCounter()

void UDFChangeFileCounter ( IN PVCB  Vcb,
IN BOOLEAN  FileCounter,
IN BOOLEAN  Increase 
)

Definition at line 1520 of file udf_info.cpp.

1525 {
1526  uint32* counter;
1527 
1528  counter = FileCounter ?
1529  &(Vcb->numFiles) :
1530  &(Vcb->numDirs);
1531  if(*counter == (ULONG)-1)
1532  return;
1533  if(Increase) {
1535  } else {
1537  }
1538 
1539 } // end UDFChangeFileCounter()
unsigned int uint32
Definition: types.h:32
#define UDFInterlockedDecrement(addr)
Definition: env_spec_w32.h:677
GLuint counter
Definition: glext.h:11116
#define Vcb
Definition: cdprocs.h:1425
#define UDFInterlockedIncrement(addr)
Definition: env_spec_w32.h:675
long int32
Definition: platform.h:12
unsigned int ULONG
Definition: retypes.h:1

Referenced by UDFUnlinkFile__().

◆ UDFChangeFileLinkCount()

void UDFChangeFileLinkCount ( IN PUDF_FILE_INFO  FileInfo,
IN BOOLEAN  Increase 
)

Definition at line 1315 of file udf_info.cpp.

1319 {
1320  uint16 Ident;
1321 
1323 
1324  FileInfo->Dloc->FE_Flags |= UDF_FE_FLAG_FE_MODIFIED;
1325  Ident = FileInfo->Dloc->FileEntry->tagIdent;
1326  if(Ident == TID_FILE_ENTRY) {
1327  PFILE_ENTRY fe = (PFILE_ENTRY)(FileInfo->Dloc->FileEntry);
1328  if(Increase) {
1329  fe->fileLinkCount++;
1330  } else {
1331  fe->fileLinkCount--;
1332  }
1333  if(fe->fileLinkCount & 0x8000)
1334  fe->fileLinkCount = 0xffff;
1335  return;
1336  } else if(Ident == TID_EXTENDED_FILE_ENTRY) {
1337  PEXTENDED_FILE_ENTRY fe = (PEXTENDED_FILE_ENTRY)(FileInfo->Dloc->FileEntry);
1338  if(Increase) {
1339  fe->fileLinkCount++;
1340  } else {
1341  fe->fileLinkCount--;
1342  }
1343  if(fe->fileLinkCount & 0x8000)
1344  fe->fileLinkCount = 0xffff;
1345  return;
1346  }
1347  return;
1348 } // end UDFChangeFileLinkCount()
uint16 fileLinkCount
Definition: ecma_167.h:519
struct _FILE_ENTRY * PFILE_ENTRY
#define TID_EXTENDED_FILE_ENTRY
Definition: ecma_167.h:175
#define UDF_FE_FLAG_FE_MODIFIED
Was modified & should be flushed.
Definition: udf_rel.h:323
uint16 fileLinkCount
Definition: ecma_167.h:748
Definition: ecma_167.h:742
Definition: ecma_167.h:513
#define ValidateFileInfo(fi)
Definition: env_spec_w32.h:516
unsigned short uint16
Definition: types.h:30
struct _EXTENDED_FILE_ENTRY * PEXTENDED_FILE_ENTRY
#define TID_FILE_ENTRY
Definition: ecma_167.h:170

◆ UDFCheckArea()

BOOLEAN __fastcall UDFCheckArea ( IN PVCB  Vcb,
IN lba_t  LBA,
IN uint32  BCount 
)

Definition at line 763 of file remap.cpp.

768 {
769  uint8* buff;
770  OSSTATUS RC;
772  uint32 i, d;
773  BOOLEAN ext_ok = TRUE;
774  EXTENT_MAP Map[2];
775  uint32 PS = Vcb->WriteBlockSize >> Vcb->BlockSizeBits;
776 
777  buff = (uint8*)DbgAllocatePoolWithTag(NonPagedPool, Vcb->WriteBlockSize, 'bNWD' );
778  if(buff) {
779  for(i=0; i<BCount; i+=d) {
780  if(!((LBA+i) & (PS-1)) &&
781  (i+PS <= BCount)) {
782  d = PS;
783  } else {
784  d = 1;
785  }
786  RC = UDFTRead(Vcb,
787  buff,
788  d << Vcb->BlockSizeBits,
789  LBA+i,
790  &ReadBytes,
791  PH_TMP_BUFFER);
792 
793  if(RC != STATUS_SUCCESS) {
794  Map[0].extLocation = LBA+i;
795  Map[0].extLength = d << Vcb->BlockSizeBits;
796  UDFMarkSpaceAsXXXNoProtect(Vcb, 0, &(Map[0]), AS_DISCARDED | AS_BAD); // free
797  ext_ok = FALSE;
798  }
799  }
800  DbgFreePool(buff);
801  }
802  return ext_ok;
803 } // end UDFCheckArea()
#define TRUE
Definition: types.h:120
#define DbgAllocatePoolWithTag(a, b, c)
Definition: env_spec_w32.h:333
unsigned int uint32
Definition: types.h:32
uint32 extLocation
Definition: ecma_167.h:129
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
#define OSSTATUS
Definition: env_spec_w32.h:57
unsigned char BOOLEAN
#define UDFMarkSpaceAsXXXNoProtect(Vcb, FileInfo, Map, asXXX)
Definition: udf_info.h:302
#define AS_BAD
Definition: udf_info.h:329
static NTSTATUS ReadBytes(IN PDEVICE_OBJECT LowerDevice, OUT PUCHAR Buffer, IN ULONG BufferSize, OUT PULONG_PTR FilledBytes)
Definition: detect.c:67
#define DbgFreePool
Definition: env_spec_w32.h:334
#define d
Definition: ke_i.h:81
#define Vcb
Definition: cdprocs.h:1425
unsigned char uint8
Definition: types.h:28
OSSTATUS UDFTRead(IN void *_Vcb, IN void *Buffer, IN SIZE_T Length, IN uint32 LBA, OUT PSIZE_T ReadBytes, IN uint32 Flags)
Definition: phys_lib.cpp:596
uint32 extLength
Definition: ecma_167.h:128
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define AS_DISCARDED
Definition: udf_info.h:328
#define PH_TMP_BUFFER
Definition: phys_lib.h:65
return STATUS_SUCCESS
Definition: btrfs.c:2938
static unsigned char buff[32768]
Definition: fatten.c:17

Referenced by UDFAllocFreeExtent_(), and UDFRemapPacket().

◆ UDFCleanUpFile__()

uint32 UDFCleanUpFile__ ( IN PVCB  Vcb,
IN PUDF_FILE_INFO  FileInfo 
)

Definition at line 2276 of file udf_info.cpp.

2280 {
2281  PUDF_DATALOC_INFO Dloc;
2282  uint32 lc = 0;
2283  BOOLEAN IsASDir;
2284  BOOLEAN KeepDloc;
2285  PDIR_INDEX_ITEM DirNdx, DirNdx2;
2286  BOOLEAN Parallel = FALSE;
2287  BOOLEAN Linked = FALSE;
2288 #ifdef UDF_DBG
2289  BOOLEAN Modified = FALSE;
2290  PDIR_INDEX_HDR hDirNdx;
2291  uint_di Index;
2292  PUDF_FILE_INFO DirInfo;
2293 #endif // UDF_DBG
2294 
2295  if(!FileInfo) return UDF_FREE_FILEINFO;
2296 
2298 
2299  if(FileInfo->OpenCount || FileInfo->RefCount) {
2300  UDFPrint(("UDF: not all references are closed\n"));
2301  UDFPrint((" Skipping cleanup\n"));
2302  UDFPrint(("UDF: OpenCount = %x, RefCount = %x, LinkRefCount = %x\n",
2303  FileInfo->OpenCount,FileInfo->RefCount,FileInfo->Dloc->LinkRefCount));
2304  return UDF_FREE_NOTHING;
2305  }
2306  if(FileInfo->Fcb) {
2307  UDFPrint(("Operating System still has references to this file\n"));
2308  UDFPrint((" Skipping cleanup\n"));
2309 // BrutePoint();
2310  return UDF_FREE_NOTHING;
2311  }
2312 
2313  IsASDir = UDFIsAStreamDir(FileInfo);
2314 
2315  if((Dloc = FileInfo->Dloc)) {
2316 
2317 #ifdef UDF_DBG
2318  DirInfo = FileInfo->ParentFile;
2319  if(DirInfo) {
2320  hDirNdx = DirInfo->Dloc->DirIndex;
2321  Index = FileInfo->Index;
2322  // we can't delete modified file
2323  // it should be closed & reopened (or flushed) before deletion
2324  DirNdx = UDFDirIndex(hDirNdx,Index);
2325  UDFPrint(("Cleanup Mod: %s%s%s%s%s%s\n",
2326  (Dloc->FE_Flags & UDF_FE_FLAG_FE_MODIFIED) ? "FE " : "",
2327  (Dloc->DataLoc.Modified) ? "DataLoc " : "",
2328  (Dloc->DataLoc.Flags & EXTENT_FLAG_PREALLOCATED) ? "Data-PreAlloc " : "",
2329  (Dloc->AllocLoc.Modified) ? "AllocLoc " : "",
2330  (Dloc->FELoc.Modified) ? "FELoc " : "",
2331  (DirNdx && (DirNdx->FI_Flags & UDF_FI_FLAG_FI_MODIFIED)) ? "FI " : ""
2332  ));
2333  Modified = ((Dloc->FE_Flags & UDF_FE_FLAG_FE_MODIFIED) ||
2334  Dloc->DataLoc.Modified ||
2336  Dloc->AllocLoc.Modified ||
2337  Dloc->FELoc.Modified ||
2338  (DirNdx && (DirNdx->FI_Flags & UDF_FI_FLAG_FI_MODIFIED)) );
2339  }
2340 #endif // UDF_DBG
2341 
2343 
2344  Parallel = (ParFileInfo != NULL);
2345  Linked = (FileInfo->NextLinkedFile != FileInfo);
2346 
2347 // Parallel = (FileInfo->NextLinkedFile != FileInfo);
2348  ASSERT(FileInfo->NextLinkedFile);
2349 // ASSERT(!Parallel);
2350  KeepDloc = (Dloc->LinkRefCount ||
2351  Dloc->CommonFcb ||
2352  Linked ) ?
2353  TRUE : FALSE;
2354 
2355  if(Dloc->DirIndex) {
2356  uint_di i;
2357  for(i=2; (DirNdx = UDFDirIndex(Dloc->DirIndex,i)); i++) {
2358  if(DirNdx->FileInfo) {
2359  if(!KeepDloc) {
2360  BrutePoint();
2361  UDFPrint(("UDF: Found not cleaned up reference.\n"));
2362  UDFPrint((" Skipping cleanup (1)\n"));
2363 // BrutePoint();
2364  return UDF_FREE_NOTHING;
2365  }
2366  // The file being cleaned up may have not closed Dirs
2367  // (linked Dir). In this case each of them may have
2368  // reference to FileInfo in DirIndex[1]
2369  // Here we'll check it and change for valid value if
2370  // necessary (Update Child Objects - I)
2371  if(DirNdx->FileInfo->Dloc) {
2372  // we can get here only when (Parallel == TRUE)
2373  DirNdx2 = UDFDirIndex(DirNdx->FileInfo->Dloc->DirIndex, 1);
2374  // It is enough to check DirNdx2->FileInfo only.
2375  // If one of Parallel FI's has reference (and equal)
2376  // to the FI being removed, it'll be removed from
2377  // the chain & nothing wrong will happen.
2378  if(DirNdx2 && (DirNdx2->FileInfo == FileInfo)) {
2379  if(FileInfo->PrevLinkedFile == FileInfo) {
2380  BrutePoint();
2381  DirNdx2->FileInfo = NULL;
2382  } else {
2383  DirNdx2->FileInfo = Parallel ?
2384  ParFileInfo : FileInfo->PrevLinkedFile;
2385  }
2386  ASSERT(!DirNdx2->FileInfo->RefCount);
2387  }
2388  }
2389  }
2390  }
2391  }
2392  if(Dloc->SDirInfo) {
2393  UDFPrint(("UDF: Found not cleaned up reference (SDir).\n"));
2394 
2395  // (Update Child Objects - II)
2396  if(Dloc->SDirInfo->ParentFile == FileInfo) {
2397  BrutePoint();
2398  ASSERT(ParFileInfo);
2399  Dloc->SDirInfo->ParentFile = ParFileInfo;
2400  }
2401  // We should break Cleanup process if alive reference detected
2402  // and there is no possibility to store pointer in some other
2403  // place (in parallel object)
2404  if(!KeepDloc) {
2405  BrutePoint();
2406  UDFPrint((" Skipping cleanup\n"));
2407  return UDF_FREE_NOTHING;
2408  }
2409 
2410  if(!UDFIsSDirDeleted(Dloc->SDirInfo) &&
2411  Dloc->SDirInfo->Dloc) {
2412  DirNdx2 = UDFDirIndex(Dloc->SDirInfo->Dloc->DirIndex, 1);
2413  if(DirNdx2 && (DirNdx2->FileInfo == FileInfo)) {
2414  DirNdx2->FileInfo =
2415  Parallel ? ParFileInfo : NULL;
2416  ASSERT(!DirNdx2->FileInfo->RefCount);
2417  }
2418  }
2419  }
2420 
2421  if(!KeepDloc) {
2422 
2423 #ifdef UDF_DBG
2424  ASSERT(!Modified);
2425 #endif
2426 
2427 #ifndef UDF_TRACK_ONDISK_ALLOCATION
2428  if(Dloc->DataLoc.Mapping) MyFreePool__(Dloc->DataLoc.Mapping);
2429  if(Dloc->AllocLoc.Mapping) MyFreePool__(Dloc->AllocLoc.Mapping);
2430  if(Dloc->FELoc.Mapping) MyFreePool__(Dloc->FELoc.Mapping);
2431  if(Dloc->FileEntry) {
2432  // plain file
2434  MyFreePool__(Dloc->FileEntry);
2435  Dloc->FileEntry = NULL;
2436  } else if(FileInfo->Index >= 2) {
2437  // error durring open operation
2439  }
2440 #endif //UDF_TRACK_ONDISK_ALLOCATION
2441  if(FileInfo->Dloc->DirIndex) {
2442  uint_di i;
2443  for(i=2; (DirNdx = UDFDirIndex(Dloc->DirIndex,i)); i++) {
2444  ASSERT(!DirNdx->FileInfo);
2445  if(DirNdx->FName.Buffer)
2446  MyFreePool__(DirNdx->FName.Buffer);
2447  }
2448  // The only place where we can free FE_Charge extent is here
2449  UDFFlushFESpace(Vcb, Dloc);
2450  UDFDirIndexFree(Dloc->DirIndex);
2451  Dloc->DirIndex = NULL;
2452 #ifdef UDF_TRACK_ONDISK_ALLOCATION
2454  if(FileInfo->Dloc->DirIndex) {
2455  for(i=2; DirNdx = UDFDirIndex(Dloc->DirIndex,i); i++) {
2456  ASSERT(!DirNdx->FileInfo);
2457  if(DirNdx->FName.Buffer)
2458  MyFreePool__(DirNdx->FName.Buffer);
2459  }
2460  UDFDirIndexFree(Dloc->DirIndex);
2461  Dloc->DirIndex = NULL;
2462  }
2463 #endif //UDF_TRACK_ONDISK_ALLOCATION
2464  }
2465 
2466 #ifdef UDF_TRACK_ONDISK_ALLOCATION
2467  if(Dloc->AllocLoc.Mapping) MyFreePool__(Dloc->AllocLoc.Mapping);
2468  if(Dloc->FELoc.Mapping) MyFreePool__(Dloc->FELoc.Mapping);
2469  if(Dloc->FileEntry) {
2470  // plain file
2472  MyFreePool__(Dloc->FileEntry);
2473  Dloc->FileEntry = NULL;
2474  } else if(FileInfo->Index >= 2) {
2475  // error durring open operation
2477  }
2478  if(Dloc->DataLoc.Mapping) {
2479  if(lc && (lc != UDF_INVALID_LINK_COUNT)) {
2480  UDFCheckSpaceAllocation(Vcb, 0, Dloc->DataLoc.Mapping, AS_USED); // check if used
2481  } else {
2482  UDFCheckSpaceAllocation(Vcb, 0, Dloc->DataLoc.Mapping, AS_FREE); // check if free
2483  }
2484  MyFreePool__(Dloc->DataLoc.Mapping);
2485  }
2486 #endif //UDF_TRACK_ONDISK_ALLOCATION
2487 
2488  if(lc && (lc != UDF_INVALID_LINK_COUNT)) {
2489  UDFRemoveDloc(Vcb, Dloc);
2490  } else {
2491  UDFFreeDloc(Vcb, Dloc);
2492  }
2493  } else // KeepDloc cannot be FALSE if (Linked == TRUE)
2494  if(Linked) {
2495 // BrutePoint();
2496  // Update pointers in ParentObject (if any)
2497  if(FileInfo->ParentFile->Dloc->SDirInfo == FileInfo)
2498  FileInfo->ParentFile->Dloc->SDirInfo = FileInfo->PrevLinkedFile;
2499  DirNdx = UDFDirIndex(FileInfo->Dloc->DirIndex, 0);
2500  if(DirNdx && (DirNdx->FileInfo == FileInfo))
2501  DirNdx->FileInfo = FileInfo->PrevLinkedFile;
2502  DirNdx = UDFDirIndex(FileInfo->ParentFile->Dloc->DirIndex, FileInfo->Index);
2503  if(DirNdx && (DirNdx->FileInfo == FileInfo))
2504  DirNdx->FileInfo = ParFileInfo;
2505  // remove from linked chain
2506  FileInfo->NextLinkedFile->PrevLinkedFile = FileInfo->PrevLinkedFile;
2507  FileInfo->PrevLinkedFile->NextLinkedFile = FileInfo->NextLinkedFile;
2508  // update pointer in Dloc
2509  if(FileInfo->Dloc->LinkedFileInfo == FileInfo)
2510  FileInfo->Dloc->LinkedFileInfo = FileInfo->PrevLinkedFile;
2511  }
2512  FileInfo->Dloc = NULL;
2513  } else {
2514  KeepDloc = FALSE;
2515  }
2516 
2517  // Cleanup pointers in ParentObject (if any)
2518  if(IsASDir) {
2519  if(FileInfo->ParentFile->Dloc->SDirInfo == FileInfo) {
2520  ASSERT(!Linked);
2521  FileInfo->ParentFile->Dloc->SDirInfo = NULL;
2522  FileInfo->ParentFile->Dloc->FE_Flags &= ~UDF_FE_FLAG_HAS_DEL_SDIR;
2523  }
2524  } else
2525  if(FileInfo->ParentFile) {
2526  ASSERT(FileInfo->ParentFile->Dloc);
2527  DirNdx = UDFDirIndex(FileInfo->ParentFile->Dloc->DirIndex, FileInfo->Index);
2528  ASSERT(DirNdx);
2529 #ifdef UDF_DBG
2530  PUDF_FILE_INFO OldFI;
2531  if(Parallel) {
2532  ASSERT(!DirNdx || !(OldFI = DirNdx->FileInfo) ||
2533  !(OldFI == FileInfo));
2534  } else {
2535  ASSERT(!DirNdx || !(OldFI = DirNdx->FileInfo) ||
2536  (OldFI == FileInfo));
2537  }
2538 #endif
2539  if( DirNdx && (DirNdx->FileInfo == FileInfo) ) {
2540  if(!Parallel)
2541  DirNdx->FileInfo = NULL;
2542 #ifdef UDF_DBG
2543  } else {
2544  // We can get here after incomplete Open
2545  if(!Parallel && DirNdx->FileInfo)
2546  BrutePoint();
2547 #endif
2548  }
2549 #ifdef UDF_DBG
2550  } else {
2551 // BrutePoint();
2552 #endif
2553  }
2554 
2555  if(!Parallel && FileInfo->FileIdent)
2556  MyFreePool__(FileInfo->FileIdent);
2557  FileInfo->FileIdent = NULL;
2558  // Kill reference to parent object
2559  FileInfo->ParentFile = NULL;
2560  // Kill references to parallel object(s) since it has no reference to
2561  // this one now
2562  FileInfo->NextLinkedFile =
2563  FileInfo->PrevLinkedFile = FileInfo;
2564  if(FileInfo->ListPtr)
2565  FileInfo->ListPtr->FileInfo = NULL;;
2566  return KeepDloc ? UDF_FREE_FILEINFO : (UDF_FREE_FILEINFO | UDF_FREE_DLOC);
2567 } // end UDFCleanUpFile__()
UNICODE_STRING FName
Definition: udf_rel.h:173
void UDFFreeDloc(IN PVCB Vcb, IN PUDF_DATALOC_INFO Dloc)
Definition: dirtree.cpp:1353
#define UDFPrint(Args)
Definition: udffs.h:225