summaryrefslogtreecommitdiffstats
path: root/discover/paths.c
Commit message (Collapse)AuthorAgeFilesLines
* discover/paths: Fix wget command with https and !DEBUGJeremy Kerr2014-06-051-2/+3
| | | | | | | | When DEBUG is undefed, we run out of wget arguments for loading https URLs. We need an extra element in the argv array to handle all possible arguments. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* lib/process: Add helper for check process clean exitJeremy Kerr2014-01-211-2/+2
| | | | | | | We have a few incorrect checks for the exit status of a process; this change adds a helper with the correct WIFEXITED && WEXITSTATUS==0 logic. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/paths: Check process exit status when loading URLsJeremy Kerr2014-01-211-1/+4
| | | | | | | | | | Currently, we may report incorrect success when loading a URL, as we only check the return value of process_run_sync() (and not the process exit status itself) in load_process_to_local_file. This fix adds a check to the synchronous load. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: we need stderr for the BusyBox TFTP type checkJeremy Kerr2014-01-141-0/+1
| | | | | | | Busybox tftp doesn't support -V, so prints an error to stderr. We'll only see the Busybox identifier if we capture stderr too. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* configure: Use AC_GNU_SOURCEJeremy Kerr2013-12-181-1/+3
| | | | | | | Rather than #defining _GNU_SOURCE in our .c files, we can define this from config.h instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Use mkstemp rather than tempnamJeremy Kerr2013-11-141-4/+6
| | | | | | We're getting warnings from some compilers about tempnam being unsafe. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add load_url_cancelJeremy Kerr2013-10-141-2/+29
| | | | | | | We'd like a way to cancel pending loads, as part of aborting the boot process. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover/paths: Check local file URLs in load_urlJeremy Kerr2013-09-261-3/+20
| | | | | | Make the error case for local files the same as for remotes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add struct load_url_result and load_taskJeremy Kerr2013-09-261-237/+197
| | | | | | | | | | | | | | | Currently, load_url and load_url_async return a filename parameter and a tempfile flag (indicating whether the file needs to be cleaned after use). Instead, encapsulate this data in a struct load_url_result, which the caller (and async callbacks) can read the status, filename and clean parameters. For internal use in load_url and helpers, we add a struct load_task to hold a pointer to the load_url_result and async data. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't depend on tftp failure for type detectionJeremy Kerr2013-09-261-40/+69
| | | | | | | | Rather than always trying both TFTP client types, do a runtime detection on first invocation. This can be fixed at build-time with --with-tftp=TYPE. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: load_url_async callback should take an int statusJeremy Kerr2013-09-251-4/+1
| | | | | | We don't need a pointer here, just the status value. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Add an asynchronous version of load_urlNeelesh Gupta2013-09-251-22/+138
| | | | | | | | | | | A new load_url_async() function handles retrieving the resources by forking an external process which currently blocks the parent waiting for the process to complete. This patch modifies the load_*() functions to handle it asynchronously by providing the exit callback and returning without waiting for the child process to exit. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
* lib/process: replace pb_run_cmdJeremy Kerr2013-08-191-27/+11
| | | | | | | This change replaces the pb_run_cmd() function with proper usage of the process API. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Don't free URL in load_urlJeremy Kerr2013-07-231-1/+0
| | | | | | | | | | | | | Previously, load_url took a char * argument, from which it parsed a newly allocated URL, and freed the URL before returning. Commit 5be946c changed load_url (then load_file) to accept a parsed URL instead of a char *, but didn't remove the free. Any URLs passed to load_url are currently being unintionally free()ed. This change removes the invalid free. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* discover: Change parsers to emit resources rather than filenamesJeremy Kerr2013-04-291-128/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move boot to discover serverJeremy Kerr2013-04-151-0/+277
| | | | | | | | | | | | | | | | | | | | | 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>
* Fix paths.c build warningsGeoff Levand2011-12-041-2/+2
| | | | Signed-off-by: Geoff Levand <geoff@infradead.org>
* Remove discover sd to ps3d hackGeoff Levand2009-07-091-8/+0
| | | | | | | This is now old enough to be retired and allow config files on ps3d devices to refer to scsi devices. Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
* Add URL test to resolve_pathGeoff Levand2009-06-301-0/+8
| | | | | | | | | | Add a check to discover's resolve_path() to test if the path is a URL, and if so just return that path. If the path has "file://", treat it as a local path. 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>
* Initial device handler codeJeremy Kerr2008-12-161-46/+60
| | | | | | Mount discovered devices, and set up symlinks for UUID and LABELs Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Initial support for multiple UIsJeremy Kerr2008-12-151-0/+141
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