summaryrefslogtreecommitdiffstats
path: root/discover
diff options
context:
space:
mode:
Diffstat (limited to 'discover')
-rw-r--r--discover/device-handler.c5
-rw-r--r--discover/platform-powerpc.c11
-rw-r--r--discover/platform.c1
3 files changed, 17 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c
index 31cbcc2..4f7a7b7 100644
--- a/discover/device-handler.c
+++ b/discover/device-handler.c
@@ -1391,10 +1391,15 @@ static int umount_device(struct discover_device *dev)
int device_request_write(struct discover_device *dev, bool *release)
{
const char *fstype, *device_path;
+ const struct config *config;
int rc;
*release = false;
+ config = config_get();
+ if (!config->allow_writes)
+ return -1;
+
if (!dev->mounted)
return -1;
diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c
index 2b3b043..fc96305 100644
--- a/discover/platform-powerpc.c
+++ b/discover/platform-powerpc.c
@@ -53,6 +53,7 @@ static const char *known_params[] = {
"petitboot,bootdevs",
"petitboot,language",
"petitboot,debug?",
+ "petitboot,write?",
NULL,
};
@@ -548,6 +549,10 @@ static void populate_config(struct platform_powerpc *platform,
val = get_param(platform, "petitboot,debug?");
config->debug = val && !strcmp(val, "true");
}
+
+ val = get_param(platform, "petitboot,write?");
+ if (val)
+ config->allow_writes = !strcmp(val, "true");
}
static char *iface_config_str(void *ctx, struct interface_config *config)
@@ -707,6 +712,12 @@ static int update_config(struct platform_powerpc *platform,
val = config->lang ?: "";
update_string_config(platform, "petitboot,language", val);
+ if (config->allow_writes == defaults->allow_writes)
+ val = "";
+ else
+ val = config->allow_writes ? "true" : "false";
+ update_string_config(platform, "petitboot,write?", val);
+
update_network_config(platform, config);
update_bootdev_config(platform, config);
diff --git a/discover/platform.c b/discover/platform.c
index 74e2a82..b1d0f19 100644
--- a/discover/platform.c
+++ b/discover/platform.c
@@ -108,6 +108,7 @@ void config_set_defaults(struct config *config)
config->network.n_dns_servers = 0;
config->safe_mode = false;
config->lang = NULL;
+ config->allow_writes = true;
config->n_autoboot_opts = 2;
config->autoboot_opts = talloc_array(config, struct autoboot_option,
OpenPOWER on IntegriCloud