subsystems: Rename reserved function names

Rename reserved function names in the subsys/ subdirectory except
for static _mod_pub_set and _mod_unbind functions in bluetooth mesh
cfg_srv.c which clash with the similarly named global functions.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
This commit is contained in:
Patrik Flykt 2019-03-14 19:42:51 -06:00 committed by Anas Nashif
parent fd42bf7443
commit 4aa48833d8
30 changed files with 207 additions and 208 deletions

View file

@ -52,7 +52,7 @@ extern __printf_like(3, 4) int snprintk(char *str, size_t size,
extern __printf_like(3, 0) int vsnprintk(char *str, size_t size,
const char *fmt, va_list ap);
extern __printf_like(3, 0) void _vprintk(int (*out)(int f, void *c), void *ctx,
extern __printf_like(3, 0) void z_vprintk(int (*out)(int f, void *c), void *ctx,
const char *fmt, va_list ap);
#else
static inline __printf_like(1, 2) void printk(const char *fmt, ...)

View file

@ -11,7 +11,7 @@
#define DESC(d) ((void *)d)
extern int _prf(int (*func)(), void *dest,
extern int z_prf(int (*func)(), void *dest,
const char *format, va_list vargs);
int fprintf(FILE *_MLIBC_RESTRICT F, const char *_MLIBC_RESTRICT format, ...)
@ -20,7 +20,7 @@ int fprintf(FILE *_MLIBC_RESTRICT F, const char *_MLIBC_RESTRICT format, ...)
int r;
va_start(vargs, format);
r = _prf(fputc, DESC(F), format, vargs);
r = z_prf(fputc, DESC(F), format, vargs);
va_end(vargs);
return r;
@ -31,7 +31,7 @@ int vfprintf(FILE *_MLIBC_RESTRICT F, const char *_MLIBC_RESTRICT format,
{
int r;
r = _prf(fputc, DESC(F), format, vargs);
r = z_prf(fputc, DESC(F), format, vargs);
return r;
}
@ -42,7 +42,7 @@ int printf(const char *_MLIBC_RESTRICT format, ...)
int r;
va_start(vargs, format);
r = _prf(fputc, DESC(stdout), format, vargs);
r = z_prf(fputc, DESC(stdout), format, vargs);
va_end(vargs);
return r;
@ -52,7 +52,7 @@ int vprintf(const char *_MLIBC_RESTRICT format, va_list vargs)
{
int r;
r = _prf(fputc, DESC(stdout), format, vargs);
r = z_prf(fputc, DESC(stdout), format, vargs);
return r;
}

View file

@ -429,7 +429,7 @@ static int _atoi(char **sptr)
return i;
}
int _prf(int (*func)(), void *dest, char *format, va_list vargs)
int z_prf(int (*func)(), void *dest, char *format, va_list vargs)
{
/*
* Due the fact that buffer is passed to functions in this file,

View file

@ -9,7 +9,7 @@
#include <stdarg.h>
#include <stdio.h>
extern int _prf(int (*func)(), void *dest,
extern int z_prf(int (*func)(), void *dest,
const char *format, va_list vargs);
struct emitter {
@ -44,7 +44,7 @@ int snprintf(char *_MLIBC_RESTRICT s, size_t len,
p.len = (int) len;
va_start(vargs, format);
r = _prf(sprintf_out, (void *) (&p), format, vargs);
r = z_prf(sprintf_out, (void *) (&p), format, vargs);
va_end(vargs);
*(p.ptr) = 0;
@ -62,7 +62,7 @@ int sprintf(char *_MLIBC_RESTRICT s, const char *_MLIBC_RESTRICT format, ...)
p.len = (int) 0x7fffffff; /* allow up to "maxint" characters */
va_start(vargs, format);
r = _prf(sprintf_out, (void *) (&p), format, vargs);
r = z_prf(sprintf_out, (void *) (&p), format, vargs);
va_end(vargs);
*(p.ptr) = 0;
@ -83,7 +83,7 @@ int vsnprintf(char *_MLIBC_RESTRICT s, size_t len,
p.ptr = s;
p.len = (int) len;
r = _prf(sprintf_out, (void *) (&p), format, vargs);
r = z_prf(sprintf_out, (void *) (&p), format, vargs);
*(p.ptr) = 0;
return r;
@ -98,7 +98,7 @@ int vsprintf(char *_MLIBC_RESTRICT s, const char *_MLIBC_RESTRICT format,
p.ptr = s;
p.len = (int) 0x7fffffff; /* allow up to "maxint" characters */
r = _prf(sprintf_out, (void *) (&p), format, vargs);
r = z_prf(sprintf_out, (void *) (&p), format, vargs);
*(p.ptr) = 0;
return r;

View file

@ -98,7 +98,7 @@ static void print_err(out_func_t out, void *ctx)
*
* @return N/A
*/
void _vprintk(out_func_t out, void *ctx, const char *fmt, va_list ap)
void z_vprintk(out_func_t out, void *ctx, const char *fmt, va_list ap)
{
int might_format = 0; /* 1 if encountered a '%' */
enum pad_type padding = PAD_NONE;
@ -316,7 +316,7 @@ void vprintk(const char *fmt, va_list ap)
if (_is_user_context()) {
struct buf_out_context ctx = { 0 };
_vprintk(buf_char_out, &ctx, fmt, ap);
z_vprintk(buf_char_out, &ctx, fmt, ap);
if (ctx.buf_count) {
buf_flush(&ctx);
@ -324,7 +324,7 @@ void vprintk(const char *fmt, va_list ap)
} else {
struct out_context ctx = { 0 };
_vprintk(char_out, &ctx, fmt, ap);
z_vprintk(char_out, &ctx, fmt, ap);
}
}
#else
@ -332,7 +332,7 @@ void vprintk(const char *fmt, va_list ap)
{
struct out_context ctx = { 0 };
_vprintk(char_out, &ctx, fmt, ap);
z_vprintk(char_out, &ctx, fmt, ap);
}
#endif
@ -510,7 +510,7 @@ int snprintk(char *str, size_t size, const char *fmt, ...)
va_list ap;
va_start(ap, fmt);
_vprintk((out_func_t)str_out, &ctx, fmt, ap);
z_vprintk((out_func_t)str_out, &ctx, fmt, ap);
va_end(ap);
if (ctx.count < ctx.max) {
@ -524,7 +524,7 @@ int vsnprintk(char *str, size_t size, const char *fmt, va_list ap)
{
struct str_context ctx = { str, size, 0 };
_vprintk((out_func_t)str_out, &ctx, fmt, ap);
z_vprintk((out_func_t)str_out, &ctx, fmt, ap);
if (ctx.count < ctx.max) {
str[ctx.count] = '\0';

View file

@ -486,7 +486,7 @@ static const struct bt_hci_driver drv = {
.send = hci_driver_send,
};
static int _hci_driver_init(struct device *unused)
static int hci_driver_init(struct device *unused)
{
ARG_UNUSED(unused);
@ -495,4 +495,4 @@ static int _hci_driver_init(struct device *unused)
return 0;
}
SYS_INIT(_hci_driver_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
SYS_INIT(hci_driver_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

View file

@ -66,7 +66,7 @@ static struct {
atomic_t other;
} drops;
extern int _prf(int (*func)(), void *dest,
extern int z_prf(int (*func)(), void *dest,
const char *format, va_list vargs);
static void monitor_send(const void *data, size_t len)

View file

@ -2252,7 +2252,7 @@ static u8_t smp_master_ident(struct bt_smp *smp, struct net_buf *buf)
}
#endif /* !CONFIG_BT_SMP_SC_PAIR_ONLY */
static int _smp_init(struct bt_smp *smp)
static int smp_init(struct bt_smp *smp)
{
/* Initialize SMP context without clearing L2CAP channel context */
(void)memset((u8_t *)smp + sizeof(smp->chan), 0,
@ -2355,7 +2355,7 @@ int bt_smp_send_security_req(struct bt_conn *conn)
return -EINVAL;
}
if (_smp_init(smp) != 0) {
if (smp_init(smp) != 0) {
return -ENOBUFS;
}
@ -2394,7 +2394,7 @@ static u8_t smp_pairing_req(struct bt_smp *smp, struct net_buf *buf)
* is already initialized.
*/
if (!atomic_test_bit(smp->flags, SMP_FLAG_SEC_REQ)) {
int ret = _smp_init(smp);
int ret = smp_init(smp);
if (ret) {
return ret;
@ -2533,7 +2533,7 @@ int bt_smp_send_pairing_req(struct bt_conn *conn)
return -EINVAL;
}
if (_smp_init(smp)) {
if (smp_init(smp)) {
return -ENOBUFS;
}

View file

@ -26,7 +26,7 @@ static inline int is_idle_thread(struct k_thread *thread)
}
static inline void _sys_trace_thread_switched_in(void)
static inline void z_sys_trace_thread_switched_in(void)
{
struct k_thread *thread;
@ -39,7 +39,7 @@ static inline void _sys_trace_thread_switched_in(void)
}
}
#define sys_trace_thread_switched_in() _sys_trace_thread_switched_in()
#define sys_trace_thread_switched_in() z_sys_trace_thread_switched_in()
#define sys_trace_thread_switched_out() SEGGER_SYSVIEW_OnTaskStopExec()

View file

@ -7,7 +7,7 @@
#include <SEGGER_SYSVIEW.h>
#include "SEGGER_SYSVIEW_Zephyr.h"
static void _cbSendSystemDesc(void)
static void cbSendSystemDesc(void)
{
SEGGER_SYSVIEW_SendSysDesc("N=ZephyrSysView");
SEGGER_SYSVIEW_SendSysDesc("D=" CONFIG_BOARD " "
@ -19,7 +19,7 @@ void SEGGER_SYSVIEW_Conf(void)
{
SEGGER_SYSVIEW_Init(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC,
&SYSVIEW_X_OS_TraceAPI, _cbSendSystemDesc);
&SYSVIEW_X_OS_TraceAPI, cbSendSystemDesc);
#if defined(DT_PHYS_RAM_ADDR) /* x86 */
SEGGER_SYSVIEW_SetRAMBase(DT_PHYS_RAM_ADDR);

View file

@ -18,8 +18,8 @@ LOG_MODULE_REGISTER(fs_nvs, CONFIG_NVS_LOG_LEVEL);
/* basic routines */
/* _nvs_al_size returns size aligned to fs->write_block_size */
static inline size_t _nvs_al_size(struct nvs_fs *fs, size_t len)
/* nvs_al_size returns size aligned to fs->write_block_size */
static inline size_t nvs_al_size(struct nvs_fs *fs, size_t len)
{
if (fs->write_block_size <= 1U) {
return len;
@ -30,7 +30,7 @@ static inline size_t _nvs_al_size(struct nvs_fs *fs, size_t len)
/* flash routines */
/* basic aligned flash write to nvs address */
static int _nvs_flash_al_wrt(struct nvs_fs *fs, u32_t addr, const void *data,
static int nvs_flash_al_wrt(struct nvs_fs *fs, u32_t addr, const void *data,
size_t len)
{
const u8_t *data8 = (const u8_t *)data;
@ -81,7 +81,7 @@ end:
}
/* basic flash read from nvs address */
static int _nvs_flash_rd(struct nvs_fs *fs, u32_t addr, void *data,
static int nvs_flash_rd(struct nvs_fs *fs, u32_t addr, void *data,
size_t len)
{
int rc;
@ -97,44 +97,44 @@ static int _nvs_flash_rd(struct nvs_fs *fs, u32_t addr, void *data,
}
/* allocation entry write */
static int _nvs_flash_ate_wrt(struct nvs_fs *fs, const struct nvs_ate *entry)
static int nvs_flash_ate_wrt(struct nvs_fs *fs, const struct nvs_ate *entry)
{
int rc;
rc = _nvs_flash_al_wrt(fs, fs->ate_wra, entry,
rc = nvs_flash_al_wrt(fs, fs->ate_wra, entry,
sizeof(struct nvs_ate));
fs->ate_wra -= _nvs_al_size(fs, sizeof(struct nvs_ate));
fs->ate_wra -= nvs_al_size(fs, sizeof(struct nvs_ate));
return rc;
}
/* data write */
static int _nvs_flash_data_wrt(struct nvs_fs *fs, const void *data, size_t len)
static int nvs_flash_data_wrt(struct nvs_fs *fs, const void *data, size_t len)
{
int rc;
rc = _nvs_flash_al_wrt(fs, fs->data_wra, data, len);
fs->data_wra += _nvs_al_size(fs, len);
rc = nvs_flash_al_wrt(fs, fs->data_wra, data, len);
fs->data_wra += nvs_al_size(fs, len);
return rc;
}
/* flash ate read */
static int _nvs_flash_ate_rd(struct nvs_fs *fs, u32_t addr,
static int nvs_flash_ate_rd(struct nvs_fs *fs, u32_t addr,
struct nvs_ate *entry)
{
return _nvs_flash_rd(fs, addr, entry, sizeof(struct nvs_ate));
return nvs_flash_rd(fs, addr, entry, sizeof(struct nvs_ate));
}
/* end of basic flash routines */
/* advanced flash routines */
/* _nvs_flash_block_cmp compares the data in flash at addr to data
/* nvs_flash_block_cmp compares the data in flash at addr to data
* in blocks of size NVS_BLOCK_SIZE aligned to fs->write_block_size
* returns 0 if equal, 1 if not equal, errcode if error
*/
static int _nvs_flash_block_cmp(struct nvs_fs *fs, u32_t addr, const void *data,
static int nvs_flash_block_cmp(struct nvs_fs *fs, u32_t addr, const void *data,
size_t len)
{
const u8_t *data8 = (const u8_t *)data;
@ -145,7 +145,7 @@ static int _nvs_flash_block_cmp(struct nvs_fs *fs, u32_t addr, const void *data,
block_size = NVS_BLOCK_SIZE & ~(fs->write_block_size - 1U);
while (len) {
bytes_to_cmp = MIN(block_size, len);
rc = _nvs_flash_rd(fs, addr, buf, bytes_to_cmp);
rc = nvs_flash_rd(fs, addr, buf, bytes_to_cmp);
if (rc) {
return rc;
}
@ -160,11 +160,11 @@ static int _nvs_flash_block_cmp(struct nvs_fs *fs, u32_t addr, const void *data,
return 0;
}
/* _nvs_flash_cmp_const compares the data in flash at addr to a constant
/* nvs_flash_cmp_const compares the data in flash at addr to a constant
* value. returns 0 if all data in flash is equal to value, 1 if not equal,
* errcode if error
*/
static int _nvs_flash_cmp_const(struct nvs_fs *fs, u32_t addr, u8_t value,
static int nvs_flash_cmp_const(struct nvs_fs *fs, u32_t addr, u8_t value,
size_t len)
{
int rc;
@ -175,7 +175,7 @@ static int _nvs_flash_cmp_const(struct nvs_fs *fs, u32_t addr, u8_t value,
(void)memset(cmp, value, block_size);
while (len) {
bytes_to_cmp = MIN(block_size, len);
rc = _nvs_flash_block_cmp(fs, addr, cmp, bytes_to_cmp);
rc = nvs_flash_block_cmp(fs, addr, cmp, bytes_to_cmp);
if (rc) {
return rc;
}
@ -188,7 +188,7 @@ static int _nvs_flash_cmp_const(struct nvs_fs *fs, u32_t addr, u8_t value,
/* flash block move: move a block at addr to the current data write location
* and updates the data write location.
*/
static int _nvs_flash_block_move(struct nvs_fs *fs, u32_t addr, size_t len)
static int nvs_flash_block_move(struct nvs_fs *fs, u32_t addr, size_t len)
{
int rc;
size_t bytes_to_copy, block_size;
@ -198,11 +198,11 @@ static int _nvs_flash_block_move(struct nvs_fs *fs, u32_t addr, size_t len)
while (len) {
bytes_to_copy = MIN(block_size, len);
rc = _nvs_flash_rd(fs, addr, buf, bytes_to_copy);
rc = nvs_flash_rd(fs, addr, buf, bytes_to_copy);
if (rc) {
return rc;
}
rc = _nvs_flash_data_wrt(fs, buf, bytes_to_copy);
rc = nvs_flash_data_wrt(fs, buf, bytes_to_copy);
if (rc) {
return rc;
}
@ -215,13 +215,13 @@ static int _nvs_flash_block_move(struct nvs_fs *fs, u32_t addr, size_t len)
/* erase a sector by first checking it is used and then erasing if required
* return 0 if OK, errorcode on error.
*/
static int _nvs_flash_erase_sector(struct nvs_fs *fs, u32_t addr)
static int nvs_flash_erase_sector(struct nvs_fs *fs, u32_t addr)
{
int rc;
off_t offset;
addr &= ADDR_SECT_MASK;
rc = _nvs_flash_cmp_const(fs, addr, 0xff, fs->sector_size);
rc = nvs_flash_cmp_const(fs, addr, 0xff, fs->sector_size);
if (rc <= 0) {
/* flash error or empty sector */
return rc;
@ -247,7 +247,7 @@ static int _nvs_flash_erase_sector(struct nvs_fs *fs, u32_t addr)
}
/* crc update on allocation entry */
static void _nvs_ate_crc8_update(struct nvs_ate *entry)
static void nvs_ate_crc8_update(struct nvs_ate *entry)
{
u8_t crc8;
@ -258,7 +258,7 @@ static void _nvs_ate_crc8_update(struct nvs_ate *entry)
/* crc check on allocation entry
* returns 0 if OK, 1 on crc fail
*/
static int _nvs_ate_crc8_check(const struct nvs_ate *entry)
static int nvs_ate_crc8_check(const struct nvs_ate *entry)
{
u8_t crc8;
@ -269,11 +269,11 @@ static int _nvs_ate_crc8_check(const struct nvs_ate *entry)
return 1;
}
/* _nvs_ate_cmp_const compares an ATE to a constant value. returns 0 if
/* nvs_ate_cmp_const compares an ATE to a constant value. returns 0 if
* the whole ATE is equal to value, 1 if not equal.
*/
static int _nvs_ate_cmp_const(const struct nvs_ate *entry, u8_t value)
static int nvs_ate_cmp_const(const struct nvs_ate *entry, u8_t value)
{
const u8_t *data8 = (const u8_t *)entry;
int i;
@ -288,27 +288,27 @@ static int _nvs_ate_cmp_const(const struct nvs_ate *entry, u8_t value)
}
/* store an entry in flash */
static int _nvs_flash_wrt_entry(struct nvs_fs *fs, u16_t id, const void *data,
static int nvs_flash_wrt_entry(struct nvs_fs *fs, u16_t id, const void *data,
size_t len)
{
int rc;
struct nvs_ate entry;
size_t ate_size;
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
entry.id = id;
entry.offset = (u16_t)(fs->data_wra & ADDR_OFFS_MASK);
entry.len = (u16_t)len;
entry.part = 0xff;
_nvs_ate_crc8_update(&entry);
nvs_ate_crc8_update(&entry);
rc = _nvs_flash_data_wrt(fs, data, len);
rc = nvs_flash_data_wrt(fs, data, len);
if (rc) {
return rc;
}
rc = _nvs_flash_ate_wrt(fs, &entry);
rc = nvs_flash_ate_wrt(fs, &entry);
if (rc) {
return rc;
}
@ -320,16 +320,16 @@ static int _nvs_flash_wrt_entry(struct nvs_fs *fs, u16_t id, const void *data,
/* walking through allocation entry list, from newest to oldest entries
* read ate from addr, modify addr to the previous ate
*/
static int _nvs_prev_ate(struct nvs_fs *fs, u32_t *addr, struct nvs_ate *ate)
static int nvs_prev_ate(struct nvs_fs *fs, u32_t *addr, struct nvs_ate *ate)
{
int rc;
struct nvs_ate close_ate, end_ate;
u32_t data_end_addr, ate_end_addr;
size_t ate_size;
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
rc = _nvs_flash_ate_rd(fs, *addr, ate);
rc = nvs_flash_ate_rd(fs, *addr, ate);
if (rc) {
return rc;
}
@ -346,19 +346,19 @@ static int _nvs_prev_ate(struct nvs_fs *fs, u32_t *addr, struct nvs_ate *ate)
*addr -= (1 << ADDR_SECT_SHIFT);
}
rc = _nvs_flash_ate_rd(fs, *addr, &close_ate);
rc = nvs_flash_ate_rd(fs, *addr, &close_ate);
if (rc) {
return rc;
}
rc = _nvs_ate_cmp_const(&close_ate, 0xff);
rc = nvs_ate_cmp_const(&close_ate, 0xff);
/* at the end of filesystem */
if (!rc) {
*addr = fs->ate_wra;
return 0;
}
if (!_nvs_ate_crc8_check(&close_ate)) {
if (!nvs_ate_crc8_check(&close_ate)) {
(*addr) &= ADDR_SECT_MASK;
/* update the address so it points to the last added ate */
(*addr) += close_ate.offset;
@ -371,11 +371,11 @@ static int _nvs_prev_ate(struct nvs_fs *fs, u32_t *addr, struct nvs_ate *ate)
ate_end_addr = *addr;
data_end_addr = *addr & ADDR_SECT_MASK;
while (ate_end_addr > data_end_addr) {
rc = _nvs_flash_ate_rd(fs, ate_end_addr, &end_ate);
rc = nvs_flash_ate_rd(fs, ate_end_addr, &end_ate);
if (rc) {
return rc;
}
if (!_nvs_ate_crc8_check(&end_ate)) {
if (!nvs_ate_crc8_check(&end_ate)) {
/* found a valid ate, update data_end_addr and *addr */
data_end_addr &= ADDR_SECT_MASK;
data_end_addr += end_ate.offset + end_ate.len;
@ -390,7 +390,7 @@ static int _nvs_prev_ate(struct nvs_fs *fs, u32_t *addr, struct nvs_ate *ate)
return 0;
}
static void _nvs_sector_advance(struct nvs_fs *fs, u32_t *addr)
static void nvs_sector_advance(struct nvs_fs *fs, u32_t *addr)
{
*addr += (1 << ADDR_SECT_SHIFT);
if ((*addr >> ADDR_SECT_SHIFT) == fs->sector_count) {
@ -401,13 +401,13 @@ static void _nvs_sector_advance(struct nvs_fs *fs, u32_t *addr)
/* allocation entry close (this closes the current sector) by writing offset
* of last ate to the sector end.
*/
static int _nvs_sector_close(struct nvs_fs *fs)
static int nvs_sector_close(struct nvs_fs *fs)
{
int rc;
struct nvs_ate close_ate;
size_t ate_size;
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
close_ate.id = 0xFFFF;
close_ate.len = 0U;
@ -416,11 +416,11 @@ static int _nvs_sector_close(struct nvs_fs *fs)
fs->ate_wra &= ADDR_SECT_MASK;
fs->ate_wra += (fs->sector_size - ate_size);
_nvs_ate_crc8_update(&close_ate);
nvs_ate_crc8_update(&close_ate);
rc = _nvs_flash_ate_wrt(fs, &close_ate);
rc = nvs_flash_ate_wrt(fs, &close_ate);
_nvs_sector_advance(fs, &fs->ate_wra);
nvs_sector_advance(fs, &fs->ate_wra);
fs->data_wra = fs->ate_wra & ADDR_SECT_MASK;
@ -432,7 +432,7 @@ static int _nvs_sector_close(struct nvs_fs *fs)
* that has just been started. The data to gc is in the sector after this new
* sector.
*/
static int _nvs_gc(struct nvs_fs *fs)
static int nvs_gc(struct nvs_fs *fs)
{
int rc;
struct nvs_ate close_ate, gc_ate, wlk_ate;
@ -440,22 +440,22 @@ static int _nvs_gc(struct nvs_fs *fs)
data_addr, stop_addr;
size_t ate_size;
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
sec_addr = (fs->ate_wra & ADDR_SECT_MASK);
_nvs_sector_advance(fs, &sec_addr);
nvs_sector_advance(fs, &sec_addr);
gc_addr = sec_addr + fs->sector_size - ate_size;
/* if the sector is not closed don't do gc */
rc = _nvs_flash_ate_rd(fs, gc_addr, &close_ate);
rc = nvs_flash_ate_rd(fs, gc_addr, &close_ate);
if (rc < 0) {
/* flash error */
return rc;
}
rc = _nvs_ate_cmp_const(&close_ate, 0xff);
rc = nvs_ate_cmp_const(&close_ate, 0xff);
if (!rc) {
rc = _nvs_flash_erase_sector(fs, sec_addr);
rc = nvs_flash_erase_sector(fs, sec_addr);
if (rc) {
return rc;
}
@ -469,14 +469,14 @@ static int _nvs_gc(struct nvs_fs *fs)
while (1) {
gc_prev_addr = gc_addr;
rc = _nvs_prev_ate(fs, &gc_addr, &gc_ate);
rc = nvs_prev_ate(fs, &gc_addr, &gc_ate);
if (rc) {
return rc;
}
wlk_addr = fs->ate_wra;
while (1) {
wlk_prev_addr = wlk_addr;
rc = _nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
rc = nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
if (rc) {
return rc;
}
@ -486,7 +486,7 @@ static int _nvs_gc(struct nvs_fs *fs)
* invalid, don't consider these as a match.
*/
if ((wlk_ate.id == gc_ate.id) &&
(!_nvs_ate_crc8_check(&wlk_ate))) {
(!nvs_ate_crc8_check(&wlk_ate))) {
break;
}
}
@ -501,14 +501,14 @@ static int _nvs_gc(struct nvs_fs *fs)
data_addr += gc_ate.offset;
gc_ate.offset = (u16_t)(fs->data_wra & ADDR_OFFS_MASK);
_nvs_ate_crc8_update(&gc_ate);
nvs_ate_crc8_update(&gc_ate);
rc = _nvs_flash_block_move(fs, data_addr, gc_ate.len);
rc = nvs_flash_block_move(fs, data_addr, gc_ate.len);
if (rc) {
return rc;
}
rc = _nvs_flash_ate_wrt(fs, &gc_ate);
rc = nvs_flash_ate_wrt(fs, &gc_ate);
if (rc) {
return rc;
}
@ -520,14 +520,14 @@ static int _nvs_gc(struct nvs_fs *fs)
}
}
rc = _nvs_flash_erase_sector(fs, sec_addr);
rc = nvs_flash_erase_sector(fs, sec_addr);
if (rc) {
return rc;
}
return 0;
}
static int _nvs_startup(struct nvs_fs *fs)
static int nvs_startup(struct nvs_fs *fs)
{
int rc;
struct nvs_ate last_ate;
@ -541,16 +541,16 @@ static int _nvs_startup(struct nvs_fs *fs)
k_mutex_lock(&fs->nvs_lock, K_FOREVER);
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
/* step through the sectors to find the last sector */
for (u16_t i = 0; i < fs->sector_count; i++) {
addr = (i << ADDR_SECT_SHIFT) + fs->sector_size - ate_size;
rc = _nvs_flash_cmp_const(fs, addr, 0xff,
rc = nvs_flash_cmp_const(fs, addr, 0xff,
sizeof(struct nvs_ate));
if (rc) {
/* closed sector */
_nvs_sector_advance(fs, &addr);
rc = _nvs_flash_cmp_const(fs, addr, 0xff,
nvs_sector_advance(fs, &addr);
rc = nvs_flash_cmp_const(fs, addr, 0xff,
sizeof(struct nvs_ate));
if (!rc) {
/* open sector */
@ -560,12 +560,12 @@ static int _nvs_startup(struct nvs_fs *fs)
/* none of the sectors where closed, set the address to
* the first sector
*/
_nvs_sector_advance(fs, &addr);
nvs_sector_advance(fs, &addr);
}
/* search for the first ate containing all 0xff) */
while (1) {
addr -= ate_size;
rc = _nvs_flash_cmp_const(fs, addr, 0xff,
rc = nvs_flash_cmp_const(fs, addr, 0xff,
sizeof(struct nvs_ate));
if (!rc) {
/* found ff empty location */
@ -582,14 +582,14 @@ static int _nvs_startup(struct nvs_fs *fs)
if ((addr & ADDR_OFFS_MASK) != fs->sector_size - 2 * ate_size) {
addr += ate_size;
rc = _nvs_flash_ate_rd(fs, addr, &last_ate);
rc = nvs_flash_ate_rd(fs, addr, &last_ate);
if (rc) {
goto end;
}
if (!_nvs_ate_crc8_check(&last_ate)) {
if (!nvs_ate_crc8_check(&last_ate)) {
/* crc8 is ok, complete write of ate was performed */
fs->data_wra += last_ate.offset;
fs->data_wra += _nvs_al_size(fs, last_ate.len);
fs->data_wra += nvs_al_size(fs, last_ate.len);
}
}
@ -599,7 +599,7 @@ static int _nvs_startup(struct nvs_fs *fs)
if (!empty_len) {
break;
}
rc = _nvs_flash_cmp_const(fs, fs->data_wra, 0xff, empty_len);
rc = nvs_flash_cmp_const(fs, fs->data_wra, 0xff, empty_len);
if (rc < 0) {
goto end;
}
@ -614,21 +614,21 @@ static int _nvs_startup(struct nvs_fs *fs)
* otherwise the data may not fit into the sector.
*/
addr = fs->ate_wra & ADDR_SECT_MASK;
_nvs_sector_advance(fs, &addr);
rc = _nvs_flash_cmp_const(fs, addr, 0xff, fs->sector_size);
nvs_sector_advance(fs, &addr);
rc = nvs_flash_cmp_const(fs, addr, 0xff, fs->sector_size);
if (rc < 0) {
goto end;
}
if (rc) {
/* the sector after fs->ate_wrt is not empty */
rc = _nvs_flash_erase_sector(fs, fs->ate_wra);
rc = nvs_flash_erase_sector(fs, fs->ate_wra);
if (rc) {
goto end;
}
fs->ate_wra &= ADDR_SECT_MASK;
fs->ate_wra += (fs->sector_size - 2 * ate_size);
fs->data_wra = (fs->ate_wra & ADDR_SECT_MASK);
rc = _nvs_gc(fs);
rc = nvs_gc(fs);
if (rc) {
goto end;
}
@ -651,7 +651,7 @@ int nvs_clear(struct nvs_fs *fs)
for (u16_t i = 0; i < fs->sector_count; i++) {
addr = i << ADDR_SECT_SHIFT;
rc = _nvs_flash_erase_sector(fs, addr);
rc = nvs_flash_erase_sector(fs, addr);
if (rc) {
return rc;
}
@ -698,7 +698,7 @@ int nvs_init(struct nvs_fs *fs, const char *dev_name)
return -EINVAL;
}
rc = _nvs_startup(fs);
rc = nvs_startup(fs);
if (rc) {
return rc;
}
@ -730,8 +730,8 @@ ssize_t nvs_write(struct nvs_fs *fs, u16_t id, const void *data, size_t len)
return -EACCES;
}
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
data_size = _nvs_al_size(fs, len);
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
data_size = nvs_al_size(fs, len);
/* The maximum data size is sector size - 3 ate
* where: 1 ate for data, 1 ate for sector close
@ -748,11 +748,11 @@ ssize_t nvs_write(struct nvs_fs *fs, u16_t id, const void *data, size_t len)
while (1) {
rd_addr = wlk_addr;
rc = _nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
rc = nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
if (rc) {
return rc;
}
if ((wlk_ate.id == id) && (!_nvs_ate_crc8_check(&wlk_ate))) {
if ((wlk_ate.id == id) && (!nvs_ate_crc8_check(&wlk_ate))) {
break;
}
if (wlk_addr == fs->ate_wra) {
@ -772,7 +772,7 @@ ssize_t nvs_write(struct nvs_fs *fs, u16_t id, const void *data, size_t len)
}
} else {
/* compare the data and if equal return 0 */
rc = _nvs_flash_block_cmp(fs, rd_addr, data, len);
rc = nvs_flash_block_cmp(fs, rd_addr, data, len);
if (rc <= 0) {
return rc;
}
@ -796,19 +796,19 @@ ssize_t nvs_write(struct nvs_fs *fs, u16_t id, const void *data, size_t len)
/* Leave space for delete ate */
if (sector_freespace >= data_size + ate_size) {
rc = _nvs_flash_wrt_entry(fs, id, data, len);
rc = nvs_flash_wrt_entry(fs, id, data, len);
if (rc) {
goto end;
}
break;
}
rc = _nvs_sector_close(fs);
rc = nvs_sector_close(fs);
if (rc) {
goto end;
}
rc = _nvs_gc(fs);
rc = nvs_gc(fs);
if (rc) {
goto end;
}
@ -839,7 +839,7 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, u16_t id, void *data, size_t len,
return -EACCES;
}
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
if (len > (fs->sector_size - 2 * ate_size)) {
return -EINVAL;
@ -852,11 +852,11 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, u16_t id, void *data, size_t len,
while (cnt_his <= cnt) {
rd_addr = wlk_addr;
rc = _nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
rc = nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
if (rc) {
goto err;
}
if ((wlk_ate.id == id) && (!_nvs_ate_crc8_check(&wlk_ate))) {
if ((wlk_ate.id == id) && (!nvs_ate_crc8_check(&wlk_ate))) {
cnt_his++;
}
if (wlk_addr == fs->ate_wra) {
@ -871,7 +871,7 @@ ssize_t nvs_read_hist(struct nvs_fs *fs, u16_t id, void *data, size_t len,
rd_addr &= ADDR_SECT_MASK;
rd_addr += wlk_ate.offset;
rc = _nvs_flash_rd(fs, rd_addr, data, MIN(len, wlk_ate.len));
rc = nvs_flash_rd(fs, rd_addr, data, MIN(len, wlk_ate.len));
if (rc) {
goto err;
}
@ -903,7 +903,7 @@ ssize_t nvs_calc_free_space(struct nvs_fs *fs)
return -EACCES;
}
ate_size = _nvs_al_size(fs, sizeof(struct nvs_ate));
ate_size = nvs_al_size(fs, sizeof(struct nvs_ate));
free_space = 0;
for (u16_t i = 1; i < fs->sector_count; i++) {
@ -913,7 +913,7 @@ ssize_t nvs_calc_free_space(struct nvs_fs *fs)
step_addr = fs->ate_wra;
while (1) {
rc = _nvs_prev_ate(fs, &step_addr, &step_ate);
rc = nvs_prev_ate(fs, &step_addr, &step_ate);
if (rc) {
return rc;
}
@ -921,7 +921,7 @@ ssize_t nvs_calc_free_space(struct nvs_fs *fs)
wlk_addr = fs->ate_wra;
while (1) {
rc = _nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
rc = nvs_prev_ate(fs, &wlk_addr, &wlk_ate);
if (rc) {
return rc;
}
@ -932,9 +932,9 @@ ssize_t nvs_calc_free_space(struct nvs_fs *fs)
}
if ((wlk_addr == step_addr) && step_ate.len &&
(!_nvs_ate_crc8_check(&step_ate))) {
(!nvs_ate_crc8_check(&step_ate))) {
/* count needed */
free_space -= _nvs_al_size(fs, step_ate.len);
free_space -= nvs_al_size(fs, step_ate.len);
free_space -= ate_size;
}

View file

@ -46,8 +46,8 @@ static u32_t timestamp_div;
typedef int (*out_func_t)(int c, void *ctx);
extern int _prf(int (*func)(), void *dest, char *format, va_list vargs);
extern void _vprintk(out_func_t out, void *log_output,
extern int z_prf(int (*func)(), void *dest, char *format, va_list vargs);
extern void z_vprintk(out_func_t out, void *log_output,
const char *fmt, va_list ap);
/* The RFC 5424 allows very flexible mapping and suggest the value 0 being the
@ -116,9 +116,9 @@ static int print_formatted(const struct log_output *log_output,
va_start(args, fmt);
#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCH_POSIX) && \
defined(CONFIG_LOG_ENABLE_FANCY_OUTPUT_FORMATTING)
length = _prf(out_func, (void *)log_output, (char *)fmt, args);
length = z_prf(out_func, (void *)log_output, (char *)fmt, args);
#else
_vprintk(out_func, (void *)log_output, fmt, args);
z_vprintk(out_func, (void *)log_output, fmt, args);
#endif
va_end(args);
@ -554,9 +554,9 @@ void log_output_string(const struct log_output *log_output,
#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCH_POSIX) && \
defined(CONFIG_LOG_ENABLE_FANCY_OUTPUT_FORMATTING)
length = _prf(out_func, (void *)log_output, (char *)fmt, ap);
length = z_prf(out_func, (void *)log_output, (char *)fmt, ap);
#else
_vprintk(out_func, (void *)log_output, fmt, ap);
z_vprintk(out_func, (void *)log_output, fmt, ap);
#endif
(void)length;

View file

@ -493,7 +493,6 @@ static inline struct net_buf_pool *get_data_pool(struct net_context *context)
#define get_data_pool(...) NULL
#endif /* CONFIG_NET_CONTEXT_NET_PKT_POOL */
#if NET_LOG_LEVEL >= LOG_LEVEL_DBG
void net_pkt_unref_debug(struct net_pkt *pkt, const char *caller, int line)
{

View file

@ -2640,22 +2640,22 @@ static const struct shell *shell_for_ping;
#if defined(CONFIG_NET_IPV6)
static enum net_verdict _handle_ipv6_echo_reply(struct net_pkt *pkt,
static enum net_verdict handle_ipv6_echo_reply(struct net_pkt *pkt,
struct net_ipv6_hdr *ip_hdr,
struct net_icmp_hdr *icmp_hdr);
static struct net_icmpv6_handler ping6_handler = {
.type = NET_ICMPV6_ECHO_REPLY,
.code = 0,
.handler = _handle_ipv6_echo_reply,
.handler = handle_ipv6_echo_reply,
};
static inline void _remove_ipv6_ping_handler(void)
static inline void remove_ipv6_ping_handler(void)
{
net_icmpv6_unregister_handler(&ping6_handler);
}
static enum net_verdict _handle_ipv6_echo_reply(struct net_pkt *pkt,
static enum net_verdict handle_ipv6_echo_reply(struct net_pkt *pkt,
struct net_ipv6_hdr *ip_hdr,
struct net_icmp_hdr *icmp_hdr)
{
@ -2665,13 +2665,13 @@ static enum net_verdict _handle_ipv6_echo_reply(struct net_pkt *pkt,
net_sprint_ipv6_addr(&ip_hdr->src),
net_sprint_ipv6_addr(&ip_hdr->dst));
k_sem_give(&ping_timeout);
_remove_ipv6_ping_handler();
remove_ipv6_ping_handler();
net_pkt_unref(pkt);
return NET_OK;
}
static int _ping_ipv6(const struct shell *shell, char *host)
static int ping_ipv6(const struct shell *shell, char *host)
{
struct in6_addr ipv6_target;
struct net_if *iface = net_if_get_default();
@ -2705,7 +2705,7 @@ static int _ping_ipv6(const struct shell *shell, char *host)
sys_rand32_get(),
sys_rand32_get());
if (ret) {
_remove_ipv6_ping_handler();
remove_ipv6_ping_handler();
} else {
PR("Sent a ping to %s\n", host);
}
@ -2713,40 +2713,40 @@ static int _ping_ipv6(const struct shell *shell, char *host)
return ret;
}
#else
#define _ping_ipv6(...) -ENOTSUP
#define _remove_ipv6_ping_handler()
#define ping_ipv6(...) -ENOTSUP
#define remove_ipv6_ping_handler()
#endif /* CONFIG_NET_IPV6 */
#if defined(CONFIG_NET_IPV4)
static enum net_verdict _handle_ipv4_echo_reply(struct net_pkt *pkt,
static enum net_verdict handle_ipv4_echo_reply(struct net_pkt *pkt,
struct net_ipv4_hdr *ip_hdr);
static struct net_icmpv4_handler ping4_handler = {
.type = NET_ICMPV4_ECHO_REPLY,
.code = 0,
.handler = _handle_ipv4_echo_reply,
.handler = handle_ipv4_echo_reply,
};
static inline void _remove_ipv4_ping_handler(void)
static inline void remove_ipv4_ping_handler(void)
{
net_icmpv4_unregister_handler(&ping4_handler);
}
static enum net_verdict _handle_ipv4_echo_reply(struct net_pkt *pkt,
static enum net_verdict handle_ipv4_echo_reply(struct net_pkt *pkt,
struct net_ipv4_hdr *ip_hdr)
{
PR_SHELL(shell_for_ping, "Received echo reply from %s to %s\n",
net_sprint_ipv4_addr(&ip_hdr->src),
net_sprint_ipv4_addr(&ip_hdr->dst));
k_sem_give(&ping_timeout);
_remove_ipv4_ping_handler();
remove_ipv4_ping_handler();
net_pkt_unref(pkt);
return NET_OK;
}
static int _ping_ipv4(const struct shell *shell, char *host)
static int ping_ipv4(const struct shell *shell, char *host)
{
struct in_addr ipv4_target;
int ret;
@ -2763,7 +2763,7 @@ static int _ping_ipv4(const struct shell *shell, char *host)
sys_rand32_get(),
sys_rand32_get());
if (ret) {
_remove_ipv4_ping_handler();
remove_ipv4_ping_handler();
} else {
PR("Sent a ping to %s\n", host);
}
@ -2771,8 +2771,8 @@ static int _ping_ipv4(const struct shell *shell, char *host)
return ret;
}
#else
#define _ping_ipv4(...) -ENOTSUP
#define _remove_ipv4_ping_handler()
#define ping_ipv4(...) -ENOTSUP
#define remove_ipv4_ping_handler()
#endif /* CONFIG_NET_IPV4 */
#endif /* CONFIG_NET_IPV6 || CONFIG_NET_IPV4 */
@ -2800,7 +2800,7 @@ static int cmd_net_ping(const struct shell *shell, size_t argc, char *argv[])
shell_for_ping = shell;
if (IS_ENABLED(CONFIG_NET_IPV6)) {
ret = _ping_ipv6(shell, host);
ret = ping_ipv6(shell, host);
if (!ret) {
goto wait_reply;
} else if (ret == -EIO) {
@ -2810,7 +2810,7 @@ static int cmd_net_ping(const struct shell *shell, size_t argc, char *argv[])
}
if (IS_ENABLED(CONFIG_NET_IPV4)) {
ret = _ping_ipv4(shell, host);
ret = ping_ipv4(shell, host);
if (ret) {
if (ret == -EIO) {
PR_WARNING("Cannot send IPv4 ping\n");
@ -2826,8 +2826,8 @@ wait_reply:
ret = k_sem_take(&ping_timeout, K_SECONDS(2));
if (ret == -EAGAIN) {
PR_INFO("Ping timeout\n");
_remove_ipv6_ping_handler();
_remove_ipv4_ping_handler();
remove_ipv6_ping_handler();
remove_ipv4_ping_handler();
return -ETIMEDOUT;
}

View file

@ -48,7 +48,7 @@ static int wifi_connect(u32_t mgmt_request, struct net_if *iface,
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT, wifi_connect);
static void _scan_result_cb(struct net_if *iface, int status,
static void scan_result_cb(struct net_if *iface, int status,
struct wifi_scan_result *entry)
{
if (!iface) {
@ -81,7 +81,7 @@ static int wifi_scan(u32_t mgmt_request, struct net_if *iface,
return -ENOTSUP;
}
return off_api->scan(dev, _scan_result_cb);
return off_api->scan(dev, scan_result_cb);
}
NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_SCAN, wifi_scan);

View file

@ -32,7 +32,7 @@ static struct bt_gatt_attr attrs[] = {
static struct bt_gatt_service ipss_svc = BT_GATT_SERVICE(attrs);
#endif
int _net_config_bt_setup(void)
int z_net_config_bt_setup(void)
{
struct net_if *iface;
struct device *dev;

View file

@ -7,7 +7,7 @@
*/
#if defined(CONFIG_NET_L2_BT) && defined(CONFIG_NET_CONFIG_SETTINGS)
int _net_config_bt_setup(void);
int z_net_config_bt_setup(void);
#else
#define _net_config_bt_setup(...) 0
#define z_net_config_bt_setup(...) 0
#endif

View file

@ -17,7 +17,7 @@ LOG_MODULE_DECLARE(net_config, CONFIG_NET_CONFIG_LOG_LEVEL);
#include <net/net_mgmt.h>
#include <net/ieee802154_mgmt.h>
int _net_config_ieee802154_setup(void)
int z_net_config_ieee802154_setup(void)
{
u16_t channel = CONFIG_NET_CONFIG_IEEE802154_CHANNEL;
u16_t pan_id = CONFIG_NET_CONFIG_IEEE802154_PAN_ID;

View file

@ -7,7 +7,7 @@
*/
#if defined(CONFIG_NET_L2_IEEE802154) && defined(CONFIG_NET_CONFIG_SETTINGS)
int _net_config_ieee802154_setup(void);
int z_net_config_ieee802154_setup(void);
#else
#define _net_config_ieee802154_setup(...) 0
#define z_net_config_ieee802154_setup(...) 0
#endif

View file

@ -350,12 +350,12 @@ static int init_app(struct device *device)
#if defined(CONFIG_NET_IPV6)
/* IEEE 802.15.4 is only usable if IPv6 is enabled */
ret = _net_config_ieee802154_setup();
ret = z_net_config_ieee802154_setup();
if (ret < 0) {
NET_ERR("Cannot setup IEEE 802.15.4 interface (%d)", ret);
}
ret = _net_config_bt_setup();
ret = z_net_config_bt_setup();
if (ret < 0) {
NET_ERR("Cannot setup Bluetooth interface (%d)", ret);
}

View file

@ -49,7 +49,7 @@ static void zsock_received_cb(struct net_context *ctx,
int status,
void *user_data);
static inline int _k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
static inline int k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
{
struct k_poll_event events[] = {
K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE,
@ -631,7 +631,7 @@ static inline ssize_t zsock_recv_dgram(struct net_context *ctx,
if (flags & ZSOCK_MSG_PEEK) {
int res;
res = _k_fifo_wait_non_empty(&ctx->recv_q, timeout);
res = k_fifo_wait_non_empty(&ctx->recv_q, timeout);
/* EAGAIN when timeout expired, EINTR when cancelled */
if (res && res != -EAGAIN && res != -EINTR) {
errno = -res;
@ -719,7 +719,7 @@ static inline ssize_t zsock_recv_stream(struct net_context *ctx,
return 0;
}
res = _k_fifo_wait_non_empty(&ctx->recv_q, timeout);
res = k_fifo_wait_non_empty(&ctx->recv_q, timeout);
/* EAGAIN when timeout expired, EINTR when cancelled */
if (res && res != -EAGAIN && res != -EINTR) {
errno = -res;

View file

@ -26,7 +26,7 @@ extern const struct socket_op_vtable sock_fd_op_vtable;
static const struct socket_op_vtable can_sock_fd_op_vtable;
static inline int _k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
static inline int k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
{
struct k_poll_event events[] = {
K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE,
@ -211,7 +211,7 @@ static ssize_t zcan_recvfrom_ctx(struct net_context *ctx, void *buf,
if (flags & ZSOCK_MSG_PEEK) {
int ret;
ret = _k_fifo_wait_non_empty(&ctx->recv_q, timeout);
ret = k_fifo_wait_non_empty(&ctx->recv_q, timeout);
/* EAGAIN when timeout expired, EINTR when cancelled */
if (ret && ret != -EAGAIN && ret != -EINTR) {
errno = -ret;

View file

@ -26,7 +26,7 @@ extern const struct socket_op_vtable sock_fd_op_vtable;
static const struct socket_op_vtable packet_sock_fd_op_vtable;
static inline int _k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
static inline int k_fifo_wait_non_empty(struct k_fifo *fifo, int32_t timeout)
{
struct k_poll_event events[] = {
K_POLL_EVENT_INITIALIZER(K_POLL_TYPE_FIFO_DATA_AVAILABLE,
@ -191,7 +191,7 @@ ssize_t zpacket_recvfrom_ctx(struct net_context *ctx, void *buf, size_t max_len,
if (flags & ZSOCK_MSG_PEEK) {
int res;
res = _k_fifo_wait_non_empty(&ctx->recv_q, timeout);
res = k_fifo_wait_non_empty(&ctx->recv_q, timeout);
/* EAGAIN when timeout expired, EINTR when cancelled */
if (res && res != -EAGAIN && res != -EINTR) {
errno = -res;

View file

@ -9,9 +9,9 @@
#ifdef CONFIG_NEWLIB_LIBC
typedef int (*out_func_t)(int c, void *ctx);
extern void _vprintk(out_func_t out, void *ctx, const char *fmt, va_list ap);
extern void z_vprintk(out_func_t out, void *ctx, const char *fmt, va_list ap);
#else
extern int _prf(int (*func)(), void *dest, char *format, va_list vargs);
extern int z_prf(int (*func)(), void *dest, char *format, va_list vargs);
#endif
static int out_func(int c, void *ctx)
@ -40,9 +40,9 @@ void shell_fprintf_fmt(const struct shell_fprintf *sh_fprintf,
const char *fmt, va_list args)
{
#if !defined(CONFIG_NEWLIB_LIBC) && !defined(CONFIG_ARCH_POSIX)
(void)_prf(out_func, (void *)sh_fprintf, (char *)fmt, args);
(void)z_prf(out_func, (void *)sh_fprintf, (char *)fmt, args);
#else
_vprintk(out_func, (void *)sh_fprintf, fmt, args);
z_vprintk(out_func, (void *)sh_fprintf, fmt, args);
#endif
if (sh_fprintf->ctrl_blk->autoflush) {

View file

@ -77,13 +77,13 @@ static __unused const char *TC_RESULT_STR[] = {
#define TC_END(result, fmt, ...) PRINT_DATA(fmt, ##__VA_ARGS__)
/* prints result and the function name */
#define _TC_END_RESULT(result, func) \
#define Z_TC_END_RESULT(result, func) \
do { \
TC_END(result, "%s - %s\n", TC_RESULT_TO_STR(result), func); \
PRINT_LINE; \
} while (0)
#define TC_END_RESULT(result) \
_TC_END_RESULT((result), __func__)
Z_TC_END_RESULT((result), __func__)
#if defined(CONFIG_ARCH_POSIX)
#define TC_END_POST(result) posix_exit(result)

View file

@ -22,7 +22,7 @@
void ztest_test_fail(void);
#if CONFIG_ZTEST_ASSERT_VERBOSE == 0
static inline void _zassert_(int cond, const char *file, int line)
static inline void z_zassert_(int cond, const char *file, int line)
{
if (!(cond)) {
PRINT("\n Assertion failed at %s:%d\n",
@ -31,12 +31,12 @@ static inline void _zassert_(int cond, const char *file, int line)
}
}
#define _zassert(cond, default_msg, file, line, func, msg, ...) \
_zassert_(cond, file, line)
#define z_zassert(cond, default_msg, file, line, func, msg, ...) \
z_zassert_(cond, file, line)
#else /* CONFIG_ZTEST_ASSERT_VERBOSE != 0 */
static inline void _zassert(int cond,
static inline void z_zassert(int cond,
const char *default_msg,
const char *file,
int line, const char *func,
@ -85,7 +85,7 @@ static inline void _zassert(int cond,
*/
#define zassert(cond, default_msg, msg, ...) \
_zassert(cond, msg ? ("(" default_msg ")") : (default_msg), \
z_zassert(cond, msg ? ("(" default_msg ")") : (default_msg), \
__FILE__, __LINE__, __func__, msg ? msg : "", ##__VA_ARGS__)
/**

View file

@ -34,7 +34,7 @@
* @param value Value for @a param
*/
#define ztest_expect_value(func, param, value) \
_ztest_expect_value(STRINGIFY(func), STRINGIFY(param), \
z_ztest_expect_value(STRINGIFY(func), STRINGIFY(param), \
(uintptr_t)(value))
/**
@ -49,7 +49,7 @@
* @param param Parameter to check
*/
#define ztest_check_expected_value(param) \
_ztest_check_expected_value(__func__, STRINGIFY(param), \
z_ztest_check_expected_value(__func__, STRINGIFY(param), \
(uintptr_t)(param))
/**
@ -59,7 +59,7 @@
* @param value Value to return from @a func
*/
#define ztest_returns_value(func, value) \
_ztest_returns_value(STRINGIFY(func), (uintptr_t)(value))
z_ztest_returns_value(STRINGIFY(func), (uintptr_t)(value))
/**
* @brief Get the return value for current function
@ -70,7 +70,7 @@
* @returns The value the current function should return
*/
#define ztest_get_return_value() \
_ztest_get_return_value(__func__)
z_ztest_get_return_value(__func__)
/**
* @brief Get the return value as a pointer for current function
@ -81,7 +81,7 @@
* @returns The value the current function should return as a `void *`
*/
#define ztest_get_return_value_ptr() \
((void *)_ztest_get_return_value(__func__))
((void *)z_ztest_get_return_value(__func__))
/**
* @}
@ -91,20 +91,20 @@
#include <zephyr/types.h>
void _init_mock(void);
int _cleanup_mock(void);
void z_init_mock(void);
int z_cleanup_mock(void);
void _ztest_expect_value(const char *fn, const char *name, uintptr_t value);
void _ztest_check_expected_value(const char *fn, const char *param,
void z_ztest_expect_value(const char *fn, const char *name, uintptr_t value);
void z_ztest_check_expected_value(const char *fn, const char *param,
uintptr_t value);
void _ztest_returns_value(const char *fn, uintptr_t value);
uintptr_t _ztest_get_return_value(const char *fn);
void z_ztest_returns_value(const char *fn, uintptr_t value);
uintptr_t z_ztest_get_return_value(const char *fn);
#else /* !CONFIG_ZTEST_MOCKING */
#define _init_mock()
#define _cleanup_mock() 0
#define z_init_mock()
#define z_cleanup_mock() 0
#endif /* CONFIG_ZTEST_MOCKING */

View file

@ -23,7 +23,7 @@ struct unit_test {
u32_t thread_options;
};
void _ztest_run_test_suite(const char *name, struct unit_test *suite);
void z_ztest_run_test_suite(const char *name, struct unit_test *suite);
/**
* @defgroup ztest_test Ztest testing macros
@ -164,7 +164,7 @@ extern struct k_mem_domain ztest_mem_domain;
* @param suite Test suite to run.
*/
#define ztest_run_test_suite(suite) \
_ztest_run_test_suite(#suite, _##suite)
z_ztest_run_test_suite(#suite, _##suite)
/**
* @}

View file

@ -31,7 +31,7 @@ static int cleanup_test(struct unit_test *test)
int ret = TC_PASS;
int mock_status;
mock_status = _cleanup_mock();
mock_status = z_cleanup_mock();
#ifdef KERNEL
/* we need to remove the ztest_thread information from the timeout_q.
@ -138,7 +138,7 @@ static int run_test(struct unit_test *test)
run_test_functions(test);
out:
ret |= cleanup_test(test);
_TC_END_RESULT(ret, test->name);
Z_TC_END_RESULT(ret, test->name);
return ret;
}
@ -234,9 +234,9 @@ static int run_test(struct unit_test *test)
}
if (test_result == -2) {
_TC_END_RESULT(TC_SKIP, test->name);
Z_TC_END_RESULT(TC_SKIP, test->name);
} else {
_TC_END_RESULT(ret, test->name);
Z_TC_END_RESULT(ret, test->name);
}
return ret;
@ -244,7 +244,7 @@ static int run_test(struct unit_test *test)
#endif /* !KERNEL */
void _ztest_run_test_suite(const char *name, struct unit_test *suite)
void z_ztest_run_test_suite(const char *name, struct unit_test *suite)
{
int fail = 0;
@ -290,7 +290,7 @@ K_APPMEM_PARTITION_DEFINE(ztest_mem_partition);
#ifndef KERNEL
int main(void)
{
_init_mock();
z_init_mock();
test_main();
end_report();
@ -320,7 +320,7 @@ void main(void)
k_mem_domain_add_thread(&ztest_mem_domain, k_current_get());
#endif /* CONFIG_USERSPACE */
_init_mock();
z_init_mock();
test_main();
end_report();
}

View file

@ -39,7 +39,7 @@ static struct parameter *alloc_parameter(void)
return param;
}
void _init_mock(void)
void z_init_mock(void)
{
}
@ -126,7 +126,7 @@ struct parameter *alloc_parameter(void)
return param;
}
void _init_mock(void)
void z_init_mock(void)
{
}
@ -176,12 +176,12 @@ static void insert_value(struct parameter *param, const char *fn,
static struct parameter parameter_list = { NULL, "", "", 0 };
static struct parameter return_value_list = { NULL, "", "", 0 };
void _ztest_expect_value(const char *fn, const char *name, uintptr_t val)
void z_ztest_expect_value(const char *fn, const char *name, uintptr_t val)
{
insert_value(&parameter_list, fn, name, val);
}
void _ztest_check_expected_value(const char *fn, const char *name,
void z_ztest_check_expected_value(const char *fn, const char *name,
uintptr_t val)
{
struct parameter *param;
@ -206,13 +206,13 @@ void _ztest_check_expected_value(const char *fn, const char *name,
}
}
void _ztest_returns_value(const char *fn, uintptr_t value)
void z_ztest_returns_value(const char *fn, uintptr_t value)
{
insert_value(&return_value_list, fn, "", value);
}
uintptr_t _ztest_get_return_value(const char *fn)
uintptr_t z_ztest_get_return_value(const char *fn)
{
uintptr_t value;
struct parameter *param = find_and_delete_value(&return_value_list,
@ -240,7 +240,7 @@ static void free_param_list(struct parameter *param)
}
}
int _cleanup_mock(void)
int z_cleanup_mock(void)
{
int fail = 0;