Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

130 lines
2.9 KiB

  1. /**************************************************************************************************
  2. FILENAME: Freespace.h
  3. COPYRIGHT 2001 Microsoft Corporation and Executive Software International, Inc.
  4. DESCRIPTION:
  5. Free space location prototypes.
  6. **************************************************************************************************/
  7. #ifndef _FREESPACE_H_
  8. #define _FREESPACE_H_
  9. typedef struct _FILE_LIST_ENTRY *PFILE_LIST_ENTRY;
  10. typedef struct _FREE_SPACE_ENTRY *PFREE_SPACE_ENTRY;
  11. PVOID
  12. PreviousEntry(
  13. IN PVOID pCurrentEntry
  14. );
  15. PVOID
  16. LastEntry(
  17. IN PRTL_AVL_TABLE Table
  18. );
  19. BOOL
  20. BuildFreeSpaceList(
  21. IN OUT PRTL_GENERIC_TABLE pFreeSpaceTable,
  22. IN CONST LONGLONG MinClusterCount,
  23. IN CONST BOOL bSortBySize,
  24. OUT LONGLONG *pBiggestFreeSpaceClusterCount = NULL,
  25. OUT LONGLONG *pBiggestFreeSpaceStartingLcn = NULL,
  26. IN CONST BOOL bIgnoreMftZone = FALSE
  27. );
  28. BOOL
  29. BuildFreeSpaceListWithExclude(
  30. IN OUT PRTL_GENERIC_TABLE pFreeSpaceTable,
  31. IN CONST LONGLONG MinClusterCount,
  32. IN CONST LONGLONG ExcludeZoneStart,
  33. IN CONST LONGLONG ExcludeZoneEnd,
  34. IN CONST BOOL bSortBySize,
  35. IN CONST BOOL bExcludeMftZone = TRUE
  36. );
  37. BOOL
  38. BuildFreeSpaceListWithMultipleTrees(
  39. OUT LONGLONG *pMaxClusterCount,
  40. IN CONST LONGLONG IncludeZoneStartingLcn = 0,
  41. IN CONST LONGLONG IncludeZoneEndingLcn = 0
  42. );
  43. BOOL
  44. FindFreeSpace(
  45. IN PRTL_GENERIC_TABLE pTable,
  46. IN BOOL DeleteUnusedEntries,
  47. IN LONGLONG MaxStartingLcn
  48. );
  49. BOOL
  50. FindSortedFreeSpace(
  51. IN PRTL_GENERIC_TABLE pTable
  52. );
  53. BOOL
  54. FindFreeSpaceWithMultipleTrees(
  55. IN CONST LONGLONG ClusterCount,
  56. IN CONST LONGLONG MaxStartingLcn
  57. );
  58. BOOL
  59. UpdateInMultipleTrees(
  60. IN PFREE_SPACE_ENTRY pOldEntry,
  61. IN PFREE_SPACE_ENTRY pNewEntry
  62. );
  63. //Uses FindFreeSpace to find a series of free space extents that can be used to partially defragment a file.
  64. BOOL
  65. FindLastFreeSpaceChunks(
  66. );
  67. //Checks to see if the cluster just before the first cluster of the current file is free. Used when moving
  68. //contiguous files to consolidate free space.
  69. BOOL
  70. IsFreeSpaceAtHeadOfFile(
  71. );
  72. //Finds the next extent of free space on the drive within a given range of clusters.
  73. VOID
  74. FindFreeExtent(
  75. IN PULONG pBitmap,
  76. IN LONGLONG RangeEnd,
  77. IN OUT PLONGLONG pLcn,
  78. OUT PLONGLONG pStartingLcn,
  79. OUT PLONGLONG pClusterCount
  80. );
  81. //Generic routine to find free space fitting various requirements.
  82. BOOL
  83. FindFreeSpace(
  84. IN int Type
  85. );
  86. //Gets a volume bitmap and (on NTFS) fills the MFT zone with "in use".
  87. BOOL
  88. GetVolumeBitmap(
  89. );
  90. //Counts the number of free spaces in the bitmap, and calculates stats about the free spaces.
  91. BOOL
  92. CountFreeSpaces(
  93. );
  94. //Fills a VolumeBitmap with 'inuse' if it's an NTFS volume
  95. BOOL
  96. MarkMFTUnavailable(
  97. void
  98. );
  99. //Checking for usable freespace
  100. BOOL
  101. DetermineUsableFreespace(
  102. LONGLONG *llUsableFreeClusters
  103. );
  104. #endif // _FREESPACE_H_