-
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
discover_server_notify_boot_status(handler->server, &status);
}
+void device_handler_update_config(struct device_handler *handler,
+ struct config *config)
+{
+ config_set(config);
+ discover_server_notify_config(handler->server, config);
+}
+
#ifndef PETITBOOT_TEST
static bool check_existing_mount(struct discover_device *dev)
{
struct event;
struct device;
struct waitset;
+struct config;
struct discover_device {
struct device *device;
void device_handler_boot(struct device_handler *handler,
struct boot_command *cmd);
void device_handler_cancel_default(struct device_handler *handler);
+void device_handler_update_config(struct device_handler *handler,
+ struct config *config);
int device_request_write(struct discover_device *dev, bool *release);
void device_release_write(struct discover_device *dev, bool release);
struct pb_protocol_message *message;
struct boot_command *boot_command;
struct client *client = arg;
+ struct config *config;
int rc;
message = pb_protocol_read_message(client, client->fd);
device_handler_cancel_default(client->server->device_handler);
break;
+ case PB_PROTOCOL_ACTION_CONFIG:
+ config = talloc_zero(client, struct config);
+
+ rc = pb_protocol_deserialise_config(config, message);
+ if (rc) {
+ pb_log("%s: no config?", __func__);
+ return 0;
+ }
+
+ device_handler_update_config(client->server->device_handler,
+ config);
+ break;
+
default:
pb_log("%s: invalid action %d\n", __func__, message->action);
return 0;
return 0;
pb_log("new configuration data received\n");
- dump_config(config);
+ dump_config(newconfig);
- rc = storage->save(storage, config);
+ rc = storage->save(storage, newconfig);
if (!rc)
config = talloc_steal(config_ctx, newconfig);