summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
* discover/grub2: Create 'conditional' statementsJeremy Kerr2013-09-243-31/+65
| | | | | | | | Rather than holding the condition and conditional-statements in struct grub2_statment_if, create a new conditional type that contains these. We can then use this to implement elif statements. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow empty statementsJeremy Kerr2013-09-241-14/+12
| | | | | | | | Re-arrange the script/statements parse rules to allow empty statements. We also move the EOL token out of the 'statement' definition, and use it to separate 'statements'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement submenuJeremy Kerr2013-09-242-0/+8
| | | | | | | Just recurse into the submenu items, as we flatten everything into the one menu. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add function supportJeremy Kerr2013-09-243-0/+57
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Improve error handlingJeremy Kerr2013-09-242-2/+6
| | | | | | | Only run the script if the parse succeeded, and and improve the error reporting by enabling verbose errors and line numbers. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'else' blocksJeremy Kerr2013-09-242-0/+10
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'search' commandJeremy Kerr2013-09-241-0/+30
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'linux' & 'initrd' commandsJeremy Kerr2013-09-243-10/+78
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Function infrastructure improvementsJeremy Kerr2013-09-243-38/+52
| | | | | | | | For user-defined functions, we'll need a data pointer to the function's execution callback. Add this as a void *, and change references from 'command' to 'function'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add option state in menuentry processingJeremy Kerr2013-09-242-0/+17
| | | | | | | This will allow menuentry-specific commands to populate boot option data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add a reference to the context from grub2_scriptJeremy Kerr2013-09-243-10/+15
| | | | | | We'll need the context to add boot options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Hook up flex/bison parser to discover serverJeremy Kerr2013-09-249-323/+201
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Move parser-api definitions to parser.yJeremy Kerr2013-09-242-111/+109
| | | | | | No need for a separate file here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement multiple-arv variable splittingJeremy Kerr2013-09-243-17/+101
| | | | | | | If we expand a variable containing word-delimiter chars, we need to create new argv items. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add initial command executionJeremy Kerr2013-09-243-5/+144
| | | | | | .. with a simple 'set' command to update the environment Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add menuentry executionJeremy Kerr2013-09-243-1/+16
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix word appendJeremy Kerr2013-09-242-1/+5
| | | | | | | | The parser was setting word->next on the top-level word, resulting in word chains of a maximum length of 2. Instead, use a last pointer to always append to the last word. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Handle var tokens in lexerJeremy Kerr2013-09-244-75/+78
| | | | | | | Rather than post-processing to expand variables, use the lexer to identify variable tokens as a type of grub2_word. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Remove debug printfsJeremy Kerr2013-09-241-5/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Initial environment handlingJeremy Kerr2013-09-241-9/+26
| | | | | | A simple linked-list implementation of string pairs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add initial execution codeJeremy Kerr2013-09-243-3/+76
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix statement reduce ruleJeremy Kerr2013-09-241-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add var expansion codeJeremy Kerr2013-09-242-0/+99
| | | | | | Still todo: splitting. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add initial script infrastructureJeremy Kerr2013-09-243-2/+22
| | | | | | | Now that we can parse scripts, we want some infrastructure for execution. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Use subclass-style structs for ASTJeremy Kerr2013-09-242-39/+41
| | | | | | | Use embedded 'struct grub2_statement' data to create a subclass-style syntax tree of statements. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement statement blocksJeremy Kerr2013-09-243-1/+22
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement reduce rulesJeremy Kerr2013-09-242-31/+56
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add structures & API for parserJeremy Kerr2013-09-243-6/+156
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement parserJeremy Kerr2013-09-241-1/+39
| | | | | | | | Add our simple parser to handle a grub2 script. Since we're not building a parse tree at the moment (we have no reduce rules), we just have a simple word-based %union for our tokens. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Initial grub2 lexerJeremy Kerr2013-09-243-0/+186
| | | | | | Add a simple flex lexer to tokenise our grub2 config files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Add booting status messageJeremy Kerr2013-09-231-0/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Allow printf formatting in update_statusJeremy Kerr2013-09-231-3/+9
| | | | | | | It'd be nice to include arbitrary format strings here, so do a taloc_vasprintf in update_status. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Fix log message with no newlineJeremy Kerr2013-09-231-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: clear default_timeout waiter on timeoutJeremy Kerr2013-09-231-0/+2
| | | | | | We don't want cancel_default to try to remove an already-removed waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't register multiple boot_timeout waitersJeremy Kerr2013-09-231-2/+8
| | | | | | | Rather than adding another timeout waiter, just override handler->default_boot_option and extend the timeout a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: Implement default optionsJeremy Kerr2013-09-201-4/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Implement device prioritiesJeremy Kerr2013-09-191-4/+37
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: register network devices with the device handlerJeremy Kerr2013-09-193-14/+29
| | | | | | | We'd like to correlate incoming network boot options with a device, so register the interface with the device hander. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: Manage network->interfaces with {add,remove}_interfaceJeremy Kerr2013-09-191-2/+14
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: ignore devices with zero MTUJeremy Kerr2013-09-191-1/+6
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove unnecessary event passingJeremy Kerr2013-09-197-491/+467
| | | | | | | | | | | | | | | Currently, we pass "events" between the udev, user-event and device-handler layers. These events all get sent through device_handler_event, then de-multiplexed to an appropriate handler, depending on their source. Instead, just export relevant device_handler functions, and have the (old) event sources call these functions directly. This also means we can include a lot more of the device hander code in the parser tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Fix use-after-free in boot()Jeremy Kerr2013-09-191-2/+2
| | | | | | We need boot_task for kexec_reboot. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/log: Cleanup log APIJeremy Kerr2013-09-191-9/+10
| | | | | | | | | | Rather than exposing log internals (through always_flush and set_stream), do all logging init through pb_log_init(). If pb_log_init() hasn't been called, pb_log will drop messages. Also, add a pb_debug() function, specifically for debugging information. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Consolidate device path, name and ID.Jeremy Kerr2013-09-193-31/+9
| | | | | | | | | | | | This change cleans up our usage of device path, names and IDs. Device ID is the kernel name for the device. We also expose this through lookup_by_name. Device path is the path to the dev node (ie, always starts with /dev/), and is only used for mounting. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: populate udev device typesJeremy Kerr2013-09-182-0/+23
| | | | | | Now that we have device types, populate from the udev info. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config: Add autoboot timeout to configuration varsJeremy Kerr2013-09-182-3/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: check for a valid boot option before addingJeremy Kerr2013-09-061-1/+2
| | | | | | | | | | If we didn't find any valid boot options in the pxe buffer, we'll call discover_context_add_boot_option with a NULL boot option. This change adds a check before we try to add the boot option, and a test to verify this situation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot-parser: Handle 'partition=' directive overrideNeelesh Gupta2013-08-301-4/+16
| | | | | | | | | | | | | | | In a yaboot conf file, we may see a device= directive that actually specifies a partition (eg, sda1) rather than the underlying block device (sda). If we then encounter a partition= directive, we don't handle the resolution of the partition correctly, as we simply append the partition number to the device= string. This change implements a smarter handling of the partition= directive, where we strip away any partition information from the device= parameter first. Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add dry_run argument to process_initJeremy Kerr2013-08-201-1/+1
| | | | | | | Implement dry-run behaviour on the discover server by passing a bool to process_init. UIs don't need to support dry runs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmdJeremy Kerr2013-08-194-143/+94
| | | | | | | This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud