diff options
-rw-r--r-- | discover/devmapper.c | 4 | ||||
-rw-r--r-- | discover/platform-powerpc.c | 5 | ||||
-rw-r--r-- | discover/platform.c | 4 | ||||
-rw-r--r-- | lib/types/types.h | 1 | ||||
-rw-r--r-- | utils/pb-config.c | 2 |
5 files changed, 16 insertions, 0 deletions
diff --git a/discover/devmapper.c b/discover/devmapper.c index 1fd1215..e2ef0b5 100644 --- a/discover/devmapper.c +++ b/discover/devmapper.c @@ -6,6 +6,7 @@ #include "libdevmapper.h" #include "devmapper.h" +#include "platform.h" #define MERGE_INTERVAL_US 200000 @@ -320,6 +321,9 @@ int devmapper_init_snapshot(struct device_handler *handler, { struct ramdisk_device *ramdisk; + if (config_get()->disable_snapshots) + return 0; + ramdisk = device_handler_get_ramdisk(handler); if (!ramdisk) { pb_log("No ramdisk available for snapshot %s\n", diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index fc96305..d45cced 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -54,6 +54,7 @@ static const char *known_params[] = { "petitboot,language", "petitboot,debug?", "petitboot,write?", + "petitboot,snapshots?", NULL, }; @@ -553,6 +554,10 @@ static void populate_config(struct platform_powerpc *platform, val = get_param(platform, "petitboot,write?"); if (val) config->allow_writes = !strcmp(val, "true"); + + val = get_param(platform, "petitboot,snapshots?"); + if (val) + config->disable_snapshots = !strcmp(val, "false"); } static char *iface_config_str(void *ctx, struct interface_config *config) diff --git a/discover/platform.c b/discover/platform.c index b1d0f19..a6bd74c 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -35,6 +35,9 @@ static void dump_config(struct config *config) if (config->safe_mode) pb_log(" safe mode: active\n"); + if (config->disable_snapshots) + pb_log(" dm-snapshots disabled\n"); + for (i = 0; i < config->network.n_interfaces; i++) { struct interface_config *ifconf = config->network.interfaces[i]; @@ -109,6 +112,7 @@ void config_set_defaults(struct config *config) config->safe_mode = false; config->lang = NULL; config->allow_writes = true; + config->disable_snapshots = false; config->n_autoboot_opts = 2; config->autoboot_opts = talloc_array(config, struct autoboot_option, diff --git a/lib/types/types.h b/lib/types/types.h index f7e4752..0415206 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -151,6 +151,7 @@ struct config { char *lang; /* not user-settable */ + bool disable_snapshots; bool safe_mode; bool debug; }; diff --git a/utils/pb-config.c b/utils/pb-config.c index 009bec7..c52180b 100644 --- a/utils/pb-config.c +++ b/utils/pb-config.c @@ -79,6 +79,8 @@ static void print_config(void *ctx, struct config *config, const char *var) config->safe_mode ? "enabled" : "disabled"); print_one_config(ctx, var, "debug", "%s", config->debug ? "enabled" : "disabled"); + print_one_config(ctx, var, "dm-snapshots", "%s", + config->disable_snapshots ? "disabled" : "enabled"); } int main(int argc, char **argv) |