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.

262 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. UDFSBoot.h
  5. Abstract:
  6. This module defines globally used procedure and data structures used
  7. by CD/DVD boot for UDF images.
  8. Author:
  9. Vijayachandran Jayaseelan (vijayj@microsoft.com)
  10. Revision History:
  11. --*/
  12. #ifndef _UDFSBOOT_
  13. #define _UDFSBOOT_
  14. #include <udf.h>
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #define UDF_BLOCK_SIZE 2048
  19. #define UDF_MAX_VOLUMES 1
  20. //
  21. // forward declarations
  22. //
  23. typedef struct _UDF_VOLUME* PUDF_VOLUME;
  24. typedef struct _UDF_CACHE_ENTRY* PUDF_CACHE_ENTRY;
  25. typedef struct _UDF_FILE_DIRECTORY* PUDF_FILE_DIRECTORY;
  26. typedef PVOID PUDF_BLOCK;
  27. //
  28. // Volume abstraction
  29. //
  30. typedef struct _UDF_VOLUME {
  31. PUDF_CACHE_ENTRY Cache;
  32. ULONG StartBlk;
  33. ULONG BlockSize;
  34. ULONG DeviceId;
  35. ULONG RootDirBlk;
  36. } UDF_VOLUME;
  37. ARC_STATUS
  38. UDFSVolumeOpen(
  39. IN PUDF_VOLUME Volume,
  40. IN ULONG DeviceId
  41. );
  42. ARC_STATUS
  43. UDFSVolumeReadBlock(
  44. IN PUDF_VOLUME Volume,
  45. IN ULONG BlockIdx,
  46. OUT PUDF_BLOCK Block
  47. );
  48. //
  49. // File or Directory abstraction
  50. //
  51. typedef struct _UDF_FILE_IDENTIFIER {
  52. ULONG BlockIdx;
  53. USHORT Offset; // inside the block
  54. } UDF_FILE_IDENTIFIER, * PUDF_FILE_IDENTIFIER;
  55. typedef struct _UDF_FILE_DIRECTORY {
  56. PUDF_VOLUME Volume;
  57. ULONGLONG Size;
  58. ULONG IcbBlk;
  59. ULONG StartDataBlk;
  60. UDF_FILE_IDENTIFIER FileId;
  61. UCHAR NumExtents;
  62. BOOLEAN IsDirectory;
  63. } UDF_FILE_DIRECTORY;
  64. ARC_STATUS
  65. UDFSDirGetFirstFID(
  66. IN PUDF_FILE_DIRECTORY Dir,
  67. OUT PUDF_FILE_IDENTIFIER File,
  68. OUT PUDF_BLOCK Block
  69. );
  70. ARC_STATUS
  71. UDFSDirGetNextFID(
  72. IN PUDF_FILE_DIRECTORY Dir,
  73. IN OUT PUDF_FILE_IDENTIFIER File,
  74. IN OUT PUDF_BLOCK Block
  75. );
  76. ARC_STATUS
  77. UDFSDirGetFile(
  78. IN PUDF_FILE_DIRECTORY Dir,
  79. IN PCHAR Name,
  80. OUT PUDF_FILE_DIRECTORY File
  81. );
  82. ARC_STATUS
  83. UDFSFileReadBlock(
  84. IN PUDF_FILE_DIRECTORY File,
  85. IN ULONG BlockIdx,
  86. IN ULONG Size,
  87. OUT PUDF_BLOCK Block
  88. );
  89. ARC_STATUS
  90. UDFSFileRead(
  91. IN PUDF_FILE_DIRECTORY File,
  92. IN PVOID Buffer,
  93. IN ULONG BufferSize,
  94. OUT PULONG Transfer
  95. );
  96. ARC_STATUS
  97. UDFSFileSeek(
  98. IN PUDF_FILE_DIRECTORY File,
  99. IN PLARGE_INTEGER Offset,
  100. IN SEEK_MODE SeekMode
  101. );
  102. ARC_STATUS
  103. UDFSFileClose(
  104. IN PUDF_FILE_DIRECTORY File
  105. );
  106. //
  107. // Cache abstractions
  108. //
  109. #define UDF_MAX_PATH_LEN 256
  110. #define UDF_MAX_CACHE_ENTRIES 48
  111. typedef struct _UDF_CACHE_ENTRY {
  112. CHAR Name[UDF_MAX_PATH_LEN];
  113. USHORT Usage;
  114. UDF_FILE_DIRECTORY File;
  115. } UDF_CACHE_ENTRY;
  116. ULONG
  117. UDFCachePutEntry(
  118. IN OUT PUDF_CACHE_ENTRY Cache,
  119. IN PCHAR Name,
  120. IN PUDF_FILE_DIRECTORY File
  121. );
  122. ULONG
  123. UDFCacheGetEntryByName(
  124. IN PUDF_CACHE_ENTRY Cache,
  125. IN PCHAR Name,
  126. IN BOOLEAN Increment
  127. );
  128. VOID
  129. UDFCacheFreeEntry(
  130. IN OUT PUDF_CACHE_ENTRY Cache,
  131. IN ULONG Idx
  132. );
  133. VOID
  134. UDFCacheIncrementUsage(
  135. IN OUT PUDF_CACHE_ENTRY Cache,
  136. IN ULONG Idx
  137. );
  138. VOID
  139. UDFCacheDecrementUsage(
  140. IN OUT PUDF_CACHE_ENTRY Cache,
  141. IN ULONG Idx
  142. );
  143. //
  144. // abstractions used by outside (loader) world
  145. //
  146. typedef struct _UDFS_STRUCTURE_CONTEXT {
  147. PUDF_VOLUME Volume;
  148. } UDFS_STRUCTURE_CONTEXT, *PUDFS_STRUCTURE_CONTEXT;
  149. //
  150. // Define UDFS file context structure.
  151. //
  152. typedef struct _UDFS_FILE_CONTEXT {
  153. ULONG CacheIdx;
  154. } UDFS_FILE_CONTEXT, *PUDFS_FILE_CONTEXT;
  155. //
  156. // Define file I/O prototypes.
  157. //
  158. PBL_DEVICE_ENTRY_TABLE
  159. IsUDFSFileStructure (
  160. IN ULONG DeviceId,
  161. IN PVOID StructureContext
  162. );
  163. ARC_STATUS
  164. UDFSOpen (
  165. IN CHAR * FIRMWARE_PTR OpenPath,
  166. IN OPEN_MODE OpenMode,
  167. OUT ULONG * FIRMWARE_PTR FileId
  168. );
  169. ARC_STATUS
  170. UDFSClose (
  171. IN ULONG FileId
  172. );
  173. ARC_STATUS
  174. UDFSRead (
  175. IN ULONG FileId,
  176. OUT VOID * FIRMWARE_PTR Buffer,
  177. IN ULONG Length,
  178. OUT ULONG * FIRMWARE_PTR Count
  179. );
  180. ARC_STATUS
  181. UDFSSeek (
  182. IN ULONG FileId,
  183. IN LARGE_INTEGER * FIRMWARE_PTR Offset,
  184. IN SEEK_MODE SeekMode
  185. );
  186. ARC_STATUS
  187. UDFSWrite (
  188. IN ULONG FileId,
  189. IN VOID * FIRMWARE_PTR Buffer,
  190. IN ULONG Length,
  191. OUT ULONG * FIRMWARE_PTR Count
  192. );
  193. ARC_STATUS
  194. UDFSGetFileInformation (
  195. IN ULONG FileId,
  196. OUT FILE_INFORMATION * FIRMWARE_PTR Buffer
  197. );
  198. ARC_STATUS
  199. UDFSSetFileInformation (
  200. IN ULONG FileId,
  201. IN ULONG AttributeFlags,
  202. IN ULONG AttributeMask
  203. );
  204. ARC_STATUS
  205. UDFSInitialize(
  206. VOID
  207. );
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. #endif // _UDFSBOOT_