rtos: Remove typedef'd struct
authorMarc Schink <dev@zapb.de>
Mon, 25 Jan 2021 10:28:59 +0000 (11:28 +0100)
committerAntonio Borneo <borneo.antonio@gmail.com>
Wed, 10 Mar 2021 21:29:52 +0000 (21:29 +0000)
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>
14 files changed:
src/rtos/FreeRTOS.c
src/rtos/ThreadX.c
src/rtos/chibios.c
src/rtos/chromium-ec.c
src/rtos/eCos.c
src/rtos/embKernel.c
src/rtos/hwthread.c
src/rtos/linux.c
src/rtos/mqx.c
src/rtos/nuttx.c
src/rtos/riot.c
src/rtos/rtos.c
src/rtos/rtos.h
src/rtos/uCOS-III.c

index ee9b48bb9a807cc19d7efa9da8d040430377420c..4d520b9b419205ec27917371cda8d953f055e08e 100644 (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;
index 7d58725c4f57eb6cae1153ec4849bafe7a61563a..0b3fef07eb4f54a52b013291c550e608f645462e 100644 (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];
index a56d3ce0581ee2f3c28a65492ea0ec614197aa79..29abede80183ef9f404aec03d0cf378fb6f1b74d 100644 (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));
 
index ae12a3bf5487f65fe344b60a37f80b2e502dcb10..1476f19690767fdd9bfec6e11beefe6f92919497 100644 (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;
index e6b70730b5d40533b749305bdd4b97e6ecf533c2..9501a5522900b92078e90a4e5cdaa88e462c2d70 100644 (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];
index 2f04963b425b41819da592ea63c7e7efe7fbae41..994cbc091ee345d85521bfc8ab16b34b5759b766 100644 (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];
index e2d1ccf1353ead7177734df800b5dbef4e5be3ab..ce24086353a2398a34250b25f1c0296bd1f00dfd 100644 (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;
 }
index 0cb4b54c87cb81d344268f26d02ffac568f62d11..4b96a931dafaa78c0b9133b09885b8ecf10253aa 100644 (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];
index f45c15d23e15abedbc46e6e4a18f6f5a32bbec8e..0914e31043963956efe796e4dbc43fd49d49325a 100644 (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 */
index 19b93bad12bb0b61c31b2ced2897942ae7190dd7..6569e38f2bf93fdc344b1e7645973d2df80b0a3c 100644 (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];
index 15cbb0f8564b6253c4bbc964e7d79d5d5fbfbe72..dcba8381cb976a476fddb4603f16578dd959f3fe 100644 (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");
index d9ba735f21055191b07a8c664e5890f7537223c6..91d9379f30395619c7797a3a178b9341f990532d 100644 (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;
 
index b437be0ddf61a9e37a9f7aaa7f405dd0b186363f..b3fd01fca2f7a58fee5b264ec740de9b086a6c22 100644 (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);
index 304d07c59117693d5a5f7af4a448b73b6fdfdb4c..d62a2199bae01349a360a3838c197830a83fcaa9 100644 (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;