diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-07-21 18:18:35 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-07-22 09:04:59 +0800 |
commit | d2b12ddb905a74fa6b2e454142b0b9f71fd99398 (patch) | |
tree | ef6ab12a56aa0dc9fc0f6b35795ed2b9f01c0411 /lib/pb-protocol | |
parent | 3c49b3fa6e6038fd226253e71cb082e09b4ff7a5 (diff) | |
download | talos-petitboot-d2b12ddb905a74fa6b2e454142b0b9f71fd99398.tar.gz talos-petitboot-d2b12ddb905a74fa6b2e454142b0b9f71fd99398.zip |
discover: Add safe mode
Safe mode configures the discover server to not start any device
parsing; this can be used to diagnose any problems with early device
handing.
In safe mode, we don't initialise any of the device sources - udev,
network and user events are disabled.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'lib/pb-protocol')
-rw-r--r-- | lib/pb-protocol/pb-protocol.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 67e1f9e..d39c1c4 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -267,7 +267,8 @@ int pb_protocol_config_len(const struct config *config) unsigned int i, len; len = 4 /* config->autoboot_enabled */ + - 4 /* config->autoboot_timeout_sec */; + 4 /* config->autoboot_timeout_sec */ + + 4 /* config->safe_mode */; len += 4; for (i = 0; i < config->network.n_interfaces; i++) @@ -448,6 +449,9 @@ int pb_protocol_serialise_config(const struct config *config, *(uint32_t *)pos = __cpu_to_be32(config->autoboot_timeout_sec); pos += 4; + *(uint32_t *)pos = config->safe_mode; + pos += 4; + *(uint32_t *)pos = __cpu_to_be32(config->network.n_interfaces); pos += 4; for (i = 0; i < config->network.n_interfaces; i++) { @@ -862,6 +866,10 @@ int pb_protocol_deserialise_config(struct config *config, if (read_u32(&pos, &len, &config->autoboot_timeout_sec)) goto out; + if (read_u32(&pos, &len, &tmp)) + goto out; + config->safe_mode = !!tmp; + if (read_u32(&pos, &len, &config->network.n_interfaces)) goto out; |