kernel: object: rename z_object_init to k_object_init
Do not use z_ for internal API and rename to k_object_init.
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
diff --git a/doc/kernel/usermode/kernelobjects.rst b/doc/kernel/usermode/kernelobjects.rst
index 1ac62ab..a5a20b6 100644
--- a/doc/kernel/usermode/kernelobjects.rst
+++ b/doc/kernel/usermode/kernelobjects.rst
@@ -210,7 +210,7 @@
is run by the kernel early in the boot process.
If a kernel object is initialized with a private static initializer, the object
-must have :c:func:`z_object_init` called on it at some point by a supervisor
+must have :c:func:`k_object_init` called on it at some point by a supervisor
thread, otherwise the kernel will consider the object uninitialized if accessed
by a user thread. This is very uncommon, typically only for kernel objects that
are embedded within some larger struct and initialized statically.
@@ -228,7 +228,7 @@
};
...
- z_object_init(&my_foo.sem);
+ k_object_init(&my_foo.sem);
...
diff --git a/include/zephyr/sys/internal/kobject_internal.h b/include/zephyr/sys/internal/kobject_internal.h
index db6b031..65c6204 100644
--- a/include/zephyr/sys/internal/kobject_internal.h
+++ b/include/zephyr/sys/internal/kobject_internal.h
@@ -74,11 +74,11 @@
*
* @param obj Address of the kernel object
*/
-void z_object_init(const void *obj);
+void k_object_init(const void *obj);
#else
-static inline void z_object_init(const void *obj)
+static inline void k_object_init(const void *obj)
{
ARG_UNUSED(obj);
}
diff --git a/kernel/condvar.c b/kernel/condvar.c
index 21f538c..e62fd27 100644
--- a/kernel/condvar.c
+++ b/kernel/condvar.c
@@ -21,7 +21,7 @@
int z_impl_k_condvar_init(struct k_condvar *condvar)
{
z_waitq_init(&condvar->wait_q);
- z_object_init(condvar);
+ k_object_init(condvar);
#ifdef CONFIG_OBJ_CORE_CONDVAR
k_obj_core_init_and_link(K_OBJ_CORE(condvar), &obj_type_condvar);
diff --git a/kernel/device.c b/kernel/device.c
index d5ceb61..8a07e4a 100644
--- a/kernel/device.c
+++ b/kernel/device.c
@@ -21,7 +21,7 @@
void z_device_state_init(void)
{
STRUCT_SECTION_FOREACH(device, dev) {
- z_object_init(dev);
+ k_object_init(dev);
}
}
diff --git a/kernel/events.c b/kernel/events.c
index 6549786..513559c 100644
--- a/kernel/events.c
+++ b/kernel/events.c
@@ -58,7 +58,7 @@
z_waitq_init(&event->wait_q);
- z_object_init(event);
+ k_object_init(event);
#ifdef CONFIG_OBJ_CORE_EVENT
k_obj_core_init_and_link(K_OBJ_CORE(event), &obj_type_event);
diff --git a/kernel/mem_slab.c b/kernel/mem_slab.c
index 7f78532..3be1066 100644
--- a/kernel/mem_slab.c
+++ b/kernel/mem_slab.c
@@ -151,7 +151,7 @@
if (rc < 0) {
goto out;
}
- z_object_init(slab);
+ k_object_init(slab);
#ifdef CONFIG_OBJ_CORE_MEM_SLAB
k_obj_core_init_and_link(K_OBJ_CORE(slab), &obj_type_mem_slab);
@@ -198,7 +198,7 @@
#endif
z_waitq_init(&slab->wait_q);
- z_object_init(slab);
+ k_object_init(slab);
out:
SYS_PORT_TRACING_OBJ_INIT(k_mem_slab, slab, rc);
diff --git a/kernel/msg_q.c b/kernel/msg_q.c
index 5b0f7cb..3f56c09 100644
--- a/kernel/msg_q.c
+++ b/kernel/msg_q.c
@@ -59,7 +59,7 @@
SYS_PORT_TRACING_OBJ_INIT(k_msgq, msgq);
- z_object_init(msgq);
+ k_object_init(msgq);
}
int z_impl_k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,
diff --git a/kernel/mutex.c b/kernel/mutex.c
index 94084bd..f94fa43 100644
--- a/kernel/mutex.c
+++ b/kernel/mutex.c
@@ -57,7 +57,7 @@
z_waitq_init(&mutex->wait_q);
- z_object_init(mutex);
+ k_object_init(mutex);
#ifdef CONFIG_OBJ_CORE_MUTEX
k_obj_core_init_and_link(K_OBJ_CORE(mutex), &obj_type_mutex);
diff --git a/kernel/pipes.c b/kernel/pipes.c
index e4bb022..c19b0e5 100644
--- a/kernel/pipes.c
+++ b/kernel/pipes.c
@@ -53,7 +53,7 @@
#if defined(CONFIG_POLL)
sys_dlist_init(&pipe->poll_events);
#endif
- z_object_init(pipe);
+ k_object_init(pipe);
#ifdef CONFIG_OBJ_CORE_PIPE
k_obj_core_init_and_link(K_OBJ_CORE(pipe), &obj_type_pipe);
diff --git a/kernel/poll.c b/kernel/poll.c
index 67e1e7f..3727a2b 100644
--- a/kernel/poll.c
+++ b/kernel/poll.c
@@ -482,7 +482,7 @@
sys_dlist_init(&sig->poll_events);
sig->signaled = 0U;
/* signal->result is left uninitialized */
- z_object_init(sig);
+ k_object_init(sig);
SYS_PORT_TRACING_FUNC(k_poll_api, signal_init, sig);
}
diff --git a/kernel/queue.c b/kernel/queue.c
index 2625b9a..095ea07 100644
--- a/kernel/queue.c
+++ b/kernel/queue.c
@@ -66,7 +66,7 @@
SYS_PORT_TRACING_OBJ_INIT(k_queue, queue);
- z_object_init(queue);
+ k_object_init(queue);
}
#ifdef CONFIG_USERSPACE
diff --git a/kernel/sem.c b/kernel/sem.c
index 3b8bcb1..c411d9b 100644
--- a/kernel/sem.c
+++ b/kernel/sem.c
@@ -63,7 +63,7 @@
#if defined(CONFIG_POLL)
sys_dlist_init(&sem->poll_events);
#endif
- z_object_init(sem);
+ k_object_init(sem);
#ifdef CONFIG_OBJ_CORE_SEM
k_obj_core_init_and_link(K_OBJ_CORE(sem), &obj_type_sem);
diff --git a/kernel/stack.c b/kernel/stack.c
index 0362ece..dc6d1a6 100644
--- a/kernel/stack.c
+++ b/kernel/stack.c
@@ -32,7 +32,7 @@
stack->top = stack->base + num_entries;
SYS_PORT_TRACING_OBJ_INIT(k_stack, stack);
- z_object_init(stack);
+ k_object_init(stack);
#ifdef CONFIG_OBJ_CORE_STACK
k_obj_core_init_and_link(K_OBJ_CORE(stack), &obj_type_stack);
diff --git a/kernel/thread.c b/kernel/thread.c
index 8e477b1..2358533 100644
--- a/kernel/thread.c
+++ b/kernel/thread.c
@@ -591,8 +591,8 @@
__ASSERT((options & K_USER) == 0U || z_stack_is_user_capable(stack),
"user thread %p with kernel-only stack %p",
new_thread, stack);
- z_object_init(new_thread);
- z_object_init(stack);
+ k_object_init(new_thread);
+ k_object_init(stack);
new_thread->stack_obj = stack;
new_thread->syscall_frame = NULL;
diff --git a/kernel/timer.c b/kernel/timer.c
index 9994ae4..1dc60db 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -128,7 +128,7 @@
timer->user_data = NULL;
- z_object_init(timer);
+ k_object_init(timer);
#ifdef CONFIG_OBJ_CORE_TIMER
k_obj_core_init_and_link(K_OBJ_CORE(timer), &obj_type_timer);
diff --git a/kernel/userspace.c b/kernel/userspace.c
index e6be81e..02211be 100644
--- a/kernel/userspace.c
+++ b/kernel/userspace.c
@@ -754,7 +754,7 @@
return 0;
}
-void z_object_init(const void *obj)
+void k_object_init(const void *obj)
{
struct z_object *ko;
@@ -794,7 +794,7 @@
{
struct z_object *ko;
- /* See comments in z_object_init() */
+ /* See comments in k_object_init() */
ko = z_object_find(obj);
if (ko == NULL) {
return;
diff --git a/subsys/net/ip/net_if.c b/subsys/net/ip/net_if.c
index b77c3ad..acf5d62 100644
--- a/subsys/net/ip/net_if.c
+++ b/subsys/net/ip/net_if.c
@@ -422,7 +422,7 @@
NET_DBG("On iface %p", iface);
#ifdef CONFIG_USERSPACE
- z_object_init(iface);
+ k_object_init(iface);
#endif
k_mutex_init(&iface->lock);
diff --git a/tests/kernel/mem_protect/mem_protect/src/kobject.c b/tests/kernel/mem_protect/mem_protect/src/kobject.c
index 3b566da..d0ec8c1 100644
--- a/tests/kernel/mem_protect/mem_protect/src/kobject.c
+++ b/tests/kernel/mem_protect/mem_protect/src/kobject.c
@@ -42,7 +42,7 @@
{
set_fault_valid(false);
- z_object_init(random_sem_type);
+ k_object_init(random_sem_type);
k_thread_access_grant(k_current_get(),
&kobject_sem,
&kobject_mutex,