syscall: rename Z_SYSCALL_VERIFY -> K_SYSCALL_VERIFY
Rename internal API to not use z_/Z_. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
1a9de05767
commit
ee9f278323
@ -311,7 +311,7 @@ Several macros exist to validate arguments:
|
||||
|
||||
* :c:macro:`K_SYSCALL_VERIFY_MSG()` does a runtime check of some boolean
|
||||
expression which must evaluate to true otherwise the check will fail.
|
||||
A variant :c:macro:`Z_SYSCALL_VERIFY` exists which does not take
|
||||
A variant :c:macro:`K_SYSCALL_VERIFY` exists which does not take
|
||||
a message parameter, instead printing the expression tested if it
|
||||
fails. The latter should only be used for the most obvious of tests.
|
||||
|
||||
@ -641,7 +641,7 @@ Helper macros for creating system call verification functions are provided in
|
||||
* :c:macro:`K_SYSCALL_MEMORY_ARRAY_READ()`
|
||||
* :c:macro:`K_SYSCALL_MEMORY_ARRAY_WRITE()`
|
||||
* :c:macro:`K_SYSCALL_VERIFY_MSG()`
|
||||
* :c:macro:`Z_SYSCALL_VERIFY`
|
||||
* :c:macro:`K_SYSCALL_VERIFY`
|
||||
|
||||
Functions for invoking system calls are defined in
|
||||
:zephyr_file:`include/zephyr/syscall.h`:
|
||||
|
||||
@ -59,7 +59,7 @@ static inline int z_vrfy_i2c_transfer(const struct device *dev,
|
||||
* in i2c.h use only a handful of messages, so up to 32 messages
|
||||
* should be more than sufficient.
|
||||
*/
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(num_msgs >= 1 && num_msgs < 32));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(num_msgs >= 1 && num_msgs < 32));
|
||||
|
||||
/* We need to be able to read the overall array of messages */
|
||||
Z_OOPS(K_SYSCALL_MEMORY_ARRAY_READ(msgs, num_msgs,
|
||||
|
||||
@ -69,7 +69,7 @@ static inline int z_vrfy_i3c_transfer(struct i3c_device_desc *target,
|
||||
* in i2c.h use only a handful of messages, so up to 32 messages
|
||||
* should be more than sufficient.
|
||||
*/
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(num_msgs >= 1 && num_msgs < 32));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(num_msgs >= 1 && num_msgs < 32));
|
||||
|
||||
/* We need to be able to read the overall array of messages */
|
||||
Z_OOPS(K_SYSCALL_MEMORY_ARRAY_READ(msgs, num_msgs,
|
||||
|
||||
@ -86,7 +86,7 @@ static inline int z_vrfy_spi_transceive(const struct device *dev,
|
||||
Z_OOPS(K_SYSCALL_MEMORY_READ(tx_bufs,
|
||||
sizeof(struct spi_buf_set)));
|
||||
memcpy(&tx_bufs_copy, tx, sizeof(tx_bufs_copy));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(tx_bufs_copy.count < 32));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(tx_bufs_copy.count < 32));
|
||||
} else {
|
||||
memset(&tx_bufs_copy, 0, sizeof(tx_bufs_copy));
|
||||
}
|
||||
@ -98,7 +98,7 @@ static inline int z_vrfy_spi_transceive(const struct device *dev,
|
||||
Z_OOPS(K_SYSCALL_MEMORY_READ(rx_bufs,
|
||||
sizeof(struct spi_buf_set)));
|
||||
memcpy(&rx_bufs_copy, rx, sizeof(rx_bufs_copy));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(rx_bufs_copy.count < 32));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(rx_bufs_copy.count < 32));
|
||||
} else {
|
||||
memset(&rx_bufs_copy, 0, sizeof(rx_bufs_copy));
|
||||
}
|
||||
|
||||
@ -328,7 +328,7 @@ int k_usermode_string_copy(char *dst, const char *src, size_t maxlen);
|
||||
* oops. A stringified version of this expression will be printed.
|
||||
* @return 0 on success, nonzero on failure
|
||||
*/
|
||||
#define Z_SYSCALL_VERIFY(expr) K_SYSCALL_VERIFY_MSG(expr, #expr)
|
||||
#define K_SYSCALL_VERIFY(expr) K_SYSCALL_VERIFY_MSG(expr, #expr)
|
||||
|
||||
/**
|
||||
* @brief Runtime check that a user thread has read and/or write permission to
|
||||
|
||||
@ -364,7 +364,7 @@ static inline int z_vrfy_k_poll(struct k_poll_event *events,
|
||||
/* Validate the events buffer and make a copy of it in an
|
||||
* allocated kernel-side buffer.
|
||||
*/
|
||||
if (Z_SYSCALL_VERIFY(num_events >= 0)) {
|
||||
if (K_SYSCALL_VERIFY(num_events >= 0)) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
@ -393,7 +393,7 @@ static inline int z_vrfy_k_poll(struct k_poll_event *events,
|
||||
for (int i = 0; i < num_events; i++) {
|
||||
struct k_poll_event *e = &events_copy[i];
|
||||
|
||||
if (Z_SYSCALL_VERIFY(e->mode == K_POLL_MODE_NOTIFY_ONLY)) {
|
||||
if (K_SYSCALL_VERIFY(e->mode == K_POLL_MODE_NOTIFY_ONLY)) {
|
||||
ret = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ static inline int32_t z_vrfy_k_stack_alloc_init(struct k_stack *stack,
|
||||
uint32_t num_entries)
|
||||
{
|
||||
Z_OOPS(K_SYSCALL_OBJ_NEVER_INIT(stack, K_OBJ_STACK));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(num_entries > 0));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(num_entries > 0));
|
||||
return z_impl_k_stack_alloc_init(stack, num_entries);
|
||||
}
|
||||
#include <syscalls/k_stack_alloc_init_mrsh.c>
|
||||
|
||||
@ -763,14 +763,14 @@ k_tid_t z_vrfy_k_thread_create(struct k_thread *new_thread,
|
||||
/* User threads may only create other user threads and they can't
|
||||
* be marked as essential
|
||||
*/
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(options & K_USER));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(!(options & K_ESSENTIAL)));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(options & K_USER));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(!(options & K_ESSENTIAL)));
|
||||
|
||||
/* Check validity of prio argument; must be the same or worse priority
|
||||
* than the caller
|
||||
*/
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(_is_valid_prio(prio, NULL)));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(z_is_prio_lower_or_equal(prio,
|
||||
Z_OOPS(K_SYSCALL_VERIFY(_is_valid_prio(prio, NULL)));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(z_is_prio_lower_or_equal(prio,
|
||||
_current->base.prio)));
|
||||
|
||||
z_setup_new_thread(new_thread, stack, stack_size,
|
||||
|
||||
@ -482,7 +482,7 @@ static inline int z_vrfy_zsock_bind(int sock, const struct sockaddr *addr,
|
||||
{
|
||||
struct sockaddr_storage dest_addr_copy;
|
||||
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(k_usermode_from_copy(&dest_addr_copy, (void *)addr, addrlen));
|
||||
|
||||
return z_impl_zsock_bind(sock, (struct sockaddr *)&dest_addr_copy,
|
||||
@ -561,7 +561,7 @@ int z_vrfy_zsock_connect(int sock, const struct sockaddr *addr,
|
||||
{
|
||||
struct sockaddr_storage dest_addr_copy;
|
||||
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(k_usermode_from_copy(&dest_addr_copy, (void *)addr, addrlen));
|
||||
|
||||
return z_impl_zsock_connect(sock, (struct sockaddr *)&dest_addr_copy,
|
||||
@ -864,7 +864,7 @@ ssize_t z_vrfy_zsock_sendto(int sock, const void *buf, size_t len, int flags,
|
||||
|
||||
Z_OOPS(K_SYSCALL_MEMORY_READ(buf, len));
|
||||
if (dest_addr) {
|
||||
Z_OOPS(Z_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(K_SYSCALL_VERIFY(addrlen <= sizeof(dest_addr_copy)));
|
||||
Z_OOPS(k_usermode_from_copy(&dest_addr_copy, (void *)dest_addr,
|
||||
addrlen));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user