pb-config: Move config storage modules to "platform" modules in discover code 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>
pb-config/powerpc: fix default option handling Currently, we don't update nvram if an NVRAM parameter is set to the default. This means we can never revert a configuration to its default value. This change fixes the default setting behaviour; instead of checking for a default, we want to check if it's a default and the option is absent. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/process: Add helper for check process clean exit 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>
config/powerpc: Always call update_network_config Currently, we have a bug when setting the default network configuration (ie, no devices have any specific config), as we won't call update_network_config to clear out the value of the petitboot,network parameter. This change always invokes update_network_config, regardless of the number of interfaces configured. This ensures we clear out the petitboot,network param, which is then synced to nvram if the param has changed. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/pb-config/powerpc-nvram: Fix format of dns config It should be dns,<server> not dns=<server> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/types: use unsigned int for interface, dns and prio counts Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/pb-config: Implement save method for powerpc nvram strorage Write values back to nvram. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/pb-config/powerpc-nvram: Use talloc_zero for interface configs We're seeing a problem where ifconf->ignore isn't initialised; use talloc_zero instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/pb-config/powerpc-nvram: Add petitboot,timeout nvram property Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/process: replace pb_run_cmd_pipe Replace pb_run_cmd_pipe with process_create / process_run_sync. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
network: handle DNS config If we have a dns config option, update resolv.conf Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
config: DNS configuration isn't interface-specific Rather than attaching DNS configuration to an interface, separate it out into general network config. The powerpc-nvram storage exepects dns as a "dns,server,..." string. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
config: Split interface configuration from network configuration This change moves the interface configuration into its own 'struct interface_config'. We also remove the _config suffix from the network and interface members. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
config/powerpc-nvram: Fix nvram line parsing We have a couple of issues with the nvram output parser; lines aren't being broken up correctly. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
config/powerpc-nvram: Don't require petitboot, prefix on all params Currently, we only store nvram params with a "petitboot," prefix, so that we don't grow the config list to an unbound size. However, the "auto-boot?" param has no prefix. Instead, remove the requirement for the "petitboot," prefix, and use an array of known parameters instead. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib: Add pb-config module 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>