[Skiboot] [PATCH RFC v2 02/12] opal-prd: split type-specific fields of control messages
Jeremy Kerr
jk at ozlabs.org
Fri May 26 12:54:21 AEST 2017
We'd like to add other type-specific fields, so introduce a union to
populate with these.
Signed-off-by: Jeremy Kerr <jk at ozlabs.org>
---
external/opal-prd/opal-prd.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c
index 93419e3..5e8f798 100644
--- a/external/opal-prd/opal-prd.c
+++ b/external/opal-prd/opal-prd.c
@@ -96,9 +96,14 @@ enum control_msg_type {
struct control_msg {
enum control_msg_type type;
int response;
- uint32_t argc;
- uint32_t data_len;
- uint8_t data[];
+ union {
+ struct {
+ unsigned int argc;
+ } run_cmd;
+ };
+ unsigned int data_len;
+ unsigned char data[];
+
};
#define MAX_CONTROL_MSG_BUF 4096
@@ -1339,7 +1344,7 @@ static void handle_prd_control_run_cmd(struct control_msg *send_msg,
return;
}
- argc = recv_msg->argc;
+ argc = recv_msg->run_cmd.argc;
pr_debug("CTRL: run_command, argc:%d\n", argc);
argv = malloc(argc * sizeof(*argv));
@@ -1895,7 +1900,7 @@ static int send_run_command(struct opal_prd_ctx *ctx, int argc, char *argv[])
/* Setup message */
send_msg->type = CONTROL_MSG_RUN_CMD;
- send_msg->argc = argc;
+ send_msg->run_cmd.argc = argc;
send_msg->data_len = size;
s = (char *)send_msg->data;
for (i = 0; i < argc; i++) {
--
2.7.4
More information about the Skiboot
mailing list