Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

SimpleFileSystem.h 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /** @file
  2. SimpleFileSystem protocol as defined in the UEFI 2.0 specification.
  3. The SimpleFileSystem protocol is the programmatic access to the FAT (12,16,32)
  4. file system specified in UEFI 2.0. It can also be used to abstract a file
  5. system other than FAT.
  6. UEFI 2.0 can boot from any valid EFI image contained in a SimpleFileSystem.
  7. Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
  8. This program and the accompanying materials are licensed and made available under
  9. the terms and conditions of the BSD License that accompanies this distribution.
  10. The full text of the license may be found at
  11. http://opensource.org/licenses/bsd-license.php.
  12. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  13. WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
  14. **/
  15. #ifndef __SIMPLE_FILE_SYSTEM_H__
  16. #define __SIMPLE_FILE_SYSTEM_H__
  17. FILE_LICENCE ( BSD3 );
  18. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID \
  19. { \
  20. 0x964e5b22, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
  21. }
  22. typedef struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL;
  23. typedef struct _EFI_FILE_PROTOCOL EFI_FILE_PROTOCOL;
  24. typedef struct _EFI_FILE_PROTOCOL *EFI_FILE_HANDLE;
  25. ///
  26. /// Protocol GUID name defined in EFI1.1.
  27. ///
  28. #define SIMPLE_FILE_SYSTEM_PROTOCOL EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID
  29. ///
  30. /// Protocol name defined in EFI1.1.
  31. ///
  32. typedef EFI_SIMPLE_FILE_SYSTEM_PROTOCOL EFI_FILE_IO_INTERFACE;
  33. typedef EFI_FILE_PROTOCOL EFI_FILE;
  34. /**
  35. Open the root directory on a volume.
  36. @param This A pointer to the volume to open the root directory.
  37. @param Root A pointer to the location to return the opened file handle for the
  38. root directory.
  39. @retval EFI_SUCCESS The device was opened.
  40. @retval EFI_UNSUPPORTED This volume does not support the requested file system type.
  41. @retval EFI_NO_MEDIA The device has no medium.
  42. @retval EFI_DEVICE_ERROR The device reported an error.
  43. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  44. @retval EFI_ACCESS_DENIED The service denied access to the file.
  45. @retval EFI_OUT_OF_RESOURCES The volume was not opened due to lack of resources.
  46. @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
  47. longer supported. Any existing file handles for this volume are
  48. no longer valid. To access the files on the new medium, the
  49. volume must be reopened with OpenVolume().
  50. **/
  51. typedef
  52. EFI_STATUS
  53. (EFIAPI *EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME)(
  54. IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
  55. OUT EFI_FILE_PROTOCOL **Root
  56. );
  57. #define EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION 0x00010000
  58. ///
  59. /// Revision defined in EFI1.1
  60. ///
  61. #define EFI_FILE_IO_INTERFACE_REVISION EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_REVISION
  62. struct _EFI_SIMPLE_FILE_SYSTEM_PROTOCOL {
  63. ///
  64. /// The version of the EFI_SIMPLE_FILE_SYSTEM_PROTOCOL. The version
  65. /// specified by this specification is 0x00010000. All future revisions
  66. /// must be backwards compatible.
  67. ///
  68. UINT64 Revision;
  69. EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_OPEN_VOLUME OpenVolume;
  70. };
  71. /**
  72. Opens a new file relative to the source file's location.
  73. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  74. handle to the source location. This would typically be an open
  75. handle to a directory.
  76. @param NewHandle A pointer to the location to return the opened handle for the new
  77. file.
  78. @param FileName The Null-terminated string of the name of the file to be opened.
  79. The file name may contain the following path modifiers: "\", ".",
  80. and "..".
  81. @param OpenMode The mode to open the file. The only valid combinations that the
  82. file may be opened with are: Read, Read/Write, or Create/Read/Write.
  83. @param Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the
  84. attribute bits for the newly created file.
  85. @retval EFI_SUCCESS The file was opened.
  86. @retval EFI_NOT_FOUND The specified file could not be found on the device.
  87. @retval EFI_NO_MEDIA The device has no medium.
  88. @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
  89. longer supported.
  90. @retval EFI_DEVICE_ERROR The device reported an error.
  91. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  92. @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
  93. when the media is write-protected.
  94. @retval EFI_ACCESS_DENIED The service denied access to the file.
  95. @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
  96. @retval EFI_VOLUME_FULL The volume is full.
  97. **/
  98. typedef
  99. EFI_STATUS
  100. (EFIAPI *EFI_FILE_OPEN)(
  101. IN EFI_FILE_PROTOCOL *This,
  102. OUT EFI_FILE_PROTOCOL **NewHandle,
  103. IN CHAR16 *FileName,
  104. IN UINT64 OpenMode,
  105. IN UINT64 Attributes
  106. );
  107. //
  108. // Open modes
  109. //
  110. #define EFI_FILE_MODE_READ 0x0000000000000001ULL
  111. #define EFI_FILE_MODE_WRITE 0x0000000000000002ULL
  112. #define EFI_FILE_MODE_CREATE 0x8000000000000000ULL
  113. //
  114. // File attributes
  115. //
  116. #define EFI_FILE_READ_ONLY 0x0000000000000001ULL
  117. #define EFI_FILE_HIDDEN 0x0000000000000002ULL
  118. #define EFI_FILE_SYSTEM 0x0000000000000004ULL
  119. #define EFI_FILE_RESERVED 0x0000000000000008ULL
  120. #define EFI_FILE_DIRECTORY 0x0000000000000010ULL
  121. #define EFI_FILE_ARCHIVE 0x0000000000000020ULL
  122. #define EFI_FILE_VALID_ATTR 0x0000000000000037ULL
  123. /**
  124. Closes a specified file handle.
  125. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  126. handle to close.
  127. @retval EFI_SUCCESS The file was closed.
  128. **/
  129. typedef
  130. EFI_STATUS
  131. (EFIAPI *EFI_FILE_CLOSE)(
  132. IN EFI_FILE_PROTOCOL *This
  133. );
  134. /**
  135. Close and delete the file handle.
  136. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the
  137. handle to the file to delete.
  138. @retval EFI_SUCCESS The file was closed and deleted, and the handle was closed.
  139. @retval EFI_WARN_DELETE_FAILURE The handle was closed, but the file was not deleted.
  140. **/
  141. typedef
  142. EFI_STATUS
  143. (EFIAPI *EFI_FILE_DELETE)(
  144. IN EFI_FILE_PROTOCOL *This
  145. );
  146. /**
  147. Reads data from a file.
  148. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  149. handle to read data from.
  150. @param BufferSize On input, the size of the Buffer. On output, the amount of data
  151. returned in Buffer. In both cases, the size is measured in bytes.
  152. @param Buffer The buffer into which the data is read.
  153. @retval EFI_SUCCESS Data was read.
  154. @retval EFI_NO_MEDIA The device has no medium.
  155. @retval EFI_DEVICE_ERROR The device reported an error.
  156. @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file.
  157. @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file.
  158. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  159. @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory
  160. entry. BufferSize has been updated with the size
  161. needed to complete the request.
  162. **/
  163. typedef
  164. EFI_STATUS
  165. (EFIAPI *EFI_FILE_READ)(
  166. IN EFI_FILE_PROTOCOL *This,
  167. IN OUT UINTN *BufferSize,
  168. OUT VOID *Buffer
  169. );
  170. /**
  171. Writes data to a file.
  172. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  173. handle to write data to.
  174. @param BufferSize On input, the size of the Buffer. On output, the amount of data
  175. actually written. In both cases, the size is measured in bytes.
  176. @param Buffer The buffer of data to write.
  177. @retval EFI_SUCCESS Data was written.
  178. @retval EFI_UNSUPPORTED Writes to open directory files are not supported.
  179. @retval EFI_NO_MEDIA The device has no medium.
  180. @retval EFI_DEVICE_ERROR The device reported an error.
  181. @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.
  182. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  183. @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
  184. @retval EFI_ACCESS_DENIED The file was opened read only.
  185. @retval EFI_VOLUME_FULL The volume is full.
  186. **/
  187. typedef
  188. EFI_STATUS
  189. (EFIAPI *EFI_FILE_WRITE)(
  190. IN EFI_FILE_PROTOCOL *This,
  191. IN OUT UINTN *BufferSize,
  192. IN VOID *Buffer
  193. );
  194. /**
  195. Sets a file's current position.
  196. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the
  197. file handle to set the requested position on.
  198. @param Position The byte position from the start of the file to set.
  199. @retval EFI_SUCCESS The position was set.
  200. @retval EFI_UNSUPPORTED The seek request for nonzero is not valid on open
  201. directories.
  202. @retval EFI_DEVICE_ERROR An attempt was made to set the position of a deleted file.
  203. **/
  204. typedef
  205. EFI_STATUS
  206. (EFIAPI *EFI_FILE_SET_POSITION)(
  207. IN EFI_FILE_PROTOCOL *This,
  208. IN UINT64 Position
  209. );
  210. /**
  211. Returns a file's current position.
  212. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  213. handle to get the current position on.
  214. @param Position The address to return the file's current position value.
  215. @retval EFI_SUCCESS The position was returned.
  216. @retval EFI_UNSUPPORTED The request is not valid on open directories.
  217. @retval EFI_DEVICE_ERROR An attempt was made to get the position from a deleted file.
  218. **/
  219. typedef
  220. EFI_STATUS
  221. (EFIAPI *EFI_FILE_GET_POSITION)(
  222. IN EFI_FILE_PROTOCOL *This,
  223. OUT UINT64 *Position
  224. );
  225. /**
  226. Returns information about a file.
  227. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  228. handle the requested information is for.
  229. @param InformationType The type identifier for the information being requested.
  230. @param BufferSize On input, the size of Buffer. On output, the amount of data
  231. returned in Buffer. In both cases, the size is measured in bytes.
  232. @param Buffer A pointer to the data buffer to return. The buffer's type is
  233. indicated by InformationType.
  234. @retval EFI_SUCCESS The information was returned.
  235. @retval EFI_UNSUPPORTED The InformationType is not known.
  236. @retval EFI_NO_MEDIA The device has no medium.
  237. @retval EFI_DEVICE_ERROR The device reported an error.
  238. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  239. @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to read the current directory entry.
  240. BufferSize has been updated with the size needed to complete
  241. the request.
  242. **/
  243. typedef
  244. EFI_STATUS
  245. (EFIAPI *EFI_FILE_GET_INFO)(
  246. IN EFI_FILE_PROTOCOL *This,
  247. IN EFI_GUID *InformationType,
  248. IN OUT UINTN *BufferSize,
  249. OUT VOID *Buffer
  250. );
  251. /**
  252. Sets information about a file.
  253. @param File A pointer to the EFI_FILE_PROTOCOL instance that is the file
  254. handle the information is for.
  255. @param InformationType The type identifier for the information being set.
  256. @param BufferSize The size, in bytes, of Buffer.
  257. @param Buffer A pointer to the data buffer to write. The buffer's type is
  258. indicated by InformationType.
  259. @retval EFI_SUCCESS The information was set.
  260. @retval EFI_UNSUPPORTED The InformationType is not known.
  261. @retval EFI_NO_MEDIA The device has no medium.
  262. @retval EFI_DEVICE_ERROR The device reported an error.
  263. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  264. @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_INFO_ID and the media is
  265. read-only.
  266. @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_PROTOCOL_SYSTEM_INFO_ID
  267. and the media is read only.
  268. @retval EFI_WRITE_PROTECTED InformationType is EFI_FILE_SYSTEM_VOLUME_LABEL_ID
  269. and the media is read-only.
  270. @retval EFI_ACCESS_DENIED An attempt is made to change the name of a file to a
  271. file that is already present.
  272. @retval EFI_ACCESS_DENIED An attempt is being made to change the EFI_FILE_DIRECTORY
  273. Attribute.
  274. @retval EFI_ACCESS_DENIED An attempt is being made to change the size of a directory.
  275. @retval EFI_ACCESS_DENIED InformationType is EFI_FILE_INFO_ID and the file was opened
  276. read-only and an attempt is being made to modify a field
  277. other than Attribute.
  278. @retval EFI_VOLUME_FULL The volume is full.
  279. @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the size of the type indicated
  280. by InformationType.
  281. **/
  282. typedef
  283. EFI_STATUS
  284. (EFIAPI *EFI_FILE_SET_INFO)(
  285. IN EFI_FILE_PROTOCOL *This,
  286. IN EFI_GUID *InformationType,
  287. IN UINTN BufferSize,
  288. IN VOID *Buffer
  289. );
  290. /**
  291. Flushes all modified data associated with a file to a device.
  292. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  293. handle to flush.
  294. @retval EFI_SUCCESS The data was flushed.
  295. @retval EFI_NO_MEDIA The device has no medium.
  296. @retval EFI_DEVICE_ERROR The device reported an error.
  297. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  298. @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
  299. @retval EFI_ACCESS_DENIED The file was opened read-only.
  300. @retval EFI_VOLUME_FULL The volume is full.
  301. **/
  302. typedef
  303. EFI_STATUS
  304. (EFIAPI *EFI_FILE_FLUSH)(
  305. IN EFI_FILE_PROTOCOL *This
  306. );
  307. typedef struct {
  308. //
  309. // If Event is NULL, then blocking I/O is performed.
  310. // If Event is not NULL and non-blocking I/O is supported, then non-blocking I/O is performed,
  311. // and Event will be signaled when the read request is completed.
  312. // The caller must be prepared to handle the case where the callback associated with Event
  313. // occurs before the original asynchronous I/O request call returns.
  314. //
  315. EFI_EVENT Event;
  316. //
  317. // Defines whether or not the signaled event encountered an error.
  318. //
  319. EFI_STATUS Status;
  320. //
  321. // For OpenEx(): Not Used, ignored.
  322. // For ReadEx(): On input, the size of the Buffer. On output, the amount of data returned in Buffer.
  323. // In both cases, the size is measured in bytes.
  324. // For WriteEx(): On input, the size of the Buffer. On output, the amount of data actually written.
  325. // In both cases, the size is measured in bytes.
  326. // For FlushEx(): Not used, ignored.
  327. //
  328. UINTN BufferSize;
  329. //
  330. // For OpenEx(): Not Used, ignored.
  331. // For ReadEx(): The buffer into which the data is read.
  332. // For WriteEx(): The buffer of data to write.
  333. // For FlushEx(): Not Used, ignored.
  334. //
  335. VOID *Buffer;
  336. } EFI_FILE_IO_TOKEN;
  337. /**
  338. Opens a new file relative to the source directory's location.
  339. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  340. handle to the source location.
  341. @param NewHandle A pointer to the location to return the opened handle for the new
  342. file.
  343. @param FileName The Null-terminated string of the name of the file to be opened.
  344. The file name may contain the following path modifiers: "\", ".",
  345. and "..".
  346. @param OpenMode The mode to open the file. The only valid combinations that the
  347. file may be opened with are: Read, Read/Write, or Create/Read/Write.
  348. @param Attributes Only valid for EFI_FILE_MODE_CREATE, in which case these are the
  349. attribute bits for the newly created file.
  350. @param Token A pointer to the token associated with the transaction.
  351. @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.
  352. If Event is not NULL (asynchronous I/O): The request was successfully
  353. queued for processing.
  354. @retval EFI_NOT_FOUND The specified file could not be found on the device.
  355. @retval EFI_NO_MEDIA The device has no medium.
  356. @retval EFI_MEDIA_CHANGED The device has a different medium in it or the medium is no
  357. longer supported.
  358. @retval EFI_DEVICE_ERROR The device reported an error.
  359. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  360. @retval EFI_WRITE_PROTECTED An attempt was made to create a file, or open a file for write
  361. when the media is write-protected.
  362. @retval EFI_ACCESS_DENIED The service denied access to the file.
  363. @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the file.
  364. @retval EFI_VOLUME_FULL The volume is full.
  365. **/
  366. typedef
  367. EFI_STATUS
  368. (EFIAPI *EFI_FILE_OPEN_EX)(
  369. IN EFI_FILE_PROTOCOL *This,
  370. OUT EFI_FILE_PROTOCOL **NewHandle,
  371. IN CHAR16 *FileName,
  372. IN UINT64 OpenMode,
  373. IN UINT64 Attributes,
  374. IN OUT EFI_FILE_IO_TOKEN *Token
  375. );
  376. /**
  377. Reads data from a file.
  378. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to read data from.
  379. @param Token A pointer to the token associated with the transaction.
  380. @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.
  381. If Event is not NULL (asynchronous I/O): The request was successfully
  382. queued for processing.
  383. @retval EFI_NO_MEDIA The device has no medium.
  384. @retval EFI_DEVICE_ERROR The device reported an error.
  385. @retval EFI_DEVICE_ERROR An attempt was made to read from a deleted file.
  386. @retval EFI_DEVICE_ERROR On entry, the current file position is beyond the end of the file.
  387. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  388. @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
  389. **/
  390. typedef
  391. EFI_STATUS
  392. (EFIAPI *EFI_FILE_READ_EX) (
  393. IN EFI_FILE_PROTOCOL *This,
  394. IN OUT EFI_FILE_IO_TOKEN *Token
  395. );
  396. /**
  397. Writes data to a file.
  398. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file handle to write data to.
  399. @param Token A pointer to the token associated with the transaction.
  400. @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.
  401. If Event is not NULL (asynchronous I/O): The request was successfully
  402. queued for processing.
  403. @retval EFI_UNSUPPORTED Writes to open directory files are not supported.
  404. @retval EFI_NO_MEDIA The device has no medium.
  405. @retval EFI_DEVICE_ERROR The device reported an error.
  406. @retval EFI_DEVICE_ERROR An attempt was made to write to a deleted file.
  407. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  408. @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
  409. @retval EFI_ACCESS_DENIED The file was opened read only.
  410. @retval EFI_VOLUME_FULL The volume is full.
  411. @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
  412. **/
  413. typedef
  414. EFI_STATUS
  415. (EFIAPI *EFI_FILE_WRITE_EX) (
  416. IN EFI_FILE_PROTOCOL *This,
  417. IN OUT EFI_FILE_IO_TOKEN *Token
  418. );
  419. /**
  420. Flushes all modified data associated with a file to a device.
  421. @param This A pointer to the EFI_FILE_PROTOCOL instance that is the file
  422. handle to flush.
  423. @param Token A pointer to the token associated with the transaction.
  424. @retval EFI_SUCCESS If Event is NULL (blocking I/O): The data was read successfully.
  425. If Event is not NULL (asynchronous I/O): The request was successfully
  426. queued for processing.
  427. @retval EFI_NO_MEDIA The device has no medium.
  428. @retval EFI_DEVICE_ERROR The device reported an error.
  429. @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted.
  430. @retval EFI_WRITE_PROTECTED The file or medium is write-protected.
  431. @retval EFI_ACCESS_DENIED The file was opened read-only.
  432. @retval EFI_VOLUME_FULL The volume is full.
  433. @retval EFI_OUT_OF_RESOURCES Unable to queue the request due to lack of resources.
  434. **/
  435. typedef
  436. EFI_STATUS
  437. (EFIAPI *EFI_FILE_FLUSH_EX) (
  438. IN EFI_FILE_PROTOCOL *This,
  439. IN OUT EFI_FILE_IO_TOKEN *Token
  440. );
  441. #define EFI_FILE_PROTOCOL_REVISION 0x00010000
  442. #define EFI_FILE_PROTOCOL_REVISION2 0x00020000
  443. #define EFI_FILE_PROTOCOL_LATEST_REVISION EFI_FILE_PROTOCOL_REVISION2
  444. //
  445. // Revision defined in EFI1.1.
  446. //
  447. #define EFI_FILE_REVISION EFI_FILE_PROTOCOL_REVISION
  448. ///
  449. /// The EFI_FILE_PROTOCOL provides file IO access to supported file systems.
  450. /// An EFI_FILE_PROTOCOL provides access to a file's or directory's contents,
  451. /// and is also a reference to a location in the directory tree of the file system
  452. /// in which the file resides. With any given file handle, other files may be opened
  453. /// relative to this file's location, yielding new file handles.
  454. ///
  455. struct _EFI_FILE_PROTOCOL {
  456. ///
  457. /// The version of the EFI_FILE_PROTOCOL interface. The version specified
  458. /// by this specification is EFI_FILE_PROTOCOL_LATEST_REVISION.
  459. /// Future versions are required to be backward compatible to version 1.0.
  460. ///
  461. UINT64 Revision;
  462. EFI_FILE_OPEN Open;
  463. EFI_FILE_CLOSE Close;
  464. EFI_FILE_DELETE Delete;
  465. EFI_FILE_READ Read;
  466. EFI_FILE_WRITE Write;
  467. EFI_FILE_GET_POSITION GetPosition;
  468. EFI_FILE_SET_POSITION SetPosition;
  469. EFI_FILE_GET_INFO GetInfo;
  470. EFI_FILE_SET_INFO SetInfo;
  471. EFI_FILE_FLUSH Flush;
  472. EFI_FILE_OPEN_EX OpenEx;
  473. EFI_FILE_READ_EX ReadEx;
  474. EFI_FILE_WRITE_EX WriteEx;
  475. EFI_FILE_FLUSH_EX FlushEx;
  476. };
  477. extern EFI_GUID gEfiSimpleFileSystemProtocolGuid;
  478. #endif