Skip to content

Commit

Permalink
opal-prd: split type-specific fields of control messages
Browse files Browse the repository at this point in the history
We'd like to add other type-specific fields, so introduce a union to
populate with these.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
jk-ozlabs authored and stewartsmith committed Jun 6, 2017
1 parent b537752 commit 05dd64a
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions external/opal-prd/opal-prd.c
Expand Up @@ -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
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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++) {
Expand Down

0 comments on commit 05dd64a

Please sign in to comment.