Skip to content

Commit 05dd64a

Browse files
jk-ozlabsstewartsmith
authored andcommitted
opal-prd: split type-specific fields of control messages
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>
1 parent b537752 commit 05dd64a

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

external/opal-prd/opal-prd.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ enum control_msg_type {
9696
struct control_msg {
9797
enum control_msg_type type;
9898
int response;
99-
uint32_t argc;
100-
uint32_t data_len;
101-
uint8_t data[];
99+
union {
100+
struct {
101+
unsigned int argc;
102+
} run_cmd;
103+
};
104+
unsigned int data_len;
105+
unsigned char data[];
106+
102107
};
103108

104109
#define MAX_CONTROL_MSG_BUF 4096
@@ -1339,7 +1344,7 @@ static void handle_prd_control_run_cmd(struct control_msg *send_msg,
13391344
return;
13401345
}
13411346

1342-
argc = recv_msg->argc;
1347+
argc = recv_msg->run_cmd.argc;
13431348
pr_debug("CTRL: run_command, argc:%d\n", argc);
13441349

13451350
argv = malloc(argc * sizeof(*argv));
@@ -1895,7 +1900,7 @@ static int send_run_command(struct opal_prd_ctx *ctx, int argc, char *argv[])
18951900

18961901
/* Setup message */
18971902
send_msg->type = CONTROL_MSG_RUN_CMD;
1898-
send_msg->argc = argc;
1903+
send_msg->run_cmd.argc = argc;
18991904
send_msg->data_len = size;
19001905
s = (char *)send_msg->data;
19011906
for (i = 0; i < argc; i++) {

0 commit comments

Comments
 (0)