summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* discover: Remove unnecessary event passingJeremy Kerr2013-09-1918-510/+529
| | | | | | | | | | | | | | | 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/pb-config: Initialise DNS server infoJeremy Kerr2013-09-191-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/log: Cleanup log APIJeremy Kerr2013-09-196-51/+65
| | | | | | | | | | 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-183-0/+39
| | | | | | Now that we have device types, populate from the udev info. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* types: Add device_type to struct deviceJeremy Kerr2013-09-182-0/+18
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config/powerpc-nvram: Add petitboot,timeout nvram propertyJeremy Kerr2013-09-181-0/+14
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-config: Add autoboot timeout to configuration varsJeremy Kerr2013-09-184-5/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-udhcpc: Fix string returned from resolve_urlJeremy Kerr2013-09-061-0/+1
| | | | | | In the 'as-is' case, we were echoing both URLs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/pxe: check for a valid boot option before addingJeremy Kerr2013-09-063-1/+22
| | | | | | | | | | 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>
* ui/ncurses: Allow both DEL and ^H to map to backspaceJeremy Kerr2013-09-061-0/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/parser: add 'partition' directive overriding test for yaboot conf fileNeelesh Gupta2013-08-302-0/+34
| | | | | | | | Check the overriding of 'partition' directive from yaboot conf file for 'petitboot', then verify the device name on which the resource resides Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> 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>
* test: add 'partition=directive' test for yaboot conf fileNeelesh Gupta2013-08-292-0/+34
| | | | | Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Implement process_init change in testcasesJeremy Kerr2013-08-296-6/+6
| | | | | | We need to provide the dry_run argument. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: handle EINTR from waitpidJeremy Kerr2013-08-201-2/+7
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add dry_run argument to process_initJeremy Kerr2013-08-206-6/+11
| | | | | | | 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-199-237/+115
| | | | | | | This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmd_pipeJeremy Kerr2013-08-197-138/+66
| | | | | | Replace pb_run_cmd_pipe with process_create / process_run_sync. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: add process testsJeremy Kerr2013-08-197-4/+407
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: handle -EINTRJeremy Kerr2013-08-193-4/+7
| | | | | | | Now that we're handing non-fatal signals (i.e., SIGCHLD in the process lib), we need to gracefully handle -EINTR from poll(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add process helpersJeremy Kerr2013-08-193-0/+515
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We've grown-out of pb_run_cmd a little, as we have a number of different process types: boot(): - kexec: short-running process, run synchronously - boot hooks: short-running, run sync, need exit code & stdout network init: - interface configuration: short running, run sync - udhcp processes are long running, we may want completion, but doesn't block other actions downloads: - potentially long-running, block parse progress config nvram: - read: short running, can block, need stdout - write: short running, can block We'd like to introduce proper asynchronous processes, to allow config & boot-option downloads without blocking the discover server. This change introduces a new type for processes, 'struct process'. These structures are created with process_create, and run with process_run_sync or process_run_async. The latter reports completion through a callback member of struct process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test: Add --enable-test-valgrindJeremy Kerr2013-08-192-0/+13
| | | | | | | Add an --enable-test-valgrind argument to configure, to run all tests under valgrind, configured to fail on leaked memory Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Use talloc in list testJeremy Kerr2013-08-191-1/+8
| | | | | | .. so we can free at exit Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: build with -DEBUGJeremy Kerr2013-08-191-3/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: talloc struct boot_taskJeremy Kerr2013-08-191-38/+34
| | | | | | | | | Rather than using the stack for struct boot_task, talloc one instead. This gives us a short-lived context (active for the boot() process only), and we don't need to use the externally-provided context directly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove unused user_event_triggerJeremy Kerr2013-08-193-14/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: remove waitset_destroyJeremy Kerr2013-08-193-7/+0
| | | | | | We can rely on the ctx free to destroy the waitset. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: talloc waiters from waitset contextJeremy Kerr2013-08-161-1/+1
| | | | | | | We can lose a reference to the first waiter allocated, as set->waiters may be NULL. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: fix talloc_realloc contextJeremy Kerr2013-08-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: merge time & io waiter init loopsJeremy Kerr2013-08-161-24/+22
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: move type-specific members to a unionJeremy Kerr2013-08-161-9/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/file: Add sensible perms when using replace_fileJeremy Kerr2013-08-161-0/+3
| | | | | | Rather than no access at all, use a default of 0644. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: free buffers from resolv.conf updateJeremy Kerr2013-08-161-7/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/network: fix incorrect nameserver directive in resolv.confJeremy Kerr2013-08-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* network: handle DNS configJeremy Kerr2013-08-083-2/+61
| | | | | | If we have a dns config option, update resolv.conf Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/file: Add replace_file()Jeremy Kerr2013-08-082-0/+44
| | | | | | Add a function to atomically replace a file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: separate file-reading code into file.cJeremy Kerr2013-08-084-53/+103
| | | | | | | We'll need to read files in the network config code, so add a 'file' object, containing the read_file function. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove libparser objectJeremy Kerr2013-08-081-21/+14
| | | | | | | | There's no real need for a separate libparser object. Our tests pull-in the parsers directly, and the discover server is the only thing that actually links to libparser.ro. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: DNS configuration isn't interface-specificJeremy Kerr2013-08-083-8/+31
| | | | | | | | | Rather than attaching DNS configuration to an interface, separate it out into general network config. The powerpc-nvram storage exepects dns as a "dns,server,..." string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Split interface configuration from network configurationJeremy Kerr2013-08-085-64/+66
| | | | | | | | This change moves the interface configuration into its own 'struct interface_config'. We also remove the _config suffix from the network and interface members. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: implement default optionsJeremy Kerr2013-08-075-0/+54
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: fix device parsingJeremy Kerr2013-08-074-76/+154
| | | | | | | | | | | | | | | A couple of fixes for yaboot's device-handling code. Firstly, we need to use 'device=' rather than 'root=', as the latter is purely for ybin, to define where the yaboot binary goes. Secondly, we need to respect global and option-specific device= parameters. To do this, we keep all boot_image and initrd strings in the state, and create the actual resources in yaboot_finish. Add a test for all override cases, and fix the incorrect boot= parsing in the rh8 test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Allow all image options to be overridden by global optionsJeremy Kerr2013-08-073-29/+109
| | | | | | | | | | All of the image options should be overridable by global options. Instead of building the boot_args during yaboot_process_pair, we add discovered data into the state struct, then create the boot args from this data during yaboot_finish Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: fix segfault on failed boot image loadJeremy Kerr2013-08-011-2/+3
| | | | | | | | | | If the boot image fails to load, we end up calling talloc_free on an unitialised are of stack (boot_task.local_initrd). Move the initialisers a little earlier, so we always NULL pointers before potentially freeing. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser/yaboot: Fix check for image presenceJeremy Kerr2013-07-313-1/+34
| | | | | | | | | | In the cleanup of yaboot option state, 3fb8fb6fb, we change from checking opt->boot_image to opt, to indicate that we're parsing an image section. We missed one check, which is causing a segfault due to the null opt. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Hookup --no-autoboot to configGeoff Levand2013-07-233-2/+14
| | | | | | | Add new routine config_set_autoboot(), and use it to set the --no-autoboot option. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add --no-autoboot optionGeoff Levand2013-07-232-3/+37
| | | | | | | Add the command line option --no-autoboot to pb-discover and update the pb-discover manpage. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Log autoboot timeoutGeoff Levand2013-07-231-3/+5
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
OpenPOWER on IntegriCloud