89 struct setting pxe_boot_menu_prompt_setting =
91 struct setting pxe_boot_menu_setting =
99 unsigned int num_menu_items;
104 memset ( raw_menu, 0,
sizeof ( raw_menu ) );
107 sizeof ( raw_menu ) ) ) < 0 ){
109 DBG (
"Could not retrieve raw PXE boot menu: %s\n",
113 if ( raw_menu_len >= (
int )
sizeof ( raw_menu ) ) {
114 DBG (
"Raw PXE boot menu too large for buffer\n" );
117 raw_menu_end = ( raw_menu + raw_menu_len );
123 if ( raw_prompt_len < 0 )
128 raw_menu_item = ( (
void * ) raw_menu );
130 if ( ( ( (
void * ) raw_menu_item ) +
131 sizeof ( *raw_menu_item ) ) > raw_menu_end )
133 if ( ( ( (
void * ) raw_menu_item ) +
134 sizeof ( *raw_menu_item ) +
135 raw_menu_item->desc_len ) > raw_menu_end )
138 raw_menu_item = ( ( (
void * ) raw_menu_item ) +
139 sizeof ( *raw_menu_item ) +
140 raw_menu_item->desc_len );
144 *menu =
zalloc (
sizeof ( **menu ) +
145 ( num_menu_items *
sizeof ( (*menu)->items[0] ) ) +
147 raw_prompt_len + 1 );
149 DBG (
"Could not allocate PXE boot menu\n" );
154 (*menu)->num_items = num_menu_items;
155 raw_menu_item = ( ( (
void * ) (*menu) ) +
sizeof ( **menu ) +
156 ( num_menu_items *
sizeof ( (*menu)->items[0] ) ) );
157 memcpy ( raw_menu_item, raw_menu, raw_menu_len );
158 for ( i = 0 ; i < num_menu_items ; i++ ) {
160 (*menu)->items[i].desc = raw_menu_item->
desc;
165 raw_menu_item->
type = 0;
166 raw_menu_item = ( ( (
void * ) raw_menu_item ) +
167 sizeof ( *raw_menu_item ) +
170 if ( raw_prompt_len ) {
171 raw_menu_prompt = ( ( (
void * ) raw_menu_item ) +
174 raw_menu_prompt, raw_prompt_len );
176 ( ( raw_menu_prompt->
timeout == 0xff ) ?
177 -1 : raw_menu_prompt->
timeout );
178 (*menu)->prompt = raw_menu_prompt->
prompt;
180 (*menu)->timeout = -1;
194 unsigned int index,
int selected ) {
202 while (
len < (
sizeof ( buf ) - 1 ) )
204 buf[
sizeof ( buf ) - 1 ] =
'\0';
221 unsigned int key_selection;
231 for ( i = 0 ; i < menu->
num_items ; i++ )
233 for ( i = 0 ; i < menu->
num_items ; i++ )
261 ( ( key_selection = (
toupper (
key ) -
'A' ) )
284 unsigned long elapsed;
320 elapsed = ( now -
start );
346 unsigned int pxe_type;
375 assert ( pxebs_settings );
int getkey(unsigned long timeout)
Get single keypress.
int uriboot(struct uri *filename, struct uri **root_paths, unsigned int root_path_count, int drive, struct san_boot_config *san_config, unsigned int flags)
Boot from filename and root-path URIs.
#define DHCP_PXE_BOOT_MENU_PROMPT
PXE boot menu prompt.
struct arbelprm_rc_send_wqe rc
Dynamic Host Configuration Protocol.
#define TICKS_PER_SEC
Number of ticks per second.
int printf(const char *fmt,...)
Write a formatted string to the console.
static void uri_put(struct uri *uri)
Decrement URI reference count.
#define KEY_F8
F8 (for PXE)
int endwin(void)
Finalise console environment.
#define mvprintw(y, x, fmt,...)
int fetch_raw_setting(struct settings *settings, const struct setting *setting, void *data, size_t len)
Fetch value of setting.
#define LINES(...)
Define inline lines.
Uniform Resource Identifiers.
#define ECANCELED
Operation canceled.
uint32_t start
Starting offset.
static int toupper(int character)
Convert character to upper case.
#define KEY_DOWN
Down arrow.
uint64_t tag
Setting tag, if applicable.
#define ENOMEM
Not enough space.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define KEY_MIN
Minimum value for special keypresses.
#define CPAIR_PXE
PXE selected menu entry.
WINDOW * initscr(void)
Initialise console environment.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
struct uri * fetch_next_server_and_filename(struct settings *settings)
Fetch next-server and filename settings into a URI.
static struct net_device * netdev
#define ESC
Escape character.
#define PXEBS_SETTINGS_NAME
Setting block name used for BootServerDHCP responses.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
void * zalloc(size_t size)
Allocate cleared memory.
#define DHCP_PXE_BOOT_MENU
PXE boot menu.
#define le16_to_cpu(value)
#define CPAIR_DEFAULT
Default colour pair.
#define ENOSPC
No space left on device.
static int move(int y, int x)
struct settings * find_settings(const char *name)
Find settings block.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
A Uniform Resource Identifier.
#define color_set(cpno, opts)
unsigned long currticks(void)
Get current system time in ticks.
#define DBG(...)
Print a debugging message.
#define NULL
NULL pointer (VOID *)
int pxebs(struct net_device *netdev, unsigned int pxe_type)
int iskey(void)
Check for available input on any console.
void * memset(void *dest, int character, size_t len) __nonnull