summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
...
* discover: Add URL resourcesJeremy Kerr2013-04-292-0/+13
| | | | | | | URL resources are simple: the URLs are already resolved, so not much to do here. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add devpath resourcesJeremy Kerr2013-04-293-0/+138
| | | | | | | | | Add a generic resource type, to handle "dev:path"-style file references. This creates a duplicate of is_prefix_ignorecase, which we'll switch over to later. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* 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-297-95/+137
| | | | | | | | | 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>
* device-handler: Don't unmount non-mounted devicesJeremy Kerr2013-04-291-0/+3
| | | | 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>
* 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-1610-192/+209
| | | | | | | | | | | 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>
* discover: Consolidate user events by device IDJeremy Kerr2013-04-163-15/+18
| | | | | | | | | | 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-164-15/+59
| | | | | | | | | | | | | | | | | | | | 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-161-2/+5
| | | | | | | | | | | | | 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: 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-153-5/+15
| | | | | | | 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-153-6/+431
| | | | | | | | | | | | | | | | | | | | | 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-151-1/+9
| | | | | | | 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>
* 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>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-107-14/+26
| | | | | | | | | 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-107-7/+7
| | | | | | | | | | | | 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>
* 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-051-1/+1
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Use pb_run_cmd rather than calling system()Jeremy Kerr2013-03-051-1/+11
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: remove (unused) duplicate struct mount_mapJeremy Kerr2013-03-051-5/+0
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: remove unused message.h fileJeremy Kerr2013-03-052-32/+0
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser: remove unused fields from struct parserJeremy Kerr2013-03-051-2/+0
| | | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: simplify handler switch statementJeremy Kerr2013-03-052-35/+22
| | | | | | | | Instead of using nested switch statements in device_handler_event, define an array of handlers, and lookup instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Geoff Levand <geoff@infradead.org>
* Cleanup --dry-run option codeGeoff Levand2012-03-301-2/+2
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* pb-discover: Ignore ram, loop and no-name devicesGeoff Levand2012-03-262-10/+18
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Fix device mount retryGeoff Levand2012-03-261-4/+11
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add more paths to grub2 parserGeoff Levand2012-03-261-0/+4
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Log to stderr, allow --log=-Geoff Levand2012-03-261-4/+8
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Zero automatic sockaddrGeoff Levand2012-03-261-0/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add DEVPATH to udev_print_event()Geoff Levand2012-03-261-2/+6
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add grub2 conf file parserGeoff Levand2012-03-183-3/+190
| | | | | | | | Add grub2 parser and sample config file. Reorder parser priorities: From (yaboot -> kboot) to (kboot -> grub2 -> yaboot). Signed-off-by: Geoff Levand <geoff@infradead.org>
* Minor comment fixGeoff Levand2012-03-181-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add new member get_pair to conf parser contextGeoff Levand2012-03-184-1/+15
| | | | | | | | To allow parsers more control over finding paramerter pairs add a new member get_pair to the parser struct conf_context. Initialize get_pair=conf_get_pair_equal for existing parsers. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Refactor parser routine conf_get_param_pair()Geoff Levand2012-03-183-9/+32
| | | | | | | | Refactor conf_get_param_pair() and rename to conf_get_pair(). Add two new wrapper routines conf_get_pair_equal() and conf_get_pair_space(). Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add parser routine conf_replace_char()Geoff Levand2012-03-182-0/+17
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Convert test to automakeGeoff Levand2012-03-161-5/+9
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Use static array for parsersGeoff Levand2012-03-165-28/+19
| | | | | | | | | Change the parser structure array implementation from using an array in a seperate parsers section to a static array of pointers in parser.c. Parser priority is now set by the position in the new parsers array. Signed-off-by: Geoff Levand <geoff@infradead.org>
* Fix seg fault with bare kboot.conf variablesGeoff Levand2012-03-161-0/+5
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Use define_parser() for nativeGeoff Levand2012-03-161-12/+19
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add --start-daemon option to ui programsGeoff Levand2012-03-081-2/+2
| | | | | | | | 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>
* Log file cleanupsGeoff Levand2012-03-081-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
OpenPOWER on IntegriCloud