summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* discover/grub2: Clean up error-handling for grub2 parser & lexerJeremy Kerr2013-09-266-16/+47
| | | | | | | Rather than printf() & exit(), use the pb logging functions and abort the parse. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Enable logging to stdoutJeremy Kerr2013-09-261-0/+2
| | | | | | We may as well show the logs while testing. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* tests/urls: Run URL tests under valgrindJeremy Kerr2013-09-263-3/+23
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource: create_url_resource should take ownership of urlJeremy Kerr2013-09-261-0/+1
| | | | | | | The URL needs to share the lifetime of resource, so talloc_steal it in create_url_resource. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: talloc from new URL in pb_url_copyJeremy Kerr2013-09-261-6/+6
| | | | | | | We're ending up with members of new_url being allocated from the old URL's context. We should be tallocing from the new_url instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/paths: Check local file URLs in load_urlJeremy Kerr2013-09-261-3/+20
| | | | | | Make the error case for local files the same as for remotes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/system: Don't modify dir parameter to pb_rmdir_recursiveJeremy Kerr2013-09-261-3/+3
| | | | | | | We're modifying dir rather than cur (the local copy of dir), so the caller-provided (const!) string is no longer const. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Log boot status updatesJeremy Kerr2013-09-261-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Download resources in parallelJeremy Kerr2013-09-261-104/+64
| | | | | | | | Now that we can download asynchronously, we can download boot resources in parallel. This also means we don't need a state machine; we're either not done (loads are still pending) or done. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add struct load_url_result and load_taskJeremy Kerr2013-09-264-307/+287
| | | | | | | | | | | | | | | Currently, load_url and load_url_async return a filename parameter and a tempfile flag (indicating whether the file needs to be cleaned after use). Instead, encapsulate this data in a struct load_url_result, which the caller (and async callbacks) can read the status, filename and clean parameters. For internal use in load_url and helpers, we add a struct load_task to hold a pointer to the load_url_result and async data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't depend on tftp failure for type detectionJeremy Kerr2013-09-264-40/+107
| | | | | | | | Rather than always trying both TFTP client types, do a runtime detection on first invocation. This can be fixed at build-time with --with-tftp=TYPE. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Store clean_* in the boot taskJeremy Kerr2013-09-261-9/+9
| | | | | | ... otherwise we won't clean up local files from earlier boot stages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Check for failed loads in boot()Jeremy Kerr2013-09-251-14/+33
| | | | | | | Use the status argument to the URL load callback to check for load failures. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: load_url_async callback should take an int statusJeremy Kerr2013-09-253-15/+5
| | | | | | We don't need a pointer here, just the status value. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Implement asynchronous boot() processNeelesh Gupta2013-09-251-82/+137
| | | | | | | | | | | | The current boot process handled by boot() function is implemented such that it blocks on the boot resources being downloaded which blocks the discover process until the download completes. This patch re-implements the boot() function using callback mechanism and asynchronous notifications so that boot() returns to continue the discover process while the download is in progress. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
* discover: Add an asynchronous version of load_urlNeelesh Gupta2013-09-252-22/+143
| | | | | | | | | | | A new load_url_async() function handles retrieving the resources by forking an external process which currently blocks the parent waiting for the process to complete. This patch modifies the load_*() functions to handle it asynchronously by providing the exit callback and returning without waiting for the child process to exit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
* discover/grub2: Reimplement default optionsJeremy Kerr2013-09-256-2/+118
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Check for devices with duplicate serial propertiesJeremy Kerr2013-09-243-0/+23
| | | | | | | | | If we have multipath devices present in the system, we'll end up with duplicate mounts, parse results and boot options. This change adds a check to see if we've encountered a device with this serial number previously. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-udhcpc: use plain kernel names for dhcp eventsJeremy Kerr2013-09-241-5/+5
| | | | | | No need to prefix with /net/ Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Fix uninitialised op variableJeremy Kerr2013-09-241-0/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add test-grub2-single-line-if testJeremy Kerr2013-09-242-0/+29
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Support var=value assignmentsJeremy Kerr2013-09-241-0/+12
| | | | | | We want to allow assignments outside of the 'set' builtin. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow double-quotes in embedded configJeremy Kerr2013-09-241-0/+1
| | | | | | We need to escape any double-quotes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add true & false builtinsJeremy Kerr2013-09-241-0/+24
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Allow checks for NULL boot_argsJeremy Kerr2013-09-242-1/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Add variable expansion in Ubuntu conf file testJeremy Kerr2013-09-241-2/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2/lexer: Require 1+ spaces for a TOKEN_DELIMJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add linux16 commandJeremy Kerr2013-09-241-0/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow both delimiters and EOLs after a "then" reserved wordJeremy Kerr2013-09-241-2/+4
| | | | | | | | | | | Putting an if-statement on one line should be possible: if true; then echo "true"; else echo "false"; fi To do this, we'll need to allow both EOLs and TOKEN_DELIM after then and else. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: Fix spacing in grub2-f18-ppc64 testJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement test builtinJeremy Kerr2013-09-241-1/+117
| | | | | | A faily simple implementation now, and could do with some testing... Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add nops for unnecessary builtinsJeremy Kerr2013-09-241-0/+15
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement statement_block_executeJeremy Kerr2013-09-243-1/+12
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: unknown commands should failJeremy Kerr2013-09-241-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Populate option idsJeremy Kerr2013-09-241-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Allow EOF as a statement terminatorJeremy Kerr2013-09-241-1/+4
| | | | | | Files may not have a trailing newline. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add print_tokenJeremy Kerr2013-09-241-0/+10
| | | | | | For better trace output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: fix comment handlingJeremy Kerr2013-09-241-3/+2
| | | | | | | Remove '#' from the list of word chars. Also, don't need the '$' char in the comment regex Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Implement 'elif'Jeremy Kerr2013-09-243-9/+31
| | | | | | | Rather than just having one conditional in an if statement, we use a list of conditionals instead. This allows us to implement elif. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* 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>
OpenPOWER on IntegriCloud