OpenCore
1.0.4
OpenCore Bootloader
|
#include <Guid/FileInfo.h>
#include <IndustryStandard/Mbr.h>
#include <Protocol/SimpleFileSystem.h>
#include <Protocol/DevicePath.h>
#include <Protocol/BlockIo.h>
#include <Protocol/BlockIo2.h>
Go to the source code of this file.
Data Structures | |
struct | DIRECTORY_SEARCH_CONTEXT |
struct | OC_DISK_CONTEXT |
struct | OC_PARTITION_ENTRIES |
Macros | |
#define | OC_MAX_VOLUME_LABEL_SIZE 64 |
#define | OC_MAX_CONTENT_FLAVOUR_SIZE 64 |
Typedefs | |
typedef EFI_STATUS(* | OC_PROCESS_DIRECTORY_ENTRY) (EFI_FILE_HANDLE Directory, EFI_FILE_INFO *FileInfo, UINTN FileInfoSize, VOID *Context OPTIONAL) |
Functions | |
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * | OcLocateFileSystem (IN EFI_HANDLE DeviceHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *FilePath OPTIONAL) |
EFI_FILE_PROTOCOL * | OcLocateRootVolume (IN EFI_HANDLE DeviceHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *FilePath OPTIONAL) |
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * | OcLocateFileSystemByGuid (IN CONST GUID *Guid) |
CHAR16 * | OcGetVolumeLabel (IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem) |
EFI_STATUS | OcSafeFileOpen (IN CONST EFI_FILE_PROTOCOL *Directory, OUT EFI_FILE_PROTOCOL **NewHandle, IN CONST CHAR16 *FileName, IN CONST UINT64 OpenMode, IN CONST UINT64 Attributes) |
BOOLEAN | OcFileExists (IN CONST EFI_FILE_PROTOCOL *Directory, IN CONST CHAR16 *FileName) |
EFI_STATUS | OcDeleteFile (IN EFI_FILE_PROTOCOL *Directory, IN CONST CHAR16 *FileName) |
VOID * | OcReadFile (IN CONST EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL, IN CONST UINT32 MaxFileSize OPTIONAL) |
VOID * | OcReadFileFromDirectory (IN CONST EFI_FILE_PROTOCOL *RootDirectory, IN CONST CHAR16 *FilePath, OUT UINT32 *FileSize OPTIONAL, IN UINT32 MaxFileSize OPTIONAL) |
EFI_STATUS | OcReadFileSize (IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem, IN CONST CHAR16 *FilePath, OUT UINT32 *Size) |
EFI_STATUS | OcGetFileData (IN EFI_FILE_PROTOCOL *File, IN UINT32 Position, IN UINT32 Size, OUT UINT8 *Buffer) |
EFI_STATUS | OcSetFileData (IN EFI_FILE_PROTOCOL *WritableFs OPTIONAL, IN CONST CHAR16 *FileName, IN CONST VOID *Buffer, IN UINT32 Size) |
EFI_STATUS | OcAllocateCopyFileData (IN EFI_FILE_PROTOCOL *File, OUT UINT8 **Buffer, OUT UINT32 *BufferSize) |
VOID | OcDirectorySeachContextInit (IN OUT DIRECTORY_SEARCH_CONTEXT *Context) |
EFI_STATUS | OcGetNewestFileFromDirectory (IN OUT DIRECTORY_SEARCH_CONTEXT *Context, IN EFI_FILE_PROTOCOL *Directory, IN CHAR16 *FileNameStartsWith OPTIONAL, OUT EFI_FILE_INFO **FileInfo) |
EFI_STATUS | OcEnsureDirectoryFile (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN IsDirectory) |
EFI_STATUS | OcScanDirectory (IN EFI_FILE_HANDLE Directory, IN OC_PROCESS_DIRECTORY_ENTRY ProcessEntry, IN OUT VOID *Context OPTIONAL) |
VOID * | OcGetFileInfo (IN EFI_FILE_PROTOCOL *File, IN EFI_GUID *InformationType, IN UINTN MinFileInfoSize, OUT UINTN *RealFileInfoSize OPTIONAL) |
EFI_STATUS | OcGetFileSize (IN EFI_FILE_PROTOCOL *File, OUT UINT32 *Size) |
EFI_STATUS | OcGetFileModificationTime (IN EFI_FILE_PROTOCOL *File, OUT EFI_TIME *Time) |
BOOLEAN | OcIsWritableFileSystem (IN EFI_FILE_PROTOCOL *Fs) |
EFI_STATUS | OcFindWritableFileSystem (IN OUT EFI_FILE_PROTOCOL **WritableFs) |
EFI_STATUS | OcFindWritableOcFileSystem (OUT EFI_FILE_PROTOCOL **FileSystem) |
EFI_STATUS EFIAPI | OcOpenFileByRemainingDevicePath (IN EFI_HANDLE FileSystemHandle, IN CONST EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes) |
EFI_STATUS EFIAPI | OcOpenFileByDevicePath (IN OUT EFI_DEVICE_PATH_PROTOCOL **FilePath, OUT EFI_FILE_PROTOCOL **File, IN UINT64 OpenMode, IN UINT64 Attributes) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskGetDevicePath (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
EFI_HANDLE | OcPartitionGetDiskHandle (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
EFI_HANDLE | OcPartitionGetPartitionHandle (IN EFI_DEVICE_PATH_PROTOCOL *HdDevicePath) |
BOOLEAN | OcIsDiskCdRom (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath) |
EFI_STATUS | OcDiskReadElTorito (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINT8 **Buffer, OUT UINTN *BufferSize) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskFindSystemPartitionPath (IN CONST EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *EspDevicePathSize, OUT EFI_HANDLE *EspDeviceHandle) |
EFI_STATUS | OcDiskInitializeContext (OUT OC_DISK_CONTEXT *Context, IN EFI_HANDLE DiskHandle, IN BOOLEAN UseBlockIo2) |
EFI_STATUS | OcDiskRead (IN OC_DISK_CONTEXT *Context, IN UINT64 Lba, IN UINTN BufferSize, OUT VOID *Buffer) |
EFI_STATUS | OcDiskWrite (IN OC_DISK_CONTEXT *Context, IN UINT64 Lba, IN UINTN BufferSize, IN VOID *Buffer) |
CONST OC_PARTITION_ENTRIES * | OcGetDiskPartitions (IN EFI_HANDLE DiskHandle, IN BOOLEAN UseBlockIo2) |
CONST EFI_PARTITION_ENTRY * | OcGetGptPartitionEntry (IN EFI_HANDLE FsHandle) |
MASTER_BOOT_RECORD * | OcGetDiskMbrTable (IN EFI_HANDLE DiskHandle, IN BOOLEAN CheckPartitions) |
EFI_STATUS | OcDiskGetMbrPartitionIndex (IN EFI_HANDLE PartitionHandle, OUT UINT8 *PartitionIndex) |
EFI_STATUS | OcDiskMarkMbrPartitionActive (IN EFI_HANDLE DiskHandle, IN UINT8 PartitionIndex) |
EFI_DEVICE_PATH_PROTOCOL * | OcDiskFindActiveMbrPartitionPath (IN EFI_DEVICE_PATH_PROTOCOL *DiskDevicePath, OUT UINTN *PartitionDevicePathSize, OUT EFI_HANDLE *PartitionDeviceHandle) |
EFI_DEVICE_PATH_PROTOCOL * | OcCreateFvFileDevicePath (IN EFI_GUID *FileGuid) |
VOID * | OcReadFvFileSection (IN EFI_GUID *FileGuid, IN UINT8 SectionType, OUT UINT32 *FileSize) |
Copyright (C) 2016 - 2017, The HermitCrabs Lab. All rights reserved.
All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Definition in file OcFileLib.h.
#define OC_MAX_CONTENT_FLAVOUR_SIZE 64 |
Maximum safe content flavour size.
Definition at line 37 of file OcFileLib.h.
#define OC_MAX_VOLUME_LABEL_SIZE 64 |
Maximum safe volume label size.
Definition at line 32 of file OcFileLib.h.
typedef EFI_STATUS(* OC_PROCESS_DIRECTORY_ENTRY) (EFI_FILE_HANDLE Directory, EFI_FILE_INFO *FileInfo, UINTN FileInfoSize, VOID *Context OPTIONAL) |
Process directory item.
Note: Successful processing must return EFI_SUCCESS or EFI_NOT_FOUND, or further processing will be aborted.
Return EFI_NOT_FOUND to continue processing but act if no file found.
[in] | Directory | Parent directory file handle. |
[in] | FileInfo | EFI_FILE_INFO allocated from pool memory, will be freed after this call, data to preserve must be copied. |
[in] | FileInfoSize | FileInfoSize. |
[in,out] | Context | Optional application-specific context. |
EFI_SUCCESS | File found and successfully processed. |
EFI_NOT_FOUND | (Act as if) no matching file was found. |
other | Error processing file (aborts directory scan). |
Definition at line 330 of file OcFileLib.h.
EFI_STATUS OcAllocateCopyFileData | ( | IN EFI_FILE_PROTOCOL * | File, |
OUT UINT8 ** | Buffer, | ||
OUT UINT32 * | BufferSize ) |
Read all bytes from EFI_FILE_PROTOCOL and return a buffer.
[in] | File | A pointer to the file protocol. |
[out] | Buffer | A pointer for the returned buffer. |
[out] | BufferSize | A pointer for the size of the returned buffer. |
EFI_SUCCESS | on success. |
Definition at line 373 of file FileProtocol.c.
EFI_DEVICE_PATH_PROTOCOL * OcCreateFvFileDevicePath | ( | IN EFI_GUID * | FileGuid | ) |
Creates a device path for a firmware file.
[in] | FileGuid | Firmware file GUID. |
device | path allocated from pool on success. |
NULL | on failure (e.g. when a file is not present). |
Definition at line 163 of file FirmwareFile.c.
EFI_STATUS OcDeleteFile | ( | IN EFI_FILE_PROTOCOL * | Directory, |
IN CONST CHAR16 * | FileName ) |
Delete child file relative to source file's location.
Directory | File protocol instance of parent directory. |
FileName | Null-terminated file name or relative path. |
EFI_SUCCESS | File successfully deleted. |
EFI_NOT_FOUND | File was not present. |
other | Other error opening or deleting file. |
Definition at line 49 of file FileMisc.c.
VOID OcDirectorySeachContextInit | ( | IN OUT DIRECTORY_SEARCH_CONTEXT * | Context | ) |
Initialize DIRECTORY_SEARCH_CONTEXT.
[in,out] | Context | A pointer to the DIRECTORY_SEARCH_CONTEXT. |
Definition at line 408 of file FileProtocol.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindActiveMbrPartitionPath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINTN * | PartitionDevicePathSize, | ||
OUT EFI_HANDLE * | PartitionDeviceHandle ) |
Locate the disk's active MBR partition.
[in] | DiskDevicePath | The Device Path of the disk to scan. |
[out] | PartitionDevicePathSize | The size of the returned Device Path. |
[out] | PartitionDeviceHandle | Device handle of the returned partition. |
Definition at line 1057 of file DiskMisc.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskFindSystemPartitionPath | ( | IN CONST EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINTN * | EspDevicePathSize, | ||
OUT EFI_HANDLE * | EspDeviceHandle ) |
Locate the disk's EFI System Partition.
[in] | DiskDevicePath | The Device Path of the disk to scan. |
[out] | EspDevicePathSize | The size of the returned Device Path. |
[out] | EspDeviceHandle | Device handle of the returned partition. |
Definition at line 458 of file DiskMisc.c.
EFI_DEVICE_PATH_PROTOCOL * OcDiskGetDevicePath | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the disk's Device Path from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Device | Path or NULL |
Definition at line 280 of file DiskMisc.c.
EFI_STATUS OcDiskGetMbrPartitionIndex | ( | IN EFI_HANDLE | PartitionHandle, |
OUT UINT8 * | PartitionIndex ) |
Retrieve the MBR partition index for the specified partition.
[in] | PartitionHandle | Partition device handle to retrieve MBR partition index for. |
[out] | PartitionIndex | Pointer to store partition index in. |
EFI_SUCCESS | on success. |
Definition at line 908 of file DiskMisc.c.
EFI_STATUS OcDiskInitializeContext | ( | OUT OC_DISK_CONTEXT * | Context, |
IN EFI_HANDLE | DiskHandle, | ||
IN BOOLEAN | UseBlockIo2 ) |
Initialize disk I/O context.
[out] | Context | Disk I/O context to intialize. |
[in] | DiskHandle | Disk handle with protocols. |
[in] | UseBlockIo2 | Try to use BlockIo2 protocol if available. |
EFI_SUCCESS | on success. |
Definition at line 46 of file DiskMisc.c.
EFI_STATUS OcDiskMarkMbrPartitionActive | ( | IN EFI_HANDLE | DiskHandle, |
IN UINT8 | PartitionIndex ) |
Mark specified MBR partition as active.
[in] | DiskHandle | Disk device handle containing MBR partition table |
[in] | PartitionIndex | MBR partition index. |
EFI_SUCCESS | on success. |
Definition at line 978 of file DiskMisc.c.
EFI_STATUS OcDiskRead | ( | IN OC_DISK_CONTEXT * | Context, |
IN UINT64 | Lba, | ||
IN UINTN | BufferSize, | ||
OUT VOID * | Buffer ) |
Read information from disk.
[in] | Context | Disk I/O context. |
[in] | Lba | LBA number to read from. |
[in] | BufferSize | Buffer size allocated in Buffer. |
[out] | Buffer | Buffer to store data in. |
EFI_SUCCESS | on success. |
Definition at line 116 of file DiskMisc.c.
EFI_STATUS OcDiskReadElTorito | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath, |
OUT UINT8 ** | Buffer, | ||
OUT UINTN * | BufferSize ) |
Read El-Torito boot sector from CD-ROM device.
[in] | DiskDevicePath | The Device Path of the disk. |
[out] | Buffer | Pointer to pool-allocated buffer containing the boot sector data. |
[out] | BufferSize | Size of Buffer. |
EFI_SUCCESS | on success. |
Definition at line 392 of file DiskMisc.c.
EFI_STATUS OcDiskWrite | ( | IN OC_DISK_CONTEXT * | Context, |
IN UINT64 | Lba, | ||
IN UINTN | BufferSize, | ||
IN VOID * | Buffer ) |
Write information to disk.
[in] | Context | Disk I/O context. |
[in] | Lba | LBA number to write to. |
[in] | BufferSize | Buffer size allocated in Buffer. |
[out] | Buffer | Buffer containing data to write. |
EFI_SUCCESS | on success. |
Definition at line 151 of file DiskMisc.c.
EFI_STATUS OcEnsureDirectoryFile | ( | IN EFI_FILE_PROTOCOL * | File, |
IN BOOLEAN | IsDirectory ) |
Ensure specified file is directory or file as specified by IsDirectory.
[in] | File | The file to check. |
[in] | IsDirectory | Require that file is directory. |
EFI_SUCCESS | File is directory/file as specified. |
EFI_INVALID_PARAMETER | File is not directory/file as specified. |
Definition at line 418 of file FileProtocol.c.
BOOLEAN OcFileExists | ( | IN CONST EFI_FILE_PROTOCOL * | Directory, |
IN CONST CHAR16 * | FileName ) |
Report existence of file relative to source file's location.
Directory | File protocol instance of parent directory. |
FileName | Null-terminated file name or relative path. |
TRUE | when file exists. |
Definition at line 21 of file FileMisc.c.
EFI_STATUS OcFindWritableFileSystem | ( | IN OUT EFI_FILE_PROTOCOL ** | WritableFs | ) |
Find writable filesystem.
[in,out] | WritableFs | First found writeable file system. |
EFI_SUCCESS | on success. |
Definition at line 206 of file FileProtocol.c.
EFI_STATUS OcFindWritableOcFileSystem | ( | OUT EFI_FILE_PROTOCOL ** | FileSystem | ) |
Find writable filesystem from Bootstrap.
[out] | FileSystem | Pointer to first found writeable file system. |
EFI_SUCCESS | on success. |
Definition at line 277 of file FileProtocol.c.
MASTER_BOOT_RECORD * OcGetDiskMbrTable | ( | IN EFI_HANDLE | DiskHandle, |
IN BOOLEAN | CheckPartitions ) |
Retrieve the disk MBR table, if applicable.
[in] | DiskHandle | Disk device handle to retrive MBR partition table from. |
[in] | CheckPartitions | Check partition layout. This should be FALSE for a PBR. |
MBR | partition table or NULL. |
Definition at line 828 of file DiskMisc.c.
CONST OC_PARTITION_ENTRIES * OcGetDiskPartitions | ( | IN EFI_HANDLE | DiskHandle, |
IN BOOLEAN | UseBlockIo2 ) |
Retrieve the disk GPT partitions, if applicable.
[in] | DiskHandle | Disk device handle to retrive partition table from. |
[in] | UseBlockIo2 | Use 2nd revision of Block I/O if available. |
partition | entry list or NULL. |
Definition at line 573 of file DiskMisc.c.
EFI_STATUS OcGetFileData | ( | IN EFI_FILE_PROTOCOL * | File, |
IN UINT32 | Position, | ||
IN UINT32 | Size, | ||
OUT UINT8 * | Buffer ) |
Read exact amount of bytes from EFI_FILE_PROTOCOL at specified position.
[in] | File | A pointer to the file protocol. |
[in] | Position | Position to read data from. |
[in] | Size | The size of the data read. |
[out] | Buffer | A pointer to previously allocated buffer to read data to. |
EFI_SUCCESS | on success. |
Definition at line 69 of file FileProtocol.c.
VOID * OcGetFileInfo | ( | IN EFI_FILE_PROTOCOL * | File, |
IN EFI_GUID * | InformationType, | ||
IN UINTN | MinFileInfoSize, | ||
OUT UINTN *RealFileInfoSize | OPTIONAL ) |
Get file information of specified type.
[in] | File | A pointer to file handle. |
[in] | InformationType | A pointer to file info GUID. |
[in] | MinFileInfoSize | Minimal size of the info provided. |
[out] | RealFileInfoSize | Actual info size read (optional). |
read | file info or NULL. |
Definition at line 33 of file GetFileInfo.c.
EFI_STATUS OcGetFileModificationTime | ( | IN EFI_FILE_PROTOCOL * | File, |
OUT EFI_TIME * | Time ) |
Determine file modification time.
[in] | File | A pointer to the file protocol. |
[out] | Time | Modification time. |
EFI_SUCCESS | on success. |
Definition at line 158 of file FileProtocol.c.
EFI_STATUS OcGetFileSize | ( | IN EFI_FILE_PROTOCOL * | File, |
OUT UINT32 * | Size ) |
Determine file size if it is less than 4 GB.
[in] | File | A pointer to the file protocol. |
[out] | Size | 32-bit file size. |
EFI_SUCCESS | on success. |
Definition at line 114 of file FileProtocol.c.
CONST EFI_PARTITION_ENTRY * OcGetGptPartitionEntry | ( | IN EFI_HANDLE | FsHandle | ) |
Retrieve the partition's GPT information, if applicable. Calls to this function undergo internal lazy caching.
[in] | FsHandle | The device handle of the partition to retrieve info of. |
partition | entry or NULL |
Retrieve the partition's GPT information, if applicable
[in] | FsHandle | The device handle of the partition to retrieve info of. |
Definition at line 732 of file DiskMisc.c.
EFI_STATUS OcGetNewestFileFromDirectory | ( | IN OUT DIRECTORY_SEARCH_CONTEXT * | Context, |
IN EFI_FILE_PROTOCOL * | Directory, | ||
IN CHAR16 *FileNameStartsWith | OPTIONAL, | ||
OUT EFI_FILE_INFO ** | FileInfo ) |
Gets the next newest file from the specified directory.
[in,out] | Context | Context. |
[in] | Directory | The directory EFI_FILE_PROTOCOL instance. |
[in] | FileNameStartsWith | Skip files starting with this value. |
[out] | FileInfo | EFI_FILE_INFO allocated from pool memory. |
EFI_SUCCESS | on success. |
Definition at line 444 of file FileProtocol.c.
CHAR16 * OcGetVolumeLabel | ( | IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * | FileSystem | ) |
Retrieves volume label.
[in] | FileSystem | A pointer to the file system protocol of the volume. |
A | pointer to the NULL terminated unicode volume label. |
Definition at line 35 of file GetVolumeLabel.c.
BOOLEAN OcIsDiskCdRom | ( | IN EFI_DEVICE_PATH_PROTOCOL * | DiskDevicePath | ) |
Check if disk is a CD-ROM device.
[in] | DiskDevicePath | The Device Path of the disk. |
Device | Path or NULL |
Definition at line 369 of file DiskMisc.c.
BOOLEAN OcIsWritableFileSystem | ( | IN EFI_FILE_PROTOCOL * | Fs | ) |
Check if filesystem is writable.
[in] | Fs | File system to check. |
TRUE | on success. |
Definition at line 177 of file FileProtocol.c.
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * OcLocateFileSystem | ( | IN EFI_HANDLE DeviceHandle | OPTIONAL, |
IN EFI_DEVICE_PATH_PROTOCOL *FilePath | OPTIONAL ) |
Locate file system from Device handle or path.
[in] | DeviceHandle | Device handle. |
[in] | FilePath | Device path. |
simple | file system protocol or NULL. |
Definition at line 29 of file LocateFileSystem.c.
EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * OcLocateFileSystemByGuid | ( | IN CONST GUID * | Guid | ) |
Locate file system from GUID.
[in] | Guid | GUID of the volume to locate. |
simple | file system protocol or NULL. |
Definition at line 104 of file LocateFileSystem.c.
EFI_FILE_PROTOCOL * OcLocateRootVolume | ( | IN EFI_HANDLE DeviceHandle | OPTIONAL, |
IN EFI_DEVICE_PATH_PROTOCOL *FilePath | OPTIONAL ) |
Locate root volume from Device handle or path.
[in] | DeviceHandle | Device handle. |
[in] | FilePath | Device path. |
opened | file protocol or NULL. |
Definition at line 81 of file LocateFileSystem.c.
EFI_STATUS EFIAPI OcOpenFileByDevicePath | ( | IN OUT EFI_DEVICE_PATH_PROTOCOL ** | FilePath, |
OUT EFI_FILE_PROTOCOL ** | File, | ||
IN UINT64 | OpenMode, | ||
IN UINT64 | Attributes ) |
Open a file or directory by device path. This is a modified version of EfiOpenFileByDevicePath function, which handles paths with trailing slashes, that cause Open failure on old firmware. EfiOpenFileByDevicePath is additionally not available in UDK.
See more details at: https://github.com/tianocore/edk2/commit/768b611136d0f2b99a99e446c089d1a30c3fa5d5
[in,out] | FilePath | Device path protocol. |
[out] | File | Resulting file protocol. |
[in] | OpenMode | File open mode. |
[in] | Attributes | File attributes. |
EFI_SUCCESS | on succesful open. |
Definition at line 206 of file OpenFile.c.
EFI_STATUS EFIAPI OcOpenFileByRemainingDevicePath | ( | IN EFI_HANDLE | FileSystemHandle, |
IN CONST EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath, | ||
OUT EFI_FILE_PROTOCOL ** | File, | ||
IN UINT64 | OpenMode, | ||
IN UINT64 | Attributes ) |
Open a file or directory by file system handle and path. See OcOpenFileByDevicePath() for more details.
[in] | FileSystemHandle | File System handle. |
[in] | RemainingDevicePath | The remaining Device Path (must be all file path nodes). |
[out] | File | Resulting file protocol. |
[in] | OpenMode | File open mode. |
[in] | Attributes | File attributes. |
EFI_SUCCESS | on succesful open. |
Definition at line 83 of file OpenFile.c.
EFI_HANDLE OcPartitionGetDiskHandle | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the disk's device handle from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
device | handle or NULL |
Retrieve the disk's device handle from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Definition at line 331 of file DiskMisc.c.
EFI_HANDLE OcPartitionGetPartitionHandle | ( | IN EFI_DEVICE_PATH_PROTOCOL * | HdDevicePath | ) |
Retrieve the partition's device handle from a partition's Device Path.
[in] | HdDevicePath | The Device Path of the partition. |
Definition at line 353 of file DiskMisc.c.
VOID * OcReadFile | ( | IN CONST EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * | FileSystem, |
IN CONST CHAR16 * | FilePath, | ||
OUT UINT32 *FileSize | OPTIONAL, | ||
IN CONST UINT32 MaxFileSize | OPTIONAL ) |
Read file from file system with implicit double (2 byte) null termination. Null termination does not affect the returned file size. Depending on the implementation 0 byte files may return null.
[in] | FileSystem | A pointer to the file system protocol of the volume. |
[in] | FilePath | The full path to the file on the device. |
[out] | FileSize | The size of the file read (optional). |
[in] | MaxFileSize | Upper file size bound (optional). |
A | pointer to a buffer containing file read or NULL. |
Definition at line 33 of file ReadFile.c.
VOID * OcReadFileFromDirectory | ( | IN CONST EFI_FILE_PROTOCOL * | RootDirectory, |
IN CONST CHAR16 * | FilePath, | ||
OUT UINT32 *FileSize | OPTIONAL, | ||
IN UINT32 MaxFileSize | OPTIONAL ) |
Read file from file protocol with implicit double (2 byte) null termination. Null termination does not affect the returned file size. Depending on the implementation 0 byte files may return null.
[in] | RootDirectory | A pointer to the file protocol of the directory. |
[in] | FilePath | The full path to the file on the device. |
[out] | FileSize | The size of the file read (optional). |
[in] | MaxFileSize | Upper file size bound (optional). |
A | pointer to a buffer containing file read or NULL. |
Definition at line 155 of file ReadFile.c.
EFI_STATUS OcReadFileSize | ( | IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL * | FileSystem, |
IN CONST CHAR16 * | FilePath, | ||
OUT UINT32 * | Size ) |
Determine file size if it is less than 4 GB.
[in] | FileSystem | A pointer to the file system protocol of the volume. |
[in] | FilePath | The full path to the file on the device. |
[out] | Size | 32-bit file size. |
EFI_SUCCESS | on success. |
Definition at line 110 of file ReadFile.c.
VOID * OcReadFvFileSection | ( | IN EFI_GUID * | FileGuid, |
IN UINT8 | SectionType, | ||
OUT UINT32 * | FileSize ) |
Reads firmware file section to pool-allocated buffer.
[in] | FileGuid | Firmware file GUID. |
[in] | SectionType | Section type to read. |
[out] | FileSize | Size of the section read. |
NULL | on failure (e.g. when a file is not present). |
Definition at line 186 of file FirmwareFile.c.
EFI_STATUS OcSafeFileOpen | ( | IN CONST EFI_FILE_PROTOCOL * | Directory, |
OUT EFI_FILE_PROTOCOL ** | NewHandle, | ||
IN CONST CHAR16 * | FileName, | ||
IN CONST UINT64 | OpenMode, | ||
IN CONST UINT64 | Attributes ) |
Opens a new file relative to the source file's location. This function is equivalent to EFI_FILE_OPEN but has additional restrictions to provide board compatibility. Currently the only restriction is no trailing slash in the filename due to issues in FAT drivers.
Directory | File protocol instance of parent directory. |
NewHandle | Pointer for returned handle. |
FileName | Null-terminated file name or relative path. |
OpenMode | File open mode. |
Attributes | Attributes for the newly created file. |
EFI_SUCCESS | for successfully opened file. |
Definition at line 29 of file OpenFile.c.
EFI_STATUS OcScanDirectory | ( | IN EFI_FILE_HANDLE | Directory, |
IN OC_PROCESS_DIRECTORY_ENTRY | ProcessEntry, | ||
IN OUT VOID *Context | OPTIONAL ) |
Scan directory, calling specified procedure for each directory entry.
[in] | Directory | The directory to scan. |
[in] | ProcessEntry | Process entry, called for each directory entry matching filter. |
[in,out] | Context | Optional application-specific context. |
EFI_NOT_FOUND | Successful processing, no entries matching filter were found. |
EFI_SUCCESS | Successful processing, at least one entry matching filter was found. |
EFI_OUT_OF_RESOURCES | Out of memory. |
other | Other error returned by file system or ProcessEntry during processing |
Definition at line 587 of file FileProtocol.c.
EFI_STATUS OcSetFileData | ( | IN EFI_FILE_PROTOCOL *WritableFs | OPTIONAL, |
IN CONST CHAR16 * | FileName, | ||
IN CONST VOID * | Buffer, | ||
IN UINT32 | Size ) |
Write exact amount of bytes to a newly created file in EFI_FILE_PROTOCOL. Please note, that several filesystems (or drivers) may limit file name length.
[in] | WritableFs | A pointer to the file protocol, any will be tried if NULL. |
[in] | FileName | File name (possibly with path) to write. |
[in] | Buffer | A pointer with the data to be written. |
[in] | Size | Amount of data to be written. |
EFI_SUCCESS | on success. |
Definition at line 312 of file FileProtocol.c.