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().
Jeremy Kerr [Tue, 2 Jul 2013 02:36:47 +0000 (10:36 +0800)]
config/powerpc-nvram: Don't require petitboot, prefix on all params
Currently, we only store nvram params with a "petitboot," prefix, so
that we don't grow the config list to an unbound size. However,
the "auto-boot?" param has no prefix.
Instead, remove the requirement for the "petitboot," prefix, and use an
array of known parameters instead.
Geoff Levand [Sun, 30 Jun 2013 20:45:58 +0000 (13:45 -0700)]
discover: Fix automake warnings
Change the Makfile.am relocatable output files from automake _LIBRARIES
to automake _PROGRAMS. Also, change the output file name extension
from .o to .ro to better show these are relocatable files.
Fixes automake warnings like these:
discover/Makefile.am: `libparser.o' is not a standard library name
discover/Makefile.am: did you mean `libparser.a'?
Jeremy Kerr [Mon, 24 Jun 2013 05:03:14 +0000 (13:03 +0800)]
ui/ncurses: Remove unused 'cod' variable
When configured with --disable-debug, we get an unused variable warning:
ui/ncurses/nc-cui.c: In function 'cui_device_remove':
ui/ncurses/nc-cui.c:439:24: error: unused variable 'cod'
cc1: all warnings being treated as errors
Jeremy Kerr [Thu, 20 Jun 2013 04:00:26 +0000 (12:00 +0800)]
discover/event: Fix incorrect calculation of param data length
We're not accounting for the action in the event header (only the device
string) when we pass the length of param data to event_parse_params.
This means we walk past the end of the event data while parsing params.
Geoff Levand [Tue, 21 May 2013 13:27:24 +0000 (21:27 +0800)]
discover: Send options to client in order
Send the boot options to the client in the order discovered. This
change is in follow up to inverting the order that the server
saves the options internally.
Jeremy Kerr [Fri, 17 May 2013 01:38:07 +0000 (09:38 +0800)]
lib/waiter: Ensure waiters are consistent during waiter_poll
We have a bug at the moment: if the waitset's->waiters array is updated
duing waiter_poll() (eg, a client connection is closed, and the client's
callback performs a waiter_remove()), then we may invoke callbacks for
incorrect waiters.
This change uses a consistent waiters array duing execution of
waiter_poll, so that any pollfds returned from poll() will result in
correct callback invocations.
This assumes that a waiter will only ever remove *itself* from the
waitset; otherwise, we may call a free()ed waiter.
Jeremy Kerr [Mon, 20 May 2013 02:28:23 +0000 (10:28 +0800)]
test/parser: cleanup parser allocations on exit
We should talloc_free the parser list once we're done, enabling
valgrind's leak check. Before:
[jk@pablo parser]$ valgrind ./test-null
...
==9330== HEAP SUMMARY:
==9330== in use at exit: 288 bytes in 3 blocks
==9330== total heap usage: 11 allocs, 8 frees, 1,177 bytes allocated
After:
[jk@pablo parser]$ valgrind ./test-null
...
==9940== HEAP SUMMARY:
==9940== in use at exit: 0 bytes in 0 blocks
==9940== total heap usage: 11 allocs, 11 frees, 1,177 bytes allocated
==9940==
==9940== All heap blocks were freed -- no leaks are possible
Geoff Levand [Sat, 18 May 2013 01:57:07 +0000 (09:57 +0800)]
test/parser: Add check_not_present_resource
Add a new routine check_not_present_resource() to check
that a resource is not present. This is typically used
to check that an initrd entry has not been found.
Also add any needed checks for no initrd to the existing
tests.
Jeremy Kerr [Wed, 8 May 2013 08:39:58 +0000 (16:39 +0800)]
discover/resource: Provide resolve_resource_against_device
Any other implementation of resources will need to resolve againsst
particular devices, so make resolve_devpath_against_device
publically-accessible, and rename to not be devpath-specific.
Jeremy Kerr [Wed, 15 May 2013 08:41:56 +0000 (16:41 +0800)]
test/parser: Add test device hotplug functions
Add a function, test_hotplug_device(), to simulate the addition of
devices during tests. This should make it possible to observe boot
options' resources changing from unresolved state to resolved.
Jeremy Kerr [Wed, 15 May 2013 05:11:43 +0000 (13:11 +0800)]
test/parser: Allow raw config data in test .c files
Add a little post-processing script (extract-config.awk) to allow us to
put the config data directly into the test .c files, without having to
quote the C string.
Jeremy Kerr [Wed, 15 May 2013 07:28:57 +0000 (15:28 +0800)]
test: Replace parser tests with empty framework
This change is a major rework of the parser tests. Currently, the parser
tests just run the parsers on each subdir of data/, but we don't
actually check the results.
Rather than just running parsers and expecting a certain fixed output,
the new tests are arbitraty (short!) C programs. This allows us to set
up the device configuration / discover context etc in whatever manner
necessary, and check that the boot options that the parsers emit are
correct.
This change removes all of the old tests, and adds a new "null" test.
Actual tests will be added in subsequent changes.
Jeremy Kerr [Mon, 13 May 2013 02:08:47 +0000 (10:08 +0800)]
discover: Allow devices with no device_path
Devices that have been added via the user path may not have a device
path. In this case, don't segfault in device_match_path, and break out
of mount_device early.