diff --git a/doc/kernel/usermode/kernelobjects.rst b/doc/kernel/usermode/kernelobjects.rst index 1ac62ab8a96..a5a20b6500e 100644 --- a/doc/kernel/usermode/kernelobjects.rst +++ b/doc/kernel/usermode/kernelobjects.rst @@ -210,7 +210,7 @@ Some objects will be implicitly initialized at boot: 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 @@ are embedded within some larger struct and initialized statically. }; ... - 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 db6b031fb9a..65c62048396 100644 --- a/include/zephyr/sys/internal/kobject_internal.h +++ b/include/zephyr/sys/internal/kobject_internal.h @@ -74,11 +74,11 @@ struct z_object_assignment { * * @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 21f538c1996..e62fd27acce 100644 --- a/kernel/condvar.c +++ b/kernel/condvar.c @@ -21,7 +21,7 @@ static struct k_spinlock lock; 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 d5ceb615461..8a07e4a9b23 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 654978650bc..513559ced0f 100644 --- a/kernel/events.c +++ b/kernel/events.c @@ -58,7 +58,7 @@ void z_impl_k_event_init(struct k_event *event) 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 7f7853213b9..3be1066d2b7 100644 --- a/kernel/mem_slab.c +++ b/kernel/mem_slab.c @@ -151,7 +151,7 @@ static int init_mem_slab_obj_core_list(void) 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 @@ int k_mem_slab_init(struct k_mem_slab *slab, void *buffer, #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 5b0f7cb83bd..3f56c095fcd 100644 --- a/kernel/msg_q.c +++ b/kernel/msg_q.c @@ -59,7 +59,7 @@ void k_msgq_init(struct k_msgq *msgq, char *buffer, size_t msg_size, 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 94084bdcce9..f94fa430508 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -57,7 +57,7 @@ int z_impl_k_mutex_init(struct k_mutex *mutex) 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 e4bb0227901..c19b0e500c0 100644 --- a/kernel/pipes.c +++ b/kernel/pipes.c @@ -53,7 +53,7 @@ void k_pipe_init(struct k_pipe *pipe, unsigned char *buffer, size_t size) #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 67e1e7f76a2..3727a2ba9f3 100644 --- a/kernel/poll.c +++ b/kernel/poll.c @@ -482,7 +482,7 @@ void z_impl_k_poll_signal_init(struct k_poll_signal *sig) 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 2625b9aba5b..095ea077878 100644 --- a/kernel/queue.c +++ b/kernel/queue.c @@ -66,7 +66,7 @@ void z_impl_k_queue_init(struct k_queue *queue) 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 3b8bcb12808..c411d9b63c2 100644 --- a/kernel/sem.c +++ b/kernel/sem.c @@ -63,7 +63,7 @@ int z_impl_k_sem_init(struct k_sem *sem, unsigned int initial_count, #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 0362ece76b5..dc6d1a6bfa1 100644 --- a/kernel/stack.c +++ b/kernel/stack.c @@ -32,7 +32,7 @@ void k_stack_init(struct k_stack *stack, stack_data_t *buffer, 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 8e477b1f7dc..23585339e52 100644 --- a/kernel/thread.c +++ b/kernel/thread.c @@ -591,8 +591,8 @@ char *z_setup_new_thread(struct k_thread *new_thread, __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 9994ae49b64..1dc60dbe7ca 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -128,7 +128,7 @@ void k_timer_init(struct k_timer *timer, 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 e6be81e9a20..02211be3029 100644 --- a/kernel/userspace.c +++ b/kernel/userspace.c @@ -754,7 +754,7 @@ int z_object_validate(struct z_object *ko, enum k_objects otype, return 0; } -void z_object_init(const void *obj) +void k_object_init(const void *obj) { struct z_object *ko; @@ -794,7 +794,7 @@ void z_object_uninit(const void *obj) { 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 b77c3ad3269..acf5d628b9d 100644 --- a/subsys/net/ip/net_if.c +++ b/subsys/net/ip/net_if.c @@ -422,7 +422,7 @@ static inline void init_iface(struct net_if *iface) 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 3b566da4457..d0ec8c1fb30 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 @@ ZTEST(mem_protect_kobj, test_kobject_access_grant) { 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,