summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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-084-57/+59
| | | | | | | | 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: Hookup --no-autoboot to configGeoff Levand2013-07-232-2/+11
| | | | | | | Add new routine config_set_autoboot(), and use it to set the --no-autoboot option. Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/waiter: Defer free of removed waitersJeremy Kerr2013-07-231-3/+27
| | | | | | | | | 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(). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config/powerpc-nvram: Fix nvram line parsingJeremy Kerr2013-07-021-2/+11
| | | | | | | We have a couple of issues with the nvram output parser; lines aren't being broken up correctly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config/powerpc-nvram: Don't require petitboot, prefix on all paramsJeremy Kerr2013-07-021-6/+23
| | | | | | | | | | | 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. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/boot: Allow boot hooks to alter boot dataJeremy Kerr2013-06-241-3/+3
| | | | | | | By exiting with status == 2, boot hooks can update boot data by printing name=value to stdout. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/system: Add pb_run_cmd_pipeJeremy Kerr2013-06-242-2/+73
| | | | | | Add a function to run a command and capture the output into a buffer. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add initial dtb supportGeoff Levand2013-06-242-0/+15
| | | | | | | Updates & fixes by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add network handlingJeremy Kerr2013-06-242-0/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Add pb-config moduleJeremy Kerr2013-06-247-0/+541
| | | | | | | | | Add a library for (name, value) configuration. Different storage backends are allowed (although currently hardcoded to powerpc nvram), and config is read-only at present. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add "cancel default boot" messagesJeremy Kerr2013-06-241-0/+1
| | | | | | | Allow the default boot process to be cancelled, via a message with action PB_PROTOCOL_ACTION_CANCEL_DEFAULT. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Add timeout waitersJeremy Kerr2013-06-242-34/+146
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* types: Add is_default to struct boot_optionJeremy Kerr2013-06-242-1/+12
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: Ensure waiters are consistent during waiter_pollJeremy Kerr2013-05-211-19/+43
| | | | | | | | | | | | | | | | 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. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: allocate waiters separately from set->waitersJeremy Kerr2013-05-211-13/+22
| | | | | | | | | | Since we reallocate set->waiters, we can't hand out pointers to within that array. Instead, this change allocates the 'struct waiter's separately from the set->waiters array. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log cleanupJeremy Kerr2013-05-161-9/+0
| | | | | | | Remove some of the more noisy log messages, and add some information pertinent to device resolution events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Add pb_url_to_stringJeremy Kerr2013-05-152-5/+9
| | | | | | Add a function to unparse a URL, to make comparisons in tests easy. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: fix no-scheme URL parsingJeremy Kerr2013-05-061-6/+8
| | | | | | | | | | | | | | | | | | | | | | | We were incorrectly dropping the first strlen("file://") characters from URLs with no scheme: --- test/urls/data/localpath.test 2013-05-02 17:26:48.826359036 +0800 +++ /tmp/tmp.gn4JsWLw5o 2013-05-02 17:26:50.262364613 +0800 @@ -2,6 +2,6 @@ scheme file host (null) port (null) -path /test/path/to/local/file -dir /test/path/to/local/ +path ath/to/local/file +dir ath/to/local/ file file This change fixes the issue by indicating "no scheme found" by a NULL return from pb_url_find_scheme, and hadling it appropriately. We add a testcase too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Add boot_status (de-)serialisation functionsJeremy Kerr2013-05-062-0/+84
| | | | | | | Add code to the pb-protocol layer to serialise and deserialise boot_status messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Add boot_status type & protocol definitionsJeremy Kerr2013-05-062-0/+11
| | | | | | Add an initial definition for boot status messages sent to clients Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: remove unnecessary udevadm referencesJeremy Kerr2013-05-062-2/+0
| | | | | | Since we interact with libudev now, we no longer need to run udevadm. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/list: Fix handling of empty listsJeremy Kerr2013-05-031-5/+6
| | | | | | | | | | | The current list_for_each_entry_safe marco SEGVs on empty lists; the list_entry will give us a NULL tmp on the first iteration. This change removes the use of list_entry, as we're effectively by-passing its NULL return semantics with our own. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/url: Add pb_join_urlJeremy Kerr2013-04-292-16/+110
| | | | | | Add a a function to join a string to a base URL Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* list: Fix seg fault with list_for_each_entry_safeGeoff Levand2013-04-231-7/+5
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/list: Add list_for_each_entry_safeJeremy Kerr2013-04-161-0/+8
| | | | | | | Add a list iterator that is safe against deletion of the current element. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Separate device add from boot-option add messagesJeremy Kerr2013-04-163-93/+102
| | | | | | | | | | | | | | | | | | | | We want to cater for situations where boot options may be discovered some time after we get notificiation about devices. For instance, discovering boot options from DHCP configuration parameters. In this case, we'll need to notify UIs of boot options appear some time after the device (and/or other boot options on the same device) has appeared. This change adds a new protocol message type, PB_PROTOCOL_ACTION_BOOT_OPTION_ADD. We also rename PB_PROTOCOL_ACTION_ADD to make it clear that it is just for devices. The discover server is updated to send boot option add events at device discover time, but we are now able to decouple this later. We also update the clients to handle the boot option add events separately. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-protocol: Don't allocate in deserialise functionsJeremy Kerr2013-04-162-16/+8
| | | | | | | | | | | | | Curently, the protocol deserialise functions are allocating device and boot_command structures. This (implicitly) makes them responsible for initialisation of these structures too. Rather that making the protocol responsible for initialising the devices and boot commands, this change gives the deserialise functions an argument to an already-instanciated structure. This means that the creation is no longer implied by the deserialise. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: parse boot message from incoming ACTION_BOOT messagesJeremy Kerr2013-04-152-0/+34
| | | | | | | Add a function in the protocol code to deserialise a boot message, and use it to extract a boot_command in the discover server. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Move URL-handling code to libJeremy Kerr2013-04-153-1/+283
| | | | | | | We'll need to use the URL handling code in the server, so move it to the lib/ directory. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover-client: Add discover_client_bootJeremy Kerr2013-04-152-0/+27
| | | | | | | | This change implements the client side of the server-based boot interface. We add a funcion, discover_client_boot, which serialises a boot message, then sends it to the server. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add boot command structure to petitboot protocol descriptionJeremy Kerr2013-04-153-0/+16
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-102-34/+57
| | | | | | | | | Rather than defining the set of waiters (and pollfds) in waiter.c, add a struct waitset to contain these. A waitset is created with waitset_create, which is passed to the waiter_* functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/types: Create common file for type definitionsJeremy Kerr2013-04-103-26/+34
| | | | | | | | | | | | The device and boot_option types are defined in pb-protocol.h, but aren't really specific to the procotol. This means a lot of non-messaging-related files are #including the protocol definitions unnecessarily. This change separates the types out into lib/types/types.h. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Allow host programs to be configuredJeremy Kerr2013-03-051-10/+10
| | | | | | | | | | | | | | | Rather than hard-coding in lib/system/system.c, this change adds a set of #defines for host programs, through the autoheader config.h These host programs can then be set through configure: ./configure HOST_PROG_MOUNT=/usr/bin/mount Because we need to define nine host programs, we add an autoconf macro to avoid repeating the definition code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add udevadm to pb_system_appsJeremy Kerr2013-03-052-0/+2
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* lib/pb-protocol: suppress warning for unused buf_len argJeremy Kerr2013-03-051-0/+1
| | | | | | | When assert is disabled, we end up with an warning for buf_len. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Cleanup --dry-run option codeGeoff Levand2012-03-302-4/+11
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add new macro DEFINE_LIST()Geoff Levand2012-03-261-1/+3
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Log to stderr, allow --log=-Geoff Levand2012-03-261-3/+3
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add --start-daemon option to ui programsGeoff Levand2012-03-083-3/+9
| | | | | | | | Add the option --start-daemon to automatically start pb-discover if it is not already started. For use when running as a stand-alone app. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Convert build to use automakeGeoff Levand2012-02-121-0/+35
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add custom TALLOC_ABORTGeoff Levand2011-11-121-0/+7
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add va-copy check to configure.acGeoff Levand2011-11-121-6/+7
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add list_prev_entry, list_next_entryGeoff Levand2011-11-111-4/+9
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Return NULL for head list_entryGeoff Levand2011-11-111-7/+9
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Cleanup list formattingGeoff Levand2011-11-111-12/+12
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add STATIC_LIST initializerGeoff Levand2011-11-111-0/+7
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Fix waiter_register return valueGeoff Levand2011-11-031-1/+5
|
* Add pb_protocol_dump_deviceGeoff Levand2011-10-302-0/+25
|
OpenPOWER on IntegriCloud