kernel: object: rename z_object -> k_object
Do not use z_ for internal structures and rename to k_object instead.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be466a1..5a40538 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1124,7 +1124,7 @@
${PROCESS_GPERF}
-i ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
-o ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC}
- -p "struct z_object"
+ -p "struct k_object"
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
DEPENDS kobj_prebuilt_hash_output_src_pre ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@@ -1316,7 +1316,7 @@
${PROCESS_GPERF}
-i ${KOBJECT_HASH_OUTPUT_SRC_PRE}
-o ${KOBJECT_HASH_OUTPUT_SRC}
- -p "struct z_object"
+ -p "struct k_object"
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
DEPENDS kobj_hash_output_src_pre ${CMAKE_CURRENT_BINARY_DIR}/${KOBJECT_HASH_OUTPUT_SRC_PRE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
diff --git a/cmake/linker_script/common/common-rom.cmake b/cmake/linker_script/common/common-rom.cmake
index 35c023e..d79fa22 100644
--- a/cmake/linker_script/common/common-rom.cmake
+++ b/cmake/linker_script/common/common-rom.cmake
@@ -67,13 +67,13 @@
# Build-time assignment of permissions to kernel objects to
# threads declared with K_THREAD_DEFINE()
zephyr_linker_section(
- NAME z_object_assignment_area
+ NAME k_object_assignment_area
VMA FLASH NOINPUT
SUBALIGN 4
)
zephyr_linker_section_configure(
- SECTION z_object_assignment
- INPUT ".z_object_assignment.static.*"
+ SECTION k_object_assignment
+ INPUT ".k_object_assignment.static.*"
KEEP SORT NAME
)
endif()
diff --git a/doc/contribute/documentation/guidelines.rst b/doc/contribute/documentation/guidelines.rst
index 2fd7d82..55db8e2 100644
--- a/doc/contribute/documentation/guidelines.rst
+++ b/doc/contribute/documentation/guidelines.rst
@@ -392,7 +392,7 @@
.. code-block:: c
- struct z_object {
+ struct k_object {
char *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type;
@@ -408,7 +408,7 @@
.. code-block:: c
- struct z_object {
+ struct k_object {
char *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type;
diff --git a/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld b/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld
index cd5c610..dfa19d1 100644
--- a/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld
+++ b/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld
@@ -75,7 +75,7 @@
/* Build-time assignment of permissions to kernel objects to
* threads declared with K_THREAD_DEFINE()
*/
- ITERABLE_SECTION_ROM(z_object_assignment, 4)
+ ITERABLE_SECTION_ROM(k_object_assignment, 4)
#endif
SECTION_DATA_PROLOGUE(app_shmem_regions,,)
diff --git a/include/zephyr/sys/internal/kobject_internal.h b/include/zephyr/sys/internal/kobject_internal.h
index 65c6204..15bab17 100644
--- a/include/zephyr/sys/internal/kobject_internal.h
+++ b/include/zephyr/sys/internal/kobject_internal.h
@@ -27,7 +27,7 @@
#endif /* CONFIG_GEN_PRIV_STACKS */
/* Object extra data. Only some objects use this, determined by object type */
-union z_object_data {
+union k_object_data {
/* Backing mutex for K_OBJ_SYS_MUTEX */
struct k_mutex *mutex;
@@ -51,15 +51,15 @@
/* Table generated by gperf, these objects are retrieved via
* z_object_find() */
-struct z_object {
+struct k_object {
void *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type;
uint8_t flags;
- union z_object_data data;
+ union k_object_data data;
} __packed __aligned(4);
-struct z_object_assignment {
+struct k_object_assignment {
struct k_thread *thread;
void * const *objects;
};
@@ -92,21 +92,21 @@
* This is a low-level function to allocate some memory, and register that
* allocated memory in the kernel object lookup tables with type K_OBJ_ANY.
* Initialization state and thread permissions will be cleared. The
- * returned z_object's data value will be uninitialized.
+ * returned k_object's data value will be uninitialized.
*
* Most users will want to use k_object_alloc() instead.
*
* Memory allocated will be drawn from the calling thread's reasource pool
* and may be freed later by passing the actual object pointer (found
- * in the returned z_object's 'name' member) to k_object_free().
+ * in the returned k_object's 'name' member) to k_object_free().
*
* @param align Required memory alignment for the allocated object
* @param size Size of the allocated object
* @return NULL on insufficient memory
- * @return A pointer to the associated z_object that is installed in the
+ * @return A pointer to the associated k_object that is installed in the
* kernel object tables
*/
-struct z_object *k_object_create_dynamic_aligned(size_t align, size_t size);
+struct k_object *k_object_create_dynamic_aligned(size_t align, size_t size);
/**
* Allocate memory and install as a generic kernel object
@@ -114,20 +114,20 @@
* This is a low-level function to allocate some memory, and register that
* allocated memory in the kernel object lookup tables with type K_OBJ_ANY.
* Initialization state and thread permissions will be cleared. The
- * returned z_object's data value will be uninitialized.
+ * returned k_object's data value will be uninitialized.
*
* Most users will want to use k_object_alloc() instead.
*
* Memory allocated will be drawn from the calling thread's reasource pool
* and may be freed later by passing the actual object pointer (found
- * in the returned z_object's 'name' member) to k_object_free().
+ * in the returned k_object's 'name' member) to k_object_free().
*
* @param size Size of the allocated object
* @return NULL on insufficient memory
- * @return A pointer to the associated z_object that is installed in the
+ * @return A pointer to the associated k_object that is installed in the
* kernel object tables
*/
-static inline struct z_object *k_object_create_dynamic(size_t size)
+static inline struct k_object *k_object_create_dynamic(size_t size)
{
return k_object_create_dynamic_aligned(0, size);
}
@@ -135,7 +135,7 @@
#else
/* LCOV_EXCL_START */
-static inline struct z_object *k_object_create_dynamic_aligned(size_t align,
+static inline struct k_object *k_object_create_dynamic_aligned(size_t align,
size_t size)
{
ARG_UNUSED(align);
@@ -144,7 +144,7 @@
return NULL;
}
-static inline struct z_object *k_object_create_dynamic(size_t size)
+static inline struct k_object *k_object_create_dynamic(size_t size)
{
ARG_UNUSED(size);
diff --git a/include/zephyr/sys/kobject.h b/include/zephyr/sys/kobject.h
index 089898c..628bb96 100644
--- a/include/zephyr/sys/kobject.h
+++ b/include/zephyr/sys/kobject.h
@@ -65,7 +65,7 @@
#define K_THREAD_ACCESS_GRANT(name_, ...) \
static void * const _CONCAT(_object_list_, name_)[] = \
{ __VA_ARGS__, NULL }; \
- static const STRUCT_SECTION_ITERABLE(z_object_assignment, \
+ static const STRUCT_SECTION_ITERABLE(k_object_assignment, \
_CONCAT(_object_access_, name_)) = \
{ (&_k_thread_obj_ ## name_), \
(_CONCAT(_object_list_, name_)) }
diff --git a/include/zephyr/syscall_handler.h b/include/zephyr/syscall_handler.h
index ac6d47a..8bff82e 100644
--- a/include/zephyr/syscall_handler.h
+++ b/include/zephyr/syscall_handler.h
@@ -78,7 +78,7 @@
* -EPERM If the caller does not have permissions
* -EINVAL Object is not initialized
*/
-int z_object_validate(struct z_object *ko, enum k_objects otype,
+int z_object_validate(struct k_object *ko, enum k_objects otype,
enum _obj_init_check init);
/**
@@ -86,11 +86,11 @@
*
* @param retval Return value from z_object_validate()
* @param obj Kernel object we were trying to verify
- * @param ko If retval=-EPERM, struct z_object * that was looked up, or NULL
+ * @param ko If retval=-EPERM, struct k_object * that was looked up, or NULL
* @param otype Expected type of the kernel object
*/
void z_dump_object_error(int retval, const void *obj,
- struct z_object *ko, enum k_objects otype);
+ struct k_object *ko, enum k_objects otype);
/**
* Kernel object validation function
@@ -102,14 +102,14 @@
* @return Kernel object's metadata, or NULL if the parameter wasn't the
* memory address of a kernel object
*/
-struct z_object *z_object_find(const void *obj);
+struct k_object *z_object_find(const void *obj);
-typedef void (*_wordlist_cb_func_t)(struct z_object *ko, void *context);
+typedef void (*_wordlist_cb_func_t)(struct k_object *ko, void *context);
/**
* Iterate over all the kernel object metadata in the system
*
- * @param func function to run on each struct z_object
+ * @param func function to run on each struct k_object
* @param context Context pointer to pass to each invocation
*/
void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context);
@@ -129,7 +129,7 @@
* @param ko Kernel object metadata to update
* @param thread The thread to grant permission
*/
-void z_thread_perms_set(struct z_object *ko, struct k_thread *thread);
+void z_thread_perms_set(struct k_object *ko, struct k_thread *thread);
/**
* Revoke a thread's permission to a kernel object
@@ -137,7 +137,7 @@
* @param ko Kernel object metadata to update
* @param thread The thread to grant permission
*/
-void z_thread_perms_clear(struct z_object *ko, struct k_thread *thread);
+void z_thread_perms_clear(struct k_object *ko, struct k_thread *thread);
/*
* Revoke access to all objects for the provided thread
@@ -427,7 +427,7 @@
#define Z_SYSCALL_MEMORY_ARRAY_WRITE(ptr, nmemb, size) \
Z_SYSCALL_MEMORY_ARRAY(ptr, nmemb, size, 1)
-static inline int z_obj_validation_check(struct z_object *ko,
+static inline int z_obj_validation_check(struct k_object *ko,
const void *obj,
enum k_objects otype,
enum _obj_init_check init)
diff --git a/kernel/futex.c b/kernel/futex.c
index 4036204..360d2a9 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -14,7 +14,7 @@
static struct z_futex_data *k_futex_find_data(struct k_futex *futex)
{
- struct z_object *obj;
+ struct k_object *obj;
obj = z_object_find(futex);
if (obj == NULL || obj->type != K_OBJ_FUTEX) {
diff --git a/kernel/sched.c b/kernel/sched.c
index 66b10c3..12393c0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1878,7 +1878,7 @@
*/
static bool thread_obj_validate(struct k_thread *thread)
{
- struct z_object *ko = z_object_find(thread);
+ struct k_object *ko = z_object_find(thread);
int ret = z_object_validate(ko, K_OBJ_THREAD, _OBJ_INIT_TRUE);
switch (ret) {
diff --git a/kernel/thread.c b/kernel/thread.c
index 2358533..4a54fd5 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -360,7 +360,7 @@
{
#ifdef CONFIG_THREAD_NAME
size_t len;
- struct z_object *ko = z_object_find(thread);
+ struct k_object *ko = z_object_find(thread);
/* Special case: we allow reading the names of initialized threads
* even if we don't have permission on them
@@ -725,7 +725,7 @@
int prio, uint32_t options, k_timeout_t delay)
{
size_t total_size, stack_obj_size;
- struct z_object *stack_object;
+ struct k_object *stack_object;
/* The thread and stack objects *must* be in an uninitialized state */
Z_OOPS(Z_SYSCALL_OBJ_NEVER_INIT(new_thread, K_OBJ_THREAD));
@@ -791,7 +791,7 @@
static void grant_static_access(void)
{
- STRUCT_SECTION_FOREACH(z_object_assignment, pos) {
+ STRUCT_SECTION_FOREACH(k_object_assignment, pos) {
for (int i = 0; pos->objects[i] != NULL; i++) {
k_object_access_grant(pos->objects[i],
pos->thread);
diff --git a/kernel/userspace.c b/kernel/userspace.c
index 02211be..f986544 100644
--- a/kernel/userspace.c
+++ b/kernel/userspace.c
@@ -77,7 +77,7 @@
extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES];
#endif
-static void clear_perms_cb(struct z_object *ko, void *ctx_ptr);
+static void clear_perms_cb(struct k_object *ko, void *ctx_ptr);
const char *otype_to_str(enum k_objects otype)
{
@@ -119,7 +119,7 @@
*/
uint8_t *z_priv_stack_find(k_thread_stack_t *stack)
{
- struct z_object *obj = z_object_find(stack);
+ struct k_object *obj = z_object_find(stack);
__ASSERT(obj != NULL, "stack object not found");
__ASSERT(obj->type == K_OBJ_THREAD_STACK_ELEMENT,
@@ -166,14 +166,14 @@
MAX(DYN_OBJ_DATA_ALIGN_K_THREAD, (sizeof(void *)))
struct dyn_obj {
- struct z_object kobj;
+ struct k_object kobj;
sys_dnode_t dobj_list;
/* The object itself */
void *data;
};
-extern struct z_object *z_object_gperf_find(const void *obj);
+extern struct k_object *z_object_gperf_find(const void *obj);
extern void z_object_gperf_wordlist_foreach(_wordlist_cb_func_t func,
void *context);
@@ -311,7 +311,7 @@
sys_bitfield_set_bit((mem_addr_t)_thread_idx_map, tidx);
}
-static struct z_object *dynamic_object_create(enum k_objects otype, size_t align,
+static struct k_object *dynamic_object_create(enum k_objects otype, size_t align,
size_t size)
{
struct dyn_obj *dyn;
@@ -373,9 +373,9 @@
return &dyn->kobj;
}
-struct z_object *k_object_create_dynamic_aligned(size_t align, size_t size)
+struct k_object *k_object_create_dynamic_aligned(size_t align, size_t size)
{
- struct z_object *obj = dynamic_object_create(K_OBJ_ANY, align, size);
+ struct k_object *obj = dynamic_object_create(K_OBJ_ANY, align, size);
if (obj == NULL) {
LOG_ERR("could not allocate kernel object, out of memory");
@@ -386,7 +386,7 @@
static void *z_object_alloc(enum k_objects otype, size_t size)
{
- struct z_object *zo;
+ struct k_object *zo;
uintptr_t tidx = 0;
if (otype <= K_OBJ_ANY || otype >= K_OBJ_LAST) {
@@ -475,9 +475,9 @@
}
}
-struct z_object *z_object_find(const void *obj)
+struct k_object *z_object_find(const void *obj)
{
- struct z_object *ret;
+ struct k_object *ret;
ret = z_object_gperf_find(obj);
@@ -514,7 +514,7 @@
static unsigned int thread_index_get(struct k_thread *thread)
{
- struct z_object *ko;
+ struct k_object *ko;
ko = z_object_find(thread);
@@ -525,7 +525,7 @@
return ko->data.thread_id;
}
-static void unref_check(struct z_object *ko, uintptr_t index)
+static void unref_check(struct k_object *ko, uintptr_t index)
{
k_spinlock_key_t key = k_spin_lock(&obj_lock);
@@ -579,7 +579,7 @@
k_spin_unlock(&obj_lock, key);
}
-static void wordlist_cb(struct z_object *ko, void *ctx_ptr)
+static void wordlist_cb(struct k_object *ko, void *ctx_ptr)
{
struct perm_ctx *ctx = (struct perm_ctx *)ctx_ptr;
@@ -602,7 +602,7 @@
}
}
-void z_thread_perms_set(struct z_object *ko, struct k_thread *thread)
+void z_thread_perms_set(struct k_object *ko, struct k_thread *thread)
{
int index = thread_index_get(thread);
@@ -611,7 +611,7 @@
}
}
-void z_thread_perms_clear(struct z_object *ko, struct k_thread *thread)
+void z_thread_perms_clear(struct k_object *ko, struct k_thread *thread)
{
int index = thread_index_get(thread);
@@ -621,7 +621,7 @@
}
}
-static void clear_perms_cb(struct z_object *ko, void *ctx_ptr)
+static void clear_perms_cb(struct k_object *ko, void *ctx_ptr)
{
uintptr_t id = (uintptr_t)ctx_ptr;
@@ -637,7 +637,7 @@
}
}
-static int thread_perms_test(struct z_object *ko)
+static int thread_perms_test(struct k_object *ko)
{
int index;
@@ -652,7 +652,7 @@
return 0;
}
-static void dump_permission_error(struct z_object *ko)
+static void dump_permission_error(struct k_object *ko)
{
int index = thread_index_get(_current);
LOG_ERR("thread %p (%d) does not have permission on %s %p",
@@ -661,7 +661,7 @@
LOG_HEXDUMP_ERR(ko->perms, sizeof(ko->perms), "permission bitmap");
}
-void z_dump_object_error(int retval, const void *obj, struct z_object *ko,
+void z_dump_object_error(int retval, const void *obj, struct k_object *ko,
enum k_objects otype)
{
switch (retval) {
@@ -691,7 +691,7 @@
void z_impl_k_object_access_grant(const void *object, struct k_thread *thread)
{
- struct z_object *ko = z_object_find(object);
+ struct k_object *ko = z_object_find(object);
if (ko != NULL) {
z_thread_perms_set(ko, thread);
@@ -700,7 +700,7 @@
void k_object_access_revoke(const void *object, struct k_thread *thread)
{
- struct z_object *ko = z_object_find(object);
+ struct k_object *ko = z_object_find(object);
if (ko != NULL) {
z_thread_perms_clear(ko, thread);
@@ -714,14 +714,14 @@
void k_object_access_all_grant(const void *object)
{
- struct z_object *ko = z_object_find(object);
+ struct k_object *ko = z_object_find(object);
if (ko != NULL) {
ko->flags |= K_OBJ_FLAG_PUBLIC;
}
}
-int z_object_validate(struct z_object *ko, enum k_objects otype,
+int z_object_validate(struct k_object *ko, enum k_objects otype,
enum _obj_init_check init)
{
if (unlikely((ko == NULL) ||
@@ -756,7 +756,7 @@
void k_object_init(const void *obj)
{
- struct z_object *ko;
+ struct k_object *ko;
/* By the time we get here, if the caller was from userspace, all the
* necessary checks have been done in z_object_validate(), which takes
@@ -781,7 +781,7 @@
void z_object_recycle(const void *obj)
{
- struct z_object *ko = z_object_find(obj);
+ struct k_object *ko = z_object_find(obj);
if (ko != NULL) {
(void)memset(ko->perms, 0, sizeof(ko->perms));
@@ -792,7 +792,7 @@
void z_object_uninit(const void *obj)
{
- struct z_object *ko;
+ struct k_object *ko;
/* See comments in k_object_init() */
ko = z_object_find(obj);
diff --git a/kernel/userspace_handler.c b/kernel/userspace_handler.c
index 5453bbc..ec59ca5 100644
--- a/kernel/userspace_handler.c
+++ b/kernel/userspace_handler.c
@@ -9,11 +9,11 @@
#include <zephyr/kernel_structs.h>
#include <zephyr/toolchain.h>
-static struct z_object *validate_kernel_object(const void *obj,
+static struct k_object *validate_kernel_object(const void *obj,
enum k_objects otype,
enum _obj_init_check init)
{
- struct z_object *ko;
+ struct k_object *ko;
int ret;
ko = z_object_find(obj);
@@ -56,7 +56,7 @@
static inline void z_vrfy_k_object_access_grant(const void *object,
struct k_thread *thread)
{
- struct z_object *ko;
+ struct k_object *ko;
Z_OOPS(Z_SYSCALL_OBJ_INIT(thread, K_OBJ_THREAD));
ko = validate_any_object(object);
@@ -68,7 +68,7 @@
static inline void z_vrfy_k_object_release(const void *object)
{
- struct z_object *ko;
+ struct k_object *ko;
ko = validate_any_object((void *)object);
Z_OOPS(Z_SYSCALL_VERIFY_MSG(ko != NULL, "object %p access denied",
diff --git a/lib/os/mutex.c b/lib/os/mutex.c
index 3cd8461..b2284f0 100644
--- a/lib/os/mutex.c
+++ b/lib/os/mutex.c
@@ -11,7 +11,7 @@
static struct k_mutex *get_k_mutex(struct sys_mutex *mutex)
{
- struct z_object *obj;
+ struct k_object *obj;
obj = z_object_find(mutex);
if (obj == NULL || obj->type != K_OBJ_SYS_MUTEX) {
diff --git a/scripts/build/gen_kobject_list.py b/scripts/build/gen_kobject_list.py
index 420d964..db274c1 100755
--- a/scripts/build/gen_kobject_list.py
+++ b/scripts/build/gen_kobject_list.py
@@ -727,7 +727,7 @@
#include <zephyr/syscall_handler.h>
#include <string.h>
%}
-struct z_object;
+struct k_object;
"""
# Different versions of gperf have different prototypes for the lookup
@@ -735,7 +735,7 @@
# turned into a string, we told gperf to expect binary strings that are not
# NULL-terminated.
footer = """%%
-struct z_object *z_object_gperf_find(const void *obj)
+struct k_object *z_object_gperf_find(const void *obj)
{
return z_object_lookup((const char *)obj, sizeof(void *));
}
@@ -752,7 +752,7 @@
}
#ifndef CONFIG_DYNAMIC_OBJECTS
-struct z_object *z_object_find(const void *obj)
+struct k_object *z_object_find(const void *obj)
ALIAS_OF(z_object_gperf_find);
void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context)
diff --git a/scripts/pylib/twister/twisterlib/size_calc.py b/scripts/pylib/twister/twisterlib/size_calc.py
index 8a98c44..f449d26 100644
--- a/scripts/pylib/twister/twisterlib/size_calc.py
+++ b/scripts/pylib/twister/twisterlib/size_calc.py
@@ -78,7 +78,7 @@
"ctors",
"init_array",
"reset",
- "z_object_assignment_area",
+ "k_object_assignment_area",
"rodata",
"net_l2",
"vector",
diff --git a/subsys/net/lib/sockets/socketpair.c b/subsys/net/lib/sockets/socketpair.c
index 0ec4c4c..fad4f7a 100644
--- a/subsys/net/lib/sockets/socketpair.c
+++ b/subsys/net/lib/sockets/socketpair.c
@@ -228,7 +228,7 @@
}
#elif CONFIG_USERSPACE
- struct z_object *zo = k_object_create_dynamic(sizeof(*spair));
+ struct k_object *zo = k_object_create_dynamic(sizeof(*spair));
if (zo == NULL) {
spair = NULL;
diff --git a/tests/kernel/mem_protect/mem_protect/src/kobject.c b/tests/kernel/mem_protect/mem_protect/src/kobject.c
index d0ec8c1..76ed3f5 100644
--- a/tests/kernel/mem_protect/mem_protect/src/kobject.c
+++ b/tests/kernel/mem_protect/mem_protect/src/kobject.c
@@ -1054,7 +1054,7 @@
set_fault_valid(false);
int ret;
- struct z_object *ko;
+ struct k_object *ko;
k_thread_access_grant(&child_thread,
&child_stack);
diff --git a/tests/kernel/mem_protect/userspace/src/main.c b/tests/kernel/mem_protect/userspace/src/main.c
index 2e63638..7c0289a 100644
--- a/tests/kernel/mem_protect/userspace/src/main.c
+++ b/tests/kernel/mem_protect/userspace/src/main.c
@@ -867,7 +867,7 @@
*/
ZTEST(userspace, test_object_recycle)
{
- struct z_object *ko;
+ struct k_object *ko;
int perms_count = 0;
int dummy = 0;
diff --git a/tests/kernel/threads/thread_stack/src/main.c b/tests/kernel/threads/thread_stack/src/main.c
index b84b3b3..9a3a01a 100644
--- a/tests/kernel/threads/thread_stack/src/main.c
+++ b/tests/kernel/threads/thread_stack/src/main.c
@@ -333,7 +333,7 @@
size_t metadata_size;
#ifdef CONFIG_USERSPACE
- struct z_object *zo;
+ struct k_object *zo;
zo = z_object_find(stack_obj);
if (zo != NULL) {