Browse Source

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>
pull/64779/head
Anas Nashif 2 years ago committed by Carles Cufí
parent
commit
c91cad735a
  1. 4
      doc/kernel/usermode/kernelobjects.rst
  2. 4
      include/zephyr/sys/internal/kobject_internal.h
  3. 2
      kernel/condvar.c
  4. 2
      kernel/device.c
  5. 2
      kernel/events.c
  6. 4
      kernel/mem_slab.c
  7. 2
      kernel/msg_q.c
  8. 2
      kernel/mutex.c
  9. 2
      kernel/pipes.c
  10. 2
      kernel/poll.c
  11. 2
      kernel/queue.c
  12. 2
      kernel/sem.c
  13. 2
      kernel/stack.c
  14. 4
      kernel/thread.c
  15. 2
      kernel/timer.c
  16. 4
      kernel/userspace.c
  17. 2
      subsys/net/ip/net_if.c
  18. 2
      tests/kernel/mem_protect/mem_protect/src/kobject.c

4
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. is run by the kernel early in the boot process.
If a kernel object is initialized with a private static initializer, the object 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 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 by a user thread. This is very uncommon, typically only for kernel objects that
are embedded within some larger struct and initialized statically. 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);
... ...

4
include/zephyr/sys/internal/kobject_internal.h

@ -74,11 +74,11 @@ struct z_object_assignment {
* *
* @param obj Address of the kernel object * @param obj Address of the kernel object
*/ */
void z_object_init(const void *obj); void k_object_init(const void *obj);
#else #else
static inline void z_object_init(const void *obj) static inline void k_object_init(const void *obj)
{ {
ARG_UNUSED(obj); ARG_UNUSED(obj);
} }

2
kernel/condvar.c

@ -21,7 +21,7 @@ static struct k_spinlock lock;
int z_impl_k_condvar_init(struct k_condvar *condvar) int z_impl_k_condvar_init(struct k_condvar *condvar)
{ {
z_waitq_init(&condvar->wait_q); z_waitq_init(&condvar->wait_q);
z_object_init(condvar); k_object_init(condvar);
#ifdef CONFIG_OBJ_CORE_CONDVAR #ifdef CONFIG_OBJ_CORE_CONDVAR
k_obj_core_init_and_link(K_OBJ_CORE(condvar), &obj_type_condvar); k_obj_core_init_and_link(K_OBJ_CORE(condvar), &obj_type_condvar);

2
kernel/device.c

@ -21,7 +21,7 @@
void z_device_state_init(void) void z_device_state_init(void)
{ {
STRUCT_SECTION_FOREACH(device, dev) { STRUCT_SECTION_FOREACH(device, dev) {
z_object_init(dev); k_object_init(dev);
} }
} }

2
kernel/events.c

@ -58,7 +58,7 @@ void z_impl_k_event_init(struct k_event *event)
z_waitq_init(&event->wait_q); z_waitq_init(&event->wait_q);
z_object_init(event); k_object_init(event);
#ifdef CONFIG_OBJ_CORE_EVENT #ifdef CONFIG_OBJ_CORE_EVENT
k_obj_core_init_and_link(K_OBJ_CORE(event), &obj_type_event); k_obj_core_init_and_link(K_OBJ_CORE(event), &obj_type_event);

4
kernel/mem_slab.c

@ -151,7 +151,7 @@ static int init_mem_slab_obj_core_list(void)
if (rc < 0) { if (rc < 0) {
goto out; goto out;
} }
z_object_init(slab); k_object_init(slab);
#ifdef CONFIG_OBJ_CORE_MEM_SLAB #ifdef CONFIG_OBJ_CORE_MEM_SLAB
k_obj_core_init_and_link(K_OBJ_CORE(slab), &obj_type_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 #endif
z_waitq_init(&slab->wait_q); z_waitq_init(&slab->wait_q);
z_object_init(slab); k_object_init(slab);
out: out:
SYS_PORT_TRACING_OBJ_INIT(k_mem_slab, slab, rc); SYS_PORT_TRACING_OBJ_INIT(k_mem_slab, slab, rc);

2
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); 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, int z_impl_k_msgq_alloc_init(struct k_msgq *msgq, size_t msg_size,

2
kernel/mutex.c

@ -57,7 +57,7 @@ int z_impl_k_mutex_init(struct k_mutex *mutex)
z_waitq_init(&mutex->wait_q); z_waitq_init(&mutex->wait_q);
z_object_init(mutex); k_object_init(mutex);
#ifdef CONFIG_OBJ_CORE_MUTEX #ifdef CONFIG_OBJ_CORE_MUTEX
k_obj_core_init_and_link(K_OBJ_CORE(mutex), &obj_type_mutex); k_obj_core_init_and_link(K_OBJ_CORE(mutex), &obj_type_mutex);

2
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) #if defined(CONFIG_POLL)
sys_dlist_init(&pipe->poll_events); sys_dlist_init(&pipe->poll_events);
#endif #endif
z_object_init(pipe); k_object_init(pipe);
#ifdef CONFIG_OBJ_CORE_PIPE #ifdef CONFIG_OBJ_CORE_PIPE
k_obj_core_init_and_link(K_OBJ_CORE(pipe), &obj_type_pipe); k_obj_core_init_and_link(K_OBJ_CORE(pipe), &obj_type_pipe);

2
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); sys_dlist_init(&sig->poll_events);
sig->signaled = 0U; sig->signaled = 0U;
/* signal->result is left uninitialized */ /* signal->result is left uninitialized */
z_object_init(sig); k_object_init(sig);
SYS_PORT_TRACING_FUNC(k_poll_api, signal_init, sig); SYS_PORT_TRACING_FUNC(k_poll_api, signal_init, sig);
} }

2
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); SYS_PORT_TRACING_OBJ_INIT(k_queue, queue);
z_object_init(queue); k_object_init(queue);
} }
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE

2
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) #if defined(CONFIG_POLL)
sys_dlist_init(&sem->poll_events); sys_dlist_init(&sem->poll_events);
#endif #endif
z_object_init(sem); k_object_init(sem);
#ifdef CONFIG_OBJ_CORE_SEM #ifdef CONFIG_OBJ_CORE_SEM
k_obj_core_init_and_link(K_OBJ_CORE(sem), &obj_type_sem); k_obj_core_init_and_link(K_OBJ_CORE(sem), &obj_type_sem);

2
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; stack->top = stack->base + num_entries;
SYS_PORT_TRACING_OBJ_INIT(k_stack, stack); SYS_PORT_TRACING_OBJ_INIT(k_stack, stack);
z_object_init(stack); k_object_init(stack);
#ifdef CONFIG_OBJ_CORE_STACK #ifdef CONFIG_OBJ_CORE_STACK
k_obj_core_init_and_link(K_OBJ_CORE(stack), &obj_type_stack); k_obj_core_init_and_link(K_OBJ_CORE(stack), &obj_type_stack);

4
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), __ASSERT((options & K_USER) == 0U || z_stack_is_user_capable(stack),
"user thread %p with kernel-only stack %p", "user thread %p with kernel-only stack %p",
new_thread, stack); new_thread, stack);
z_object_init(new_thread); k_object_init(new_thread);
z_object_init(stack); k_object_init(stack);
new_thread->stack_obj = stack; new_thread->stack_obj = stack;
new_thread->syscall_frame = NULL; new_thread->syscall_frame = NULL;

2
kernel/timer.c

@ -128,7 +128,7 @@ void k_timer_init(struct k_timer *timer,
timer->user_data = NULL; timer->user_data = NULL;
z_object_init(timer); k_object_init(timer);
#ifdef CONFIG_OBJ_CORE_TIMER #ifdef CONFIG_OBJ_CORE_TIMER
k_obj_core_init_and_link(K_OBJ_CORE(timer), &obj_type_timer); k_obj_core_init_and_link(K_OBJ_CORE(timer), &obj_type_timer);

4
kernel/userspace.c

@ -754,7 +754,7 @@ int z_object_validate(struct z_object *ko, enum k_objects otype,
return 0; return 0;
} }
void z_object_init(const void *obj) void k_object_init(const void *obj)
{ {
struct z_object *ko; struct z_object *ko;
@ -794,7 +794,7 @@ void z_object_uninit(const void *obj)
{ {
struct z_object *ko; struct z_object *ko;
/* See comments in z_object_init() */ /* See comments in k_object_init() */
ko = z_object_find(obj); ko = z_object_find(obj);
if (ko == NULL) { if (ko == NULL) {
return; return;

2
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); NET_DBG("On iface %p", iface);
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
z_object_init(iface); k_object_init(iface);
#endif #endif
k_mutex_init(&iface->lock); k_mutex_init(&iface->lock);

2
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); set_fault_valid(false);
z_object_init(random_sem_type); k_object_init(random_sem_type);
k_thread_access_grant(k_current_get(), k_thread_access_grant(k_current_get(),
&kobject_sem, &kobject_sem,
&kobject_mutex, &kobject_mutex,

Loading…
Cancel
Save