summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* discover: Add struct resourceJeremy Kerr2013-04-292-0/+24
| | | | | | | | | | | | Introduce a new type, struct resource, for handling resources such as kernels and initrds. This allows the parsers to better describe resources that are required for booting. Firstly, we enforce all resources to be URLs, rather than local paths. Also, resources allow us to describe files devices that have not-yet been hotplugged. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Introduce a container type for boot optionsJeremy Kerr2013-04-298-103/+160
| | | | | | | | | This change introduces a new type, struct discover_boot_option. Like struct discover_device adds discover-specific data to struct device, struct discover_boot_option allows the discover server to store more than just the boot option strings for a boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add device lookup functionsJeremy Kerr2013-04-292-0/+98
| | | | | | | | | | | | Add a few functions to find devices by various attributes: * device_lookup_by_name * device_lookup_by_path * device_lookup_by_uuid * device_lookup_by_label * device_lookup_by_id Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add uuid and label parameters to persistent device dataJeremy Kerr2013-04-292-19/+28
| | | | | | | | | | | | | | | | Rather than depending on the event (which is only available during inital discovery) for UUID and label parameters, this change adds uuid and label members to struct discover_device. This means that the label and UUID are available during the device's lifetime, not just during initial discovery. We can also just pass the device to some of the device handling code, rather than the discover context. Also, fix an issue where we don't use the raw label/uuid (instead of the encoded one) in setup_device_links. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: change parser.parse to accept a bufferJeremy Kerr2013-04-297-104/+108
| | | | | | | Rather than having each of the parsers do their own open(), read(), etc, use the registered filenames array to find & open parser conf files. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: Add filenames to struct parserJeremy Kerr2013-04-294-5/+18
| | | | | | | In preparation of moving file handling to the discover core (rather than the parsers), include the conf file names in struct parser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Add pb_join_urlJeremy Kerr2013-04-294-20/+125
| | | | | | Add a a function to join a string to a base URL Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* device-handler: Don't unmount non-mounted devicesJeremy Kerr2013-04-291-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* test/lib: Hook into `make check`Jeremy Kerr2013-04-292-2/+3
| | | | | | | This change hooks the new list tests into 'make check'. To do this, we need to fix the return code of the list-test program. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix potentially-unused var warningJeremy Kerr2013-04-291-1/+1
| | | | | | | discover/boot.c: In function ‘boot’: discover/boot.c:153:13: error: ‘local_initrd’ may be used uninitialized in this function [-Werror=maybe-uninitialized] Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* event: Make strings constGeoff Levand2013-04-281-3/+3
| | | | | | | The processing of events does not modify the event strings, so change the strings in struct event to const (read-only). Signed-off-by: Geoff Levand <geoff@infradead.org>
* test: Rename test/list to test/libGeoff Levand2013-04-284-2/+2
| | | | | | | Having a test/list directory is a little too specific, so rename the test/list directory to test/lib as a place for any lib tests. Signed-off-by: Geoff Levand <geoff@infradead.org>
* list: Fix seg fault with list_for_each_entry_safeGeoff Levand2013-04-231-7/+5
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* test: Add list testGeoff Levand2013-04-234-1/+103
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add missing udev_destroy callGeoff Levand2013-04-211-0/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Separate temporary and permanent device dataJeremy Kerr2013-04-1611-197/+221
| | | | | | | | | | | At present, we keep both permanent (eg links/n_links) and temporary (event) data in struct discover_context. This change makes discover_context a temporary structure, just used during actual device discovery. Once discovery is complete, the permanent data (discover_device) is "committed" to the device handler. Signed-off-by: Jeremy Kerr <jk@ozlabs.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>
* discover: Consolidate user events by device IDJeremy Kerr2013-04-164-15/+36
| | | | | | | | | | Currently, we assume all user events are for a new device. This means that we can never add boot options to an existing device. This change tries to find an existing (matching by ID) device before creating a new one in the user event add path. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Separate device add from boot-option add messagesJeremy Kerr2013-04-1612-223/+302
| | | | | | | | | | | | | | | | | | | | 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-164-20/+18
| | | | | | | | | | | | | 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>
* ncurses: Fix build warningGeoff Levand2013-04-151-0/+1
| | | | | | | | Add missing header include. Fixes this warning: ui/ncurses/nc-cui.c: warning: implicit declaration of function 'pb_protocol_device_cmp' Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Fix boot with initrd errorGeoff Levand2013-04-151-2/+2
| | | | | | Fix typo in boot() routine. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Move --dry-run option to discover serverJeremy Kerr2013-04-1511-32/+24
| | | | | | | Now that the server does the booting, we should move the --dry-run argument to the server. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move boot to discover serverJeremy Kerr2013-04-1514-551/+443
| | | | | | | | | | | | | | | | | | | | | This change moves the boot-via-kexec functionality from the UIs to the discover server. On the UI side: rather than run kexec directly, we just send a message to the discover server. Because this is generic discover client functionality, we no longer need the boot callbacks in the twin- and ncurses-specific code. We also remove the kexec and URL-loading code from the UIs, and add it to the discover server code, in paths.c. We expose this to the server though a new function: load_path(void *, const char *, unsigned int *); On the server side, we simply move hook up the boot() function to use the load_file and kexec calls. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Implement device handler boot pathJeremy Kerr2013-04-156-1/+59
| | | | | | | | | | This change adds a funtion, device_handler_boot, which processes the boot command message from the discover server. We add a new file, discover/boot.c (and a corresponding header) with a skeleton for the final kexec code. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: parse boot message from incoming ACTION_BOOT messagesJeremy Kerr2013-04-153-1/+43
| | | | | | | 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>
* discover-server: Add reference to server in struct clientJeremy Kerr2013-04-151-0/+2
| | | | | | We'll need to reference the server when handling messages from clients. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/url: Move URL-handling code to libJeremy Kerr2013-04-157-10/+7
| | | | | | | 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>
* ui/ncurses: Add discover client to struct cuiJeremy Kerr2013-04-152-5/+5
| | | | | | .. we'll need it later. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover-client: interact directly with waitsetJeremy Kerr2013-04-155-80/+55
| | | | | | | | | | | | | | Currently, clients need to mess with the discover client fd directly, and manually register the waiter. Instead, this change adds a waitset parameter to discover_client_register, so that the discover client can register itself, and call discover_client_process directly. This means no proxy handlers, and no casts to waiter callbacks. We can also get rid of discover_client_get_fd. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover-client: Add discover_client_bootJeremy Kerr2013-04-155-6/+82
| | | | | | | | 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>
* discover: Allow discover server to receive boot messagesJeremy Kerr2013-04-151-2/+24
| | | | | | | | | | | | | | | Currently, the petitboot socket is one way: messages are only sent from server to client. Beause we want the clients to trigger a boot, this change allows the server to receive messages on the petitboot socket. This is just a matter of adding a waiter to the client-specific socket, then handling incoming messages. At present we don't do anything with the messages, but we'll add a handler later. 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>
* ui: callback & boot actions: kexec -> bootJeremy Kerr2013-04-159-33/+33
| | | | | | | | | find ui/ -type f | xargs sed -i -e s/kexec_cb/boot_cb/g \ -e s/on_kexec/on_boot/g \ -e s/run_kexec/boot/g Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui: pb_kexec_data -> pb_boot_dataJeremy Kerr2013-04-1510-77/+77
| | | | | | | | find ui/ -type f | xargs sed -i -e s/pb_kexec_data/pb_boot_data/g \ -e 's/\<kd\>/bd/g' Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* ui/ncurses: ked -> boot-editorJeremy Kerr2013-04-157-386/+408
| | | | | | | | | | git mv ui/ncurses/nc-ked.c ui/ncurses/nc-boot-editor.c git mv ui/ncurses/nc-ked.h ui/ncurses/nc-boot-editor.h find ui/ncurses -type f | xargs sed -i -e s/nc-ked\./nc-boot-editor./g \ -e s/ked/boot_editor/g Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-udhcpc: Fix generation of TFTP URLsJeremy Kerr2013-04-101-1/+1
| | | | | | | | | | | | DHCP boot-file parameters may not contain a preceeding slash. In this case, the current udhcp script will not form a correct URL. This change adds the slash unconditionally; in the case that the pathname already has a preceeding slash, the URL parser will handle this correctly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* ui/common: Remove unused artworkJeremy Kerr2013-04-104-3/+0
| | | | | | | | | | | | A few of the oxygen icons are no longer used, so remove them from the artwork tree. Coincidentally, this fixes and issue with `make dist`, as the drive-removable-media-usb-pendrive.png file is too long (when used with an autogenerated git version string) to be tar-ed up. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* test/urls: Fix distcheck breakagesJeremy Kerr2013-04-101-0/+4
| | | | | | | | We need a couple of extra automake variables to get `make distcheck` working. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-1016-64/+112
| | | | | | | | | 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-1017-39/+51
| | | | | | | | | | | | 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>
* test/url: Add http-simple.testJeremy Kerr2013-03-061-0/+7
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* ui/common/url: Fix multiple-preceeding-slash on pathnamesJeremy Kerr2013-03-061-0/+5
| | | | | | | Fix the double-slash URL test. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* test: Add URL parser test infrastructureJeremy Kerr2013-03-066-1/+123
| | | | | | | | | | | | This change adds some simple testing infrastrcture to the URL parser. We use a small C binary (parse-url) to run the url parser on its argument, and compare the output with an expected datafile. An initial test is included, to check the behaviour of URLs with multiple slashes between host and pathname. This test currently fails. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* ui/common/url: Add pb_url_scheme_nameJeremy Kerr2013-03-062-0/+13
| | | | | | | | Add a function to lookup the name of a scheme, for more useful URL output. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* ui/common/url: remove scheme separator from URL scheme definitionsJeremy Kerr2013-03-061-20/+35
| | | | | | | To make the scheme definitions more useful for other functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* ui/common/url: move pb_scheme_info array to file scopeJeremy Kerr2013-03-061-16/+15
| | | | | | | | We'd like to use the scheme info array for other functions, so move it to file scope, and rename to schemes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Allow host programs to be configuredJeremy Kerr2013-03-052-10/+31
| | | | | | | | | | | | | | | 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>
* discover: Remove {U,}MOUNT_BIN definesJeremy Kerr2013-03-051-7/+4
| | | | | | | Use pb_system_apps instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add udevadm to pb_system_appsJeremy Kerr2013-03-053-1/+3
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
OpenPOWER on IntegriCloud