summaryrefslogtreecommitdiffstats
path: root/discover
Commit message (Collapse)AuthorAgeFilesLines
* discover/grub2: Add default option parsingJeremy Kerr2013-06-241-1/+39
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Send options to client in orderGeoff Levand2013-05-211-2/+2
| | | | | | | | 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. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover/grub2: remove uuid log messageJeremy Kerr2013-05-211-1/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: fix error handling from failed client writesJeremy Kerr2013-05-211-4/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Fix accept() return value checkJeremy Kerr2013-05-211-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: destroy client if message read failedJeremy Kerr2013-05-211-4/+11
| | | | | | | When a client disconnects, the read from the client's fd will return EOF. We should destroy the client in this situation. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parser: Use list to hold parsersGeoff Levand2013-05-171-15/+21
| | | | | | | Now that we dynamically add parsers, we can use a list to hold them. Also simplifies the test_run_parser() routine. Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser/grub2: Add parse for linux16Geoff Levand2013-05-171-1/+2
| | | | | | Ubuntu uses the linux16 symbol in thier conf files for memory test entries. Signed-off-by: Geoff Levand <geoff@infradead.org>
* parser/grub2: Better menuentry parsingGeoff Levand2013-05-171-6/+1
| | | | | | Grub2 menuentry entry text can use double or single quotes. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover/grub2: handle search commands to specify root filesystemsJeremy Kerr2013-05-161-5/+90
| | | | | | Add a resource type for grub, allowing us to parse search parameters. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource: Provide resolve_resource_against_deviceJeremy Kerr2013-05-162-6/+8
| | | | | | | | 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. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log cleanupJeremy Kerr2013-05-165-19/+26
| | | | | | | 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>
* discover: Make device handler a little more testableJeremy Kerr2013-05-151-280/+307
| | | | | | | | | | | This change moves some of the device-handler code into an #ifdef-ed section, so we can easily drop the stuff that's not required for testing. Although the change is quite large, most of it is moving entire functions around. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Allow devices with no device_pathJeremy Kerr2013-05-151-1/+4
| | | | | | | | 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. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always associate resources with a boot optionJeremy Kerr2013-05-154-15/+19
| | | | | | | | | | | We should always be tallocing resources to a boot option context; anything else (for example, the discover context) may have a different lifetime. In order to enforce this, we change the void *ctx argument to the context_create functions to a struct discover_boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't access bytes before the start of empty stringsJeremy Kerr2013-05-151-0/+3
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Always add a NUL byte to config dataJeremy Kerr2013-05-151-1/+3
| | | | | | | conf_get_pair will read one-byte past the end of the conf buffer, so always NUL-terminate. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/yaboot: Fix boot option stateJeremy Kerr2013-05-151-12/+13
| | | | | | We're only picking up every second boot option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: use devname (not devpath) for device IDsJeremy Kerr2013-05-151-1/+1
| | | | | | devnames are unique, and much shorter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Add grub2/grub.cfg config fileJeremy Kerr2013-05-151-0/+2
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: handle boot_option->device_id entirely within handlerJeremy Kerr2013-05-093-3/+4
| | | | | | | No need for parsers to populate (or forget to populate, in the case of most parsers) opt->device_id, as we should do it on finalise. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Setup event params from udev propertiesJeremy Kerr2013-05-091-16/+17
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event: Add event_set_paramJeremy Kerr2013-05-092-2/+27
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/udev: Don't print properties of skipped devicesJeremy Kerr2013-05-091-2/+2
| | | | | | This cleans up the log output a little. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/grub2: Rework config stateJeremy Kerr2013-05-081-13/+10
| | | | | | | Rather than creating boot options pre-emptively, in two paths, just do it once when we see the menuentry option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't invert option discovery orderJeremy Kerr2013-05-081-1/+1
| | | | | | | | Keep options in the order that we discovered them in; this makes testing a little easier, as the options appear in the list in the same order as the config file. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't resend all options to all clientsJeremy Kerr2013-05-071-2/+1
| | | | | | | | | | Currently, when a new UI client connects, we send all boot options to all clients. This results in existing clients getting duplicate add events. Instead, we only want to send existing boot options to the new client. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/event-parser: correctly populate boot option resourcesJeremy Kerr2013-05-071-13/+35
| | | | | | | The user event parser should be populating the discover_boot_option's resources, not the strings in struct boot_option. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/resource.h: Add forward declarationsJeremy Kerr2013-05-071-0/+2
| | | | | | We need to define a few structs for the params of resource functions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: better event debugging outputJeremy Kerr2013-05-072-10/+22
| | | | | | | | | | | | | | | We don't currently handle conf events very well: user_event remove event: device: /net/eth0 name => (null) image => (null) args => (null) This change prints the event action properly, and prints all event params. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/kboot: Fix boot_option initialisationJeremy Kerr2013-05-061-0/+1
| | | | | | | We're not populating d_opt->option, so are returning invalid boot options from the kboot parser. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: log unresolved boot optionsJeremy Kerr2013-05-061-0/+3
| | | | | | | These are a bit of a special-case ("why isn't my boot option appearing?"), so add a log message. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: kexec harderJeremy Kerr2013-05-061-0/+15
| | | | | | | | `kexec -e` will just call shutdown, which we've already tried, so it's likely to fail. Add a further fallback to force a kexec with -e -f options. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/user-event: handle initrdsJeremy Kerr2013-05-061-0/+4
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: populate resolve_resource membersJeremy Kerr2013-05-062-8/+10
| | | | | | We're only dealing with devpath resources at the moment. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: detect unresolvable resourcesJeremy Kerr2013-05-061-2/+11
| | | | | | We don't want to call NULL resolve_resource callbacks. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Send boot status messages during boot()Jeremy Kerr2013-05-063-6/+55
| | | | | | | Now what we have protocol support, send status updates during the boot process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add discover_server_notify_boot_statusJeremy Kerr2013-05-062-0/+30
| | | | | | Add a function to the server to notify clients of boot status updates. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* udev: Revove use of udev_get_sys_pathGeoff Levand2013-05-051-1/+1
| | | | | | | libudev1 changed the symbol udev_get_sys_path to be private, so remove its use in petitboot. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Remove empty routine udev_triggerGeoff Levand2013-05-033-7/+0
| | | | | | | | With the switch of the discover server to use the libudev enumeration support the udev_trigger() routine has becone empty and is no longer needed. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Update udev routines to use libudevGeoff Levand2013-05-032-90/+240
| | | | | | | Support for 'RUN+="socket:' in udev rules files has been removed in udev version 183. Update the discover server to use libudev. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Rename struct udev to struct pb_udevGeoff Levand2013-05-033-14/+15
| | | | | | | To avoid symbol clashes with libudev, rename struct udev to struct pb_udev. No functional changes. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add PXE parserJeremy Kerr2013-04-292-1/+80
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add configuration events & DHCP handlerJeremy Kerr2013-04-295-2/+111
| | | | | | | | | | This change adds a new event type, EVENT_ACTION_CONF. These events supply a new configuration URL that petitiboot should download and parse. With this in place, we can receive DHCP configuration events. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add configuration methodsJeremy Kerr2013-04-297-8/+25
| | | | | | | | | | | | We'd like to be able to download petitboot configurations from other sources (not just local files), but we'll need some way to indicate to the parsers that a chunk of config data is from a specific source. This change adds "configuration methods". At present, we have only one: CONF_METHOD_LOCAL_FILE. For any incoming configuration data, we only run parsers that have registered themselves with that configuration method. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* parsers: dynamically register parsersJeremy Kerr2013-04-296-29/+38
| | | | | | | | | | | | | | | Currently, we require all parsers to be defined in an array in parsers.c. This change removes this requirement, by introducting a register_parser() macro, which adds a constructor to register the parser with the core parser infrastructure. Because each parser no longer resolves an undefined symbol, we need to use a `ld -r` object for libparser, instead of using libtool, which creates a .a (and hence has no parsers included). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Handle unresolved resourcesJeremy Kerr2013-04-293-6/+62
| | | | | | | | | | | | This change adds an unresolved resource queue - any unresolved resources discovered by parsers are added to this queue rather than being reported to the clients. When we discover a new device, we try to resolve any resources in the queue against the new device. If resolution succeeds, we can send the option to clients. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Finalise boot options during commitJeremy Kerr2013-04-291-0/+35
| | | | | | | | | | | Once the discover context is committed, we need to turn the resources in struct discover_boot_option into strings in struct boot_option, so that the parser can display & edit the boot option. This may cause assertions if any of the boot options contain unresolved resources, we'll fix this in the next patch. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/device-handler: Initialise existing_device variableJeremy Kerr2013-04-291-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to emit resources rather than filenamesJeremy Kerr2013-04-2912-360/+154
| | | | | | | | | | | | | | | | | | | | | | | | This change switches the parsers over to populate the resources in discover_boot_option, rather than the string parameters in boot_option. To do this, we need a few things: * Add struct resources to discover_boot_option for the boot_image, initrd and icon data. * Have the parsers populate the resources, rather than the strings. Currently, parsers can all use the devpath resource type. * Add a resolve_resource callback to parsers; this is how the device handler will attempt to resolve resources. * Change load_file to load_url, as we should be only accessing (resolved) resources by URLs. This then allows us to remove the mount map, and associated lookup code, as well as the UUID and label links to devices. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud