From 4bad34e7496f5e2ac46bc0b688b68e3010f890f2 Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 11 Mar 2020 06:56:58 -0700 Subject: [PATCH] kernel: rename _k_thread_stack_element Private data type, prefix with z_. Signed-off-by: Andrew Boie --- doc/reference/usermode/kernelobjects.rst | 2 +- include/arch/arc/arch.h | 6 +++--- include/arch/arm/aarch32/arch.h | 12 ++++++------ include/arch/x86/thread_stack.h | 6 +++--- include/kernel.h | 14 +++++++------- include/sys/arch_interface.h | 2 +- kernel/thread.c | 2 +- kernel/userspace.c | 2 +- kernel/userspace_handler.c | 2 +- scripts/elf_helper.py | 4 ++-- scripts/gen_kobject_list.py | 6 +++--- scripts/gen_priv_stacks.py | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/doc/reference/usermode/kernelobjects.rst b/doc/reference/usermode/kernelobjects.rst index c12145042d9..6e7bfc63d2d 100644 --- a/doc/reference/usermode/kernelobjects.rst +++ b/doc/reference/usermode/kernelobjects.rst @@ -6,7 +6,7 @@ Kernel Objects A kernel object can be one of three classes of data: * A core kernel object, such as a semaphore, thread, pipe, etc. -* A thread stack, which is an array of :c:type:`struct _k_thread_stack_element` +* A thread stack, which is an array of :c:type:`struct z_thread_stack_element` and declared with :c:macro:`K_THREAD_STACK_DEFINE()` * A device driver instance (struct device) that belongs to one of a defined set of subsystems diff --git a/include/arch/arc/arch.h b/include/arch/arc/arch.h index a2676eb5513..216e67a006e 100644 --- a/include/arch/arc/arch.h +++ b/include/arch/arc/arch.h @@ -139,17 +139,17 @@ extern "C" { #define ARCH_THREAD_STACK_DEFINE(sym, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(Z_ARC_THREAD_STACK_ALIGN(size)) \ sym[ARCH_THREAD_STACK_LEN(size)] #define ARCH_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(Z_ARC_THREAD_STACK_ALIGN(size)) \ sym[nmemb][Z_ARC_THREAD_STACK_ARRAY_LEN(size)] #define ARCH_THREAD_STACK_MEMBER(sym, size) \ - struct _k_thread_stack_element \ + struct z_thread_stack_element \ __aligned(Z_ARC_THREAD_STACK_ALIGN(size)) \ sym[ARCH_THREAD_STACK_LEN(size)] diff --git a/include/arch/arm/aarch32/arch.h b/include/arch/arm/aarch32/arch.h index 71ba6045c4b..fa985318b26 100644 --- a/include/arch/arm/aarch32/arch.h +++ b/include/arch/arm/aarch32/arch.h @@ -198,11 +198,11 @@ extern "C" { #if defined(CONFIG_USERSPACE) && \ defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) #define ARCH_THREAD_STACK_DEFINE(sym, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(POW2_CEIL(size)) sym[POW2_CEIL(size)] #else #define ARCH_THREAD_STACK_DEFINE(sym, size) \ - struct _k_thread_stack_element __noinit __aligned(STACK_ALIGN) \ + struct z_thread_stack_element __noinit __aligned(STACK_ALIGN) \ sym[size+MPU_GUARD_ALIGN_AND_SIZE] #endif @@ -216,12 +216,12 @@ extern "C" { #if defined(CONFIG_USERSPACE) && \ defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) #define ARCH_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(POW2_CEIL(size)) \ sym[nmemb][ARCH_THREAD_STACK_LEN(size)] #else #define ARCH_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(STACK_ALIGN) \ sym[nmemb][ARCH_THREAD_STACK_LEN(size)] #endif @@ -229,11 +229,11 @@ extern "C" { #if defined(CONFIG_USERSPACE) && \ defined(CONFIG_MPU_REQUIRES_POWER_OF_TWO_ALIGNMENT) #define ARCH_THREAD_STACK_MEMBER(sym, size) \ - struct _k_thread_stack_element __aligned(POW2_CEIL(size)) \ + struct z_thread_stack_element __aligned(POW2_CEIL(size)) \ sym[POW2_CEIL(size)] #else #define ARCH_THREAD_STACK_MEMBER(sym, size) \ - struct _k_thread_stack_element __aligned(STACK_ALIGN) \ + struct z_thread_stack_element __aligned(STACK_ALIGN) \ sym[size+MPU_GUARD_ALIGN_AND_SIZE] #endif diff --git a/include/arch/x86/thread_stack.h b/include/arch/x86/thread_stack.h index 979f7999dd4..d73288df2b6 100644 --- a/include/arch/x86/thread_stack.h +++ b/include/arch/x86/thread_stack.h @@ -199,7 +199,7 @@ struct z_x86_thread_stack_header { sizeof(struct z_x86_thread_stack_header) #define ARCH_THREAD_STACK_DEFINE(sym, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(Z_X86_STACK_BASE_ALIGN) \ sym[ROUND_UP((size), Z_X86_STACK_SIZE_ALIGN) + \ ARCH_THREAD_STACK_RESERVED] @@ -211,12 +211,12 @@ struct z_x86_thread_stack_header { ARCH_THREAD_STACK_RESERVED) #define ARCH_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(Z_X86_STACK_BASE_ALIGN) \ sym[nmemb][ARCH_THREAD_STACK_LEN(size)] #define ARCH_THREAD_STACK_MEMBER(sym, size) \ - struct _k_thread_stack_element __aligned(Z_X86_STACK_BASE_ALIGN) \ + struct z_thread_stack_element __aligned(Z_X86_STACK_BASE_ALIGN) \ sym[ROUND_UP((size), Z_X86_STACK_SIZE_ALIGN) + \ ARCH_THREAD_STACK_RESERVED] diff --git a/include/kernel.h b/include/kernel.h index 18758bfbd3b..c255a86ac53 100644 --- a/include/kernel.h +++ b/include/kernel.h @@ -174,7 +174,7 @@ union z_object_data { /* Numerical thread ID for K_OBJ_THREAD */ unsigned int thread_id; - /* Stack buffer size for K_OBJ__THREAD_STACK_ELEMENT */ + /* Stack buffer size for K_OBJ_THREAD_STACK_ELEMENT */ size_t stack_size; /* Futex wait queue and spinlock for K_OBJ_FUTEX */ @@ -403,15 +403,15 @@ static inline void k_obj_free(void *obj) * * Stacks should always be created with K_THREAD_STACK_DEFINE(). */ -struct __packed _k_thread_stack_element { +struct __packed z_thread_stack_element { char data; }; /** * @typedef k_thread_stack_t - * @brief Typedef of struct _k_thread_stack_element + * @brief Typedef of struct z_thread_stack_element * - * @see _k_thread_stack_element + * @see z_thread_stack_element */ /** @@ -5155,7 +5155,7 @@ static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym) * @req K-TSTACK-001 */ #define K_THREAD_STACK_DEFINE(sym, size) \ - struct _k_thread_stack_element __noinit __aligned(STACK_ALIGN) sym[size] + struct z_thread_stack_element __noinit __aligned(STACK_ALIGN) sym[size] /** * @brief Calculate size of stacks to be allocated in a stack array @@ -5185,7 +5185,7 @@ static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym) * @req K-TSTACK-001 */ #define K_THREAD_STACK_ARRAY_DEFINE(sym, nmemb, size) \ - struct _k_thread_stack_element __noinit \ + struct z_thread_stack_element __noinit \ __aligned(STACK_ALIGN) sym[nmemb][K_THREAD_STACK_LEN(size)] /** @@ -5202,7 +5202,7 @@ static inline char *Z_THREAD_STACK_BUFFER(k_thread_stack_t *sym) * @req K-TSTACK-001 */ #define K_THREAD_STACK_MEMBER(sym, size) \ - struct _k_thread_stack_element __aligned(STACK_ALIGN) sym[size] + struct z_thread_stack_element __aligned(STACK_ALIGN) sym[size] /** * @brief Return the size in bytes of a stack memory region diff --git a/include/sys/arch_interface.h b/include/sys/arch_interface.h index fad6f92762d..4d1b921c679 100644 --- a/include/sys/arch_interface.h +++ b/include/sys/arch_interface.h @@ -41,7 +41,7 @@ extern "C" { struct k_thread; struct k_mem_domain; -typedef struct _k_thread_stack_element k_thread_stack_t; +typedef struct z_thread_stack_element k_thread_stack_t; typedef void (*k_thread_entry_t)(void *p1, void *p2, void *p3); diff --git a/kernel/thread.c b/kernel/thread.c index 67c55309c69..b642e041051 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -648,7 +648,7 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread, Z_OOPS(Z_SYSCALL_OBJ_NEVER_INIT(new_thread, K_OBJ_THREAD)); stack_object = z_object_find(stack); Z_OOPS(Z_SYSCALL_VERIFY_MSG(z_obj_validation_check(stack_object, stack, - K_OBJ__THREAD_STACK_ELEMENT, + K_OBJ_THREAD_STACK_ELEMENT, _OBJ_INIT_FALSE) == 0, "bad stack object")); diff --git a/kernel/userspace.c b/kernel/userspace.c index d27781d2108..87d76641112 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -242,7 +242,7 @@ void *z_impl_k_object_alloc(enum k_objects otype) * to request memory that is aligned */ __ASSERT(otype > K_OBJ_ANY && otype < K_OBJ_LAST && - otype != K_OBJ__THREAD_STACK_ELEMENT, + otype != K_OBJ_THREAD_STACK_ELEMENT, "bad object type requested"); dyn_obj = z_thread_malloc(sizeof(*dyn_obj) + obj_size_get(otype)); diff --git a/kernel/userspace_handler.c b/kernel/userspace_handler.c index 054fa1724d8..8ec1845dcad 100644 --- a/kernel/userspace_handler.c +++ b/kernel/userspace_handler.c @@ -63,7 +63,7 @@ static inline void z_vrfy_k_object_release(void *object) static inline void *z_vrfy_k_object_alloc(enum k_objects otype) { Z_OOPS(Z_SYSCALL_VERIFY_MSG(otype > K_OBJ_ANY && otype < K_OBJ_LAST && - otype != K_OBJ__THREAD_STACK_ELEMENT, + otype != K_OBJ_THREAD_STACK_ELEMENT, "bad object type %d requested", otype)); return z_impl_k_object_alloc(otype); diff --git a/scripts/elf_helper.py b/scripts/elf_helper.py index f5842d2f50f..d08195e6500 100644 --- a/scripts/elf_helper.py +++ b/scripts/elf_helper.py @@ -24,7 +24,7 @@ def subsystem_to_enum(subsys): def kobject_to_enum(kobj): - if kobj.startswith("k_") or kobj.startswith("_k_"): + if kobj.startswith("k_") or kobj.startswith("z_"): name = kobj[2:] else: name = kobj @@ -34,7 +34,7 @@ def kobject_to_enum(kobj): DW_OP_addr = 0x3 DW_OP_fbreg = 0x91 -STACK_TYPE = "_k_thread_stack_element" +STACK_TYPE = "z_thread_stack_element" thread_counter = 0 sys_mutex_counter = 0 futex_counter = 0 diff --git a/scripts/gen_kobject_list.py b/scripts/gen_kobject_list.py index 18954fa539d..943e684d27d 100755 --- a/scripts/gen_kobject_list.py +++ b/scripts/gen_kobject_list.py @@ -85,7 +85,7 @@ kobjects = OrderedDict([ ("k_stack", (None, False)), ("k_thread", (None, False)), ("k_timer", (None, False)), - ("_k_thread_stack_element", (None, False)), + ("z_thread_stack_element", (None, False)), ("device", (None, False)), ("sys_mutex", (None, True)), ("k_futex", (None, True)) @@ -146,7 +146,7 @@ void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context) metadata_names = { "K_OBJ_THREAD" : "thread_id", - "K_OBJ__THREAD_STACK_ELEMENT" : "stack_size", + "K_OBJ_THREAD_STACK_ELEMENT" : "stack_size", "K_OBJ_SYS_MUTEX" : "mutex", "K_OBJ_FUTEX" : "futex_data" } @@ -312,7 +312,7 @@ def write_kobj_size_output(fp): dep, _ = obj_info # device handled by default case. Stacks are not currently handled, # if they eventually are it will be a special case. - if kobj in {"device", "_k_thread_stack_element"}: + if kobj in {"device", "z_thread_stack_element"}: continue if dep: diff --git a/scripts/gen_priv_stacks.py b/scripts/gen_priv_stacks.py index 9db974f709d..2109edc1693 100755 --- a/scripts/gen_priv_stacks.py +++ b/scripts/gen_priv_stacks.py @@ -27,7 +27,7 @@ import struct from elf_helper import ElfHelper kobjects = { - "_k_thread_stack_element": (None, False) + "z_thread_stack_element": (None, False) }