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>
This commit is contained in:
Anas Nashif 2023-09-26 21:37:25 +00:00 committed by Carles Cufí
commit a6b490073e
19 changed files with 76 additions and 76 deletions

View file

@ -1124,7 +1124,7 @@ if(CONFIG_USERSPACE)
${PROCESS_GPERF} ${PROCESS_GPERF}
-i ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE} -i ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
-o ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC} -o ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC}
-p "struct z_object" -p "struct k_object"
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose> $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
DEPENDS kobj_prebuilt_hash_output_src_pre ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE} DEPENDS kobj_prebuilt_hash_output_src_pre ${KOBJECT_PREBUILT_HASH_OUTPUT_SRC_PRE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
@ -1316,7 +1316,7 @@ if(CONFIG_USERSPACE)
${PROCESS_GPERF} ${PROCESS_GPERF}
-i ${KOBJECT_HASH_OUTPUT_SRC_PRE} -i ${KOBJECT_HASH_OUTPUT_SRC_PRE}
-o ${KOBJECT_HASH_OUTPUT_SRC} -o ${KOBJECT_HASH_OUTPUT_SRC}
-p "struct z_object" -p "struct k_object"
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose> $<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
DEPENDS kobj_hash_output_src_pre ${CMAKE_CURRENT_BINARY_DIR}/${KOBJECT_HASH_OUTPUT_SRC_PRE} DEPENDS kobj_hash_output_src_pre ${CMAKE_CURRENT_BINARY_DIR}/${KOBJECT_HASH_OUTPUT_SRC_PRE}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}

View file

@ -67,13 +67,13 @@ if(CONFIG_USERSPACE)
# Build-time assignment of permissions to kernel objects to # Build-time assignment of permissions to kernel objects to
# threads declared with K_THREAD_DEFINE() # threads declared with K_THREAD_DEFINE()
zephyr_linker_section( zephyr_linker_section(
NAME z_object_assignment_area NAME k_object_assignment_area
VMA FLASH NOINPUT VMA FLASH NOINPUT
SUBALIGN 4 SUBALIGN 4
) )
zephyr_linker_section_configure( zephyr_linker_section_configure(
SECTION z_object_assignment SECTION k_object_assignment
INPUT ".z_object_assignment.static.*" INPUT ".k_object_assignment.static.*"
KEEP SORT NAME KEEP SORT NAME
) )
endif() endif()

View file

@ -392,7 +392,7 @@ For example::
.. code-block:: c .. code-block:: c
struct z_object { struct k_object {
char *name; char *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES]; uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type; uint8_t type;
@ -408,7 +408,7 @@ This would be rendered as:
.. code-block:: c .. code-block:: c
struct z_object { struct k_object {
char *name; char *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES]; uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type; uint8_t type;

View file

@ -75,7 +75,7 @@
/* Build-time assignment of permissions to kernel objects to /* Build-time assignment of permissions to kernel objects to
* threads declared with K_THREAD_DEFINE() * threads declared with K_THREAD_DEFINE()
*/ */
ITERABLE_SECTION_ROM(z_object_assignment, 4) ITERABLE_SECTION_ROM(k_object_assignment, 4)
#endif #endif
SECTION_DATA_PROLOGUE(app_shmem_regions,,) SECTION_DATA_PROLOGUE(app_shmem_regions,,)

View file

@ -27,7 +27,7 @@ struct z_stack_data {
#endif /* CONFIG_GEN_PRIV_STACKS */ #endif /* CONFIG_GEN_PRIV_STACKS */
/* Object extra data. Only some objects use this, determined by object type */ /* 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 */ /* Backing mutex for K_OBJ_SYS_MUTEX */
struct k_mutex *mutex; struct k_mutex *mutex;
@ -51,15 +51,15 @@ union z_object_data {
/* Table generated by gperf, these objects are retrieved via /* Table generated by gperf, these objects are retrieved via
* z_object_find() */ * z_object_find() */
struct z_object { struct k_object {
void *name; void *name;
uint8_t perms[CONFIG_MAX_THREAD_BYTES]; uint8_t perms[CONFIG_MAX_THREAD_BYTES];
uint8_t type; uint8_t type;
uint8_t flags; uint8_t flags;
union z_object_data data; union k_object_data data;
} __packed __aligned(4); } __packed __aligned(4);
struct z_object_assignment { struct k_object_assignment {
struct k_thread *thread; struct k_thread *thread;
void * const *objects; void * const *objects;
}; };
@ -92,21 +92,21 @@ static inline void k_object_init(const void *obj)
* This is a low-level function to allocate some memory, and register that * 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. * allocated memory in the kernel object lookup tables with type K_OBJ_ANY.
* Initialization state and thread permissions will be cleared. The * 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. * Most users will want to use k_object_alloc() instead.
* *
* Memory allocated will be drawn from the calling thread's reasource pool * Memory allocated will be drawn from the calling thread's reasource pool
* and may be freed later by passing the actual object pointer (found * 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 align Required memory alignment for the allocated object
* @param size Size of the allocated object * @param size Size of the allocated object
* @return NULL on insufficient memory * @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 * 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 * Allocate memory and install as a generic kernel object
@ -114,20 +114,20 @@ struct z_object *k_object_create_dynamic_aligned(size_t align, size_t size);
* This is a low-level function to allocate some memory, and register that * 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. * allocated memory in the kernel object lookup tables with type K_OBJ_ANY.
* Initialization state and thread permissions will be cleared. The * 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. * Most users will want to use k_object_alloc() instead.
* *
* Memory allocated will be drawn from the calling thread's reasource pool * Memory allocated will be drawn from the calling thread's reasource pool
* and may be freed later by passing the actual object pointer (found * 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 * @param size Size of the allocated object
* @return NULL on insufficient memory * @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 * 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); return k_object_create_dynamic_aligned(0, size);
} }
@ -135,7 +135,7 @@ static inline struct z_object *k_object_create_dynamic(size_t size)
#else #else
/* LCOV_EXCL_START */ /* 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) size_t size)
{ {
ARG_UNUSED(align); ARG_UNUSED(align);
@ -144,7 +144,7 @@ static inline struct z_object *k_object_create_dynamic_aligned(size_t align,
return NULL; 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); ARG_UNUSED(size);

View file

@ -65,7 +65,7 @@ enum k_objects {
#define K_THREAD_ACCESS_GRANT(name_, ...) \ #define K_THREAD_ACCESS_GRANT(name_, ...) \
static void * const _CONCAT(_object_list_, name_)[] = \ static void * const _CONCAT(_object_list_, name_)[] = \
{ __VA_ARGS__, NULL }; \ { __VA_ARGS__, NULL }; \
static const STRUCT_SECTION_ITERABLE(z_object_assignment, \ static const STRUCT_SECTION_ITERABLE(k_object_assignment, \
_CONCAT(_object_access_, name_)) = \ _CONCAT(_object_access_, name_)) = \
{ (&_k_thread_obj_ ## name_), \ { (&_k_thread_obj_ ## name_), \
(_CONCAT(_object_list_, name_)) } (_CONCAT(_object_list_, name_)) }

View file

@ -78,7 +78,7 @@ static inline bool z_is_in_user_syscall(void)
* -EPERM If the caller does not have permissions * -EPERM If the caller does not have permissions
* -EINVAL Object is not initialized * -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); enum _obj_init_check init);
/** /**
@ -86,11 +86,11 @@ int z_object_validate(struct z_object *ko, enum k_objects otype,
* *
* @param retval Return value from z_object_validate() * @param retval Return value from z_object_validate()
* @param obj Kernel object we were trying to verify * @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 * @param otype Expected type of the kernel object
*/ */
void z_dump_object_error(int retval, const void *obj, 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 * Kernel object validation function
@ -102,14 +102,14 @@ void z_dump_object_error(int retval, const void *obj,
* @return Kernel object's metadata, or NULL if the parameter wasn't the * @return Kernel object's metadata, or NULL if the parameter wasn't the
* memory address of a kernel object * 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 * 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 * @param context Context pointer to pass to each invocation
*/ */
void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context); void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context);
@ -129,7 +129,7 @@ void z_thread_perms_inherit(struct k_thread *parent,
* @param ko Kernel object metadata to update * @param ko Kernel object metadata to update
* @param thread The thread to grant permission * @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 * Revoke a thread's permission to a kernel object
@ -137,7 +137,7 @@ void z_thread_perms_set(struct z_object *ko, struct k_thread *thread);
* @param ko Kernel object metadata to update * @param ko Kernel object metadata to update
* @param thread The thread to grant permission * @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 * Revoke access to all objects for the provided thread
@ -427,7 +427,7 @@ int z_user_string_copy(char *dst, const char *src, size_t maxlen);
#define Z_SYSCALL_MEMORY_ARRAY_WRITE(ptr, nmemb, size) \ #define Z_SYSCALL_MEMORY_ARRAY_WRITE(ptr, nmemb, size) \
Z_SYSCALL_MEMORY_ARRAY(ptr, nmemb, size, 1) 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, const void *obj,
enum k_objects otype, enum k_objects otype,
enum _obj_init_check init) enum _obj_init_check init)

View file

@ -14,7 +14,7 @@
static struct z_futex_data *k_futex_find_data(struct k_futex *futex) 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); obj = z_object_find(futex);
if (obj == NULL || obj->type != K_OBJ_FUTEX) { if (obj == NULL || obj->type != K_OBJ_FUTEX) {

View file

@ -1878,7 +1878,7 @@ int z_impl_k_thread_join(struct k_thread *thread, k_timeout_t timeout)
*/ */
static bool thread_obj_validate(struct k_thread *thread) 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); int ret = z_object_validate(ko, K_OBJ_THREAD, _OBJ_INIT_TRUE);
switch (ret) { switch (ret) {

View file

@ -360,7 +360,7 @@ static inline int z_vrfy_k_thread_name_copy(k_tid_t thread,
{ {
#ifdef CONFIG_THREAD_NAME #ifdef CONFIG_THREAD_NAME
size_t len; 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 /* Special case: we allow reading the names of initialized threads
* even if we don't have permission on them * even if we don't have permission on them
@ -725,7 +725,7 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread,
int prio, uint32_t options, k_timeout_t delay) int prio, uint32_t options, k_timeout_t delay)
{ {
size_t total_size, stack_obj_size; 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 */ /* The thread and stack objects *must* be in an uninitialized state */
Z_OOPS(Z_SYSCALL_OBJ_NEVER_INIT(new_thread, K_OBJ_THREAD)); Z_OOPS(Z_SYSCALL_OBJ_NEVER_INIT(new_thread, K_OBJ_THREAD));
@ -791,7 +791,7 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread,
static void grant_static_access(void) 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++) { for (int i = 0; pos->objects[i] != NULL; i++) {
k_object_access_grant(pos->objects[i], k_object_access_grant(pos->objects[i],
pos->thread); pos->thread);

View file

@ -77,7 +77,7 @@ static struct k_spinlock obj_lock; /* kobj struct data */
extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES]; extern uint8_t _thread_idx_map[CONFIG_MAX_THREAD_BYTES];
#endif #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) const char *otype_to_str(enum k_objects otype)
{ {
@ -119,7 +119,7 @@ struct perm_ctx {
*/ */
uint8_t *z_priv_stack_find(k_thread_stack_t *stack) 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 != NULL, "stack object not found");
__ASSERT(obj->type == K_OBJ_THREAD_STACK_ELEMENT, __ASSERT(obj->type == K_OBJ_THREAD_STACK_ELEMENT,
@ -166,14 +166,14 @@ uint8_t *z_priv_stack_find(k_thread_stack_t *stack)
MAX(DYN_OBJ_DATA_ALIGN_K_THREAD, (sizeof(void *))) MAX(DYN_OBJ_DATA_ALIGN_K_THREAD, (sizeof(void *)))
struct dyn_obj { struct dyn_obj {
struct z_object kobj; struct k_object kobj;
sys_dnode_t dobj_list; sys_dnode_t dobj_list;
/* The object itself */ /* The object itself */
void *data; 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, extern void z_object_gperf_wordlist_foreach(_wordlist_cb_func_t func,
void *context); void *context);
@ -311,7 +311,7 @@ static void thread_idx_free(uintptr_t tidx)
sys_bitfield_set_bit((mem_addr_t)_thread_idx_map, tidx); 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) size_t size)
{ {
struct dyn_obj *dyn; struct dyn_obj *dyn;
@ -373,9 +373,9 @@ static struct z_object *dynamic_object_create(enum k_objects otype, size_t align
return &dyn->kobj; 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) { if (obj == NULL) {
LOG_ERR("could not allocate kernel object, out of memory"); LOG_ERR("could not allocate kernel object, out of memory");
@ -386,7 +386,7 @@ struct z_object *k_object_create_dynamic_aligned(size_t align, size_t size)
static void *z_object_alloc(enum k_objects otype, size_t size) static void *z_object_alloc(enum k_objects otype, size_t size)
{ {
struct z_object *zo; struct k_object *zo;
uintptr_t tidx = 0; uintptr_t tidx = 0;
if (otype <= K_OBJ_ANY || otype >= K_OBJ_LAST) { if (otype <= K_OBJ_ANY || otype >= K_OBJ_LAST) {
@ -475,9 +475,9 @@ void k_object_free(void *obj)
} }
} }
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); ret = z_object_gperf_find(obj);
@ -514,7 +514,7 @@ void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context)
static unsigned int thread_index_get(struct k_thread *thread) static unsigned int thread_index_get(struct k_thread *thread)
{ {
struct z_object *ko; struct k_object *ko;
ko = z_object_find(thread); ko = z_object_find(thread);
@ -525,7 +525,7 @@ static unsigned int thread_index_get(struct k_thread *thread)
return ko->data.thread_id; 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); k_spinlock_key_t key = k_spin_lock(&obj_lock);
@ -579,7 +579,7 @@ out:
k_spin_unlock(&obj_lock, key); 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; struct perm_ctx *ctx = (struct perm_ctx *)ctx_ptr;
@ -602,7 +602,7 @@ void z_thread_perms_inherit(struct k_thread *parent, struct k_thread *child)
} }
} }
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); int index = thread_index_get(thread);
@ -611,7 +611,7 @@ void z_thread_perms_set(struct z_object *ko, struct k_thread *thread)
} }
} }
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); int index = thread_index_get(thread);
@ -621,7 +621,7 @@ void z_thread_perms_clear(struct z_object *ko, struct k_thread *thread)
} }
} }
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; uintptr_t id = (uintptr_t)ctx_ptr;
@ -637,7 +637,7 @@ void z_thread_perms_all_clear(struct k_thread *thread)
} }
} }
static int thread_perms_test(struct z_object *ko) static int thread_perms_test(struct k_object *ko)
{ {
int index; int index;
@ -652,7 +652,7 @@ static int thread_perms_test(struct z_object *ko)
return 0; 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); int index = thread_index_get(_current);
LOG_ERR("thread %p (%d) does not have permission on %s %p", LOG_ERR("thread %p (%d) does not have permission on %s %p",
@ -661,7 +661,7 @@ static void dump_permission_error(struct z_object *ko)
LOG_HEXDUMP_ERR(ko->perms, sizeof(ko->perms), "permission bitmap"); 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) enum k_objects otype)
{ {
switch (retval) { switch (retval) {
@ -691,7 +691,7 @@ void z_dump_object_error(int retval, const void *obj, struct z_object *ko,
void z_impl_k_object_access_grant(const void *object, struct k_thread *thread) 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) { if (ko != NULL) {
z_thread_perms_set(ko, thread); z_thread_perms_set(ko, thread);
@ -700,7 +700,7 @@ void z_impl_k_object_access_grant(const void *object, struct k_thread *thread)
void k_object_access_revoke(const void *object, struct k_thread *thread) 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) { if (ko != NULL) {
z_thread_perms_clear(ko, thread); z_thread_perms_clear(ko, thread);
@ -714,14 +714,14 @@ void z_impl_k_object_release(const void *object)
void k_object_access_all_grant(const void *object) 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) { if (ko != NULL) {
ko->flags |= K_OBJ_FLAG_PUBLIC; 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) enum _obj_init_check init)
{ {
if (unlikely((ko == NULL) || if (unlikely((ko == NULL) ||
@ -756,7 +756,7 @@ int z_object_validate(struct z_object *ko, enum k_objects otype,
void k_object_init(const void *obj) 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 /* 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 * necessary checks have been done in z_object_validate(), which takes
@ -781,7 +781,7 @@ void k_object_init(const void *obj)
void z_object_recycle(const void *obj) 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) { if (ko != NULL) {
(void)memset(ko->perms, 0, sizeof(ko->perms)); (void)memset(ko->perms, 0, sizeof(ko->perms));
@ -792,7 +792,7 @@ void z_object_recycle(const void *obj)
void z_object_uninit(const void *obj) void z_object_uninit(const void *obj)
{ {
struct z_object *ko; struct k_object *ko;
/* See comments in k_object_init() */ /* See comments in k_object_init() */
ko = z_object_find(obj); ko = z_object_find(obj);

View file

@ -9,11 +9,11 @@
#include <zephyr/kernel_structs.h> #include <zephyr/kernel_structs.h>
#include <zephyr/toolchain.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 k_objects otype,
enum _obj_init_check init) enum _obj_init_check init)
{ {
struct z_object *ko; struct k_object *ko;
int ret; int ret;
ko = z_object_find(obj); ko = z_object_find(obj);
@ -56,7 +56,7 @@ bool k_object_is_valid(const void *obj, enum k_objects otype)
static inline void z_vrfy_k_object_access_grant(const void *object, static inline void z_vrfy_k_object_access_grant(const void *object,
struct k_thread *thread) struct k_thread *thread)
{ {
struct z_object *ko; struct k_object *ko;
Z_OOPS(Z_SYSCALL_OBJ_INIT(thread, K_OBJ_THREAD)); Z_OOPS(Z_SYSCALL_OBJ_INIT(thread, K_OBJ_THREAD));
ko = validate_any_object(object); ko = validate_any_object(object);
@ -68,7 +68,7 @@ static inline void z_vrfy_k_object_access_grant(const void *object,
static inline void z_vrfy_k_object_release(const void *object) 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); ko = validate_any_object((void *)object);
Z_OOPS(Z_SYSCALL_VERIFY_MSG(ko != NULL, "object %p access denied", Z_OOPS(Z_SYSCALL_VERIFY_MSG(ko != NULL, "object %p access denied",

View file

@ -11,7 +11,7 @@
static struct k_mutex *get_k_mutex(struct sys_mutex *mutex) static struct k_mutex *get_k_mutex(struct sys_mutex *mutex)
{ {
struct z_object *obj; struct k_object *obj;
obj = z_object_find(mutex); obj = z_object_find(mutex);
if (obj == NULL || obj->type != K_OBJ_SYS_MUTEX) { if (obj == NULL || obj->type != K_OBJ_SYS_MUTEX) {

View file

@ -727,7 +727,7 @@ header = """%compare-lengths
#include <zephyr/syscall_handler.h> #include <zephyr/syscall_handler.h>
#include <string.h> #include <string.h>
%} %}
struct z_object; struct k_object;
""" """
# Different versions of gperf have different prototypes for the lookup # Different versions of gperf have different prototypes for the lookup
@ -735,7 +735,7 @@ struct z_object;
# turned into a string, we told gperf to expect binary strings that are not # turned into a string, we told gperf to expect binary strings that are not
# NULL-terminated. # NULL-terminated.
footer = """%% 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 *)); return z_object_lookup((const char *)obj, sizeof(void *));
} }
@ -752,7 +752,7 @@ void z_object_gperf_wordlist_foreach(_wordlist_cb_func_t func, void *context)
} }
#ifndef CONFIG_DYNAMIC_OBJECTS #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); ALIAS_OF(z_object_gperf_find);
void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context) void z_object_wordlist_foreach(_wordlist_cb_func_t func, void *context)

View file

@ -78,7 +78,7 @@ class SizeCalculator:
"ctors", "ctors",
"init_array", "init_array",
"reset", "reset",
"z_object_assignment_area", "k_object_assignment_area",
"rodata", "rodata",
"net_l2", "net_l2",
"vector", "vector",

View file

@ -228,7 +228,7 @@ static struct spair *spair_new(void)
} }
#elif CONFIG_USERSPACE #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) { if (zo == NULL) {
spair = NULL; spair = NULL;

View file

@ -1054,7 +1054,7 @@ ZTEST(mem_protect_kobj, test_mark_thread_exit_uninitialized)
set_fault_valid(false); set_fault_valid(false);
int ret; int ret;
struct z_object *ko; struct k_object *ko;
k_thread_access_grant(&child_thread, k_thread_access_grant(&child_thread,
&child_stack); &child_stack);

View file

@ -867,7 +867,7 @@ static struct k_sem recycle_sem;
*/ */
ZTEST(userspace, test_object_recycle) ZTEST(userspace, test_object_recycle)
{ {
struct z_object *ko; struct k_object *ko;
int perms_count = 0; int perms_count = 0;
int dummy = 0; int dummy = 0;

View file

@ -333,7 +333,7 @@ void scenario_entry(void *stack_obj, size_t obj_size, size_t reported_size,
size_t metadata_size; size_t metadata_size;
#ifdef CONFIG_USERSPACE #ifdef CONFIG_USERSPACE
struct z_object *zo; struct k_object *zo;
zo = z_object_find(stack_obj); zo = z_object_find(stack_obj);
if (zo != NULL) { if (zo != NULL) {