summaryrefslogtreecommitdiffstats
path: root/lib/pb-protocol/pb-protocol.c
Commit message (Collapse)AuthorAgeFilesLines
* lib/pb-protocol: Define new 'add-url' actionSamuel Mendoza-Jonas2014-07-281-0/+18
| | | | | Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Add lang member to configJeremy Kerr2014-07-281-0/+9
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add safe modeJeremy Kerr2014-07-221-1/+9
| | | | | | | | | | | Safe mode configures the discover server to not start any device parsing; this can be used to diagnose any problems with early device handing. In safe mode, we don't initialise any of the device sources - udev, network and user events are disabled. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: check config.boot_device before setting a defaultJeremy Kerr2014-07-211-0/+2
| | | | | | If a default device is set, we only allow booting from that device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* config: Add boot_device member to configJeremy Kerr2014-07-211-3/+10
| | | | | | | We'd like to specify a way to only boot from a specific block device; this adds a field to the configuration to hold the value. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-protocol: fix deserialise of boot option prioritiesJeremy Kerr2014-04-071-0/+3
| | | | | | | | | | | | Commit aa530148 introduced a priority member to struct boot_priority, but didn't update the protocol deserialise function to properly decode config messages. This meant we were leaving half of the struct uninitialised, and getting invalid values in the initialised part. This change updates the config deserialise function to do proper handling for boot priority data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Make boot_priorities more flexibleJeremy Kerr2014-01-301-2/+6
| | | | | | | | | | | | Rather than rely on the ordering of the boot_priorities array to define which device types have a higher "default boot" priority, this change introduces a slightly more flexible way of priority lookups, by adding a separate priority field to struct boot_priority. This means we can have an unordered array, change priorities without re-writing the array, and implementing a disable mechanism. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* sysinfo: Add interface link status to sysinfo dataJeremy Kerr2013-12-181-1/+8
| | | | | | | | This changes adds a 'link' parameter to the interface information sent in sysinfo messages. The discover network code populates this from the incoming netlink messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Add block device information to system infoJeremy Kerr2013-11-221-1/+41
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/pb-protocol: Add serialise & deserialise for struct configJeremy Kerr2013-11-131-0/+203
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add system info messagesJeremy Kerr2013-10-091-0/+110
| | | | | | | | Add a little infrastructure for communicating information about the system to the petitboot UIs. We just send some identifying info (type and identifier), as well as the interfaces. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* types: Add device_type to struct deviceJeremy Kerr2013-09-181-0/+10
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add initial dtb supportGeoff Levand2013-06-241-0/+13
| | | | | | | Updates & fixes by Jeremy Kerr <jk@ozlabs.org>. Signed-off-by: Geoff Levand <geoff@infradead.org> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* types: Add is_default to struct boot_optionJeremy Kerr2013-06-241-1/+10
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Add boot_status (de-)serialisation functionsJeremy Kerr2013-05-061-0/+78
| | | | | | | Add code to the pb-protocol layer to serialise and deserialise boot_status messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* protocol: Separate device add from boot-option add messagesJeremy Kerr2013-04-161-89/+88
| | | | | | | | | | | | | | | | | | | | 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-14/+6
| | | | | | | | | | | | | 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-151-0/+31
| | | | | | | 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-client: Add discover_client_bootJeremy Kerr2013-04-151-0/+24
| | | | | | | | 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-151-0/+8
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.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>
* Add pb_protocol_dump_deviceGeoff Levand2011-10-301-0/+22
|
* Add n_options to struct deviceGeoff Levand2011-10-271-0/+2
|
* Increase protocol payload sizeGeoff Levand2009-03-301-3/+17
| | | | | | | | | | | | Fixes the problem of big conf files not showing up in the UI. Increases the protocol payload from 4 KiB to 8 KiB. Also, adds some log messages when I/O errors occur, or the payload is too large for the protocol. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Remove boot_option_copy routineGeoff Levand2009-02-211-20/+0
| | | | | | | | | | Remove the now uneeded boot_option_copy() routine. The addition of persistant client device and boot option info make this routine uneeded. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add protocol object compare routinesGeoff Levand2009-02-211-0/+11
| | | | | | | | | Add routines pb_protocol_device_cmp() and pb_protocol_boot_option_cmp() to hide the implemention details of the device. The implementation of the id can be changed without effecting the users of it. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Make device instance constantGeoff Levand2009-02-011-7/+9
| | | | | | | Make the instance of devices read-only. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add boot_option_copy routineGeoff Levand2009-02-011-0/+19
| | | | | | | Add the convenience routine boot_option_copy(). Does a deep copy. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix build warningsGeoff Levand2009-02-011-4/+9
| | | | | | | | | | | | | | | | | | | | | | Fix various minor build warnings: lib/pb-protocol/pb-protocol.c:72: warning: comparison between signed and unsigned lib/pb-protocol/pb-protocol.c:78: warning: comparison between signed and unsigned lib/pb-protocol/pb-protocol.c:141: warning: unused parameter 'buf_len' lib/pb-protocol/pb-protocol.c:241: warning: comparison between signed and unsigned discover/pb-discover.c:14: warning: no previous prototype for 'sigint_handler' discover/pb-discover.c:13: warning: unused parameter 'signum' discover/log.c:22: warning: no previous prototype for 'pb_log_set_stream' discover/discover-server.c:159: warning: no previous prototype for 'discover_server_notify_add' discover/discover-server.c:169: warning: no previous prototype for 'discover_server_notify_remove' discover/discover-server.c:179: warning: no previous prototype for 'discover_server_set_device_source' discover/discover-server.c:184: warning: no previous prototype for 'discover_server_init' discover/discover-server.c:229: warning: no previous prototype for 'discover_server_destroy' discover/device-handler.c:395: warning: comparison between signed and unsigned discover/paths.c:44: warning: comparison between signed and unsigned Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Use enum type in pb_protocol_create_messageGeoff Levand2009-02-011-1/+1
| | | | | | | | To better illustrate the usage of pb_protocol_create_message(), change the type of the arg action from int to enum pb_protocol_action. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Use a list for device->boot_optionsJeremy Kerr2009-01-021-12/+23
| | | | | | Makes adding and removing options easier for parsers. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Initial support for multiple UIsJeremy Kerr2008-12-151-0/+307
Move the device discovery code from separate udev helpers to a single process to listen on two sockets: one SOCK_DGRAM for incoming udev events, and one SOCK_STREAM for UIs to connect. Initial support for client/server infrastructure, still need to wire-up the udev messages. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud