OpenCore
1.0.4
OpenCore Bootloader
|
#include <Uefi.h>
#include <Guid/FileInfo.h>
#include <Protocol/OcBootstrap.h>
#include <Protocol/SimpleFileSystem.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/OcFileLib.h>
#include <Library/UefiBootServicesTableLib.h>
Go to the source code of this file.
Macros | |
#define | EPOCH_JULIAN_DATE 2440588 |
#define | SEC_PER_MIN ((UINTN) 60) |
#define | SEC_PER_HOUR ((UINTN) 3600) |
#define | SEC_PER_DAY ((UINTN) 86400) |
#define | SEC_PER_MONTH ((UINTN) 2,592,000) |
#define | SEC_PER_YEAR ((UINTN) 31,536,000) |
Functions | |
STATIC UINT32 | EfiGetEpochDays (IN EFI_TIME *Time) |
STATIC UINT32 | EfiTimeToEpoch (IN EFI_TIME *Time) |
EFI_STATUS | OcGetFileData (IN EFI_FILE_PROTOCOL *File, IN UINT32 Position, IN UINT32 Size, OUT UINT8 *Buffer) |
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 | 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 | OcEnsureDirectoryFile (IN EFI_FILE_PROTOCOL *File, IN BOOLEAN IsDirectory) |
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 | OcScanDirectory (IN EFI_FILE_HANDLE Directory, IN OC_PROCESS_DIRECTORY_ENTRY ProcessEntry, IN OUT VOID *Context OPTIONAL) |
Copyright (C) 2019-2021, vit9696, Goldfish64, mikebeaton. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
Definition in file FileProtocol.c.
#define EPOCH_JULIAN_DATE 2440588 |
Definition at line 19 of file FileProtocol.c.
#define SEC_PER_DAY ((UINTN) 86400) |
Definition at line 24 of file FileProtocol.c.
#define SEC_PER_HOUR ((UINTN) 3600) |
Definition at line 23 of file FileProtocol.c.
#define SEC_PER_MIN ((UINTN) 60) |
Definition at line 22 of file FileProtocol.c.
#define SEC_PER_MONTH ((UINTN) 2,592,000) |
Definition at line 25 of file FileProtocol.c.
#define SEC_PER_YEAR ((UINTN) 31,536,000) |
Definition at line 26 of file FileProtocol.c.
STATIC UINT32 EfiGetEpochDays | ( | IN EFI_TIME * | Time | ) |
Definition at line 30 of file FileProtocol.c.
STATIC UINT32 EfiTimeToEpoch | ( | IN EFI_TIME * | Time | ) |
Definition at line 54 of file FileProtocol.c.
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.
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_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.
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.
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.
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.
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.
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_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.