From bd4b6797e1f3f673158a73a8334fe031560a1e08 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Wed, 22 Apr 2015 10:54:36 -0400 Subject: [PATCH] CMD_PKT_SIZE_IN_WORDS uses sizeof() Changes the definition of CMD_PKT_SIZE_IN_WORDS from a hard-coded value to one that uses sizeof(). This makes the system less brittle should the size of k_args change. Change-Id: If9ccb7f2a2a6d13bcf62eea3b0cf52942db0071c Signed-off-by: Peter Mitsis --- include/microkernel/cmdPkt.h | 2 +- include/microkernel/k_struct.h | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/include/microkernel/cmdPkt.h b/include/microkernel/cmdPkt.h index 4003b942900..3f9ee4ab3c4 100644 --- a/include/microkernel/cmdPkt.h +++ b/include/microkernel/cmdPkt.h @@ -43,7 +43,7 @@ extern "C" { /* defines */ -#define CMD_PKT_SIZE_IN_WORDS 20 /* This matches the size of struct k_args */ +#define CMD_PKT_SIZE_IN_WORDS (sizeof(struct k_args) / sizeof(uint32_t)) /******************************************************************************* * diff --git a/include/microkernel/k_struct.h b/include/microkernel/k_struct.h index ad859ceef2c..01186248a2c 100644 --- a/include/microkernel/k_struct.h +++ b/include/microkernel/k_struct.h @@ -483,13 +483,6 @@ union k_args_args { struct k_chack ChAck; }; -/* - * At the present time, the size of k_args has been calculated to be 80 bytes - * (the largest field in the K_ARGS_ARGS union type is [m1] at 48 bytes). - * Should the size of k_args change, then the macro CMD_PKT_SIZE_IN_WORDS - * in cmdPkt.h must be updated. - */ - struct k_args { struct k_args *Forw; struct k_args **Head;