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