summaryrefslogtreecommitdiffstats
path: root/discover/pb-discover.c
Commit message (Collapse)AuthorAgeFilesLines
* discover: Add debug flag to configJeremy Kerr2014-08-051-0/+3
| | | | | | | | | | This change adds a debug flag to the config, and groups it under not-user-modifiable parts of struct config. This means we no longer need the pb-sysinfo helper, as the last remaining function (--debug-enabled) can be implemented with pb-config. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add setlocale calls in discover serverJeremy Kerr2014-07-281-0/+8
| | | | | | | | We want the discover server to respect the configured language, so we'll need to add appropriate setlocale() calls. We use the config->lang setting to use any previously-saved language. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover,ui: fix checks for debug optionJeremy Kerr2014-05-011-1/+1
| | | | | | We need to check for equality with opt_yes, not just check for non-zero. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* log: Allow runtime selection of 'debug' log levelJeremy Kerr2014-04-071-2/+11
| | | | | | | | | | | | | | | | | Currently, we need to compile with -DDEBUG to implement debug-level logging in the UIs and discover server. Since we may not be able to easily replace a system's petitboot binaries, this change introduces a -v|--verbose option to the discver server and ncurses UI, which enables debug at runtime. We also move some of the udev debug code out of an #ifdef DEBUG block. Since petitboot is generally started on boot, we also add a little infrastructure to pass -v to petitboot on certain system contitions: either petitboot.debug on the kernel command line, or a petitboot,debug? NVRAM property containing the value 'true'. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: move device sources to the device handlerJeremy Kerr2014-04-021-22/+0
| | | | | | | | | | | | | | | | | | | | Currently, the pb-discover main() function initialises the device handler and the device sources. We want to eventually be able to re-init the device sources, which will be initiated by the handler. In this case, the handler will need references to the sources. This change moves the creation of the device sources to be internal to the handler. This way, the device handler gets a reference to everything, without having to pass pointers around in main(). We also remove the _destroy functions, as we handle everything through talloc destructors, as all sources are parented to the handler. We also change user_event_init and udev_init to take the handler as the first ('context') argument, to make them consistent with network_init. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* pb-config: Move config storage modules to "platform" modules in discover codeJeremy Kerr2014-01-301-3/+3
| | | | | | | | | | | | | | | | | | There's no need to include the config storage code in lib/ as only the discover server should be using it. This change moves the config-storage code to discover/, with the platform-specific parts moved to a 'struct platform'. Each platform has a probe function, which is called during init. The first probe function to return a platform is used. At present we only have the one platform, but it's now non-intrusive to add others. We keep an array of platform pointers in a separate ("platforms") section, to allow the test module to drop-in its own test "platform". Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Bring down configured interfaces on discover server exit.Jeremy Kerr2014-01-171-0/+1
| | | | | | | | We want to down the interfaces that we brought up, so hook up the network_shutdown function to the discover exit path. Also, we only want to down interfaces that we've configured, and exclude lo. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: cleanup allocated dataJeremy Kerr2013-10-211-0/+7
| | | | | | | We have a few allocations hanging around at the end of pb-discover; free them. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add system info messagesJeremy Kerr2013-10-091-0/+3
| | | | | | | | 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>
* discover: Don't call config_set_autoboot before config_initJeremy Kerr2013-10-091-3/+2
| | | | | | | | Change f611bde3 shifted the config_init until after process_init, as we need to run processes during config init. We also needed to move the config_set_autoboot invocation too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: register network devices with the device handlerJeremy Kerr2013-09-191-4/+5
| | | | | | | We'd like to correlate incoming network boot options with a device, so register the interface with the device hander. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove unnecessary event passingJeremy Kerr2013-09-191-2/+2
| | | | | | | | | | | | | | | Currently, we pass "events" between the udev, user-event and device-handler layers. These events all get sent through device_handler_event, then de-multiplexed to an appropriate handler, depending on their source. Instead, just export relevant device_handler functions, and have the (old) event sources call these functions directly. This also means we can include a lot more of the device hander code in the parser tests. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/log: Cleanup log APIJeremy Kerr2013-09-191-9/+10
| | | | | | | | | | Rather than exposing log internals (through always_flush and set_stream), do all logging init through pb_log_init(). If pb_log_init() hasn't been called, pb_log will drop messages. Also, add a pb_debug() function, specifically for debugging information. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add dry_run argument to process_initJeremy Kerr2013-08-201-1/+1
| | | | | | | Implement dry-run behaviour on the discover server by passing a bool to process_init. UIs don't need to support dry runs. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: replace pb_run_cmd_pipeJeremy Kerr2013-08-191-0/+6
| | | | | | Replace pb_run_cmd_pipe with process_create / process_run_sync. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: remove unused user_event_triggerJeremy Kerr2013-08-191-2/+0
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/waiter: remove waitset_destroyJeremy Kerr2013-08-191-1/+0
| | | | | | We can rely on the ctx free to destroy the waitset. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Hookup --no-autoboot to configGeoff Levand2013-07-231-0/+3
| | | | | | | Add new routine config_set_autoboot(), and use it to set the --no-autoboot option. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add --no-autoboot optionGeoff Levand2013-07-231-3/+10
| | | | | | | Add the command line option --no-autoboot to pb-discover and update the pb-discover manpage. Signed-off-by: Geoff Levand <geoff@infradead.org>
* discover: Add network handlingJeremy Kerr2013-06-241-0/+6
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib: Add pb-config moduleJeremy Kerr2013-06-241-0/+4
| | | | | | | | | 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: implement default bootingJeremy Kerr2013-06-241-1/+1
| | | | | | | When we see a boot option with is_default set, store it in the handler and register a timeout waiter. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Remove empty routine udev_triggerGeoff Levand2013-05-031-1/+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: Rename struct udev to struct pb_udevGeoff Levand2013-05-031-1/+1
| | | | | | | 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 missing udev_destroy callGeoff Levand2013-04-211-0/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Move --dry-run option to discover serverJeremy Kerr2013-04-151-2/+8
| | | | | | | 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>
* waiter: Don't rely on global variables to keep waiter stateJeremy Kerr2013-04-101-4/+8
| | | | | | | | | 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>
* Log to stderr, allow --log=-Geoff Levand2012-03-261-4/+8
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Log file cleanupsGeoff Levand2012-03-081-1/+1
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Add discover server optionsGeoff Levand2009-07-091-2/+96
| | | | | | Add --help, --log, and --version command line options to the discover server. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Add discover user eventGeoff Levand2009-06-301-0/+7
| | | | | | | Add a gereric event interface to pb-discover. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Add udev triggerGeoff Levand2009-06-301-0/+2
| | | | | | | | Add a new routine udev_trigger() that requests a replay of system udev events. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Log server messages to fileGeoff Levand2009-03-231-0/+12
| | | | | | | Log discover server messages to a file. Helps in debugging the server when is has problems at system startup. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Move log to libraryGeoff Levand2009-02-011-1/+1
| | | | | | | | | | | Move the log routines to the petitboot library. The log routines are generic enough to be used for both server and client. Does not change the log source. jk: move to lib/log/ instead of lib/ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Move waiter to libraryGeoff Levand2009-02-011-1/+2
| | | | | | | | | | | Move the waiter routines into the petitboot library. The waiter routines are generic enough to be used for both server and client. Does not change the waiter source. jk: move to lib/waiter/ instead of lib/ Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix build warningsGeoff Levand2009-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* Add device handler cleanupJeremy Kerr2008-12-161-2/+13
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Fix invocation of udev_initJeremy Kerr2008-12-161-1/+1
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Create device-handler for managing registered devicesJeremy Kerr2008-12-151-5/+12
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Initial support for multiple UIsJeremy Kerr2008-12-151-0/+34
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