diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2016-12-07 11:13:36 +1100 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam@mendozajonas.com> | 2016-12-20 15:04:07 +1100 |
commit | 4b06a4645e19830581505a675075773adc0857c2 (patch) | |
tree | 94d77cc95f94432277e401763c65d3d7cbcc37d8 /lib | |
parent | ea8bd5f424a9b01c71e1694bb5b6ffc13e3da4f5 (diff) | |
download | petitboot-4b06a4645e19830581505a675075773adc0857c2.zip petitboot-4b06a4645e19830581505a675075773adc0857c2.tar.gz |
types: shorten boot_status definitions
struct boot_status is a bit misnamed; we report status on things that
aren't just the boot status (eg, discovery).
This change refactors struct boot_status into just struct status. We
give the type enum a name, and shorten the enum values to suit.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pb-protocol/pb-protocol.c | 10 | ||||
-rw-r--r-- | lib/pb-protocol/pb-protocol.h | 6 | ||||
-rw-r--r-- | lib/types/types.h | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 64bd161..1e72d19 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -215,7 +215,7 @@ int pb_protocol_boot_len(const struct boot_command *boot) 4 + optional_strlen(boot->console); } -int pb_protocol_boot_status_len(const struct boot_status *status) +int pb_protocol_boot_status_len(const struct status *status) { return 4 + 4 + optional_strlen(status->message) + @@ -401,7 +401,7 @@ int pb_protocol_serialise_boot_command(const struct boot_command *boot, return 0; } -int pb_protocol_serialise_boot_status(const struct boot_status *status, +int pb_protocol_serialise_boot_status(const struct status *status, char *buf, int buf_len) { char *pos = buf; @@ -821,7 +821,7 @@ out: return rc; } -int pb_protocol_deserialise_boot_status(struct boot_status *status, +int pb_protocol_deserialise_boot_status(struct status *status, const struct pb_protocol_message *message) { unsigned int len; @@ -838,8 +838,8 @@ int pb_protocol_deserialise_boot_status(struct boot_status *status, status->type = __be32_to_cpu(*(uint32_t *)(pos)); switch (status->type) { - case BOOT_STATUS_ERROR: - case BOOT_STATUS_INFO: + case STATUS_ERROR: + case STATUS_INFO: break; default: goto out; diff --git a/lib/pb-protocol/pb-protocol.h b/lib/pb-protocol/pb-protocol.h index f850520..a8cd206 100644 --- a/lib/pb-protocol/pb-protocol.h +++ b/lib/pb-protocol/pb-protocol.h @@ -36,7 +36,7 @@ void pb_protocol_dump_device(const struct device *dev, const char *text, int pb_protocol_device_len(const struct device *dev); int pb_protocol_boot_option_len(const struct boot_option *opt); int pb_protocol_boot_len(const struct boot_command *boot); -int pb_protocol_boot_status_len(const struct boot_status *status); +int pb_protocol_boot_status_len(const struct status *status); int pb_protocol_system_info_len(const struct system_info *sysinfo); int pb_protocol_config_len(const struct config *config); int pb_protocol_url_len(const char *url); @@ -55,7 +55,7 @@ int pb_protocol_serialise_boot_option(const struct boot_option *opt, char *buf, int buf_len); int pb_protocol_serialise_boot_command(const struct boot_command *boot, char *buf, int buf_len); -int pb_protocol_serialise_boot_status(const struct boot_status *status, +int pb_protocol_serialise_boot_status(const struct status *status, char *buf, int buf_len); int pb_protocol_serialise_system_info(const struct system_info *sysinfo, char *buf, int buf_len); @@ -79,7 +79,7 @@ int pb_protocol_deserialise_boot_option(struct boot_option *opt, int pb_protocol_deserialise_boot_command(struct boot_command *cmd, const struct pb_protocol_message *message); -int pb_protocol_deserialise_boot_status(struct boot_status *status, +int pb_protocol_deserialise_boot_status(struct status *status, const struct pb_protocol_message *message); int pb_protocol_deserialise_system_info(struct system_info *sysinfo, diff --git a/lib/types/types.h b/lib/types/types.h index d660d6b..b22c0b0 100644 --- a/lib/types/types.h +++ b/lib/types/types.h @@ -70,10 +70,10 @@ struct boot_command { char *console; }; -struct boot_status { - enum { - BOOT_STATUS_INFO, - BOOT_STATUS_ERROR, +struct status { + enum status_type { + STATUS_INFO, + STATUS_ERROR, } type; char *message; char *detail; |