X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=blobdiff_plain;f=lib%2Fpb-protocol%2Fpb-protocol.c;h=31637c611c19993a390bd6e1fe86ff917a96ba58;hp=4e0af873b710ad8d72707c9fa60190076197e865;hb=ceefe00bf8c1498dfc2118d2b3666f67f91bb956;hpb=a2f7b111a2073a4afaf75499ac4c2732b71ea801 diff --git a/lib/pb-protocol/pb-protocol.c b/lib/pb-protocol/pb-protocol.c index 4e0af87..31637c6 100644 --- a/lib/pb-protocol/pb-protocol.c +++ b/lib/pb-protocol/pb-protocol.c @@ -404,3 +404,34 @@ out_err: talloc_free(dev); return NULL; } + +struct boot_command *pb_protocol_deserialise_boot_command(void *ctx, + const struct pb_protocol_message *message) +{ + struct boot_command *cmd; + const char *pos; + unsigned int len; + + len = message->payload_len; + pos = message->payload; + + cmd = talloc(ctx, struct boot_command); + + if (read_string(cmd, &pos, &len, &cmd->option_id)) + goto out_err; + + if (read_string(cmd, &pos, &len, &cmd->boot_image_file)) + goto out_err; + + if (read_string(cmd, &pos, &len, &cmd->initrd_file)) + goto out_err; + + if (read_string(cmd, &pos, &len, &cmd->boot_args)) + goto out_err; + + return cmd; + +out_err: + talloc_free(cmd); + return NULL; +}