Jeremy Kerr [Mon, 16 Sep 2013 08:26:46 +0000 (16:26 +0800)]
discover/grub2: Function infrastructure improvements
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'.
Jeremy Kerr [Fri, 13 Sep 2013 07:25:33 +0000 (15:25 +0800)]
discover/grub2: Fix word append
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.
Jeremy Kerr [Tue, 10 Sep 2013 06:04:41 +0000 (14:04 +0800)]
discover/grub2: Implement parser
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.
Jeremy Kerr [Thu, 19 Sep 2013 09:16:53 +0000 (17:16 +0800)]
discover: Remove unnecessary event passing
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.
Jeremy Kerr [Thu, 19 Sep 2013 04:18:56 +0000 (12:18 +0800)]
lib/log: Cleanup log API
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.
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>
Jeremy Kerr [Mon, 12 Aug 2013 07:57:41 +0000 (15:57 +0800)]
lib/process: Add process helpers
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
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.
Jeremy Kerr [Tue, 13 Aug 2013 03:23:57 +0000 (11:23 +0800)]
discover/boot: talloc struct boot_task
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.
Jeremy Kerr [Thu, 8 Aug 2013 06:33:19 +0000 (14:33 +0800)]
discover: remove libparser object
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.
Jeremy Kerr [Thu, 8 Aug 2013 05:54:19 +0000 (13:54 +0800)]
config: Split interface configuration from network configuration
This change moves the interface configuration into its own 'struct
interface_config'. We also remove the _config suffix from the network
and interface members.
Jeremy Kerr [Wed, 7 Aug 2013 06:00:16 +0000 (14:00 +0800)]
discover/yaboot: fix device parsing
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.
Jeremy Kerr [Wed, 7 Aug 2013 02:31:05 +0000 (10:31 +0800)]
discover/yaboot: Allow all image options to be overridden by global options
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
For a more portable build system convert to using the
autoconf-archive AX_WITH_CURSES macros. Allows building
on openSUSE, which has a different header file layout than
other distros, and fixes menu entries with UTF-8 characters;
this causes fedora installs (codename "Schrödinger´s cat")
to break the UI.
Jeremy Kerr [Thu, 18 Jul 2013 05:21:37 +0000 (13:21 +0800)]
discover: Don't free URL in load_url
Previously, load_url took a char * argument, from which it parsed a
newly allocated URL, and freed the URL before returning.
Commit 5be946c changed load_url (then load_file) to accept a parsed URL
instead of a char *, but didn't remove the free. Any URLs passed to
load_url are currently being unintionally free()ed.
Jeremy Kerr [Wed, 10 Jul 2013 07:50:43 +0000 (15:50 +0800)]
lib/waiter: Defer free of removed waiters
We may end up calling remove()-d time waiters if the timeout expires as
we're processing an IO waiter. Instead of freeing the waiter in
waiter_remove, mark the waiter as inactive, and defer the free until the
end of waiter_poll().