60 DBG (
"PXENV_FILE_OPEN" );
67 char uri_string[ filename_len + 1 ];
70 sizeof ( uri_string ) );
71 DBG (
" %s", uri_string );
72 fd =
open ( uri_string );
80 DBG (
" as file %d", fd );
126 if ( ( ready =
select ( &fdset, 0 ) ) < 0 ) {
154 DBG (
"PXENV_FILE_READ %d to %04x:%04x+%04x",
file_read->FileHandle,
166 DBG (
" read %04zx", ( (
size_t )
len ) );
190 if ( filesize < 0 ) {
195 DBG (
" is %zd", ( (
size_t ) filesize ) );
217 DBG (
"PXENV_FILE_EXEC" );
227 sizeof ( command_string ) );
228 DBG (
" %s", command_string );
230 if ( (
rc =
system ( command_string ) ) != 0 ) {
258 DBG (
"PXENV_FILE_CMDLINE to %04x:%04x+%04x \"%s\"\n",
259 file_cmdline->
Buffer.segment, file_cmdline->
Buffer.offset,
263 file_cmdline->
Buffer.offset );
293 unsigned int mask = 0;
296 DBG (
"PXENV_FILE_API_CHECK" );
299 if ( file_api_check->
Magic != 0x91d447b2 ) {
305 if ( file_api_check->
Size < sizeof ( *file_api_check ) ) {
318 file_api_check->
Size =
sizeof ( *file_api_check );
319 file_api_check->
Magic = 0xe9c17b20;
320 file_api_check->
Provider = 0x45585067;
321 file_api_check->
APIMask = mask;
322 file_api_check->
Flags = 0;
#define PXENV_FILE_CMDLINE
PXE API function code for pxenv_file_cmdline()
#define PXENV_STATUS_OUT_OF_RESOURCES
#define PXENV_FILE_SELECT
PXE API function code for pxenv_file_select()
struct arbelprm_rc_send_wqe rc
#define RDY_READ
File is ready for reading.
#define PXENV_EXIT_FAILURE
An error occurred.
UINT32_t Provider
Implementation identifier.
SEGOFF16_t Buffer
Data buffer.
UINT16_t BufferSize
Data buffer size.
UINT16_t FileHandle
File handle.
#define DHCP_EB_FEATURE_PXE_EXT
PXE API extensions.
#define PXENV_FILE_READ
PXE API function code for pxenv_file_read()
static PXENV_EXIT_t pxenv_file_api_check(struct s_PXENV_FILE_API_CHECK *file_api_check)
FILE API CHECK.
static PXENV_EXIT_t pxenv_file_open(struct s_PXENV_FILE_OPEN *file_open)
FILE OPEN.
static PXENV_EXIT_t pxenv_file_select(struct s_PXENV_FILE_SELECT *file_select)
FILE SELECT.
#define PXENV_FILE_CLOSE
PXE API function code for pxenv_file_close()
ssize_t read_user(int fd, userptr_t buffer, off_t offset, size_t max_len)
Read data from file.
static __always_inline void copy_from_user(void *dest, userptr_t src, off_t src_off, size_t len)
Copy data from user buffer.
Parameter block for pxenv_file_close()
#define PXENV_GET_FILE_SIZE
PXE API function code for pxenv_get_file_size()
#define PXENV_STATUS_BAD_FUNC
int file_open(const char *filename)
PXENV_STATUS_t Status
PXE status code.
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
#define PXENV_FILE_API_CHECK
PXE API function code for pxenv_file_api_check()
PXENV_STATUS_t Status
PXE status code.
Access to external ("user") memory.
UINT16_t FileHandle
File handle.
PXENV_STATUS_t Status
PXE status code.
#define PXE_API_CALL(_opcode, _entry, _params_type)
Define a PXE API call.
Parameter block for pxenv_file_api_check()
static PXENV_EXIT_t pxenv_file_close(struct s_PXENV_FILE_CLOSE *file_close)
FILE CLOSE.
ssize_t fsize(int fd)
Determine file size.
Parameter block for pxenv_file_select()
UINT16_t PXENV_EXIT_t
A PXE exit code.
uint32_t userptr_t
A pointer to a user buffer.
UINT32_t Flags
Reserved for the future.
#define PXENV_FILE_EXEC
PXE API function code for pxenv_file_exec()
#define PXE_API_CALLS
PXE API call table.
struct pxe_api_call pxe_file_api [] __pxe_api_call
PXE file API.
const char * pxe_cmdline
PXE command line.
Parameter block for pxenv_get_file_size()
UINT16_t Ready
Indication of readiness.
Parameter block for pxenv_file_exec()
UINT16_t FileHandle
File handle.
UINT32_t Magic
Magic number.
PXENV_STATUS_t Status
PXE status code.
uint32_t fd_set
File descriptor set as used for select()
#define FEATURE_MISC
Miscellaneous.
SEGOFF16_t Command
Command to execute.
FEATURE(FEATURE_MISC, "PXEXT", DHCP_EB_FEATURE_PXE_EXT, 2)
int file_read(void *buf, unsigned long len)
static PXENV_EXIT_t pxenv_file_exec(struct s_PXENV_FILE_EXEC *file_exec)
FILE EXEC.
static __always_inline void copy_to_user(userptr_t dest, off_t dest_off, const void *src, size_t len)
Copy data to user buffer.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
size_t strlen(const char *src)
Get length of string.
int select(fd_set *readfds, int wait)
Check file descriptors for readiness.
Parameter block for pxenv_file_cmdline()
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define PXENV_EXIT_SUCCESS
No error occurred.
UINT32_t APIMask
Supported API functions.
size_t strlen_user(userptr_t userptr, off_t offset)
Find length of NUL-terminated string in user buffer.
static PXENV_EXIT_t pxenv_file_read(struct s_PXENV_FILE_READ *file_read)
FILE READ.
Parameter block for pxenv_file_open()
UINT16_t Size
Size of structure.
#define PXENV_FILE_MAX
Minimum possible opcode used within PXE FILE API.
#define PXENV_FILE_OPEN
PXE API function code for pxenv_file_open()
UINT32_t FileSize
File size.
#define PXENV_FILE_MIN
Minimum possible opcode used within PXE FILE API.
int open(const char *uri_string)
Open file.
PXENV_STATUS_t Status
PXE status code.
PXENV_STATUS_t Status
PXE status code.
static __always_inline userptr_t real_to_user(unsigned int segment, unsigned int offset)
Convert segment:offset address to user buffer.
Parameter block for pxenv_file_read()
uint16_t offset
Offset to command line.
static struct evtchn_close * close
#define PXENV_STATUS_SUCCESS
#define DBG(...)
Print a debugging message.
static PXENV_EXIT_t pxenv_get_file_size(struct s_PXENV_GET_FILE_SIZE *get_file_size)
GET FILE SIZE.
#define PXENV_STATUS(rc)
Derive PXENV_STATUS code from iPXE error number.
uint8_t system[ETH_ALEN]
System identifier.
static PXENV_EXIT_t pxenv_file_cmdline(struct s_PXENV_FILE_CMDLINE *file_cmdline)
FILE CMDLINE.