rtos: Remove typedef'd struct

The C style guide forbids typedef'd structs, see 'Naming Rules'.

Change-Id: Ia7c8218fb61ff0c74b6dd0d10fb51a77cf059c14
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: http://openocd.zylin.com/6028
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Marc Schink 2021-01-25 11:28:59 +01:00 committed by Antonio Borneo
parent 307fe3730f
commit a8b88acd99
14 changed files with 41 additions and 41 deletions

View File

@ -109,7 +109,7 @@ static int FreeRTOS_create(struct target *target);
static int FreeRTOS_update_threads(struct rtos *rtos);
static int FreeRTOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
static int FreeRTOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int FreeRTOS_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
struct rtos_type FreeRTOS_rtos = {
.name = "FreeRTOS",
@ -474,11 +474,11 @@ static int FreeRTOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
return rtos_generic_stack_read(rtos->target, param->stacking_info_cm3, stack_ptr, reg_list, num_regs);
}
static int FreeRTOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int FreeRTOS_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = calloc(
ARRAY_SIZE(FreeRTOS_symbol_list), sizeof(symbol_table_elem_t));
ARRAY_SIZE(FreeRTOS_symbol_list), sizeof(struct symbol_table_elem));
for (i = 0; i < ARRAY_SIZE(FreeRTOS_symbol_list); i++) {
(*symbol_list)[i].symbol_name = FreeRTOS_symbol_list[i].name;

View File

@ -39,7 +39,7 @@ static bool ThreadX_detect_rtos(struct target *target);
static int ThreadX_create(struct target *target);
static int ThreadX_update_threads(struct rtos *rtos);
static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs);
static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int ThreadX_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
@ -479,11 +479,11 @@ static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
return rtos_generic_stack_read(rtos->target, stacking_info, stack_ptr, reg_list, num_regs);
}
static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int ThreadX_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = calloc(
ARRAY_SIZE(ThreadX_symbol_list), sizeof(symbol_table_elem_t));
ARRAY_SIZE(ThreadX_symbol_list), sizeof(struct symbol_table_elem));
for (i = 0; i < ARRAY_SIZE(ThreadX_symbol_list); i++)
(*symbol_list)[i].symbol_name = ThreadX_symbol_list[i];

View File

@ -107,7 +107,7 @@ static int chibios_create(struct target *target);
static int chibios_update_threads(struct rtos *rtos);
static int chibios_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
static int chibios_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int chibios_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
struct rtos_type chibios_rtos = {
.name = "chibios",
@ -131,7 +131,7 @@ enum chibios_symbol_values {
CHIBIOS_VAL_CH_DEBUG = 2
};
static symbol_table_elem_t chibios_symbol_list[] = {
static struct symbol_table_elem chibios_symbol_list[] = {
{ "rlist", 0, true}, /* Thread ready list */
{ "ch", 0, true}, /* System data structure */
{ "ch_debug", 0, false}, /* Memory Signature containing offsets of fields in rlist */
@ -497,7 +497,7 @@ static int chibios_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
return rtos_generic_stack_read(rtos->target, param->stacking_info, stack_ptr, reg_list, num_regs);
}
static int chibios_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int chibios_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
*symbol_list = malloc(sizeof(chibios_symbol_list));

View File

@ -360,12 +360,12 @@ static int chromium_ec_get_thread_reg_list(struct rtos *rtos,
stack_ptr, reg_list, num_regs);
}
static int chromium_ec_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int chromium_ec_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
size_t s;
*symbol_list = calloc(ARRAY_SIZE(chromium_ec_symbol_list),
sizeof(symbol_table_elem_t));
sizeof(struct symbol_table_elem));
if (!(*symbol_list)) {
LOG_ERROR("Chromium-EC: out of memory");
return ERROR_FAIL;

View File

@ -31,7 +31,7 @@ static bool eCos_detect_rtos(struct target *target);
static int eCos_create(struct target *target);
static int eCos_update_threads(struct rtos *rtos);
static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, struct rtos_reg **reg_list, int *num_regs);
static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int eCos_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
struct eCos_thread_state {
int value;
@ -351,11 +351,11 @@ static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
return -1;
}
static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int eCos_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = calloc(
ARRAY_SIZE(eCos_symbol_list), sizeof(symbol_table_elem_t));
ARRAY_SIZE(eCos_symbol_list), sizeof(struct symbol_table_elem));
for (i = 0; i < ARRAY_SIZE(eCos_symbol_list); i++)
(*symbol_list)[i].symbol_name = eCos_symbol_list[i];

View File

@ -36,7 +36,7 @@ static int embKernel_create(struct target *target);
static int embKernel_update_threads(struct rtos *rtos);
static int embKernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
static int embKernel_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int embKernel_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
struct rtos_type embKernel_rtos = {
.name = "embKernel",
@ -330,10 +330,10 @@ static int embKernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
return rtos_generic_stack_read(rtos->target, param->stacking_info, stack_ptr, reg_list, num_regs);
}
static int embKernel_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int embKernel_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = calloc(ARRAY_SIZE(embKernel_symbol_list), sizeof(symbol_table_elem_t));
*symbol_list = calloc(ARRAY_SIZE(embKernel_symbol_list), sizeof(struct symbol_table_elem));
for (i = 0; i < ARRAY_SIZE(embKernel_symbol_list); i++)
(*symbol_list)[i].symbol_name = embKernel_symbol_list[i];

View File

@ -35,7 +35,7 @@ static int hwthread_get_thread_reg(struct rtos *rtos, int64_t thread_id,
uint32_t reg_num, struct rtos_reg *rtos_reg);
static int hwthread_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
static int hwthread_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int hwthread_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
static int hwthread_smp_init(struct target *target);
static int hwthread_set_reg(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value);
@ -328,10 +328,10 @@ static int hwthread_set_reg(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_va
return reg->type->set(reg, reg_value);
}
static int hwthread_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int hwthread_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
/* return an empty list, we don't have any symbols to look up */
*symbol_list = calloc(1, sizeof(symbol_table_elem_t));
*symbol_list = calloc(1, sizeof(struct symbol_table_elem));
(*symbol_list)[0].symbol_name = NULL;
return 0;
}

View File

@ -246,11 +246,11 @@ static const char * const linux_symbol_list[] = {
NULL
};
static int linux_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int linux_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *)
calloc(ARRAY_SIZE(linux_symbol_list), sizeof(symbol_table_elem_t));
*symbol_list = (struct symbol_table_elem *)
calloc(ARRAY_SIZE(linux_symbol_list), sizeof(struct symbol_table_elem));
for (i = 0; i < ARRAY_SIZE(linux_symbol_list); i++)
(*symbol_list)[i].symbol_name = linux_symbol_list[i];

View File

@ -540,9 +540,9 @@ static int mqx_get_thread_reg_list(
}
/* API function, export list of required symbols */
static int mqx_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int mqx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
*symbol_list = calloc(ARRAY_SIZE(mqx_symbol_list), sizeof(symbol_table_elem_t));
*symbol_list = calloc(ARRAY_SIZE(mqx_symbol_list), sizeof(struct symbol_table_elem));
if (NULL == *symbol_list)
return ERROR_FAIL;
/* export required symbols */

View File

@ -380,12 +380,12 @@ static int nuttx_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
(uint32_t)thread_id + xcpreg_offset, reg_list, num_regs);
}
static int nuttx_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int nuttx_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
unsigned int i;
*symbol_list = (symbol_table_elem_t *) calloc(1,
sizeof(symbol_table_elem_t) * ARRAY_SIZE(nuttx_symbol_list));
*symbol_list = (struct symbol_table_elem *) calloc(1,
sizeof(struct symbol_table_elem) * ARRAY_SIZE(nuttx_symbol_list));
for (i = 0; i < ARRAY_SIZE(nuttx_symbol_list); i++)
(*symbol_list)[i].symbol_name = nuttx_symbol_list[i];

View File

@ -35,7 +35,7 @@ static int riot_create(struct target *target);
static int riot_update_threads(struct rtos *rtos);
static int riot_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
struct rtos_reg **reg_list, int *num_regs);
static int riot_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]);
static int riot_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[]);
struct riot_thread_state {
int value;
@ -360,9 +360,9 @@ static int riot_get_thread_reg_list(struct rtos *rtos, int64_t thread_id,
num_regs);
}
static int riot_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int riot_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
*symbol_list = calloc(ARRAY_SIZE(riot_symbol_list), sizeof(symbol_table_elem_t));
*symbol_list = calloc(ARRAY_SIZE(riot_symbol_list), sizeof(struct symbol_table_elem));
if (*symbol_list == NULL) {
LOG_ERROR("RIOT: out of memory");

View File

@ -176,9 +176,9 @@ int gdb_thread_packet(struct connection *connection, char const *packet, int pac
return target->rtos->gdb_thread_packet(connection, packet, packet_size);
}
static symbol_table_elem_t *next_symbol(struct rtos *os, char *cur_symbol, uint64_t cur_addr)
static struct symbol_table_elem *next_symbol(struct rtos *os, char *cur_symbol, uint64_t cur_addr)
{
symbol_table_elem_t *s;
struct symbol_table_elem *s;
if (!os->symbols)
os->type->get_symbol_list_to_lookup(&os->symbols);
@ -200,7 +200,7 @@ static symbol_table_elem_t *next_symbol(struct rtos *os, char *cur_symbol, uint6
* if 'symbol' is not declared optional */
static bool is_symbol_mandatory(const struct rtos *os, const char *symbol)
{
for (symbol_table_elem_t *s = os->symbols; s->symbol_name; ++s) {
for (struct symbol_table_elem *s = os->symbols; s->symbol_name; ++s) {
if (!strcmp(s->symbol_name, symbol))
return !s->optional;
}
@ -232,7 +232,7 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s
uint64_t addr = 0;
size_t reply_len;
char reply[GDB_BUFFER_SIZE + 1], cur_sym[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for null-termination */
symbol_table_elem_t *next_sym = NULL;
struct symbol_table_elem *next_sym = NULL;
struct target *target = get_target_from_connection(connection);
struct rtos *os = target->rtos;

View File

@ -31,11 +31,11 @@ struct reg;
/**
* Table should be terminated by an element with NULL in symbol_name
*/
typedef struct symbol_table_elem_struct {
struct symbol_table_elem {
const char *symbol_name;
symbol_address_t address;
bool optional;
} symbol_table_elem_t;
};
struct thread_detail {
threadid_t threadid;
@ -47,7 +47,7 @@ struct thread_detail {
struct rtos {
const struct rtos_type *type;
symbol_table_elem_t *symbols;
struct symbol_table_elem *symbols;
struct target *target;
/* add a context variable instead of global variable */
/* The thread currently selected by gdb. */
@ -78,7 +78,7 @@ struct rtos_type {
struct rtos_reg **reg_list, int *num_regs);
int (*get_thread_reg)(struct rtos *rtos, int64_t thread_id,
uint32_t reg_num, struct rtos_reg *reg);
int (*get_symbol_list_to_lookup)(symbol_table_elem_t *symbol_list[]);
int (*get_symbol_list_to_lookup)(struct symbol_table_elem *symbol_list[]);
int (*clean)(struct target *target);
char * (*ps_command)(struct target *target);
int (*set_reg)(struct rtos *rtos, uint32_t reg_num, uint8_t *reg_value);

View File

@ -508,9 +508,9 @@ static int uCOS_III_get_thread_reg_list(struct rtos *rtos, threadid_t threadid,
num_regs);
}
static int uCOS_III_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[])
static int uCOS_III_get_symbol_list_to_lookup(struct symbol_table_elem *symbol_list[])
{
*symbol_list = calloc(ARRAY_SIZE(uCOS_III_symbol_list), sizeof(symbol_table_elem_t));
*symbol_list = calloc(ARRAY_SIZE(uCOS_III_symbol_list), sizeof(struct symbol_table_elem));
if (*symbol_list == NULL) {
LOG_ERROR("uCOS-III: out of memory");
return ERROR_FAIL;