Function opens and returns a file handle to the root directory of a volume. @param DeviceHandle A handle for a device @return A valid file handle or NULL is returned **/
| 55 | |
| 56 | **/ |
| 57 | EFI_FILE_HANDLE |
| 58 | EfiLibOpenRoot ( |
| 59 | IN EFI_HANDLE DeviceHandle |
| 60 | ) |
| 61 | { |
| 62 | EFI_STATUS Status; |
| 63 | EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Volume; |
| 64 | EFI_FILE_HANDLE File; |
| 65 | |
| 66 | File = NULL; |
| 67 | |
| 68 | // |
| 69 | // File the file system interface to the device |
| 70 | // |
| 71 | Status = gBS->HandleProtocol ( |
| 72 | DeviceHandle, |
| 73 | &gEfiSimpleFileSystemProtocolGuid, |
| 74 | (VOID **) &Volume |
| 75 | ); |
| 76 | |
| 77 | // |
| 78 | // Open the root directory of the volume |
| 79 | // |
| 80 | if (!EFI_ERROR(Status)) { |
| 81 | Status = Volume->OpenVolume ( |
| 82 | Volume, |
| 83 | &File |
| 84 | ); |
| 85 | } |
| 86 | // |
| 87 | // Done |
| 88 | // |
| 89 | return EFI_ERROR(Status) ? NULL : File; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 |
no outgoing calls
no test coverage detected