iPXE
|
EFI local file access. More...
#include <string.h>
#include <strings.h>
#include <stdio.h>
#include <errno.h>
#include <assert.h>
#include <ipxe/refcnt.h>
#include <ipxe/malloc.h>
#include <ipxe/xfer.h>
#include <ipxe/open.h>
#include <ipxe/uri.h>
#include <ipxe/iobuf.h>
#include <ipxe/process.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/efi/Protocol/SimpleFileSystem.h>
#include <ipxe/efi/Guid/FileInfo.h>
#include <ipxe/efi/Guid/FileSystemInfo.h>
Go to the source code of this file.
Data Structures | |
struct | efi_local |
An EFI local file. More... | |
Macros | |
#define | EFI_LOCAL_BLKSIZE 4096 |
Download blocksize. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
static void | efi_local_close (struct efi_local *local, int rc) |
Close local file. More... | |
static void | efi_local_step (struct efi_local *local) |
Local file process. More... | |
static int | efi_local_check_volume_name (struct efi_local *local, EFI_HANDLE device, EFI_FILE_PROTOCOL *root, const char *volume) |
Check for matching volume name. More... | |
static int | efi_local_open_root (struct efi_local *local, EFI_HANDLE device, EFI_FILE_PROTOCOL **root) |
Open root filesystem. More... | |
static int | efi_local_open_volume (struct efi_local *local, const char *volume) |
Open root filesystem of specified volume. More... | |
static int | efi_local_open_resolved (struct efi_local *local, const char *resolved) |
Open fully-resolved path. More... | |
static int | efi_local_open_path (struct efi_local *local, const char *filename) |
Open specified path. More... | |
static int | efi_local_len (struct efi_local *local) |
Get file length. More... | |
static int | efi_local_open (struct interface *xfer, struct uri *uri) |
Open local file. More... | |
Variables | |
static struct interface_operation | efi_local_operations [] |
Data transfer interface operations. More... | |
static struct interface_descriptor | efi_local_xfer_desc |
Data transfer interface descriptor. More... | |
static struct process_descriptor | efi_local_process_desc |
Process descriptor. More... | |
struct uri_opener efi_local_uri_opener | __uri_opener |
EFI local file URI opener. More... | |
EFI local file access.
Definition in file efi_local.c.
#define EFI_LOCAL_BLKSIZE 4096 |
Download blocksize.
Definition at line 52 of file efi_local.c.
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
|
static |
Close local file.
local | Local file |
rc | Reason for close |
Definition at line 77 of file efi_local.c.
References _EFI_FILE_PROTOCOL::Close, efi_local::file, intf_shutdown(), NULL, efi_local::process, process_del(), rc, efi_local::root, and efi_local::xfer.
Referenced by efi_local_open(), and efi_local_step().
|
static |
Local file process.
local | Local file |
Definition at line 103 of file efi_local.c.
References assert(), io_buffer::data, DBGC, EEFI, EFI_LOCAL_BLKSIZE, efi_local_close(), ENOMEM, efi_local::file, free_iob(), iob_disown, iob_put, efi_local::len, NULL, rc, _EFI_FILE_PROTOCOL::Read, size, strerror(), efi_local::xfer, xfer_alloc_iob(), xfer_deliver_iob(), xfer_seek(), and xfer_window().
|
static |
Check for matching volume name.
local | Local file |
device | Device handle |
root | Root filesystem handle |
volume | Volume name |
rc | Return status code |
Definition at line 192 of file efi_local.c.
References asprintf(), DBGC, DBGC2, EEFI, efi_file_system_info_id, efi_handle_name(), ENOENT, ENOMEM, free, info, malloc(), NULL, rc, root, size, strcasecmp(), and strerror().
Referenced by efi_local_open_volume().
|
static |
Open root filesystem.
local | Local file |
device | Device handle |
root | Root filesystem handle to fill in |
rc | Return status code |
Definition at line 257 of file efi_local.c.
References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, DBGC, EEFI, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_simple_file_system_protocol_guid, efi_systab, fs, EFI_BOOT_SERVICES::OpenProtocol, rc, root, strerror(), and u.
Referenced by efi_local_open_volume().
|
static |
Open root filesystem of specified volume.
local | Local file |
volume | Volume name, or NULL to use loaded image's device |
rc | Return status code |
Definition at line 304 of file efi_local.c.
References EFI_SYSTEM_TABLE::BootServices, ByProtocol, DBGC, device, EEFI, efi_devpath_text(), efi_handle_name(), efi_loaded_image_path, efi_local_check_volume_name(), efi_local_open_root(), efi_simple_file_system_protocol_guid, efi_systab, ENOENT, EFI_BOOT_SERVICES::FreePool, EFI_BOOT_SERVICES::LocateDevicePath, EFI_BOOT_SERVICES::LocateHandleBuffer, NULL, protocol, rc, root, efi_local::root, and strerror().
Referenced by efi_local_open().
|
static |
Open fully-resolved path.
local | Local file |
resolved | Resolved path |
rc | Return status code |
Definition at line 394 of file efi_local.c.
References DBGC, EEFI, EFI_FILE_MODE_READ, efi_snprintf(), efi_local::file, name, _EFI_FILE_PROTOCOL::Open, rc, efi_local::root, strerror(), and strlen().
Referenced by efi_local_open_path().
|
static |
Open specified path.
local | Local file |
filename | Path to file relative to our own image |
rc | Return status code |
Definition at line 425 of file efi_local.c.
References assert(), base, container_of, DBGC, DBGC2, efi_loaded_image, efi_local_open_resolved(), efi_path_len(), efi_path_next(), ENOMEM, EFI_LOADED_IMAGE_PROTOCOL::FilePath, free, Header, len, memset(), next, FILEPATH_DEVICE_PATH::PathName, rc, resolve_path(), snprintf(), and tmp.
Referenced by efi_local_open().
|
static |
Get file length.
local | Local file |
rc | Return status code |
Definition at line 487 of file efi_local.c.
References DBGC, EEFI, efi_file_info_id, ENOMEM, efi_local::file, free, _EFI_FILE_PROTOCOL::GetInfo, info, efi_local::len, malloc(), NULL, rc, size, and strerror().
Referenced by efi_local_open().
Open local file.
xfer | Data transfer interface |
uri | Request URI |
rc | Return status code |
Definition at line 533 of file efi_local.c.
References efi_local_close(), efi_local_len(), efi_local_open_path(), efi_local_open_volume(), efi_local_process_desc, efi_local_xfer_desc, ENOMEM, uri::host, intf_init(), intf_plug_plug(), NULL, uri::opaque, uri::path, efi_local::process, process_add(), process_init_stopped(), rc, ref_init, ref_put, efi_local::refcnt, efi_local::xfer, and zalloc().
|
static |
Data transfer interface operations.
Definition at line 170 of file efi_local.c.
|
static |
Data transfer interface descriptor.
Definition at line 176 of file efi_local.c.
Referenced by efi_local_open().
|
static |
Process descriptor.
Definition at line 180 of file efi_local.c.
Referenced by efi_local_open().
struct uri_opener efi_local_uri_opener __uri_opener |
EFI local file URI opener.
Definition at line 584 of file efi_local.c.