summaryrefslogtreecommitdiffstats
path: root/src/core
Commit message (Collapse)AuthorAgeFilesLines
...
* [settings] Match terminology in online documentationMichael Brown2011-03-231-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Avoid memory leak when unregistering autovivified settings blocksMichael Brown2011-03-231-3/+27
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Impose a fixed order on settingsMichael Brown2011-03-231-6/+6
| | | | | | | Improve the appearance of the "config" user interface by ensuring that settings appear in some kind of logical order. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Fix setting expansionMichael Brown2011-03-231-3/+4
| | | | | | | | | | | Commit 5fbd020 ("[settings] Display canonical setting name in output of "show" command") introduced a regression causing all setting expansions (e.g. "${net0/mac}") to expand to an empty string. Fix by returning the formatted value length from fetchf_named_setting(), as expected by the caller. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Display canonical setting name in "config" user interfaceMichael Brown2011-03-221-5/+22
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Display canonical setting name in output of "show" commandMichael Brown2011-03-221-17/+41
| | | | | | | | | | | | | | | | | | Enable the "show" command to display the full, canonicalised name of the fetched setting. For example: iPXE> show mac net0/mac:hex = 52:54:00:12:34:56 iPXE> dhcp && show ip DHCP (net0 52:54:00:12:34:56)... ok net0.dhcp/ip:ipv4 = 10.0.0.168 iPXE> show net0/6 net0.dhcp/dns:ipv4 = 10.0.0.6 Inspired-by: Glenn Brown <glenn@myri.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Provide fetch_setting_origin()Michael Brown2011-03-221-5/+47
| | | | | Inspired-by: Glenn Brown <glenn@myri.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Expose settings_name()Glenn Brown2011-03-221-8/+6Star
| | | | | | | | Expose settings_name(), shrink the unnecessarily large static buffer, properly name root settings block, and simplify. Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Formalise notion of setting applicabilityMichael Brown2011-03-222-7/+44
| | | | | | | | | | | | | | | Expose a function setting_applies() to allow a caller to determine whether or not a particular setting is applicable to a particular settings block. Restrict DHCP-backed settings blocks to accepting only DHCP-based settings. Restrict network device settings blocks to accepting only DHCP-based settings and network device-specific settings such as "mac". Inspired-by: Glenn Brown <glenn@myri.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Move include/console.h to include/ipxe/console.hMichael Brown2011-03-099-9/+9
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Avoid ending up with multiple selected images on re-registrationMichael Brown2011-03-091-0/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify use of imgdownload()Michael Brown2011-03-091-1/+50
| | | | | | | Allow imgdownload() to be called without first having to allocate (and so keep track of) an image. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Generalise "currently-running script" to "currently-running image"Michael Brown2011-03-091-1/+11
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Move the register_and_{select|boot}_image() functions to imgmgmt.cMichael Brown2011-03-091-39/+0Star
| | | | | | | | These functions are used only as the "action" parameters to imgdownload() or imgfetch(), and so belong in imgmgmt.c rather than image.c Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [monojob] Display percentage progress, if availableMichael Brown2011-03-081-6/+23
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [main] Remove shell prompt when using an embedded imageMichael Brown2011-03-071-14/+13Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Use list_first_entry() to clarify logic in main()Michael Brown2011-03-071-5/+2Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [prompt] Replace shell_banner() with a generic prompt() functionMichael Brown2011-03-071-1/+17
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Add a timeout parameter to getkey()Michael Brown2011-03-071-5/+6
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [console] Avoid timer wraparound problems in getchar_timeout()Michael Brown2011-03-071-2/+2
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add generic concat_args() functionMichael Brown2011-03-071-6/+43
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Allow image_set_cmdline() to clear the command lineMichael Brown2011-03-071-4/+8
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Simplify image managementMichael Brown2011-03-072-96/+89Star
| | | | | | | | | | | Refactor the {load,exec} image operations as {probe,exec}. This makes the probe mechanism cleaner, eliminates some forward declarations, avoids holding magic state in image->priv, eliminates the possibility of screwing up between the "load" and "exec" stages, and makes the documentation simpler since the concept of "loading" (as distinct from "executing") no longer needs to be explained. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Refer to online documentation for command helpMichael Brown2011-03-042-4/+4
| | | | | | | | | | The online documentation (e.g. http://ipxe.org/cmd/ifopen), though not yet complete, is far more comprehensive than could be provided within the iPXE binary. Save around 200 bytes (compressed) by removing the command descriptions from the interactive help, and instead referring users directly to the web page describing the relevant command. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Make fetch_string_setting_copy() easier to useMichael Brown2011-03-031-1/+10
| | | | | | | | | | | | | Most callers of functions in the fetch_setting() family treat any errors as meaning "non-existent setting". In the case of fetch_string_setting_copy(), an existent setting can still result in an error due to memory allocation failure. Allow the caller to distinguish between a non-existent setting and an error in allocating memory for the copy, by returning success (and a NULL buffer pointer) for a non-existent setting. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Avoid fetch_string_setting_copy() leaving an uninitialised pointerMichael Brown2011-03-031-0/+2
| | | | | | | | For consistency with other functions in the fetch_setting() family, ensure that fetch_string_setting_copy() always initialises the pointer to the fetched setting even if fetching fails. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [image] Allow download job to complete before acting upon imageMichael Brown2011-03-021-9/+0Star
| | | | | | | | | Allow the monojob controlling the download to complete before calling register_image() and friends. This allows the trailing "ok" from monojob.c to be printed before the image starts executing (and possibly printing output of its own). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Generalise expand_command() to expand_settings()Michael Brown2011-01-282-75/+82
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [init] Remove concept of "shutdown exit flags"Michael Brown2011-01-272-3/+6
| | | | | | | | Remove the concept of shutdown exit flags, and replace it with a counter used to keep track of exposed interfaces that require devices to remain active. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Expose xfer_uri_opener()Michael Brown2011-01-271-14/+39
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nvo] Allow resizing of non-volatile stored option blocksMichael Brown2011-01-191-49/+103
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nvo] Remove the non-volatile options fragment listMichael Brown2011-01-111-49/+24Star
| | | | | | | | | Since its implementation several years ago, no driver has used a fragment list containing more than a single fragment. Simplify the NVO core and the drivers that use it by removing the whole concept of the fragment list, and using a simple (address,length) pair instead. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [dhcp] Allow use of custom reallocation functions for DHCP option blocksMichael Brown2011-01-111-1/+2
| | | | | | | | Allow functions other than realloc() to be used to reallocate DHCP option block data, and specify the reallocation function at the time of calling dhcpopt_init(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add fetch_ipv4_array_setting()Michael Brown2010-12-091-5/+21
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [debug] Add DBG_MD5() and related macrosMichael Brown2010-12-091-0/+47
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add missing copyright header and FILE_LICENCE macroMichael Brown2010-12-091-0/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [fnrec] Enhance function recordingMichael Brown2010-12-091-39/+107
| | | | | | | | | | | | | | | | | | | | | | | | | Enhance the information collected by the function recorder to include the call site and entry/exit counts. This allows fnrec.pl to produce a call tree such as: step (from core/getkey.c:46 = 0x17e90) { ref_increment (from core/process.c:93 = 0x73ec) { } net_step (from core/process.c:96 = 0x73f1) { net_poll (from net/netdevice.c:741 = 0xbce6) { netdev_poll (from net/netdevice.c:700 = 0xbc58) { } netdev_rx_dequeue (from net/netdevice.c:709 = 0xbc65) { } } } ref_decrement (from core/process.c:96 = 0x73f9) { } } Note that inlined functions are reported, confusingly, as extra calls to the *containing* function. Minimise this confusion by adding the attribute "no_instrument_function" to all functions declared as inline. (Static functions that have been inlined autonomously by gcc will still be problematic, but these are far fewer in number.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE macro to some GPL-v2-or-later filesShao Miller2010-12-043-0/+6
| | | | | | | | | Changes were made to files where the licence text within the files themselves confirms that the files are GPL version 2 or later. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Modified-by: Michael Brown <mcb30@ipxe.org> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Add FILE_LICENCE macro to some GPL-v2 filesShao Miller2010-12-042-0/+5
| | | | | | | | Changes were made to files where the licence text within the files themselves confirms that the files are GPL version 2. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Apply settings block name in register_settings()Michael Brown2010-12-012-6/+10
| | | | | | | | Pass the settings block name as a parameter to register_settings(), rather than defining it with settings_init() (and then possibly changing it by directly manipulating settings->name). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Match user expectations for &&, ||, goto, and exitMichael Brown2010-11-291-41/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The && and || operators should be left-associative, since that is how they are treated in most other languages (including C and Unix shell). For example, in the command: dhcp net0 && goto dhcp_ok || echo No DHCP on net0 if the "dhcp net0" fails then the "echo" should be executed. After an "exit" or a successful "goto", further commands on the same line should never be executed. For example: goto somewhere && echo This should never be printed exit 0 && echo This should never be printed exit 1 && echo This should never be printed An "exit" should cause the current shell or script to terminate and return the specified exit status to its caller. For example: chain test.ipxe && echo Success || echo Failure [in test.ipxe] #!ipxe exit 0 should echo "Success". Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Allow "0x"-prefixed hexadecimal values in integer-valued optionsMichael Brown2010-11-291-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [nvo] Allow fragment list to be omittedMichael Brown2010-11-251-6/+20
| | | | | | | | Allow the fragment list to be omitted when calling nvo_init(). Omitting the list will cause the whole of the NVS device to be used for NVO storage. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Fix multi-layer variable expansion (again)Michael Brown2010-11-231-3/+3
| | | | | | | | | | | | | | Expansion of the (admittedly perverse) "aaa}bbb${ccc" will currently fail because expand_command() does not check that the closing "}" occurs later than the opening "${". Fix by ensuring that the most recent opening "${" is used to match against the first *subsequent* closing "}". Total cost of this change: -12 bytes, bringing the overall cost of this feature to -4 bytes. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Fix multi-layer variable expansionMichael Brown2010-11-221-8/+12
| | | | | | | | | | | | | Expansion of ${${foo}} will currently fail, because the first opening "${" will be incorrectly matched against the first closing "}", leading to an attempt to expand the variable "${foo". Fix by ensuring that the most recent opening "${" is used to match against the first closing "}". Total cost: 8 bytes. :) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add "isset" commandMichael Brown2010-11-221-0/+35
| | | | | | | | | The "isset" command can be used to determine whether or not a setting is present. For example: isset ${net0/ip} || dhcp net0 # If we have no IP address, try DHCP Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [script] Allow "exit" to exit a scriptMichael Brown2010-11-221-4/+57
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [cmdline] Add trivial logical operators to iPXE command linesMichael Brown2010-11-221-36/+115
| | | | | | | | | | | | | | | | | Make the "||" and "&&" operators available within iPXE commands. For example: dhcp net0 || set net0/ip 192.168.0.2 would attempt to acquire an IP address via DHCP, falling back to a static address if DHCP fails. As a side-effect, comments may now be appended to any line. For example: dhcp net0 || set net0/ip 192.168.0.2 # Try DHCP first, then static Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [parseopt] Add generic option-parsing libraryMichael Brown2010-11-211-0/+219
| | | | | | | | | | | | | | | | Command implementations tend to include a substantial amount of common boilerplate code revolving around the parsing of command-line options and arguments. This increases the size cost of each command. Introduce an option-parsing library that abstracts out the common operations involved in command implementations. This enables the size of each individual command to be reduced, and also enhances consistency between commands. Total size of the library is 704 bytes, to be amortised across all command implementations. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [settings] Add "hexhyp" setting typeMichael Brown2010-11-131-4/+43
| | | | | | | | | | | | Provide a "hexhyp" setting type, which functions identically to the "hex" setting type except that it uses a hyphen instead of a colon as the byte delimiter. For example, if ${mac} expands to "52:54:00:12:34:56", then ${mac:hexhyp} will expand to "52-54-00-12-34-56". Originally-implemented-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>