diff --git a/arch/arm/src/cxd56xx/cxd56_gnss.c b/arch/arm/src/cxd56xx/cxd56_gnss.c index de267ff91d..0cbe789d01 100644 --- a/arch/arm/src/cxd56xx/cxd56_gnss.c +++ b/arch/arm/src/cxd56xx/cxd56_gnss.c @@ -891,7 +891,7 @@ static int cxd56_gnss_save_backup_data(FAR struct file *filep, unsigned long arg) { FAR char *buf; - int fd; + struct file file; int n = 0; int32_t offset = 0; @@ -901,30 +901,30 @@ static int cxd56_gnss_save_backup_data(FAR struct file *filep, return -ENOMEM; } - fd = nx_open(CONFIG_CXD56_GNSS_BACKUP_FILENAME, - O_WRONLY | O_CREAT | O_TRUNC); - if (fd < 0) + n = file_open(&file, CONFIG_CXD56_GNSS_BACKUP_FILENAME, + O_WRONLY | O_CREAT | O_TRUNC); + if (n < 0) { kmm_free(buf); - return fd; + return n; } do { n = fw_gd_readbuffer(CXD56_CPU1_DATA_TYPE_BACKUP, offset, buf, - CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); + CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); if (n <= 0) { break; } - n = nx_write(fd, buf, n); + n = file_write(&file, buf, n); offset += n; } while (n == CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); kmm_free(buf); - nx_close(fd); + file_close(&file); return n < 0 ? n : 0; } @@ -948,7 +948,7 @@ static int cxd56_gnss_save_backup_data(FAR struct file *filep, static int cxd56_gnss_erase_backup_data(FAR struct file *filep, unsigned long arg) { - return unlink(CONFIG_CXD56_GNSS_BACKUP_FILENAME); + return nx_unlink(CONFIG_CXD56_GNSS_BACKUP_FILENAME); } /**************************************************************************** @@ -2208,7 +2208,7 @@ cxd56_gnss_read_cep_file(FAR struct file *fp, int32_t offset, static void cxd56_gnss_read_backup_file(FAR int *retval) { FAR char * buf; - int fd; + struct file file; int32_t offset = 0; size_t n; int ret = 0; @@ -2220,17 +2220,16 @@ static void cxd56_gnss_read_backup_file(FAR int *retval) goto _err; } - fd = nx_open(CONFIG_CXD56_GNSS_BACKUP_FILENAME, O_RDONLY); - if (fd < 0) + ret = file_open(&file, CONFIG_CXD56_GNSS_BACKUP_FILENAME, O_RDONLY); + if (ret < 0) { kmm_free(buf); - ret = fd; goto _err; } do { - n = nx_read(fd, buf, CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); + n = file_read(&file, buf, CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); if (n <= 0) { ret = n; @@ -2247,7 +2246,7 @@ static void cxd56_gnss_read_backup_file(FAR int *retval) } while (n > 0); - nx_close(fd); + file_close(&file); kmm_free(buf); /* Notify the termination of backup sequence by write zero length data */ diff --git a/arch/arm/src/cxd56xx/cxd56_icc.c b/arch/arm/src/cxd56xx/cxd56_icc.c index a926e002a2..66c8c1c81a 100644 --- a/arch/arm/src/cxd56xx/cxd56_icc.c +++ b/arch/arm/src/cxd56xx/cxd56_icc.c @@ -151,7 +151,7 @@ static int icc_semtake(sem_t *semid) static int icc_semtrytake(sem_t *semid) { - return sem_trywait(semid); + return nxsem_trywait(semid); } static void icc_semgive(sem_t *semid) @@ -312,7 +312,6 @@ static int icc_recv(FAR struct iccdev_s *priv, FAR iccmsg_t *msg, int32_t ms) ret = icc_semtrytake(&priv->rxwait); if (ret < 0) { - ret = -get_errno(); return ret; } } diff --git a/arch/arm/src/lc823450/lc823450_ipl2.c b/arch/arm/src/lc823450/lc823450_ipl2.c index 92da2dc7c0..5a6a0c3168 100644 --- a/arch/arm/src/lc823450/lc823450_ipl2.c +++ b/arch/arm/src/lc823450/lc823450_ipl2.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -39,6 +38,8 @@ #include #include +#include + #ifdef CONFIG_FS_EVFAT # include #endif @@ -176,7 +177,7 @@ static int blk_write(const void *buf, int len, const char *path, int offset) static int install_recovery(const char *srcpath) { - int rfd; + struct file rfile; int i; int len; int rem; @@ -188,9 +189,9 @@ static int install_recovery(const char *srcpath) return -1; } - rfd = open(srcpath, O_RDONLY, 0444); + ret = file_open(&rfile, srcpath, O_RDONLY, 0444); - if (read(rfd, &upg_image, sizeof(upg_image)) != sizeof(upg_image)) + if (file_read(&rfile, &upg_image, sizeof(upg_image)) != sizeof(upg_image)) { _info("read head"); ret = -EIO; @@ -228,7 +229,7 @@ static int install_recovery(const char *srcpath) goto err; } - lseek(rfd, upg_image.chunk[i].offset + + file_seek(&rfile, upg_image.chunk[i].offset + ((void *)&upg_image.chunk[upg_image.chunknum] - (void *)&upg_image), SEEK_SET); @@ -236,7 +237,7 @@ static int install_recovery(const char *srcpath) while (rem > 0) { - len = read(rfd, copybuf, rem > 512 ? 512 : rem); + len = file_read(&rfile, copybuf, rem > 512 ? 512 : rem); if (len < 0) { @@ -255,7 +256,7 @@ err: bchlib_teardown(handle); } - close(rfd); + file_close(&rfile); _info("DONE\n"); return ret; } @@ -585,7 +586,7 @@ static int msc_enable(int forced) /* check recovery kernel update */ - mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL); + nx_mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL); nxsig_usleep(10000); /* recovery kernel install from UPG.img */ @@ -677,7 +678,7 @@ int ipl2_main(int argc, char *argv[]) { /* check recovery kernel update */ - mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL); + nx_mount(CONFIG_MTD_CP_DEVPATH, "/mnt/sd0", "evfat", 0, NULL); nxsig_usleep(10000); /* recovery kernel install from UPG.img */ diff --git a/arch/arm/src/nrf52/nrf52_radio.c b/arch/arm/src/nrf52/nrf52_radio.c index bd9609c921..fc51d27bbf 100644 --- a/arch/arm/src/nrf52/nrf52_radio.c +++ b/arch/arm/src/nrf52/nrf52_radio.c @@ -1183,7 +1183,6 @@ nrf52_radio_initialize(int intf, FAR struct nrf52_radio_board_s *board) if (ret < 0) { wlerr("ERROR: failed to reset radio interface %d\n", ret); - errno = ret; goto errout; } @@ -1193,7 +1192,6 @@ nrf52_radio_initialize(int intf, FAR struct nrf52_radio_board_s *board) if (ret < 0) { wlerr("ERROR: failed to setup radio interface %d\n", ret); - errno = ret; goto errout; } diff --git a/arch/arm/src/sama5/sam_ssc.c b/arch/arm/src/sama5/sam_ssc.c index 220723cba8..4cb9dc87b4 100644 --- a/arch/arm/src/sama5/sam_ssc.c +++ b/arch/arm/src/sama5/sam_ssc.c @@ -1355,7 +1355,7 @@ static int ssc_rxdma_setup(struct sam_ssc_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } @@ -1771,7 +1771,7 @@ static int ssc_txdma_setup(struct sam_ssc_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } diff --git a/arch/arm/src/samv7/sam_ssc.c b/arch/arm/src/samv7/sam_ssc.c index 58e1560305..19874bd480 100644 --- a/arch/arm/src/samv7/sam_ssc.c +++ b/arch/arm/src/samv7/sam_ssc.c @@ -1331,7 +1331,7 @@ static int ssc_rxdma_setup(struct sam_ssc_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } @@ -1751,7 +1751,7 @@ static int ssc_txdma_setup(struct sam_ssc_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } diff --git a/arch/arm/src/stm32/stm32_i2s.c b/arch/arm/src/stm32/stm32_i2s.c index f9d37601e7..28cdc9cda2 100644 --- a/arch/arm/src/stm32/stm32_i2s.c +++ b/arch/arm/src/stm32/stm32_i2s.c @@ -1106,7 +1106,7 @@ static int i2s_rxdma_setup(struct stm32_i2s_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } @@ -1505,7 +1505,7 @@ static int i2s_txdma_setup(struct stm32_i2s_s *priv) if (ret < 0) { - i2serr("ERROR: wd_start failed: %d\n", errno); + i2serr("ERROR: wd_start failed: %d\n", ret); } } diff --git a/boards/arm/a1x/pcduino-a10/src/a1x_bringup.c b/boards/arm/a1x/pcduino-a10/src/a1x_bringup.c index 13295013a1..0ed7b7892c 100644 --- a/boards/arm/a1x/pcduino-a10/src/a1x_bringup.c +++ b/boards/arm/a1x/pcduino-a10/src/a1x_bringup.c @@ -40,7 +40,7 @@ #include #ifdef CONFIG_FS_PROCFS -# include +# include #endif #include @@ -100,7 +100,7 @@ int a1x_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/am335x/beaglebone-black/src/am335x_bringup.c b/boards/arm/am335x/beaglebone-black/src/am335x_bringup.c index ebfea39d73..6e32fe722f 100644 --- a/boards/arm/am335x/beaglebone-black/src/am335x_bringup.c +++ b/boards/arm/am335x/beaglebone-black/src/am335x_bringup.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #ifdef CONFIG_USERLED # include #endif @@ -160,7 +161,7 @@ int am335x_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/cxd56xx/common/src/cxd56_emmcdev.c b/boards/arm/cxd56xx/common/src/cxd56_emmcdev.c index 05ee4b21d8..1f18751ff5 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_emmcdev.c +++ b/boards/arm/cxd56xx/common/src/cxd56_emmcdev.c @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include #include "cxd56_emmc.h" @@ -76,10 +76,10 @@ int board_emmc_initialize(void) /* Mount the eMMC deivce */ - ret = mount("/dev/emmc0", "/mnt/emmc", "vfat", 0, NULL); + ret = nx_mount("/dev/emmc0", "/mnt/emmc", "vfat", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the eMMC. %d\n", errno); + ferr("ERROR: Failed to mount the eMMC. %d\n", ret); } return ret; diff --git a/boards/arm/cxd56xx/common/src/cxd56_flash.c b/boards/arm/cxd56xx/common/src/cxd56_flash.c index ff6bf3b1bd..c3fee29655 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_flash.c +++ b/boards/arm/cxd56xx/common/src/cxd56_flash.c @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include #include @@ -89,10 +89,10 @@ int board_flash_initialize(void) return ret; } - ret = mount("/dev/smart0d1", "/mnt/spif", "smartfs", 0, NULL); + ret = nx_mount("/dev/smart0d1", "/mnt/spif", "smartfs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the SmartFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the SmartFS volume: %d\n", ret); return ret; } @@ -106,10 +106,10 @@ int board_flash_initialize(void) return ret; } - ret = mount(NULL, "/mnt/spif", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/spif", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/cxd56xx/common/src/cxd56_imageproc.c b/boards/arm/cxd56xx/common/src/cxd56_imageproc.c index 87cdc21fc1..ba2ef3f5c3 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_imageproc.c +++ b/boards/arm/cxd56xx/common/src/cxd56_imageproc.c @@ -208,7 +208,7 @@ static sem_t g_rotexc; static sem_t g_geexc; static sem_t g_abexc; -static int g_gfd = -1; +static struct file g_gfile; static char g_gcmdbuf[256] __attribute__ ((aligned(16))); /**************************************************************************** @@ -534,7 +534,7 @@ void imageproc_initialize(void) cxd56_ge2dinitialize(GEDEVNAME); - g_gfd = open(GEDEVNAME, O_RDWR); + file_open(&g_gfile, GEDEVNAME, O_RDWR); putreg32(1, ROT_INTR_CLEAR); putreg32(0, ROT_INTR_ENABLE); @@ -549,10 +549,9 @@ void imageproc_finalize(void) up_disable_irq(CXD56_IRQ_ROT); irq_detach(CXD56_IRQ_ROT); - if (g_gfd > 0) + if (g_gfile.f_inode) { - close(g_gfd); - g_gfd = -1; + file_close(&g_gfile); } cxd56_ge2duninitialize(GEDEVNAME); @@ -605,7 +604,7 @@ int imageproc_resize(uint8_t * ibuf, size_t len; int ret; - if (g_gfd <= 0) + if (g_gfile.f_inode == NULL) { return -ENODEV; } @@ -663,7 +662,7 @@ int imageproc_resize(uint8_t * ibuf, /* Process resize */ len = (uintptr_t) cmd - (uintptr_t) g_gcmdbuf; - ret = write(g_gfd, g_gcmdbuf, len); + ret = file_write(&g_gfile, g_gcmdbuf, len); if (ret < 0) { ip_semgive(&g_geexc); @@ -691,7 +690,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf, uint16_t clip_width = 0; uint16_t clip_height = 0; - if (g_gfd <= 0) + if (g_gfile.f_inode == NULL) { return -ENODEV; } @@ -782,7 +781,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf, /* Process resize */ len = (uintptr_t) cmd - (uintptr_t) g_gcmdbuf; - ret = write(g_gfd, g_gcmdbuf, len); + ret = file_write(&g_gfile, g_gcmdbuf, len); if (ret < 0) { ip_semgive(&g_geexc); @@ -973,7 +972,7 @@ int imageproc_alpha_blend(imageproc_imginfo_t *dst, /* Process alpha blending */ len = (uintptr_t)cmd - (uintptr_t)g_gcmdbuf; - ret = write(g_gfd, g_gcmdbuf, len); + ret = file_write(&g_gfile, g_gcmdbuf, len); if (ret < 0) { ip_semgive(&g_abexc); diff --git a/boards/arm/cxd56xx/common/src/cxd56_spisd.c b/boards/arm/cxd56xx/common/src/cxd56_spisd.c index b6d7d45174..1ebbcd7254 100644 --- a/boards/arm/cxd56xx/common/src/cxd56_spisd.c +++ b/boards/arm/cxd56xx/common/src/cxd56_spisd.c @@ -25,9 +25,9 @@ #include #include -#include #include #include +#include #include "cxd56_spi.h" #include "cxd56_gpio.h" @@ -91,10 +91,10 @@ int board_spisd_initialize(int minor, int bus) /* Mount filesystem */ - ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); + ret = nx_mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); if (ret < 0) { - _err("ERROR: Failed to mount the SDCARD. %d\n", errno); + _err("ERROR: Failed to mount the SDCARD. %d\n", ret); } return OK; diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c index b2b8b5552f..12976b19da 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_bringup.c @@ -25,14 +25,13 @@ #include #include -#include #include #include #include #include #include -#include +#include #include #ifdef CONFIG_RNDIS @@ -325,10 +324,10 @@ int cxd56_bringup(void) } #endif - ret = mount(NULL, CXD56_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CXD56_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { - _err("ERROR: Failed to mount the procfs: %d\n", errno); + _err("ERROR: Failed to mount the procfs: %d\n", ret); } #endif @@ -360,7 +359,7 @@ int cxd56_bringup(void) ret = board_flash_initialize(); if (ret < 0) { - _err("ERROR: Failed to initialize SPI-Flash. %d\n", errno); + _err("ERROR: Failed to initialize SPI-Flash. %d\n", ret); } #endif @@ -376,13 +375,13 @@ int cxd56_bringup(void) ret = board_isx012_initialize(IMAGER_I2C); if (ret < 0) { - _err("ERROR: Failed to initialize ISX012 board. %d\n", errno); + _err("ERROR: Failed to initialize ISX012 board. %d\n", ret); } devops = isx012_initialize(); if (devops == NULL) { - _err("ERROR: Failed to populate ISX012 devops. %d\n", errno); + _err("ERROR: Failed to populate ISX012 devops. %d\n", ret); ret = ERROR; } #endif /* CONFIG_VIDEO_ISX012 */ diff --git a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c index 48b291d327..7c59437b92 100644 --- a/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c +++ b/boards/arm/cxd56xx/spresense/src/cxd56_sdcard.c @@ -24,7 +24,6 @@ #include -#include #include #include #include @@ -34,6 +33,7 @@ #include #include +#include #include #include #include @@ -148,7 +148,7 @@ static void board_sdcard_enable(FAR void *arg) { if (S_ISBLK(stat_sdio.st_mode)) { - ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); + ret = nx_mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); if (ret == 0) { finfo( @@ -156,7 +156,7 @@ static void board_sdcard_enable(FAR void *arg) } else { - _err("ERROR: Failed to mount the SDCARD. %d\n", errno); + _err("ERROR: Failed to mount the SDCARD. %d\n", ret); cxd56_sdio_resetstatus(g_sdhci.sdhci); goto release_frequency_lock; } @@ -189,10 +189,10 @@ static void board_sdcard_disable(FAR void *arg) { /* un-mount */ - ret = umount("/mnt/sd0"); + ret = nx_umount2("/mnt/sd0", 0); if (ret < 0) { - ferr("ERROR: Failed to unmount the SD Card: %d\n", errno); + ferr("ERROR: Failed to unmount the SD Card: %d\n", ret); } /* Report the new state to the SDIO driver */ diff --git a/boards/arm/eoss3/quickfeather/src/eoss3_bringup.c b/boards/arm/eoss3/quickfeather/src/eoss3_bringup.c index cfc49bb580..013c174481 100644 --- a/boards/arm/eoss3/quickfeather/src/eoss3_bringup.c +++ b/boards/arm/eoss3/quickfeather/src/eoss3_bringup.c @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/boards/arm/imx6/sabre-6quad/src/imx_bringup.c b/boards/arm/imx6/sabre-6quad/src/imx_bringup.c index ca1ba7ba31..b4e13a7796 100644 --- a/boards/arm/imx6/sabre-6quad/src/imx_bringup.c +++ b/boards/arm/imx6/sabre-6quad/src/imx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "sabre-6quad.h" /**************************************************************************** @@ -64,7 +65,7 @@ int imx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/imxrt/imxrt1020-evk/src/imxrt_bringup.c b/boards/arm/imxrt/imxrt1020-evk/src/imxrt_bringup.c index ef5745bb46..b7b6e04651 100644 --- a/boards/arm/imxrt/imxrt1020-evk/src/imxrt_bringup.c +++ b/boards/arm/imxrt/imxrt1020-evk/src/imxrt_bringup.c @@ -40,11 +40,11 @@ #include -#include #include #include #include +#include #include #include @@ -178,7 +178,7 @@ int imxrt_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/imxrt/imxrt1050-evk/src/imxrt_bringup.c b/boards/arm/imxrt/imxrt1050-evk/src/imxrt_bringup.c index b1d1ca3f67..a99ad80c03 100644 --- a/boards/arm/imxrt/imxrt1050-evk/src/imxrt_bringup.c +++ b/boards/arm/imxrt/imxrt1050-evk/src/imxrt_bringup.c @@ -39,11 +39,11 @@ #include -#include #include #include #include +#include #include #include #include @@ -151,7 +151,7 @@ int imxrt_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_bringup.c b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_bringup.c index e9c0c774a0..558a4278d4 100644 --- a/boards/arm/imxrt/imxrt1060-evk/src/imxrt_bringup.c +++ b/boards/arm/imxrt/imxrt1060-evk/src/imxrt_bringup.c @@ -40,11 +40,11 @@ #include -#include #include #include #include +#include #include #include #include @@ -165,7 +165,7 @@ int imxrt_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/imxrt/teensy-4.x/src/imxrt_bringup.c b/boards/arm/imxrt/teensy-4.x/src/imxrt_bringup.c index 5819e628bb..6c84308c7d 100644 --- a/boards/arm/imxrt/teensy-4.x/src/imxrt_bringup.c +++ b/boards/arm/imxrt/teensy-4.x/src/imxrt_bringup.c @@ -24,11 +24,11 @@ #include -#include #include #include #include +#include #include #include #include @@ -127,7 +127,7 @@ int imxrt_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/kinetis/freedom-k28f/src/k28_bringup.c b/boards/arm/kinetis/freedom-k28f/src/k28_bringup.c index f55d398ee7..744266dcbd 100644 --- a/boards/arm/kinetis/freedom-k28f/src/k28_bringup.c +++ b/boards/arm/kinetis/freedom-k28f/src/k28_bringup.c @@ -24,7 +24,6 @@ #include -#include #include #include #include @@ -32,6 +31,8 @@ #include "freedom-k28f.h" +#include + #ifdef CONFIG_PL2303 # include #endif @@ -66,7 +67,7 @@ int k28_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); @@ -103,15 +104,15 @@ int k28_bringup(void) { /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_FRDMK28F_SDHC_MOUNT_BLKDEV, - CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, - CONFIG_FRDMK28F_SDHC_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_FRDMK28F_SDHC_MOUNT_BLKDEV, + CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, + CONFIG_FRDMK28F_SDHC_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", - CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, errno); + CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, ret); } } diff --git a/boards/arm/kinetis/freedom-k28f/src/k28_usbhshost.c b/boards/arm/kinetis/freedom-k28f/src/k28_usbhshost.c index f5c47c627b..5a4e0e359c 100644 --- a/boards/arm/kinetis/freedom-k28f/src/k28_usbhshost.c +++ b/boards/arm/kinetis/freedom-k28f/src/k28_usbhshost.c @@ -48,6 +48,7 @@ #include #include +#include #include #include #include @@ -288,15 +289,11 @@ static void usb_msc_connect(FAR void *arg) /* Mount */ - ret = mount((FAR const char *)blkdev, (FAR const char *)mntpnt, + ret = nx_mount((FAR const char *)blkdev, (FAR const char *)mntpnt, CONFIG_FRDMK28F_USB_AUTOMOUNT_FSTYPE, 0, NULL); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - ferr("ERROR: Mount failed: %d\n", errcode); - UNUSED(errcode); + ferr("ERROR: Mount failed: %d\n", ret); } } @@ -364,18 +361,15 @@ static void usb_msc_disconnect(FAR void *arg) /* Unmount */ - ret = umount2((FAR const char *)mntpnt, MNT_FORCE); + ret = nx_umount2((FAR const char *)mntpnt, MNT_FORCE); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - /* We expect the error to be EBUSY meaning that the volume could * not be unmounted because there are currently reference via open * files or directories. */ - if (errcode == EBUSY) + if (ret == -EBUSY) { finfo("WARNING: Volume is busy, try again later\n"); diff --git a/boards/arm/kinetis/freedom-k64f/src/k64_bringup.c b/boards/arm/kinetis/freedom-k64f/src/k64_bringup.c index aadb0cff4d..a3d62886a8 100644 --- a/boards/arm/kinetis/freedom-k64f/src/k64_bringup.c +++ b/boards/arm/kinetis/freedom-k64f/src/k64_bringup.c @@ -40,11 +40,12 @@ #include #include -#include #include #include #include +#include + #ifdef HAVE_RTC_DRIVER # include # include "kinetis_alarm.h" @@ -78,12 +79,11 @@ int k64_bringup(void) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); + ret = nx_mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif @@ -108,15 +108,15 @@ int k64_bringup(void) { /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_FRDMK64F_SDHC_MOUNT_BLKDEV, - CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, - CONFIG_FRDMK64F_SDHC_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_FRDMK64F_SDHC_MOUNT_BLKDEV, + CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, + CONFIG_FRDMK64F_SDHC_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", - CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, errno); + CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, ret); } } diff --git a/boards/arm/kinetis/freedom-k66f/src/k66_bringup.c b/boards/arm/kinetis/freedom-k66f/src/k66_bringup.c index b3994087a5..19a8ffe5fa 100644 --- a/boards/arm/kinetis/freedom-k66f/src/k66_bringup.c +++ b/boards/arm/kinetis/freedom-k66f/src/k66_bringup.c @@ -41,11 +41,12 @@ #include #include -#include #include #include #include + #include +#include #include #include @@ -79,12 +80,11 @@ int k66_bringup(void) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); + ret = nx_mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif @@ -103,15 +103,15 @@ int k66_bringup(void) { /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_FRDMK66F_SDHC_MOUNT_BLKDEV, - CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, - CONFIG_FRDMK66F_SDHC_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_FRDMK66F_SDHC_MOUNT_BLKDEV, + CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, + CONFIG_FRDMK66F_SDHC_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", - CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, errno); + CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, ret); } } diff --git a/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c b/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c index f29ceb6a65..3ecf2eb2a8 100644 --- a/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c +++ b/boards/arm/kinetis/twr-k64f120m/src/k64_appinit.c @@ -43,9 +43,9 @@ #include #include #include -#include #include +#include #ifdef CONFIG_KINETIS_SDHC # include @@ -93,12 +93,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); + ret = nx_mount(NULL, PROCFS_MOUNTPOUNT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_bringup.c b/boards/arm/lc823450/lc823450-xgevk/src/lc823450_bringup.c index ce19482677..45a9ca88e9 100644 --- a/boards/arm/lc823450/lc823450-xgevk/src/lc823450_bringup.c +++ b/boards/arm/lc823450/lc823450-xgevk/src/lc823450_bringup.c @@ -25,7 +25,6 @@ #include #include -#include #include #include @@ -34,6 +33,7 @@ # include #endif +#include #include #ifdef CONFIG_RNDIS @@ -78,7 +78,7 @@ int lc823450_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); @@ -86,7 +86,7 @@ int lc823450_bringup(void) #endif #ifdef CONFIG_FS_FAT - ret = mount("/dev/mtdblock0p10", "/mnt/sd0", "vfat", 0, NULL); + ret = nx_mount("/dev/mtdblock0p10", "/mnt/sd0", "vfat", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount vfat at /mnt/sd0: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_bringup.c index 8c0d993d17..a657826eeb 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/lpc4088-devkit/src/lpc17_40_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -354,7 +354,7 @@ int lpc4088_devkit_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system at the default location, /proc */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_bringup.c index 89723bc19f..d43cfa5ca0 100644 --- a/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/lpc4088-quickstart/src/lpc17_40_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -390,7 +390,7 @@ int lpc4088_quickstart_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system at the default location, /proc */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_bringup.c index d975e32d7f..2884bfe961 100644 --- a/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/lx_cpu/src/lpc17_40_bringup.c @@ -44,11 +44,11 @@ #include #include #include -#include #include #include #include +#include #include #include #include @@ -390,7 +390,7 @@ int lx_cpu_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system at the default location, /proc */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_bringup.c index 2574198457..4a2dedff2d 100644 --- a/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/mcb1700/src/lpc17_40_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -47,6 +46,7 @@ #include #include +#include #include #include #include @@ -373,7 +373,7 @@ int mcb1700_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_bringup.c index 810a18f362..03762562be 100644 --- a/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/olimex-lpc1766stk/src/lpc17_40_bringup.c @@ -39,12 +39,12 @@ #include -#include #include #include #include #include +#include #include #include #include @@ -392,7 +392,7 @@ int lpc17_40_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_bringup.c index 4b83b23251..b1070571a7 100644 --- a/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/open1788/src/lpc17_40_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -389,7 +389,7 @@ int open1788_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system at the default location, /proc */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_bringup.c b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_bringup.c index 46b2fbdc17..a1bde89991 100644 --- a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_bringup.c +++ b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_bringup.c @@ -42,9 +42,9 @@ #include #include #include -#include #include +#include #include #include #include @@ -120,21 +120,20 @@ int pnev5180b_bringup(void) int ret = OK; #ifdef CONFIG_FS_PROCFS - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d\n", + ret); goto done; } #endif #ifdef CONFIG_FS_BINFS - ret = mount(NULL, "/bin", "binfs", 0, NULL); + ret = nx_mount(NULL, "/bin", "binfs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d (%d)\n", - ret, errno); + syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d\n", ret); goto done; } #endif diff --git a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_romfs.c b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_romfs.c index bf2401686b..41636d18d6 100644 --- a/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_romfs.c +++ b/boards/arm/lpc17xx_40xx/pnev5180b/src/lpc17_40_romfs.c @@ -51,6 +51,7 @@ #include #include +#include #include #include "lpc17_40_romfs.h" @@ -146,12 +147,12 @@ int lpc17_40_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_LPC17_40_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, + ret = nx_mount(MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c b/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c index 704b1e46f6..0e9311dc36 100644 --- a/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c +++ b/boards/arm/lpc17xx_40xx/u-blox-c027/src/lpc17_40_appinit.c @@ -44,11 +44,10 @@ #include #include +#include #include #include -#include - #include "lpc17_40_ssp.h" /**************************************************************************** @@ -156,12 +155,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c b/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c index c26eda2820..3c1465cd81 100644 --- a/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c +++ b/boards/arm/lpc214x/zp214xpa/src/lpc2148_appinit.c @@ -84,7 +84,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/lpc31xx/ea3131/src/lpc31_fillpage.c b/boards/arm/lpc31xx/ea3131/src/lpc31_fillpage.c index 85e565e59f..2ba49981da 100644 --- a/boards/arm/lpc31xx/ea3131/src/lpc31_fillpage.c +++ b/boards/arm/lpc31xx/ea3131/src/lpc31_fillpage.c @@ -183,7 +183,7 @@ struct pg_source_s { bool initialized; /* TRUE: we are initialized */ - int fd; /* File descriptor of the nuttx.bin file */ + struct file file; /* File descriptor of the nuttx.bin file */ }; #endif @@ -272,16 +272,16 @@ static inline void lpc31_initsrc(void) /* Now mount the file system */ snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3131_PAGING_MINOR); - ret = mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat", MS_RDONLY, - NULL); + ret = nx_mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat", + MS_RDONLY, NULL); DEBUGASSERT(ret == OK); #endif /* CONFIG_EA3131_PAGING_SDSLOT */ /* Open the selected path for read-only access */ - g_pgsrc.fd = nx_open(CONFIG_PAGING_BINPATH, O_RDONLY); - DEBUGASSERT(g_pgsrc.fd >= 0); + file_open(&g_pgsrc.file, CONFIG_PAGING_BINPATH, O_RDONLY); + DEBUGASSERT(g_pgsrc.file.f_inode != NULL); /* Then we are initialized */ @@ -443,12 +443,12 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage) /* Seek to that position */ - pos = nx_seek(g_pgsrc.fd, offset, SEEK_SET); + pos = file_seek(&g_pgsrc.file, offset, SEEK_SET); DEBUGASSERT(pos != (off_t)-1); /* And read the page data from that offset */ - nbytes = nx_read(g_pgsrc.fd, vpage, PAGESIZE); + nbytes = file_read(&g_pgsrc.file, vpage, PAGESIZE); DEBUGASSERT(nbytes == PAGESIZE); return OK; diff --git a/boards/arm/lpc31xx/ea3152/src/lpc31_fillpage.c b/boards/arm/lpc31xx/ea3152/src/lpc31_fillpage.c index eb9d75d84f..98f99e84e8 100644 --- a/boards/arm/lpc31xx/ea3152/src/lpc31_fillpage.c +++ b/boards/arm/lpc31xx/ea3152/src/lpc31_fillpage.c @@ -182,7 +182,7 @@ struct pg_source_s { bool initialized; /* TRUE: we are initialized */ - int fd; /* File descriptor of the nuttx.bin file */ + struct file file; /* File descriptor of the nuttx.bin file */ }; #endif @@ -272,16 +272,16 @@ static inline void lpc31_initsrc(void) /* Now mount the file system */ snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3152_PAGING_MINOR); - ret = mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat", MS_RDONLY, - NULL); + ret = nx_mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat", + MS_RDONLY, NULL); DEBUGASSERT(ret == OK); #endif /* CONFIG_EA3152_PAGING_SDSLOT */ /* Open the selected path for read-only access */ - g_pgsrc.fd = nx_open(CONFIG_PAGING_BINPATH, O_RDONLY); - DEBUGASSERT(g_pgsrc.fd >= 0); + file_open(&g_pgsrc.file, CONFIG_PAGING_BINPATH, O_RDONLY); + DEBUGASSERT(g_pgsrc.file.f_inode != NULL); /* Then we are initialized */ @@ -444,12 +444,12 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage) /* Seek to that position */ - pos = nx_seek(g_pgsrc.fd, offset, SEEK_SET); + pos = file_seek(&g_pgsrc.file, offset, SEEK_SET); DEBUGASSERT(pos != (off_t)-1); /* And read the page data from that offset */ - nbytes = nx_read(g_pgsrc.fd, vpage, PAGESIZE); + nbytes = file_read(&g_pgsrc.file, vpage, PAGESIZE); DEBUGASSERT(nbytes == PAGESIZE); return OK; diff --git a/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c b/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c index fabd18ebbb..14a57ec001 100644 --- a/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c +++ b/boards/arm/lpc43xx/bambino-200e/src/lpc43_appinit.c @@ -53,7 +53,7 @@ # include "lpc43_spifi.h" # ifdef CONFIG_SPFI_NXFFS -# include +# include # include # endif #endif @@ -125,10 +125,10 @@ static int nsh_spifi_initialize(void) /* Mount the file system at /mnt/spifi */ - ret = mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c index 5a3975da0f..46b7471b20 100644 --- a/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c +++ b/boards/arm/lpc43xx/lpc4330-xplorer/src/lpc43_appinit.c @@ -52,7 +52,7 @@ # include "lpc43_spifi.h" # ifdef CONFIG_SPFI_NXFFS -# include +# include # include # endif #endif @@ -116,10 +116,10 @@ static int nsh_spifi_initialize(void) /* Mount the file system at /mnt/spifi */ - ret = mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c b/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c index 977e5946a7..55984950f6 100644 --- a/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c +++ b/boards/arm/lpc43xx/lpc4357-evb/src/lpc43_appinit.c @@ -52,7 +52,7 @@ # include "lpc43_spifi.h" # ifdef CONFIG_SPFI_NXFFS -# include +# include # include # endif #endif @@ -116,10 +116,10 @@ static int nsh_spifi_initialize(void) /* Mount the file system at /mnt/spifi */ - ret = mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/spifi", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_bringup.c b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_bringup.c index 107a449f9b..52a1b458cb 100644 --- a/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_bringup.c +++ b/boards/arm/lpc54xx/lpcxpresso-lpc54628/src/lpc54_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_VIDEO_FB # include #endif @@ -95,7 +96,7 @@ int lpc54_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/max326xx/max32660-evsys/src/max326_bringup.c b/boards/arm/max326xx/max32660-evsys/src/max326_bringup.c index 9d4f87ffe1..d4dea0d789 100644 --- a/boards/arm/max326xx/max32660-evsys/src/max326_bringup.c +++ b/boards/arm/max326xx/max32660-evsys/src/max326_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "max32660-evsys.h" /**************************************************************************** @@ -87,7 +88,7 @@ int max326_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/nrf52/nrf52832-mdk/src/nrf52_bringup.c b/boards/arm/nrf52/nrf52832-mdk/src/nrf52_bringup.c index 1421ebb788..fcfa59eca5 100644 --- a/boards/arm/nrf52/nrf52832-mdk/src/nrf52_bringup.c +++ b/boards/arm/nrf52/nrf52832-mdk/src/nrf52_bringup.c @@ -28,7 +28,7 @@ #include #ifdef CONFIG_FS_PROCFS -#include +#include #endif #ifdef CONFIG_NRF52_WDT @@ -66,7 +66,7 @@ int nrf52_bringup(void) int ret; #ifdef CONFIG_FS_PROCFS - mount(NULL, "/proc", "procfs", 0, NULL); + nx_mount(NULL, "/proc", "procfs", 0, NULL); #endif #ifdef CONFIG_NRF52_WDT diff --git a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c index 5f25f7f2d8..0f1002d936 100644 --- a/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c +++ b/boards/arm/rp2040/raspberrypi-pico/src/rp2040_bringup.c @@ -26,7 +26,8 @@ #include #include -#include + +#include #include "rp2040_pico.h" @@ -45,7 +46,7 @@ int rp2040_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c index f6c137aec9..00b83eb8b6 100644 --- a/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/rddrone-uavcan144/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -108,7 +109,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c index 47cdb369b4..012d24012a 100644 --- a/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/rddrone-uavcan146/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -108,7 +109,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c index ccb5900214..09ec8ef0f0 100644 --- a/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/s32k118evb/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -102,7 +103,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c index daedd840bb..10b8eb5bd0 100644 --- a/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/s32k144evb/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -107,7 +108,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c index f650a347f3..d2434a90ca 100644 --- a/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/s32k146evb/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -107,7 +108,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c index 39a10606c6..a038be0de9 100644 --- a/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c +++ b/boards/arm/s32k1xx/s32k148evb/src/s32k1xx_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -106,7 +107,7 @@ int s32k1xx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/sam34/arduino-due/src/sam_bringup.c b/boards/arm/sam34/arduino-due/src/sam_bringup.c index 23d29af207..6268519b2d 100644 --- a/boards/arm/sam34/arduino-due/src/sam_bringup.c +++ b/boards/arm/sam34/arduino-due/src/sam_bringup.c @@ -39,11 +39,11 @@ #include -#include #include #include #include +#include #include "arduino-due.h" @@ -97,7 +97,7 @@ int sam_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", diff --git a/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c b/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c index 4b3c9bd493..18c9d2275a 100644 --- a/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c +++ b/boards/arm/sam34/flipnclick-sam3x/src/sam_bringup.c @@ -39,11 +39,11 @@ #include -#include #include #include #include +#include #include "flipnclick-sam3x.h" @@ -76,7 +76,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", diff --git a/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c b/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c index 4e33ca9208..da96e63b4b 100644 --- a/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c +++ b/boards/arm/sam34/sam4cmp-db/src/sam_bringup.c @@ -40,11 +40,12 @@ #include #include -#include #include #include +#include + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -64,7 +65,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c b/boards/arm/sam34/sam4e-ek/src/sam_appinit.c index 61e2d0fd52..24bf51e0a1 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_appinit.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_appinit.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include diff --git a/boards/arm/sam34/sam4e-ek/src/sam_at25.c b/boards/arm/sam34/sam4e-ek/src/sam_at25.c index a13dda320e..3d6a924479 100644 --- a/boards/arm/sam34/sam4e-ek/src/sam_at25.c +++ b/boards/arm/sam34/sam4e-ek/src/sam_at25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include "sam_spi.h" @@ -125,10 +124,10 @@ int sam_at25_automount(int minor) /* Mount the file system at /mnt/at25 */ - ret = mount(NULL, "/mnt/at25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c index 031590c540..ad86614e90 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_appinit.c @@ -40,8 +40,6 @@ #include -#include - #include #include #include @@ -50,6 +48,7 @@ #include #include +#include #ifdef CONFIG_CDCACM # include @@ -108,8 +107,7 @@ int board_app_initialize(uintptr_t arg) if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to create the CDC/ACM serial device: %d (%d)\n", - ret, errno); + "ERROR: Failed to create the CDC/ACM serial device: %d\n", ret); return ret; } #endif @@ -118,9 +116,7 @@ int board_app_initialize(uintptr_t arg) ret = sam_nand_automount(SAM_SMC_CS0); if (ret < 0) { - syslog(LOG_ERR, - "ERROR: Failed to initialize the NAND: %d (%d)\n", - ret, errno); + syslog(LOG_ERR, "ERROR: Failed to initialize the NAND: %d\n", ret); return ret; } #endif @@ -133,9 +129,7 @@ int board_app_initialize(uintptr_t arg) ret = sam_hsmci_initialize(); if (ret < 0) { - syslog(LOG_ERR, - "ERROR: sam_hsmci_initialize() failed: %d (%d)\n", - ret, errno); + syslog(LOG_ERR, "ERROR: sam_hsmci_initialize() failed: %d\n", ret); return ret; } #endif @@ -145,12 +139,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif @@ -158,12 +151,11 @@ int board_app_initialize(uintptr_t arg) #if HAVE_HSMCI syslog(LOG_INFO, "Mounting /dev/mmcsd0 to /fat\n"); - ret = mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL); + ret = nx_mount("/dev/mmcsd0", "/fat", "vfat", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the FAT filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the FAT filesystem: %d\n", ret); return ret; } #endif @@ -174,8 +166,7 @@ int board_app_initialize(uintptr_t arg) ret = sam_sdinitialize(0, 0); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", - ret); + syslog(LOG_ERR, "ERROR: Failed to initialize MMC/SD slot: %d\n", ret); return ret; } #endif @@ -187,8 +178,7 @@ int board_app_initialize(uintptr_t arg) ret = usbmonitor_start(); if (ret != OK) { - syslog(LOG_ERR, - "ERROR: Failed to start USB monitor: %d (%d)\n", ret, errno); + syslog(LOG_ERR, "ERROR: Failed to start USB monitor: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c index 037436911c..74f55f805b 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_nandflash.c @@ -24,13 +24,13 @@ #include -#include #include #include #include #include #include +#include #include #include @@ -226,10 +226,10 @@ int sam_nand_automount(int minor) /* Mount the file system at /mnt/nand */ - ret = mount(NULL, "/mnt/nand", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nand", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c b/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c index d980e9466e..ebb0c896ed 100644 --- a/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c +++ b/boards/arm/sam34/sam4s-xplained-pro/src/sam_wdt.c @@ -114,7 +114,7 @@ static int wdog_daemon(int argc, char *argv[]) ret = file_ioctl(&filestruct, WDIOC_START, 0); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_START) failed: %d\n", ret); goto errout_with_dev; } @@ -127,7 +127,7 @@ static int wdog_daemon(int argc, char *argv[]) ret = file_ioctl(&filestruct, WDIOC_KEEPALIVE, 0); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_KEEPALIVE) failed: %d\n", ret); goto errout_with_dev; } } @@ -180,7 +180,7 @@ int sam_watchdog_initialize(void) (unsigned long)CONFIG_WDT_TIMEOUT); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_SETTIMEOUT) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_SETTIMEOUT) failed: %d\n", ret); goto errout_with_dev; } @@ -191,7 +191,7 @@ int sam_watchdog_initialize(void) (unsigned long)CONFIG_WDT_MINTIME); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_MINTIME) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_MINTIME) failed: %d\n", ret); goto errout_with_dev; } diff --git a/boards/arm/sama5/giant-board/src/sam_bringup.c b/boards/arm/sama5/giant-board/src/sam_bringup.c index b12f5c67fc..0726384439 100644 --- a/boards/arm/sama5/giant-board/src/sam_bringup.c +++ b/boards/arm/sama5/giant-board/src/sam_bringup.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -171,15 +172,15 @@ static int nsh_sdmmc_initialize(void) #ifdef CONFIG_SAMA5D27_SDMMC0_MOUNT /* Mount the volume on SDMMC0 */ - ret = mount(CONFIG_SAMA5D27_SDMMC0_MOUNT_BLKDEV, - CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D27_SDMMC0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D27_SDMMC0_MOUNT_BLKDEV, + CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D27_SDMMC0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { mcerr("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, ret); } #endif #endif @@ -207,15 +208,15 @@ static int nsh_sdmmc_initialize(void) #ifdef CONFIG_SAMA5D27_SDMMC1_MOUNT /* Mount the volume on SDMMC1 */ - ret = mount(CONFIG_SAMA5D27_SDMMC1_MOUNT_BLKDEV, - CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D27_SDMMC1_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D27_SDMMC1_MOUNT_BLKDEV, + CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D27_SDMMC1_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { mcerr("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, ret); } #endif #endif @@ -274,14 +275,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_GIANT_BOARD_ROMFS_ROMDISK_DEVNAME, - CONFIG_GIANT_BOARD_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_GIANT_BOARD_ROMFS_ROMDISK_DEVNAME, + CONFIG_GIANT_BOARD_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - fserr("ERROR: mount(%s,%s,romfs) failed: %d\n", + fserr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_GIANT_BOARD_ROMFS_ROMDISK_DEVNAME, - CONFIG_GIANT_BOARD_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_GIANT_BOARD_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif @@ -361,7 +362,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_at25.c b/boards/arm/sama5/sama5d2-xult/src/sam_at25.c index 4827b695bd..d839b727be 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_at25.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_at25.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -33,6 +31,7 @@ #include #include +#include #include #include "sam_spi.h" @@ -109,10 +108,10 @@ int sam_at25_automount(int minor) /* Mount the file system at /mnt/at25 */ - ret = mount(NULL, "/mnt/at25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c b/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c index ae0ea3f9e8..c9fc04ca9d 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_bringup.c @@ -30,6 +30,7 @@ #include #include +#include #include #include #include @@ -172,15 +173,15 @@ static int nsh_sdmmc_initialize(void) #ifdef CONFIG_SAMA5D27_SDMMC0_MOUNT /* Mount the volume on SDMMC0 */ - ret = mount(CONFIG_SAMA5D27_SDMMC0_MOUNT_BLKDEV, - CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D27_SDMMC0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D27_SDMMC0_MOUNT_BLKDEV, + CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D27_SDMMC0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D27_SDMMC0_MOUNT_MOUNTPOINT, ret); } #endif #endif @@ -208,15 +209,15 @@ static int nsh_sdmmc_initialize(void) #ifdef CONFIG_SAMA5D27_SDMMC1_MOUNT /* Mount the volume on SDMMC1 */ - ret = mount(CONFIG_SAMA5D27_SDMMC1_MOUNT_BLKDEV, - CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D27_SDMMC1_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D27_SDMMC1_MOUNT_BLKDEV, + CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D27_SDMMC1_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D27_SDMMC1_MOUNT_MOUNTPOINT, ret); } #endif #endif @@ -275,15 +276,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, ret); } } #endif @@ -306,15 +307,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI1 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, ret); } } #endif @@ -341,14 +342,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - _err("ERROR: mount(%s,%s,romfs) failed: %d\n", + _err("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif @@ -428,7 +429,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/sama5/sama5d2-xult/src/sam_nandflash.c b/boards/arm/sama5/sama5d2-xult/src/sam_nandflash.c index 81e64b4abc..304713842c 100644 --- a/boards/arm/sama5/sama5d2-xult/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d2-xult/src/sam_nandflash.c @@ -24,13 +24,13 @@ #include -#include #include #include #include #include #include +#include #include #include "arm_arch.h" @@ -192,10 +192,10 @@ int sam_nand_automount(int minor) /* Mount the file system at /mnt/nand */ - ret = mount(NULL, "/mnt/nand", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nand", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c b/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c index 65389f7069..c3797a22e5 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_appinit.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c b/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c index c0b7518979..e31c7aa6de 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_at25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include "sam_spi.h" @@ -124,10 +123,10 @@ int sam_at25_automount(int minor) /* Mount the file system at /mnt/at25 */ - ret = mount(NULL, "/mnt/at25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c b/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c index d4332aed34..47013cc72f 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_bringup.c @@ -46,6 +46,8 @@ #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -176,15 +178,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, ret); } } #endif @@ -207,15 +209,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI1 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, ret); } } #endif @@ -242,14 +244,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - _err("ERROR: mount(%s,%s,romfs) failed: %d\n", + _err("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif @@ -329,7 +331,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c b/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c index 1ab6a0e431..38e86cc32c 100644 --- a/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d3-xplained/src/sam_nandflash.c @@ -46,13 +46,13 @@ #include -#include #include #include #include #include #include +#include #include #include "arm_arch.h" @@ -213,10 +213,10 @@ int sam_nand_automount(int minor) /* Mount the file system at /mnt/nand */ - ret = mount(NULL, "/mnt/nand", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nand", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c b/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c index 350d6ae814..0857c124b4 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_appinit.c @@ -39,14 +39,13 @@ #include -#include - #include #include #include #include #include +#include #ifdef CONFIG_USBMONITOR # include @@ -227,7 +226,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c b/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c index 07052a69bf..7ad8e71613 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_at24.c @@ -57,8 +57,6 @@ #include -#include - #include #include #include @@ -66,6 +64,7 @@ #include #include +#include #include #include "sam_twi.h" @@ -147,10 +146,10 @@ int sam_at24_automount(int minor) /* Mount the file system at /mnt/at24 */ finfo("Mount the NXFFS file system at /dev/at24\n"); - ret = mount(NULL, "/mnt/at24", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at24", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c b/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c index 80abece1f0..4e0b39ff72 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_at25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include "sam_spi.h" @@ -125,10 +124,10 @@ int sam_at25_automount(int minor) /* Mount the file system at /mnt/at25 */ - ret = mount(NULL, "/mnt/at25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c b/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c index a02732a3df..52f4d0afd5 100644 --- a/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d3x-ek/src/sam_nandflash.c @@ -46,13 +46,13 @@ #include -#include #include #include #include #include #include +#include #include #include "arm_arch.h" @@ -213,10 +213,10 @@ int sam_nand_automount(int minor) /* Mount the file system at /mnt/nand */ - ret = mount(NULL, "/mnt/nand", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nand", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/sama5/sama5d4-ek/src/at25_main.c b/boards/arm/sama5/sama5d4-ek/src/at25_main.c index f1a53f6ec3..10af0ec4c3 100644 --- a/boards/arm/sama5/sama5d4-ek/src/at25_main.c +++ b/boards/arm/sama5/sama5d4-ek/src/at25_main.c @@ -145,7 +145,7 @@ int at25_main(int argc, char *argv) fd = open(g_at25dev, O_WRONLY); if (fd < 0) { - int errcode = get_errno(); + int errcode = errno; fprintf(stderr, "ERROR: Failed to open %s: %d\n", g_at25dev, errcode); return EXIT_FAILURE; } @@ -206,7 +206,7 @@ int at25_main(int argc, char *argv) nwritten = write(fd, src, memoutstream.public.nput); if (nwritten <= 0) { - int errcode = get_errno(); + int errcode = errno; if (errno != EINTR) { fprintf(stderr, "ERROR: Write failed: %d\n", errcode); @@ -236,7 +236,7 @@ int at25_main(int argc, char *argv) fd = open(g_at25dev, O_RDONLY); if (fd < 0) { - int errcode = get_errno(); + int errcode = errno; fprintf(stderr, "ERROR: Failed to open %s: %d\n", g_at25dev, errcode); return EXIT_FAILURE; } @@ -255,7 +255,7 @@ int at25_main(int argc, char *argv) nread = read(fd, g_iobuffer, rdsize); if (nread <= 0) { - int errcode = get_errno(); + int errcode = errno; if (errno != EINTR) { fprintf(stderr, "ERROR: Read failed: %d\n", errcode); diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_at25.c b/boards/arm/sama5/sama5d4-ek/src/sam_at25.c index 7456e5b83d..362f5254d0 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_at25.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_at25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include @@ -154,10 +153,10 @@ int sam_at25_automount(int minor) /* Mount the file system at /mnt/at25 */ - ret = mount(NULL, "/mnt/at25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c b/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c index d5617d1c3a..f4ae399b51 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_bringup.c @@ -46,6 +46,8 @@ #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -191,15 +193,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI0_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI0_MOUNT_MOUNTPOINT, ret); } } #endif @@ -222,15 +224,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI1 */ - ret = mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_HSMCI1_MOUNT_BLKDEV, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount %s: %d\n", - CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_HSMCI1_MOUNT_MOUNTPOINT, ret); } } #endif @@ -257,14 +259,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - _err("ERROR: mount(%s,%s,romfs) failed: %d\n", + _err("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_SAMA5D4EK_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMA5D4EK_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif @@ -344,7 +346,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMA5_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { _err("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c b/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c index 5e644d107b..ccfa04cae3 100644 --- a/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c +++ b/boards/arm/sama5/sama5d4-ek/src/sam_nandflash.c @@ -46,13 +46,13 @@ #include -#include #include #include #include #include #include +#include #include #include "arm_arch.h" @@ -213,10 +213,10 @@ int sam_nand_automount(int minor) /* Mount the file system at /mnt/nand */ - ret = mount(NULL, "/mnt/nand", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nand", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/samd5e5/metro-m4/src/sam_at24.c b/boards/arm/samd5e5/metro-m4/src/sam_at24.c index 21f9608af1..278fc00471 100644 --- a/boards/arm/samd5e5/metro-m4/src/sam_at24.c +++ b/boards/arm/samd5e5/metro-m4/src/sam_at24.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -33,6 +31,7 @@ #include #include +#include #include #include "metro-m4.h" @@ -106,11 +105,11 @@ int sam_at24_automount(int minor) /* Mount the file system at /mnt/at24 */ finfo("Mount the NXFFS file system at /dev/at24\n"); - ret = mount(NULL, "/mnt/at24", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at24", "nxffs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount the NXFFS volume: %d\n", - errno); + ret); return ret; } #endif diff --git a/boards/arm/samd5e5/metro-m4/src/sam_bringup.c b/boards/arm/samd5e5/metro-m4/src/sam_bringup.c index 8e86759161..b469163b55 100644 --- a/boards/arm/samd5e5/metro-m4/src/sam_bringup.c +++ b/boards/arm/samd5e5/metro-m4/src/sam_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -51,6 +50,8 @@ #include "sam_wdt.h" #endif +#include + #ifdef CONFIG_SAMD5E5_SERCOM5_ISI2C #include #include "hardware/sam_i2c_master.h" @@ -100,7 +101,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", @@ -154,7 +155,7 @@ int sam_bringup(void) /* Mount the file system at /mnt/nvm */ - ret = mount("/dev/smart0", "/mnt/nvm", "smartfs", 0, NULL); + ret = nx_mount("/dev/smart0", "/mnt/nvm", "smartfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount the SmartFS volume: %d\n", diff --git a/boards/arm/samd5e5/metro-m4/src/sam_usbhost.c b/boards/arm/samd5e5/metro-m4/src/sam_usbhost.c index 033edf8d3c..ea102399dc 100644 --- a/boards/arm/samd5e5/metro-m4/src/sam_usbhost.c +++ b/boards/arm/samd5e5/metro-m4/src/sam_usbhost.c @@ -29,7 +29,6 @@ #include #include -#include #include #include #include diff --git a/boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c b/boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c index b2ea8a3864..edde78f756 100644 --- a/boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c +++ b/boards/arm/samd5e5/same54-xplained-pro/src/sam_bringup.c @@ -39,12 +39,13 @@ #include -#include #include #include #include #include +#include + #include "same54-xplained-pro.h" /**************************************************************************** @@ -78,7 +79,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslot(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/samv7/same70-xplained/src/sam_bringup.c b/boards/arm/samv7/same70-xplained/src/sam_bringup.c index 0ab84fae1a..4fd09de03a 100644 --- a/boards/arm/samv7/same70-xplained/src/sam_bringup.c +++ b/boards/arm/samv7/same70-xplained/src/sam_bringup.c @@ -53,6 +53,7 @@ #include #include +#include #include #include @@ -177,7 +178,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAME70_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAME70_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", @@ -214,15 +215,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_BLKDEV, - CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_MOUNTPOINT, - CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_BLKDEV, + CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_MOUNTPOINT, + CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", - CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAME70XPLAINED_HSMCI0_MOUNT_MOUNTPOINT, ret); } } @@ -249,14 +250,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAME70XPLAINED_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_DEVNAME, + CONFIG_SAME70XPLAINED_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: mount(%s,%s,romfs) failed: %d\n", + syslog(LOG_ERR, "ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_SAME70XPLAINED_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAME70XPLAINED_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_SAME70XPLAINED_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif diff --git a/boards/arm/samv7/samv71-xult/src/sam_bringup.c b/boards/arm/samv7/samv71-xult/src/sam_bringup.c index 62eaa1a62d..379be84007 100644 --- a/boards/arm/samv7/samv71-xult/src/sam_bringup.c +++ b/boards/arm/samv7/samv71-xult/src/sam_bringup.c @@ -47,6 +47,8 @@ #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -285,7 +287,7 @@ int sam_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SAMV71_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SAMV71_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", @@ -322,15 +324,15 @@ int sam_bringup(void) /* Mount the volume on HSMCI0 */ - ret = mount(CONFIG_SAMV71XULT_HSMCI0_MOUNT_BLKDEV, - CONFIG_SAMV71XULT_HSMCI0_MOUNT_MOUNTPOINT, - CONFIG_SAMV71XULT_HSMCI0_MOUNT_FSTYPE, - 0, NULL); + ret = nx_mount(CONFIG_SAMV71XULT_HSMCI0_MOUNT_BLKDEV, + CONFIG_SAMV71XULT_HSMCI0_MOUNT_MOUNTPOINT, + CONFIG_SAMV71XULT_HSMCI0_MOUNT_FSTYPE, + 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", - CONFIG_SAMV71XULT_HSMCI0_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMV71XULT_HSMCI0_MOUNT_MOUNTPOINT, ret); } } @@ -357,14 +359,14 @@ int sam_bringup(void) { /* Mount the file system */ - ret = mount(CONFIG_SAMV71XULT_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMV71XULT_ROMFS_MOUNT_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(CONFIG_SAMV71XULT_ROMFS_ROMDISK_DEVNAME, + CONFIG_SAMV71XULT_ROMFS_MOUNT_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: mount(%s,%s,romfs) failed: %d\n", + syslog(LOG_ERR, "ERROR: nx_mount(%s,%s,romfs) failed: %d\n", CONFIG_SAMV71XULT_ROMFS_ROMDISK_DEVNAME, - CONFIG_SAMV71XULT_ROMFS_MOUNT_MOUNTPOINT, errno); + CONFIG_SAMV71XULT_ROMFS_MOUNT_MOUNTPOINT, ret); } } #endif @@ -409,11 +411,11 @@ int sam_bringup(void) /* Mount the file system at /mnt/s25fl1 */ - ret = mount(NULL, "/mnt/s25fl1", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/s25fl1", "nxffs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount the NXFFS volume: %d\n", - errno); + ret); return ret; } diff --git a/boards/arm/samv7/samv71-xult/src/sam_ili9488.c b/boards/arm/samv7/samv71-xult/src/sam_ili9488.c index 1c15d43323..eccbecb4df 100644 --- a/boards/arm/samv7/samv71-xult/src/sam_ili9488.c +++ b/boards/arm/samv7/samv71-xult/src/sam_ili9488.c @@ -990,7 +990,7 @@ static int sam_lcd_dmawait(FAR struct sam_dev_s *priv, uint32_t timeout) sam_lcd_dmatimeout, (wdparm_t)priv); if (ret < 0) { - lcderr("ERROR: wd_start failed: %d\n", errno); + lcderr("ERROR: wd_start failed: %d\n", ret); } /* Loop until the event (or the timeout occurs). */ diff --git a/boards/arm/stm32/axoloti/src/stm32_bringup.c b/boards/arm/stm32/axoloti/src/stm32_bringup.c index 2826ed0a79..2d7be190bb 100644 --- a/boards/arm/stm32/axoloti/src/stm32_bringup.c +++ b/boards/arm/stm32/axoloti/src/stm32_bringup.c @@ -39,12 +39,13 @@ #include -#include #include #include #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -179,7 +180,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "failed to mount procfs at %s %d\n", diff --git a/boards/arm/stm32/clicker2-stm32/src/stm32_bringup.c b/boards/arm/stm32/clicker2-stm32/src/stm32_bringup.c index bad47d445b..36105abcc4 100644 --- a/boards/arm/stm32/clicker2-stm32/src/stm32_bringup.c +++ b/boards/arm/stm32/clicker2-stm32/src/stm32_bringup.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include #ifdef CONFIG_USBMONITOR @@ -95,7 +95,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/cloudctrl/src/stm32_w25.c b/boards/arm/stm32/cloudctrl/src/stm32_w25.c index 21323cadc7..09c24b11c1 100644 --- a/boards/arm/stm32/cloudctrl/src/stm32_w25.c +++ b/boards/arm/stm32/cloudctrl/src/stm32_w25.c @@ -40,8 +40,6 @@ #include -#include - #include #include #include @@ -50,6 +48,7 @@ #ifdef CONFIG_STM32_SPI1 # include # include +# include # include #endif @@ -142,10 +141,10 @@ int stm32_w25initialize(int minor) /* Mount the file system at /mnt/w25 */ snprintf(devname, 12, "/mnt/w25%c", 'a' + minor); - ret = mount(NULL, devname, "nxffs", 0, NULL); + ret = nx_mount(NULL, devname, "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32/fire-stm32v2/src/stm32_w25.c b/boards/arm/stm32/fire-stm32v2/src/stm32_w25.c index 65cd257f76..95e129d213 100644 --- a/boards/arm/stm32/fire-stm32v2/src/stm32_w25.c +++ b/boards/arm/stm32/fire-stm32v2/src/stm32_w25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -49,6 +47,7 @@ #ifdef CONFIG_STM32_SPI1 # include # include +# include # include #endif @@ -141,10 +140,10 @@ int stm32_w25initialize(int minor) /* Mount the file system at /mnt/w25 */ snprintf(devname, 12, "/mnt/w25%c", 'a' + minor); - ret = mount(NULL, devname, "nxffs", 0, NULL); + ret = nx_mount(NULL, devname, "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c index 5ada3ad2d7..6f9fb84a0f 100644 --- a/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f207zg/src/stm32_bringup.c @@ -40,7 +40,6 @@ #include #include -#include #include #include diff --git a/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c index 5cbcc7c4bd..8b0d9db0d9 100644 --- a/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f303ze/src/stm32_bringup.c @@ -40,7 +40,6 @@ #include #include -#include #include #include diff --git a/boards/arm/stm32/nucleo-f412zg/src/stm32_bringup.c b/boards/arm/stm32/nucleo-f412zg/src/stm32_bringup.c index 439d4c5e2d..d777a8341b 100644 --- a/boards/arm/stm32/nucleo-f412zg/src/stm32_bringup.c +++ b/boards/arm/stm32/nucleo-f412zg/src/stm32_bringup.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #include "stm32.h" #include "nucleo-f412zg.h" @@ -87,7 +88,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c index d4984e1021..d8efe09f14 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c +++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_appinitialize.c @@ -25,11 +25,11 @@ #include #include -#include #include #include #include "nucleo-144.h" +#include #include #ifdef CONFIG_STM32_ROMFS #include "stm32_romfs.h" @@ -71,7 +71,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c index 6c8c32442c..3d75188429 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c +++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_bbsram.c @@ -361,7 +361,7 @@ int stm32_bbsram_int(void) syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf); } - rv = unlink(HARDFAULT_PATH); + rv = nx_unlink(HARDFAULT_PATH); if (rv < 0) { syslog(LOG_INFO, "stm32 bbsram: Failed to unlink Fault Log file" diff --git a/boards/arm/stm32/nucleo-f429zi/src/stm32_romfs_initialize.c b/boards/arm/stm32/nucleo-f429zi/src/stm32_romfs_initialize.c index ef7c63c636..722fa04c35 100644 --- a/boards/arm/stm32/nucleo-f429zi/src/stm32_romfs_initialize.c +++ b/boards/arm/stm32/nucleo-f429zi/src/stm32_romfs_initialize.c @@ -31,6 +31,7 @@ #include #include +#include #include #include "stm32_romfs.h" @@ -126,12 +127,12 @@ int stm32_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c b/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c index 785ee7fc92..6b146d53bc 100644 --- a/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c +++ b/boards/arm/stm32/nucleo-l152re/src/stm32_appinitialize.c @@ -26,9 +26,9 @@ #include #include -#include #include +#include #include #include "nucleo-l152re.h" @@ -95,7 +95,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(0, STM32_PROCFS_MOUNTPOINT, "procfs", 0, 0); + ret = nx_mount(0, STM32_PROCFS_MOUNTPOINT, "procfs", 0, 0); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/olimex-stm32-p407/src/stm32_bringup.c b/boards/arm/stm32/olimex-stm32-p407/src/stm32_bringup.c index 9be036973d..373eb9dc9c 100644 --- a/boards/arm/stm32/olimex-stm32-p407/src/stm32_bringup.c +++ b/boards/arm/stm32/olimex-stm32-p407/src/stm32_bringup.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include #include @@ -106,7 +106,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/omnibusf4/src/stm32_bringup.c b/boards/arm/stm32/omnibusf4/src/stm32_bringup.c index 09573445d5..e8ec765a9c 100644 --- a/boards/arm/stm32/omnibusf4/src/stm32_bringup.c +++ b/boards/arm/stm32/omnibusf4/src/stm32_bringup.c @@ -41,12 +41,13 @@ #include -#include #include #include #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -271,7 +272,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c b/boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c index d26ca27e24..5c98f55315 100644 --- a/boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c +++ b/boards/arm/stm32/omnibusf4/src/stm32_romfs_initialize.c @@ -46,6 +46,7 @@ #include #include +#include #include #include "stm32_romfs.h" @@ -141,12 +142,12 @@ int stm32_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, - "romfs", MS_RDONLY, NULL); + ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, + "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/stm32/photon/src/stm32_bringup.c b/boards/arm/stm32/photon/src/stm32_bringup.c index 5ac7f9081b..87acb1f9ba 100644 --- a/boards/arm/stm32/photon/src/stm32_bringup.c +++ b/boards/arm/stm32/photon/src/stm32_bringup.c @@ -40,12 +40,12 @@ #include #include -#include #include #include #include #include +#include #include @@ -78,7 +78,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/photon/src/stm32_rgbled.c b/boards/arm/stm32/photon/src/stm32_rgbled.c index 41270822b3..af5272525b 100644 --- a/boards/arm/stm32/photon/src/stm32_rgbled.c +++ b/boards/arm/stm32/photon/src/stm32_rgbled.c @@ -110,8 +110,8 @@ int stm32_rgbled_setup(void) struct pwm_lowerhalf_s *ledr; struct pwm_lowerhalf_s *ledg; struct pwm_lowerhalf_s *ledb; + struct file file; int ret; - int fd; /* Have we already initialized? */ @@ -165,17 +165,17 @@ int stm32_rgbled_setup(void) return ret; } - fd = nx_open("/dev/rgbled0", O_WRONLY); - if (fd < 0) + ret = file_open(&file, "/dev/rgbled0", O_WRONLY); + if (ret < 0) { - lederr("ERROR: open failed: %d\n", fd); + lederr("ERROR: open failed: %d\n", ret); return ret; } /* Initialize led off */ - nx_write(fd, "#000000", 8); - nx_close(fd); + file_write(&file, "#000000", 8); + file_close(&file); /* Now we are initialized */ diff --git a/boards/arm/stm32/photon/src/stm32_wdt.c b/boards/arm/stm32/photon/src/stm32_wdt.c index 3c3c1462b3..134bd90097 100644 --- a/boards/arm/stm32/photon/src/stm32_wdt.c +++ b/boards/arm/stm32/photon/src/stm32_wdt.c @@ -82,7 +82,7 @@ static int wdog_daemon(int argc, char *argv[]) ret = file_ioctl(&filestruct, WDIOC_START, 0); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_START) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_START) failed: %d\n", ret); goto exit_close_dev; } @@ -95,7 +95,7 @@ static int wdog_daemon(int argc, char *argv[]) ret = file_ioctl(&filestruct, WDIOC_KEEPALIVE, 0); if (ret < 0) { - wderr("ERROR: ioctl(WDIOC_KEEPALIVE) failed: %d\n", errno); + wderr("ERROR: file_ioctl(WDIOC_KEEPALIVE) failed: %d\n", ret); break; } } @@ -150,7 +150,7 @@ int photon_watchdog_initialize(void) if (ret < 0) { - wderr("ERROR: watchdog configuration failed: %d\n", errno); + wderr("ERROR: watchdog configuration failed: %d\n", ret); return ret; } diff --git a/boards/arm/stm32/shenzhou/src/stm32_w25.c b/boards/arm/stm32/shenzhou/src/stm32_w25.c index 3d5d472c9d..846b5c75e9 100644 --- a/boards/arm/stm32/shenzhou/src/stm32_w25.c +++ b/boards/arm/stm32/shenzhou/src/stm32_w25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -49,6 +47,7 @@ #ifdef CONFIG_STM32_SPI1 # include # include +# include # include # include "stm32_spi.h" @@ -142,10 +141,10 @@ int stm32_w25initialize(int minor) /* Mount the file system at /mnt/w25 */ snprintf(devname, 12, "/mnt/w25%c", 'a' + minor); - ret = mount(NULL, devname, "nxffs", 0, NULL); + ret = nx_mount(NULL, devname, "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32/stm3240g-eval/src/stm32_bringup.c b/boards/arm/stm32/stm3240g-eval/src/stm32_bringup.c index ecb70108f7..a721fe6960 100644 --- a/boards/arm/stm32/stm3240g-eval/src/stm32_bringup.c +++ b/boards/arm/stm32/stm3240g-eval/src/stm32_bringup.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include #ifdef CONFIG_STM32_SPI1 @@ -329,7 +329,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_at24.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_at24.c index d3caece497..6b8a7319c8 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_at24.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_at24.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include "stm32_i2c.h" @@ -128,10 +127,10 @@ int stm32_at24_automount(int minor) /* Mount the file system at /mnt/at24 */ finfo("Mount the NXFFS file system at /dev/at24\n"); - ret = mount(NULL, "/mnt/at24", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at24", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c index c0b39b3478..c0729ef582 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -47,6 +46,7 @@ #include #include +#include #include #ifdef CONFIG_USBMONITOR @@ -278,7 +278,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/stm32f103-minimum/src/stm32_w25.c b/boards/arm/stm32/stm32f103-minimum/src/stm32_w25.c index 6e9d12718d..173710cdc8 100644 --- a/boards/arm/stm32/stm32f103-minimum/src/stm32_w25.c +++ b/boards/arm/stm32/stm32f103-minimum/src/stm32_w25.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include diff --git a/boards/arm/stm32/stm32f411-minimum/src/stm32_bringup.c b/boards/arm/stm32/stm32f411-minimum/src/stm32_bringup.c index 36fe9494c6..d3af59f13a 100644 --- a/boards/arm/stm32/stm32f411-minimum/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f411-minimum/src/stm32_bringup.c @@ -24,9 +24,10 @@ #include -#include #include +#include + #include "stm32.h" #ifdef CONFIG_STM32_OTGFS @@ -73,7 +74,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/stm32f411e-disco/src/stm32_bringup.c b/boards/arm/stm32/stm32f411e-disco/src/stm32_bringup.c index 6e3009c758..60a2cf5636 100644 --- a/boards/arm/stm32/stm32f411e-disco/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f411e-disco/src/stm32_bringup.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #include "stm32.h" #ifdef CONFIG_STM32_OTGFS @@ -88,7 +89,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/stm32f429i-disco/src/stm32_bringup.c b/boards/arm/stm32/stm32f429i-disco/src/stm32_bringup.c index 919c224f77..0fdfd6219b 100644 --- a/boards/arm/stm32/stm32f429i-disco/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f429i-disco/src/stm32_bringup.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include #ifdef CONFIG_STM32_SPI4 @@ -120,12 +120,11 @@ int stm32_bringup(void) #ifdef HAVE_PROC /* mount the proc filesystem */ - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c index 0992baab0e..224c352a0a 100644 --- a/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32f4discovery/src/stm32_bringup.c @@ -39,12 +39,13 @@ #include -#include #include #include #include #include +#include + #ifdef CONFIG_USBMONITOR # include #endif @@ -457,7 +458,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32/stm32f4discovery/src/stm32_romfs_initialize.c b/boards/arm/stm32/stm32f4discovery/src/stm32_romfs_initialize.c index bcca7bded0..bfb925ec59 100644 --- a/boards/arm/stm32/stm32f4discovery/src/stm32_romfs_initialize.c +++ b/boards/arm/stm32/stm32f4discovery/src/stm32_romfs_initialize.c @@ -46,6 +46,7 @@ #include #include +#include #include #include "stm32_romfs.h" @@ -142,12 +143,12 @@ int stm32_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, + ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c b/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c index 13ce8c9309..6c1b6fb13b 100644 --- a/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32ldiscovery/src/stm32_bringup.c @@ -40,12 +40,12 @@ #include #include -#include #include #include #include #include +#include #include @@ -80,7 +80,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/stm32vldiscovery/src/stm32_bringup.c b/boards/arm/stm32/stm32vldiscovery/src/stm32_bringup.c index d35cf4480a..719df762fa 100644 --- a/boards/arm/stm32/stm32vldiscovery/src/stm32_bringup.c +++ b/boards/arm/stm32/stm32vldiscovery/src/stm32_bringup.c @@ -39,12 +39,12 @@ #include -#ifdef CONFIG_FS_PROCFS -# include -#endif - #include +#ifdef CONFIG_FS_PROCFS +# include +#endif + #ifdef CONFIG_BUTTONS # include #endif @@ -101,7 +101,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32/viewtool-stm32f107/src/stm32_bringup.c b/boards/arm/stm32/viewtool-stm32f107/src/stm32_bringup.c index 00ea71e08b..1e79d171ee 100644 --- a/boards/arm/stm32/viewtool-stm32f107/src/stm32_bringup.c +++ b/boards/arm/stm32/viewtool-stm32f107/src/stm32_bringup.c @@ -40,12 +40,12 @@ #include #include -#include #include #include #include #include +#include #ifdef CONFIG_RTC_DRIVER # include @@ -154,7 +154,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_bringup.c b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_bringup.c index 120c0bc4cf..7904677c6b 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_bringup.c +++ b/boards/arm/stm32f0l0g0/nucleo-f072rb/src/stm32_bringup.c @@ -39,10 +39,10 @@ #include -#include #include #include +#include #include #include "stm32_i2c.h" @@ -85,7 +85,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_bringup.c b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_bringup.c index e0e898f8ee..741378e081 100644 --- a/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_bringup.c +++ b/boards/arm/stm32f0l0g0/nucleo-f091rc/src/stm32_bringup.c @@ -39,10 +39,11 @@ #include -#include #include #include +#include + #include "nucleo-f091rc.h" /**************************************************************************** @@ -70,7 +71,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_bringup.c b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_bringup.c index a960fbe0e9..8612b3af02 100644 --- a/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_bringup.c +++ b/boards/arm/stm32f0l0g0/stm32f051-discovery/src/stm32_bringup.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #include "stm32f051-discovery.h" /**************************************************************************** @@ -69,7 +70,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_bringup.c b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_bringup.c index 7f633321ab..84cf5ca5a6 100644 --- a/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_bringup.c +++ b/boards/arm/stm32f0l0g0/stm32f072-discovery/src/stm32_bringup.c @@ -39,9 +39,10 @@ #include -#include #include +#include + #include "stm32f072-discovery.h" /**************************************************************************** @@ -69,7 +70,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32f7/nucleo-144/src/stm32_appinitialize.c b/boards/arm/stm32f7/nucleo-144/src/stm32_appinitialize.c index 0a05935192..e275285dfd 100644 --- a/boards/arm/stm32f7/nucleo-144/src/stm32_appinitialize.c +++ b/boards/arm/stm32f7/nucleo-144/src/stm32_appinitialize.c @@ -42,11 +42,11 @@ #include #include -#include #include #include #include "nucleo-144.h" +#include #include #ifdef CONFIG_STM32_ROMFS #include "stm32_romfs.h" @@ -88,7 +88,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c index 783cf0980e..5e03d6d0db 100644 --- a/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c +++ b/boards/arm/stm32f7/nucleo-144/src/stm32_bbsram.c @@ -376,11 +376,11 @@ int stm32_bbsram_int(void) syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf); } - rv = unlink(HARDFAULT_PATH); + rv = nx_unlink(HARDFAULT_PATH); if (rv < 0) { - syslog(LOG_INFO, "stm32 bbsram: Failed to unlink Fault Log file " - "[%s] (%d)\n", HARDFAULT_PATH, rv); + syslog(LOG_INFO, "stm32 bbsram: Failed to unlink Fault Log file" + " [%s] (%d)\n", HARDFAULT_PATH, rv); } } #endif /* CONFIG_STM32F7_SAVE_CRASHDUMP */ diff --git a/boards/arm/stm32f7/nucleo-144/src/stm32_romfs_initialize.c b/boards/arm/stm32f7/nucleo-144/src/stm32_romfs_initialize.c index 82d17860fa..68e9ce21c7 100644 --- a/boards/arm/stm32f7/nucleo-144/src/stm32_romfs_initialize.c +++ b/boards/arm/stm32f7/nucleo-144/src/stm32_romfs_initialize.c @@ -46,6 +46,7 @@ #include #include +#include #include #include "stm32_romfs.h" @@ -141,12 +142,12 @@ int stm32_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, + ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c index 8ace173ccf..f1f02c7ec7 100644 --- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c +++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_bringup.c @@ -40,12 +40,13 @@ #include #include -#include #include #include #include "stm32f746g-disco.h" +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -88,12 +89,11 @@ int stm32_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c index 73f958ed3c..568ae5e090 100644 --- a/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c +++ b/boards/arm/stm32f7/stm32f746g-disco/src/stm32_n25q.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include +#include #include @@ -119,10 +119,10 @@ int stm32_n25qxxx_setup(void) return ret; } - ret = mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL); if (ret < 0) { - _err("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + _err("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } diff --git a/boards/arm/stm32f7/stm32f769i-disco/src/stm32_bringup.c b/boards/arm/stm32f7/stm32f769i-disco/src/stm32_bringup.c index e9c70f3378..107c931ed7 100644 --- a/boards/arm/stm32f7/stm32f769i-disco/src/stm32_bringup.c +++ b/boards/arm/stm32f7/stm32f769i-disco/src/stm32_bringup.c @@ -40,12 +40,13 @@ #include #include -#include #include #include #include #include +#include + #include "stm32f769i-disco.h" /**************************************************************************** @@ -81,7 +82,7 @@ int stm32_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c index f49d3d0015..67ad101db3 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c +++ b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c @@ -40,10 +40,11 @@ #include #include -#include #include #include +#include + #ifdef CONFIG_USBMONITOR #include #endif @@ -174,12 +175,11 @@ int stm32_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); } #endif /* CONFIG_FS_PROCFS */ diff --git a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_romfs_initialize.c b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_romfs_initialize.c index 661937758e..9103d8ffb8 100644 --- a/boards/arm/stm32h7/nucleo-h743zi/src/stm32_romfs_initialize.c +++ b/boards/arm/stm32h7/nucleo-h743zi/src/stm32_romfs_initialize.c @@ -31,6 +31,7 @@ #include #include +#include #include #include "stm32_romfs.h" @@ -126,12 +127,12 @@ int stm32_romfs_initialize(void) finfo("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_STM32_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); - ret = mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, + ret = nx_mount(MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, "romfs", MS_RDONLY, NULL); if (ret < 0) { - ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", - MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, errno); + ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", + MOUNT_DEVNAME, CONFIG_STM32_ROMFS_MOUNTPOINT, ret); return ret; } diff --git a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c b/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c index 11b615ecf9..6f56b2c8de 100644 --- a/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c +++ b/boards/arm/stm32h7/stm32h747i-disco/src/stm32_bringup.c @@ -40,12 +40,13 @@ #include #include -#include #include #include #include "stm32h747i-disco.h" +#include + #ifdef CONFIG_BUTTONS # include #endif @@ -160,12 +161,11 @@ int stm32_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); } #endif /* CONFIG_FS_PROCFS */ diff --git a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c b/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c index f36942d19a..d2fe1bce49 100644 --- a/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c +++ b/boards/arm/stm32l4/b-l475e-iot01a/src/stm32_bringup.c @@ -42,10 +42,10 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -79,7 +79,7 @@ int stm32l4_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c index dbefb07ddc..1767c80647 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_appinit.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include +#include #include #include #include @@ -140,12 +140,12 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", + ret); return ret; } #endif diff --git a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_at45db.c b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_at45db.c index c1454bd056..45d6da6f9e 100644 --- a/boards/arm/stm32l4/nucleo-l432kc/src/stm32_at45db.c +++ b/boards/arm/stm32l4/nucleo-l432kc/src/stm32_at45db.c @@ -39,8 +39,6 @@ #include -#include - #include #include #include @@ -48,6 +46,7 @@ #include #include +#include #include #include "stm32l4_spi.h" @@ -121,10 +120,10 @@ int stm32_at45dbinitialize(int minor) /* Mount the file system at /mnt/at45db */ finfo("Mount the NXFFS file system at /dev/at45db\n"); - ret = mount(NULL, "/mnt/at45db", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at45db", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c b/boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c index 477d4f0fa7..36f7c30f9c 100644 --- a/boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c +++ b/boards/arm/stm32l4/nucleo-l452re/src/stm32_adc.c @@ -199,7 +199,7 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, { if (nbytes != -EINTR) { - aerr("ERROR: nx_read() failed: %d\n", nbytes); + aerr("ERROR: file_read() failed: %d\n", nbytes); ret = (int)nbytes; goto out_close; } diff --git a/boards/arm/stm32l4/nucleo-l452re/src/stm32_bringup.c b/boards/arm/stm32l4/nucleo-l452re/src/stm32_bringup.c index 3d4d6eee16..b939407b7e 100644 --- a/boards/arm/stm32l4/nucleo-l452re/src/stm32_bringup.c +++ b/boards/arm/stm32l4/nucleo-l452re/src/stm32_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include @@ -47,6 +46,7 @@ #include #include #include +#include #include "stm32l4_i2c.h" #include "nucleo-l452re.h" @@ -90,7 +90,7 @@ int stm32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c index 3f33e88e97..3ab5e72f69 100644 --- a/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c +++ b/boards/arm/stm32l4/nucleo-l476rg/src/stm32_appinit.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -49,6 +48,7 @@ #include #include +#include #include #include @@ -181,12 +181,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c index 903b97c36e..bfa33424ce 100644 --- a/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c +++ b/boards/arm/stm32l4/nucleo-l496zg/src/stm32_appinitialize.c @@ -42,11 +42,11 @@ #include #include -#include #include #include #include "nucleo-144.h" +#include #include #include "stm32l4_i2c.h" @@ -104,7 +104,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, STM32_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", diff --git a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c index 74dde724b5..9e7b68ca1d 100644 --- a/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c +++ b/boards/arm/stm32l4/stm32l476-mdk/src/stm32_bringup.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include +#include #include #include @@ -114,12 +114,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c index d7e013bc3e..9506124706 100644 --- a/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c +++ b/boards/arm/stm32l4/stm32l476vg-disco/src/stm32_appinit.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include +#include #include #include @@ -142,12 +142,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif @@ -248,10 +247,10 @@ int board_app_initialize(uintptr_t arg) /* Mount the file system at /mnt/nxffs */ - ret = mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/nxffs", "nxffs", 0, NULL); if (ret < 0) { - _err("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + _err("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_adc.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_adc.c index 91b58196fd..17e74e2a60 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_adc.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_adc.c @@ -191,7 +191,7 @@ int stm32l4_adc_measure_voltages(uint32_t *vrefint, uint32_t *vbat, uint32_t *ve { if (nbytes != -EINTR) { - aerr("ERROR: nx_read() failed: %d\n", nbytes); + aerr("ERROR: file_read() failed: %d\n", nbytes); ret = (int)nbytes; goto out_close; } diff --git a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c index 1dd28d57b0..56d93a7b44 100644 --- a/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c +++ b/boards/arm/stm32l4/stm32l4r9ai-disco/src/stm32_appinit.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -50,6 +49,7 @@ #include #include +#include #include #include @@ -129,12 +129,11 @@ int board_app_initialize(uintptr_t arg) syslog(LOG_INFO, "Mounting procfs to /proc\n"); - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/arm/tiva/launchxl-cc1310/src/cc1310_bringup.c b/boards/arm/tiva/launchxl-cc1310/src/cc1310_bringup.c index db2e72dcc8..3b3e7f480f 100644 --- a/boards/arm/tiva/launchxl-cc1310/src/cc1310_bringup.c +++ b/boards/arm/tiva/launchxl-cc1310/src/cc1310_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "launchxl-cc1310.h" /**************************************************************************** @@ -79,7 +80,7 @@ int cc1310_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_bringup.c b/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_bringup.c index e9f2eaadea..497798b1a9 100644 --- a/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_bringup.c +++ b/boards/arm/tiva/launchxl-cc1312r1/src/cc1312_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "launchxl-cc1312r1.h" /**************************************************************************** @@ -79,7 +80,7 @@ int cc1312_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/arm/tiva/lm3s6965-ek/src/lm_bringup.c b/boards/arm/tiva/lm3s6965-ek/src/lm_bringup.c index 696c9ce0c4..ead4a833b1 100644 --- a/boards/arm/tiva/lm3s6965-ek/src/lm_bringup.c +++ b/boards/arm/tiva/lm3s6965-ek/src/lm_bringup.c @@ -28,12 +28,13 @@ #include #include -#include #include #include #include #include +#include + #include "lm3s6965-ek.h" #include "tiva_ssi.h" @@ -130,7 +131,7 @@ int lm_bringup(void) #ifdef CONFIG_FS_BINFS /* Mount the binfs file system */ - ret = mount(NULL, "/bin", "binfs", 0, NULL); + ret = nx_mount(NULL, "/bin", "binfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount binfs at /bin: %d\n", ret); @@ -140,7 +141,7 @@ int lm_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, LM_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, LM_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", @@ -151,7 +152,7 @@ int lm_bringup(void) #ifdef CONFIG_FS_TMPFS /* Mount the tmpfs file system */ - ret = mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n", diff --git a/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c b/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c index 3a6300ecda..0f06feb6ee 100644 --- a/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c +++ b/boards/arm/tiva/tm4c123g-launchpad/src/tm4c_at24.c @@ -54,8 +54,6 @@ #include -#include - #include #include #include @@ -63,6 +61,7 @@ #include #include +#include #include #include "tiva_i2c.h" @@ -142,11 +141,11 @@ int tm4c_at24_automount(int minor) /* Mount the file system at /mnt/at24 */ - ret = mount(NULL, "/mnt/at24", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/at24", "nxffs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount the NXFFS volume: %d\n", - errno); + ret); return ret; } #endif diff --git a/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_bringup.c b/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_bringup.c index 0a1312f5c5..83c4d88a8a 100644 --- a/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_bringup.c +++ b/boards/arm/tms570/tms570ls31x-usb-kit/src/tms570_bringup.c @@ -37,16 +37,15 @@ * Included Files ****************************************************************************/ - #include +#include - #include - #include - #include - #include - #include - #include +#include +#include +#include +#include +#include - #include +#include #include "tms570ls31x_usb_kit.h" /**************************************************************************** diff --git a/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c b/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c index c2cfd34272..23540c3056 100644 --- a/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c +++ b/boards/mips/pic32mx/mirtoo/src/pic32_appinit.c @@ -39,14 +39,13 @@ #include -#include - #include #include #include #include #include +#include #ifdef CONFIG_PIC32MX_SPI2 # include @@ -160,10 +159,10 @@ int board_app_initialize(uintptr_t arg) /* Mount the file system at /mnt/sst25 */ - ret = mount(NULL, "/mnt/sst25", "nxffs", 0, NULL); + ret = nx_mount(NULL, "/mnt/sst25", "nxffs", 0, NULL); if (ret < 0) { - ferr("ERROR: Failed to mount the NXFFS volume: %d\n", errno); + ferr("ERROR: Failed to mount the NXFFS volume: %d\n", ret); return ret; } #endif diff --git a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c index d7f505f6f8..b888fce13d 100644 --- a/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c +++ b/boards/mips/pic32mx/pic32mx7mmb/src/pic32_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -48,6 +47,7 @@ #include #include +#include #include #include #include @@ -389,7 +389,7 @@ int pic32mx_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c index 0389e9bb9f..1db682f60e 100644 --- a/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c +++ b/boards/mips/pic32mz/flipnclick-pic32mz/src/pic32mz_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "flipnclick-pic32mz.h" /**************************************************************************** @@ -64,7 +65,7 @@ int pic32mz_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", diff --git a/boards/or1k/mor1kx/or1k/src/or1k_bringup.c b/boards/or1k/mor1kx/or1k/src/or1k_bringup.c index 25b3662756..faada664b4 100644 --- a/boards/or1k/mor1kx/or1k/src/or1k_bringup.c +++ b/boards/or1k/mor1kx/or1k/src/or1k_bringup.c @@ -40,10 +40,9 @@ #include #include -#include #include -#include +#include /**************************************************************************** * Public Functions @@ -70,7 +69,7 @@ int or1k_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_bringup.c b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_bringup.c index ff94fabeb6..cf8b074476 100644 --- a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_bringup.c +++ b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_bringup.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -35,6 +34,7 @@ #include #include +#include #include #include "rx65n_usbhost.h" @@ -370,12 +370,11 @@ int rx65n_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); } #endif diff --git a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c index 80d1d89ce8..780cf55e16 100644 --- a/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c +++ b/boards/renesas/rx65n/rx65n-grrose/src/rx65n_sbram.c @@ -313,11 +313,11 @@ int rx65n_sbram_int(void) syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf); } - rv = unlink(HARDFAULT_PATH); + rv = nx_unlink(HARDFAULT_PATH); if (rv < 0) { - syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file [%s" - "] (%d)\n", HARDFAULT_PATH, rv); + syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file" + " [%s] (%d)\n", HARDFAULT_PATH, rv); } } diff --git a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_bringup.c b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_bringup.c index 7e5fee5301..72f668f9cf 100644 --- a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_bringup.c +++ b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_bringup.c @@ -27,13 +27,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include "rx65n_usbhost.h" @@ -365,12 +365,11 @@ int rx65n_bringup(void) /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); } #endif diff --git a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c index 98f03d6eef..8a2e89640b 100644 --- a/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c +++ b/boards/renesas/rx65n/rx65n-rsk2mb/src/rx65n_sbram.c @@ -311,11 +311,11 @@ int rx65n_sbram_int(void) syslog(LOG_INFO, "Fault Logged on %s - Valid\n", buf); } - rv = unlink(HARDFAULT_PATH); + rv = nx_unlink(HARDFAULT_PATH); if (rv < 0) { - syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file [%s" - "] (%d)\n", HARDFAULT_PATH, rv); + syslog(LOG_INFO, "rx65n sbram: Failed to unlink Fault Log file" + " [%s] (%d)\n", HARDFAULT_PATH, rv); } } diff --git a/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c b/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c index 0c11c5ee11..f47d1021cc 100644 --- a/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c +++ b/boards/risc-v/bl602/bl602evb/src/bl602_bringup.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -88,7 +89,7 @@ int bl602_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_DEBUG, @@ -210,7 +211,7 @@ int bl602_bringup(void) /* Mount the SPIFFS file system */ #ifdef CONFIG_FS_LITTLEFS - ret = mount(path, "/mnt/lfs", "littlefs", 0, "autoformat"); + ret = nx_mount(path, "/mnt/lfs", "littlefs", 0, "autoformat"); if (ret < 0) { syslog(LOG_DEBUG, @@ -235,14 +236,14 @@ int bl602_bringup(void) { /* Mount the file system */ - ret = mount("/dev/ram0", + ret = nx_mount("/dev/ram0", "/sbin", "romfs", MS_RDONLY, NULL); if (ret < 0) { - _err("ERROR: mount(%s,%s,romfs) failed: %d\n", + _err("ERROR: nx_mount(%s,%s,romfs) failed: %d\n", "dev/ram0", - "/sbin", errno); + "/sbin", ret); } } #endif /* CONFIG_FS_ROMFS */ diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c index 7976845882..513c712d29 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_bringup.c @@ -31,12 +31,11 @@ #include #include #include -#include #include #include #include -#include +#include #include "esp32c3-devkit.h" @@ -69,7 +68,7 @@ int esp32c3_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c index e4e5a7b300..ebf5149d4d 100644 --- a/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c +++ b/boards/risc-v/esp32c3/esp32c3-devkit/src/esp32c3_gpio.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/boards/risc-v/fe310/hifive1-revb/src/fe310_bringup.c b/boards/risc-v/fe310/hifive1-revb/src/fe310_bringup.c index 74ba423e16..aada0c425b 100644 --- a/boards/risc-v/fe310/hifive1-revb/src/fe310_bringup.c +++ b/boards/risc-v/fe310/hifive1-revb/src/fe310_bringup.c @@ -39,7 +39,6 @@ #include -#include #include #include #include @@ -65,7 +64,7 @@ int fe310_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/risc-v/gap8/gapuino/src/gapuino_appinit.c b/boards/risc-v/gap8/gapuino/src/gapuino_appinit.c index 6113adc53d..963b40432e 100644 --- a/boards/risc-v/gap8/gapuino/src/gapuino_appinit.c +++ b/boards/risc-v/gap8/gapuino/src/gapuino_appinit.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include /**************************************************************************** * Public Functions @@ -81,12 +81,11 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the proc filesystem */ - ret = mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_NSH_PROC_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, - "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", - ret, errno); + "ERROR: Failed to mount the PROC filesystem: %d\n", ret); return ret; } #endif diff --git a/boards/risc-v/k210/maix-bit/src/k210_bringup.c b/boards/risc-v/k210/maix-bit/src/k210_bringup.c index e822a61f24..09af0329e4 100644 --- a/boards/risc-v/k210/maix-bit/src/k210_bringup.c +++ b/boards/risc-v/k210/maix-bit/src/k210_bringup.c @@ -39,13 +39,13 @@ #include -#include #include #include #include #include #include +#include #include "k210.h" @@ -64,7 +64,7 @@ int k210_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/risc-v/litex/arty_a7/src/litex_bringup.c b/boards/risc-v/litex/arty_a7/src/litex_bringup.c index 9b8e14fe20..a8abf06c48 100644 --- a/boards/risc-v/litex/arty_a7/src/litex_bringup.c +++ b/boards/risc-v/litex/arty_a7/src/litex_bringup.c @@ -24,13 +24,13 @@ #include -#include #include #include #include #include #include +#include #include #include "litex.h" @@ -50,7 +50,7 @@ int litex_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/sim/sim/sim/src/sim_bringup.c b/boards/sim/sim/sim/src/sim_bringup.c index 56f6b847dd..2c8c201199 100644 --- a/boards/sim/sim/sim/src/sim_bringup.c +++ b/boards/sim/sim/sim/src/sim_bringup.c @@ -26,13 +26,13 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -86,7 +86,7 @@ int sim_bringup(void) #ifdef CONFIG_FS_BINFS /* Mount the binfs file system */ - ret = mount(NULL, "/bin", "binfs", 0, NULL); + ret = nx_mount(NULL, "/bin", "binfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount binfs at /bin: %d\n", ret); @@ -96,7 +96,7 @@ int sim_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, SIM_PROCFS_MOUNTPOINT, "procfs", 0, NULL); + ret = nx_mount(NULL, SIM_PROCFS_MOUNTPOINT, "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at %s: %d\n", @@ -107,7 +107,7 @@ int sim_bringup(void) #ifdef CONFIG_FS_TMPFS /* Mount the tmpfs file system */ - ret = mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL); + ret = nx_mount(NULL, CONFIG_LIBC_TMPDIR, "tmpfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount tmpfs at %s: %d\n", @@ -176,7 +176,7 @@ int sim_bringup(void) /* Mount the SPIFFS file system */ - ret = mount("/dev/rammtd", "/mnt/spiffs", "spiffs", 0, NULL); + ret = nx_mount("/dev/rammtd", "/mnt/spiffs", "spiffs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, @@ -198,8 +198,8 @@ int sim_bringup(void) /* Mount the LittleFS file system */ - ret = mount("/dev/rammtd", "/mnt/lfs", "littlefs", 0, - "forceformat"); + ret = nx_mount("/dev/rammtd", "/mnt/lfs", "littlefs", 0, + "forceformat"); if (ret < 0) { syslog(LOG_ERR, diff --git a/boards/sim/sim/sim/src/sim_touchscreen.c b/boards/sim/sim/sim/src/sim_touchscreen.c index eca5847f25..33aff53f27 100644 --- a/boards/sim/sim/sim/src/sim_touchscreen.c +++ b/boards/sim/sim/sim/src/sim_touchscreen.c @@ -111,7 +111,7 @@ static FAR void *sim_listener(FAR void *arg) * the server. */ - fwarn("WARNING: Lost server connection: %d\n", errno); + fwarn("WARNING: Lost server connection: %d\n", ret); break; } @@ -171,7 +171,7 @@ int sim_tsc_setup(int minor) ret = boardctl(BOARDIOC_NX_START, 0); if (ret < 0) { - gerr("ERROR: Failed to start the NX server: %d\n", errno); + gerr("ERROR: Failed to start the NX server: %d\n", ret); return ret; } @@ -226,7 +226,7 @@ int sim_tsc_setup(int minor) } else { - gerr("ERROR: nx_connect failed: %d\n", errno); + gerr("ERROR: nx_connect failed: %d\n", ret); return ERROR; } diff --git a/boards/sim/sim/sim/src/sim_zoneinfo.c b/boards/sim/sim/sim/src/sim_zoneinfo.c index bf5f2bd8a0..16059a7c49 100644 --- a/boards/sim/sim/sim/src/sim_zoneinfo.c +++ b/boards/sim/sim/sim/src/sim_zoneinfo.c @@ -44,6 +44,7 @@ #include #include +#include #include #include @@ -138,10 +139,10 @@ int sim_zoneinfo(int minor) printf("Mounting ROMFS filesystem at target=%s with source=%s\n", CONFIG_LIBC_TZDIR, devname); - ret = mount(devname, CONFIG_LIBC_TZDIR, "romfs", MS_RDONLY, NULL); + ret = nx_mount(devname, CONFIG_LIBC_TZDIR, "romfs", MS_RDONLY, NULL); if (ret < 0) { - printf("ERROR: Mount failed: %d\n", errno); + printf("ERROR: Mount failed: %d\n", ret); return ret; } diff --git a/boards/x86/qemu/qemu-i486/src/qemu_appinit.c b/boards/x86/qemu/qemu-i486/src/qemu_appinit.c index 8af935090f..abb46dc4b5 100644 --- a/boards/x86/qemu/qemu-i486/src/qemu_appinit.c +++ b/boards/x86/qemu/qemu-i486/src/qemu_appinit.c @@ -39,8 +39,8 @@ #include #include +#include -#include #include #include "up_internal.h" @@ -82,7 +82,7 @@ int board_app_initialize(uintptr_t arg) #ifdef CONFIG_FS_PROCFS /* Mount the proc filesystem */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c index e9e7f0f1b1..23433e0261 100644 --- a/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c +++ b/boards/x86_64/intel64/qemu-intel64/src/qemu_bringup.c @@ -24,13 +24,13 @@ #include -#include #include #include #include #include #include +#include #include #include "qemu_intel64.h" @@ -50,7 +50,7 @@ int qemu_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c index f0479d8980..8131da6f1e 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c @@ -46,13 +46,12 @@ #include #include #include -#include #include #include #include -#include #include +#include #include #include "esp32_wlan.h" @@ -120,10 +119,10 @@ static int esp32_init_wifi_storage(void) return -1; } - ret = mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); + ret = nx_mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", errno); + syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", ret); return ret; } @@ -164,7 +163,7 @@ int esp32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c b/boards/xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c index 588121b793..a9deca2c9c 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c +++ b/boards/xtensa/esp32/esp32-devkitc/src/esp32_spiflash.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -135,7 +133,7 @@ void esp32_spiflash_encrypt_test(void) (unsigned long)(uintptr_t)&geo); if (ret < 0) { - ferr("ERROR: Failed to get GEO errno =%d\n", ret); + ferr("ERROR: Failed to get GEO ret = %d\n", ret); DEBUGASSERT(0); } @@ -167,14 +165,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase block errno=%d\n", ret); + ferr("ERROR: Failed to erase block ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(enc_mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to encrypt write errno=%d\n", ret); + ferr("ERROR: Failed to encrypt write ret=%d\n", ret); DEBUGASSERT(0); } @@ -182,7 +180,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -196,7 +194,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } @@ -214,14 +212,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase errno=%d\n", ret); + ferr("ERROR: Failed to erase ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to write errno=%d\n", ret); + ferr("ERROR: Failed to write ret=%d\n", ret); DEBUGASSERT(0); } @@ -229,7 +227,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -243,7 +241,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c index 4a03c2bcce..29230a6fe3 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_bringup.c @@ -31,13 +31,12 @@ #include #include #include -#include #include #include #include -#include #include +#include #include #include "esp32_wlan.h" @@ -101,10 +100,10 @@ static int esp32_init_wifi_storage(void) return -1; } - ret = mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); + ret = nx_mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", errno); + syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", ret); return ret; } @@ -128,7 +127,7 @@ int esp32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c index 930610982d..d21109d3a4 100644 --- a/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c +++ b/boards/xtensa/esp32/esp32-ethernet-kit/src/esp32_spiflash.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -135,7 +133,7 @@ void esp32_spiflash_encrypt_test(void) (unsigned long)(uintptr_t)&geo); if (ret < 0) { - ferr("ERROR: Failed to get GEO errno =%d\n", ret); + ferr("ERROR: Failed to get GEO ret = %d\n", ret); DEBUGASSERT(0); } @@ -167,14 +165,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase block errno=%d\n", ret); + ferr("ERROR: Failed to erase block ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(enc_mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to encrypt write errno=%d\n", ret); + ferr("ERROR: Failed to encrypt write ret=%d\n", ret); DEBUGASSERT(0); } @@ -182,7 +180,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -196,7 +194,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } @@ -214,14 +212,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase errno=%d\n", ret); + ferr("ERROR: Failed to erase ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to write errno=%d\n", ret); + ferr("ERROR: Failed to write ret=%d\n", ret); DEBUGASSERT(0); } @@ -229,7 +227,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -243,7 +241,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c index 36f280de27..ec91db96da 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c @@ -31,13 +31,13 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include "esp32_wlan.h" @@ -109,10 +109,10 @@ static int esp32_init_wifi_storage(void) return -1; } - ret = mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); + ret = nx_mount(path, CONFIG_ESP32_WIFI_FS_MOUNTPT, "spiffs", 0, NULL); if (ret < 0) { - syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", errno); + syslog(LOG_ERR, "ERROR: Failed to mount the FS volume: %d\n", ret); return ret; } @@ -136,7 +136,7 @@ int esp32_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_gpio.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_gpio.c index 4fa9d95fd6..41091a8897 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_gpio.c +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_gpio.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c index bad6a0fd66..25ac83e38d 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_spiflash.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -135,7 +133,7 @@ void esp32_spiflash_encrypt_test(void) (unsigned long)(uintptr_t)&geo); if (ret < 0) { - ferr("ERROR: Failed to get GEO errno =%d\n", ret); + ferr("ERROR: Failed to get GEO ret = %d\n", ret); DEBUGASSERT(0); } @@ -167,14 +165,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase block errno=%d\n", ret); + ferr("ERROR: Failed to erase block ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(enc_mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to encrypt write errno=%d\n", ret); + ferr("ERROR: Failed to encrypt write ret=%d\n", ret); DEBUGASSERT(0); } @@ -182,7 +180,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -196,7 +194,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } @@ -214,14 +212,14 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_ERASE(enc_mtd, erase_block, erase_nblocks); if (ret != erase_nblocks) { - ferr("ERROR: Failed to erase errno=%d\n", ret); + ferr("ERROR: Failed to erase ret=%d\n", ret); DEBUGASSERT(0); } ret = MTD_BWRITE(mtd, rw_block, rw_nblocks, wbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to write errno=%d\n", ret); + ferr("ERROR: Failed to write ret=%d\n", ret); DEBUGASSERT(0); } @@ -229,7 +227,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(enc_mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to decrypt read errno=%d\n", ret); + ferr("ERROR: Failed to decrypt read ret=%d\n", ret); DEBUGASSERT(0); } @@ -243,7 +241,7 @@ void esp32_spiflash_encrypt_test(void) ret = MTD_BREAD(mtd, rw_block, rw_nblocks, rbuf); if (ret != rw_nblocks) { - ferr("ERROR: Failed to read errno=%d\n", ret); + ferr("ERROR: Failed to read ret=%d\n", ret); DEBUGASSERT(0); } diff --git a/boards/z80/ez80/makerlisp/src/ez80_bringup.c b/boards/z80/ez80/makerlisp/src/ez80_bringup.c index a8710b7d9f..e11a8d6a0f 100644 --- a/boards/z80/ez80/makerlisp/src/ez80_bringup.c +++ b/boards/z80/ez80/makerlisp/src/ez80_bringup.c @@ -40,9 +40,10 @@ #include #include -#include #include +#include + #include "makerlisp.h" /**************************************************************************** @@ -70,7 +71,7 @@ int ez80_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/z80/ez80/z20x/src/ez80_bringup.c b/boards/z80/ez80/z20x/src/ez80_bringup.c index efbb37da79..dbd2a6f393 100644 --- a/boards/z80/ez80/z20x/src/ez80_bringup.c +++ b/boards/z80/ez80/z20x/src/ez80_bringup.c @@ -25,9 +25,10 @@ #include #include -#include #include +#include + #include "z20x.h" /**************************************************************************** @@ -55,7 +56,7 @@ int ez80_bringup(void) #ifdef CONFIG_FS_PROCFS /* Mount the procfs file system */ - ret = mount(NULL, "/proc", "procfs", 0, NULL); + ret = nx_mount(NULL, "/proc", "procfs", 0, NULL); if (ret < 0) { ferr("ERROR: Failed to mount procfs at /proc: %d\n", ret); diff --git a/boards/z80/ez80/z20x/src/ez80_w25.c b/boards/z80/ez80/z20x/src/ez80_w25.c index ccc4a7a4a6..c6dbf2b730 100644 --- a/boards/z80/ez80/z20x/src/ez80_w25.c +++ b/boards/z80/ez80/z20x/src/ez80_w25.c @@ -24,8 +24,6 @@ #include -#include - #include #include #include diff --git a/boards/z80/ez80/z20x/src/w25_main.c b/boards/z80/ez80/z20x/src/w25_main.c index 77dfcb0e36..71c3c4fa53 100644 --- a/boards/z80/ez80/z20x/src/w25_main.c +++ b/boards/z80/ez80/z20x/src/w25_main.c @@ -104,7 +104,7 @@ static int w25_read_hex(FAR uint24_t *len) fd = open(W25_CHARDEV, O_WRONLY); if (fd < 0) { - ret = -get_errno(); + ret = -errno; fprintf(stderr, "ERROR: Failed to open %s: %d\n", W25_CHARDEV, ret); return ret; } @@ -170,7 +170,7 @@ static int w25_write(int fd, FAR const void *src, size_t len) nwritten = write(fd, src, remaining); if (nwritten <= 0) { - int errcode = get_errno(); + int errcode = errno; if (errno != EINTR) { fprintf(stderr, "ERROR: Write failed: %d\n", errcode); @@ -207,7 +207,7 @@ static int w25_write_binary(FAR const struct prog_header_s *hdr) fd = open(W25_CHARDEV, O_WRONLY); if (fd < 0) { - ret = -get_errno(); + ret = -errno; fprintf(stderr, "ERROR: Failed to open %s: %d\n", W25_CHARDEV, ret); return ret; } @@ -255,7 +255,7 @@ static int w25_read(int fd, FAR void *dest, size_t len) nread = read(fd, dest, remaining); if (nread <= 0) { - int errcode = get_errno(); + int errcode = errno; if (errno != EINTR) { fprintf(stderr, "ERROR: Read failed: %d\n", errcode); @@ -291,7 +291,7 @@ static int w25_read_binary(FAR struct prog_header_s *hdr) fd = open(W25_CHARDEV, O_RDONLY); if (fd < 0) { - ret = -get_errno(); + ret = -errno; return ret; } @@ -553,7 +553,7 @@ static int w25_boot_program(void) ret = tcdrain(1); if (ret < 0) { - ret = -get_errno(); + ret = -errno; fprintf(stderr, "ERROR: tcdrain() failed: %d\n", ret); return ret; } @@ -590,7 +590,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds) fd = dup(0); if (fd < 0) { - ret = -get_errno(); + ret = -errno; fprintf(stderr, "ERROR: Failed to dup stdin: %d\n", ret); return ret; } @@ -605,7 +605,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds) if (ret < 0) { - ret = -get_errno(); + ret = -errno; fprintf(stderr, "ERROR: fcnt() failed: %d\n", ret); close(fd) ; return ret; @@ -635,7 +635,7 @@ static int w25_wait_keypress(FAR char *keyset, int nseconds) if (nread < 0) { - int errcode = get_errno(); + int errcode = errno; /* If is not an error if a signal occurred or if there is * no key pressed. diff --git a/drivers/audio/cxd56_src.c b/drivers/audio/cxd56_src.c index 2c3f14a074..8f1e8d560f 100644 --- a/drivers/audio/cxd56_src.c +++ b/drivers/audio/cxd56_src.c @@ -97,8 +97,8 @@ static struct cxd56_srcdata_s g_src; #ifdef DUMP_DATA static char *dump_name_pre = "/mnt/sd0/dump/nx_player_dump_pre.pcm"; static char *dump_name_post = "/mnt/sd0/dump/nx_player_dump_post.pcm"; -int dump_file_pre = -1; -int dump_file_post = -1; +static struct file dump_file_pre; +static struct file dump_file_post; #endif /**************************************************************************** @@ -166,7 +166,7 @@ static int cxd56_src_process(FAR struct ap_buffer_s *apb) /* audinfo("SRC: Process (size = %d)\n", apb->nbytes); */ #ifdef DUMP_DATA - write(dump_file_pre, + file_write(&dump_file_pre, (char *) (apb->samp + apb->curbyte), apb->nbytes - apb->curbyte); #endif @@ -295,7 +295,7 @@ static int cxd56_src_process(FAR struct ap_buffer_s *apb) spin_unlock_irqrestore(NULL, flags); #ifdef DUMP_DATA - write(dump_file_post, src_apb->samp, src_apb->nbytes); + file_write(&dump_file_post, src_apb->samp, src_apb->nbytes); #endif /* Fetch the next APB to fill up */ @@ -446,10 +446,10 @@ int cxd56_src_init(FAR struct cxd56_dev_s *dev, } #ifdef DUMP_DATA - unlink(dump_name_pre); - unlink(dump_name_post); - dump_file_pre = open(dump_name_pre, O_WRONLY | O_CREAT | O_APPEND); - dump_file_post = open(dump_name_post, O_WRONLY | O_CREAT | O_APPEND); + nx_unlink(dump_name_pre); + nx_unlink(dump_name_post); + file_open(&dump_file_pre, dump_name_pre, O_WRONLY | O_CREAT | O_APPEND); + file_open(&dump_file_post, dump_name_post, O_WRONLY | O_CREAT | O_APPEND); #endif /* Join any old worker threads to prevent memory leaks */ @@ -523,11 +523,11 @@ int cxd56_src_deinit(void) src_delete(g_src.src_state); #ifdef DUMP_DATA - if (dump_file_pre) - close(dump_file_pre); + if (dump_file_pre.f_inode) + file_close(&dump_file_pre); - if (dump_file_post) - close(dump_file_post); + if (dump_file_post.f_inode) + file_close(&dump_file_post); #endif return OK; diff --git a/drivers/audio/vs1053.c b/drivers/audio/vs1053.c index 131dcc6ceb..ea7d2bf854 100644 --- a/drivers/audio/vs1053.c +++ b/drivers/audio/vs1053.c @@ -1536,7 +1536,7 @@ static int vs1053_start(FAR struct audio_lowerhalf_s *lower) (pthread_addr_t) dev); if (ret != OK) { - auderr("ERROR: Can't create worker thread, errno=%d\n", errno); + auderr("ERROR: Can't create worker thread, ret=%d\n", ret); } else { diff --git a/drivers/audio/wm8776.c b/drivers/audio/wm8776.c index 5b977664f7..2216715d53 100644 --- a/drivers/audio/wm8776.c +++ b/drivers/audio/wm8776.c @@ -576,7 +576,7 @@ static void wm8776_senddone(FAR struct i2s_dev_s *i2s, CONFIG_WM8776_MSG_PRIO); if (ret < 0) { - auderr("ERROR: file_mq_send failed: %d\n", get_errno()); + auderr("ERROR: file_mq_send failed: %d\n", ret); } } @@ -939,11 +939,7 @@ static int wm8776_enqueuebuffer(FAR struct audio_lowerhalf_s *dev, sizeof(term_msg), CONFIG_WM8776_MSG_PRIO); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - auderr("ERROR: file_mq_send failed: %d\n", errcode); - UNUSED(errcode); + auderr("ERROR: file_mq_send failed: %d\n", ret); } } diff --git a/drivers/bch/bchdev_unregister.c b/drivers/bch/bchdev_unregister.c index 8a507d20ef..4286ac9494 100644 --- a/drivers/bch/bchdev_unregister.c +++ b/drivers/bch/bchdev_unregister.c @@ -103,8 +103,8 @@ int bchdev_unregister(FAR const char *chardev) if (ret < 0) { - _err("ERROR: ioctl failed: %d\n", errno); - return -errno; + _err("ERROR: ioctl failed: %d\n", ret); + return ret; } /* Lock out context switches. If there are no other references diff --git a/drivers/lcd/ili9340.c b/drivers/lcd/ili9340.c index 41b9202d00..24e462fd3f 100644 --- a/drivers/lcd/ili9340.c +++ b/drivers/lcd/ili9340.c @@ -1170,8 +1170,6 @@ FAR struct lcd_dev_s *ili9340_initialize( { return &priv->dev; } - - errno = EINVAL; } } diff --git a/drivers/lcd/lpm013m091a.c b/drivers/lcd/lpm013m091a.c index 8ea3373707..4501c1a953 100644 --- a/drivers/lcd/lpm013m091a.c +++ b/drivers/lcd/lpm013m091a.c @@ -606,8 +606,6 @@ FAR struct lcd_dev_s * { return &priv->dev; } - - errno = EINVAL; } } diff --git a/drivers/loop/losetup.c b/drivers/loop/losetup.c index b2a48b7eca..bf7c5c7862 100644 --- a/drivers/loop/losetup.c +++ b/drivers/loop/losetup.c @@ -275,7 +275,7 @@ static ssize_t loop_write(FAR struct inode *inode, nsectors * dev->sectsize); if (nbyteswritten < 0 && nbyteswritten != -EINTR) { - ferr("ERROR: nx_write failed: %zd\n", nbyteswritten); + ferr("ERROR: file_write failed: %zd\n", nbyteswritten); return nbyteswritten; } } diff --git a/drivers/sensors/fakesensor.c b/drivers/sensors/fakesensor.c index 76f077d1d4..065e04f80b 100644 --- a/drivers/sensors/fakesensor.c +++ b/drivers/sensors/fakesensor.c @@ -141,7 +141,7 @@ static int fakesensor_activate(FAR struct sensor_lowerhalf_s *lower, bool sw) /* Wake up the thread */ - sem_post(&sensor->run); + nxsem_post(&sensor->run); } else { @@ -234,7 +234,7 @@ static int fakesensor_thread(int argc, char** argv) { /* Waiting to be woken up */ - sem_wait(&sensor->run); + nxsem_wait(&sensor->run); } } } diff --git a/drivers/serial/ptmx.c b/drivers/serial/ptmx.c index 9bc7502203..8d96792b2f 100644 --- a/drivers/serial/ptmx.c +++ b/drivers/serial/ptmx.c @@ -220,7 +220,7 @@ static int ptmx_open(FAR struct file *filep) */ ret = nx_unlink(devname); - DEBUGASSERT(ret >= 0); /* unlink() should never fail */ + DEBUGASSERT(ret >= 0); /* nx_unlink() should never fail */ nxsem_post(&g_ptmx.px_exclsem); return OK; diff --git a/drivers/usbdev/usbmsc.c b/drivers/usbdev/usbmsc.c index 6454e0c18b..4f0f6e5de9 100644 --- a/drivers/usbdev/usbmsc.c +++ b/drivers/usbdev/usbmsc.c @@ -1693,7 +1693,7 @@ int usbmsc_exportluns(FAR void *handle) if (priv->thpid <= 0) { usbtrace(TRACE_CLSERROR(USBMSC_TRACEERR_THREADCREATE), - (uint16_t)errno); + (uint16_t)priv->thpid); goto errout_with_lock; } diff --git a/fs/aio/aio_write.c b/fs/aio/aio_write.c index 352d7e1f46..40c26f54c5 100644 --- a/fs/aio/aio_write.c +++ b/fs/aio/aio_write.c @@ -84,7 +84,7 @@ static void aio_write_worker(FAR void *arg) if (aiocbp->aio_fildes < CONFIG_NFILE_DESCRIPTORS) #endif { - /* Call fcntl(F_GETFL) to get the file open mode. */ + /* Call file_fcntl(F_GETFL) to get the file open mode. */ oflags = file_fcntl(aioc->u.aioc_filep, F_GETFL); if (oflags < 0) diff --git a/fs/driver/fs_findmtddriver.c b/fs/driver/fs_findmtddriver.c index d6d52e9ed0..7dc4a83fef 100644 --- a/fs/driver/fs_findmtddriver.c +++ b/fs/driver/fs_findmtddriver.c @@ -25,7 +25,6 @@ #include #include -#include #include #include #include diff --git a/fs/hostfs/hostfs_rpmsg_server.c b/fs/hostfs/hostfs_rpmsg_server.c index 5415f1708e..c659378425 100644 --- a/fs/hostfs/hostfs_rpmsg_server.c +++ b/fs/hostfs/hostfs_rpmsg_server.c @@ -504,10 +504,8 @@ static int hostfs_rpmsg_unlink_handler(FAR struct rpmsg_endpoint *ept, uint32_t src, FAR void *priv) { FAR struct hostfs_rpmsg_unlink_s *msg = data; - int ret; - ret = unlink(msg->pathname); - msg->header.result = ret ? -get_errno() : 0; + msg->header.result = nx_unlink(msg->pathname); return rpmsg_send(ept, msg, sizeof(*msg)); } diff --git a/fs/mmap/fs_mmap.c b/fs/mmap/fs_mmap.c index effb34a329..259a06f4d9 100644 --- a/fs/mmap/fs_mmap.c +++ b/fs/mmap/fs_mmap.c @@ -193,9 +193,7 @@ FAR void *mmap(FAR void *start, size_t length, int prot, int flags, return rammap(fd, length, offset); #else - /* Error out. The errno value was already set by ioctl() */ - - ferr("ERROR: ioctl(FIOC_MMAP) failed: %d\n", ret); + ferr("ERROR: nx_ioctl(FIOC_MMAP) failed: %d\n", ret); goto errout; #endif } diff --git a/fs/mmap/fs_rammap.c b/fs/mmap/fs_rammap.c index 136ff9241a..0c38b36ff7 100644 --- a/fs/mmap/fs_rammap.c +++ b/fs/mmap/fs_rammap.c @@ -170,7 +170,7 @@ FAR void *rammap(int fd, size_t length, off_t offset) { /* All other read errors are bad. */ - ferr("ERROR: Read failed: offset=%d errno=%d\n", + ferr("ERROR: Read failed: offset=%d ret=%d\n", (int)offset, (int)nread); ret = nread; diff --git a/fs/mount/fs_automount.c b/fs/mount/fs_automount.c index 8da1f42c03..d1d09a5910 100644 --- a/fs/mount/fs_automount.c +++ b/fs/mount/fs_automount.c @@ -218,15 +218,11 @@ static void automount_mount(FAR struct automounter_state_s *priv) /* Mount the file system */ - ret = mount(lower->blockdev, lower->mountpoint, lower->fstype, - 0, NULL); + ret = nx_mount(lower->blockdev, lower->mountpoint, lower->fstype, + 0, NULL); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - ferr("ERROR: Mount failed: %d\n", errcode); - UNUSED(errcode); + ferr("ERROR: Mount failed: %d\n", ret); return; } @@ -276,18 +272,15 @@ static int automount_unmount(FAR struct automounter_state_s *priv) /* Un-mount the volume */ - ret = umount2(lower->mountpoint, MNT_FORCE); + ret = nx_umount2(lower->mountpoint, MNT_FORCE); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - /* We expect the error to be EBUSY meaning that the volume could * not be unmounted because there are currently reference via open * files or directories. */ - if (errcode == EBUSY) + if (ret == -EBUSY) { finfo("WARNING: Volume is busy, try again later\n"); @@ -306,8 +299,8 @@ static int automount_unmount(FAR struct automounter_state_s *priv) else { - ferr("ERROR: umount2 failed: %d\n", errcode); - return -errcode; + ferr("ERROR: umount2 failed: %d\n", ret); + return ret; } } diff --git a/graphics/nxmu/nxmu_reportposition.c b/graphics/nxmu/nxmu_reportposition.c index 07ed7f2d79..40886a03a3 100644 --- a/graphics/nxmu/nxmu_reportposition.c +++ b/graphics/nxmu/nxmu_reportposition.c @@ -70,6 +70,6 @@ void nxmu_reportposition(FAR struct nxbe_window_s *wnd) sizeof(struct nxclimsg_newposition_s)); if (ret < 0) { - gerr("ERROR: nxmu_sendclient failed: %d\n", errno); + gerr("ERROR: nxmu_sendclient failed: %d\n", get_errno()); } } diff --git a/graphics/nxterm/nxterm_clear.c b/graphics/nxterm/nxterm_clear.c index 8fb84af0c5..1aa5c9fc68 100644 --- a/graphics/nxterm/nxterm_clear.c +++ b/graphics/nxterm/nxterm_clear.c @@ -55,6 +55,6 @@ void nxterm_clear(FAR struct nxterm_state_s *priv) ret = priv->ops->fill(priv, &rect, priv->wndo.wcolor); if (ret < 0) { - gerr("ERROR: Fill failed: %d\n", errno); + gerr("ERROR: Fill failed: %d\n", get_errno()); } } diff --git a/graphics/nxterm/nxterm_redraw.c b/graphics/nxterm/nxterm_redraw.c index 47506171a6..66a922ffad 100644 --- a/graphics/nxterm/nxterm_redraw.c +++ b/graphics/nxterm/nxterm_redraw.c @@ -88,7 +88,7 @@ void nxterm_redraw(NXTERM handle, ret = priv->ops->fill(priv, rect, priv->wndo.wcolor); if (ret < 0) { - gerr("ERROR: fill failed: %d\n", errno); + gerr("ERROR: fill failed: %d\n", get_errno()); } /* Then redraw each character on the display (Only the characters within diff --git a/graphics/nxterm/nxterm_register.c b/graphics/nxterm/nxterm_register.c index 644b6ef193..3e2b4b6387 100644 --- a/graphics/nxterm/nxterm_register.c +++ b/graphics/nxterm/nxterm_register.c @@ -96,7 +96,7 @@ FAR struct nxterm_state_s * if (priv->fcache == NULL) { gerr("ERROR: Failed to connect to font cache for font ID %d: %d\n", - wndo->fontid, errno); + wndo->fontid, get_errno()); goto errout; } @@ -106,7 +106,7 @@ FAR struct nxterm_state_s * if (hfont == NULL) { gerr("ERROR: Failed to get handlr for font ID %d: %d\n", - wndo->fontid, errno); + wndo->fontid, get_errno()); goto errout; } diff --git a/graphics/nxterm/nxterm_scroll.c b/graphics/nxterm/nxterm_scroll.c index ca96a3bec5..9d02ba9916 100644 --- a/graphics/nxterm/nxterm_scroll.c +++ b/graphics/nxterm/nxterm_scroll.c @@ -83,7 +83,7 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv, ret = priv->ops->fill(priv, &rect, priv->wndo.wcolor); if (ret < 0) { - gerr("ERROR: Fill failed: %d\n", errno); + gerr("ERROR: Fill failed: %d\n", get_errno()); } /* Fill each character that might lie within in the bounding box */ @@ -107,7 +107,7 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv, ret = priv->ops->fill(priv, &rect, priv->wndo.wcolor); if (ret < 0) { - gerr("ERROR: Fill failed: %d\n", errno); + gerr("ERROR: Fill failed: %d\n", get_errno()); } } #else @@ -143,7 +143,7 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv, ret = priv->ops->move(priv, &rect, &offset); if (ret < 0) { - gerr("ERROR: Move failed: %d\n", errno); + gerr("ERROR: Move failed: %d\n", get_errno()); } /* Finally, clear the vacated bottom part of the display */ @@ -153,7 +153,7 @@ static inline void nxterm_movedisplay(FAR struct nxterm_state_s *priv, ret = priv->ops->fill(priv, &rect, priv->wndo.wcolor); if (ret < 0) { - gerr("ERROR: Fill failed: %d\n", errno); + gerr("ERROR: Fill failed: %d\n", get_errno()); } } #endif diff --git a/libs/libc/dlfcn/lib_dlerror.c b/libs/libc/dlfcn/lib_dlerror.c index cdb47450e3..3857d18789 100644 --- a/libs/libc/dlfcn/lib_dlerror.c +++ b/libs/libc/dlfcn/lib_dlerror.c @@ -70,5 +70,5 @@ FAR char *dlerror(void) { - return (FAR char *)strerror(errno); + return (FAR char *)strerror(get_errno()); } diff --git a/libs/libc/grp/lib_find_grpfile.c b/libs/libc/grp/lib_find_grpfile.c index de705910df..6f9886ef5f 100644 --- a/libs/libc/grp/lib_find_grpfile.c +++ b/libs/libc/grp/lib_find_grpfile.c @@ -141,8 +141,8 @@ static int grp_foreach(grp_foreach_match_t match, uintptr_t arg, stream = fopen(CONFIG_LIBC_GROUP_FILEPATH, "r"); if (stream == NULL) { - int errcode = errno; - DEBUGASSERT(errno > 0); + int errcode = get_errno(); + DEBUGASSERT(errcode > 0); return -errcode; } diff --git a/libs/libc/misc/lib_sendfile.c b/libs/libc/misc/lib_sendfile.c index 44dbcc6ed5..dd333559b5 100644 --- a/libs/libc/misc/lib_sendfile.c +++ b/libs/libc/misc/lib_sendfile.c @@ -115,18 +115,25 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count) if (offset) { + off_t newpos; + /* Use lseek to get the current file position */ - startpos = lseek(infd, 0, SEEK_CUR); - if (startpos == (off_t)-1) + startpos = _NX_SEEK(infd, 0, SEEK_CUR); + if (startpos < 0) { + int errcode = _NX_GETERRNO(startpos); + _NX_SETERRNO(errcode); return ERROR; } /* Use lseek again to set the new file position */ - if (lseek(infd, *offset, SEEK_SET) == (off_t)-1) + newpos = _NX_SEEK(infd, *offset, SEEK_SET); + if (newpos < 0) { + int errcode = _NX_GETERRNO(newpos); + _NX_SETERRNO(errcode); return ERROR; } } @@ -263,9 +270,11 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count) { /* Use lseek to get the current file position */ - off_t curpos = lseek(infd, 0, SEEK_CUR); - if (curpos == (off_t)-1) + off_t curpos = _NX_SEEK(infd, 0, SEEK_CUR); + if (curpos < 0) { + int errcode = _NX_GETERRNO(curpos); + _NX_SETERRNO(errcode); return ERROR; } @@ -275,8 +284,11 @@ ssize_t sendfile(int outfd, int infd, off_t *offset, size_t count) /* Use lseek again to restore the original file position */ - if (lseek(infd, startpos, SEEK_SET) == (off_t)-1) + startpos = _NX_SEEK(infd, startpos, SEEK_SET); + if (startpos < 0) { + int errcode = _NX_GETERRNO(startpos); + _NX_SETERRNO(errcode); return ERROR; } } diff --git a/libs/libc/modlib/modlib_init.c b/libs/libc/modlib/modlib_init.c index aa1b0f61ac..1588c42ed8 100644 --- a/libs/libc/modlib/modlib_init.c +++ b/libs/libc/modlib/modlib_init.c @@ -79,10 +79,10 @@ static inline int modlib_filelen(FAR struct mod_loadinfo_s *loadinfo, /* Get the file stats */ - ret = stat(filename, &buf); + ret = _NX_STAT(filename, &buf); if (ret < 0) { - int errval = get_errno(); + int errval = _NX_GETERRNO(ret); berr("ERROR: Failed to stat file: %d\n", errval); return -errval; } diff --git a/libs/libc/modlib/modlib_read.c b/libs/libc/modlib/modlib_read.c index abc4c8be74..0084c4866d 100644 --- a/libs/libc/modlib/modlib_read.c +++ b/libs/libc/modlib/modlib_read.c @@ -101,10 +101,10 @@ int modlib_read(FAR struct mod_loadinfo_s *loadinfo, FAR uint8_t *buffer, { /* Seek to the next read position */ - rpos = lseek(loadinfo->filfd, offset, SEEK_SET); + rpos = _NX_SEEK(loadinfo->filfd, offset, SEEK_SET); if (rpos != offset) { - int errval = get_errno(); + int errval = _NX_GETERRNO(rpos); berr("ERROR: Failed to seek to position %lu: %d\n", (unsigned long)offset, errval); return -errval; diff --git a/libs/libc/modlib/modlib_uninit.c b/libs/libc/modlib/modlib_uninit.c index e7a70fd3b4..b5f586d359 100644 --- a/libs/libc/modlib/modlib_uninit.c +++ b/libs/libc/modlib/modlib_uninit.c @@ -60,7 +60,7 @@ int modlib_uninitialize(struct mod_loadinfo_s *loadinfo) if (loadinfo->filfd >= 0) { - close(loadinfo->filfd); + _NX_CLOSE(loadinfo->filfd); } return OK; diff --git a/libs/libc/netdb/lib_dnsaddserver.c b/libs/libc/netdb/lib_dnsaddserver.c index 9b768a1ca5..bcbc7ab888 100644 --- a/libs/libc/netdb/lib_dnsaddserver.c +++ b/libs/libc/netdb/lib_dnsaddserver.c @@ -74,7 +74,7 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) stream = fopen(CONFIG_NETDB_RESOLVCONF_PATH, "a+"); if (stream == NULL) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: Failed to open %s: %d\n", CONFIG_NETDB_RESOLVCONF_PATH, ret); DEBUGASSERT(ret < 0); @@ -98,7 +98,7 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) if (inet_ntop(AF_INET, &in4->sin_addr, addrstr, DNS_MAX_ADDRSTR) == NULL) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: inet_ntop failed: %d\n", ret); DEBUGASSERT(ret < 0); goto errout; @@ -131,7 +131,7 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) if (inet_ntop(AF_INET6, &in6->sin6_addr, addrstr, DNS_MAX_ADDRSTR) == NULL) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: inet_ntop failed: %d\n", ret); DEBUGASSERT(ret < 0); goto errout; @@ -177,7 +177,7 @@ int dns_add_nameserver(FAR const struct sockaddr *addr, socklen_t addrlen) if (ret < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: fprintf failed: %d\n", ret); DEBUGASSERT(ret < 0); goto errout; diff --git a/libs/libc/netdb/lib_dnsbind.c b/libs/libc/netdb/lib_dnsbind.c index a1b7d04c16..7445b179a0 100644 --- a/libs/libc/netdb/lib_dnsbind.c +++ b/libs/libc/netdb/lib_dnsbind.c @@ -96,7 +96,7 @@ int dns_bind(void) sd = socket(PF_INET, SOCK_DGRAM, 0); if (sd < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: socket() failed: %d\n", ret); return ret; } @@ -109,7 +109,7 @@ int dns_bind(void) ret = setsockopt(sd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(struct timeval)); if (ret < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: setsockopt() failed: %d\n", ret); close(sd); return ret; diff --git a/libs/libc/netdb/lib_dnsforeach.c b/libs/libc/netdb/lib_dnsforeach.c index 0772dd6307..2d8291a6c2 100644 --- a/libs/libc/netdb/lib_dnsforeach.c +++ b/libs/libc/netdb/lib_dnsforeach.c @@ -104,7 +104,7 @@ int dns_foreach_nameserver(dns_callback_t callback, FAR void *arg) stream = fopen(CONFIG_NETDB_RESOLVCONF_PATH, "r"); if (stream == NULL) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: Failed to open %s: %d\n", CONFIG_NETDB_RESOLVCONF_PATH, ret); DEBUGASSERT(ret < 0); diff --git a/libs/libc/netdb/lib_dnsquery.c b/libs/libc/netdb/lib_dnsquery.c index a42bcb8311..b24d4a1f28 100644 --- a/libs/libc/netdb/lib_dnsquery.c +++ b/libs/libc/netdb/lib_dnsquery.c @@ -296,7 +296,7 @@ static int dns_send_query(int sd, FAR const char *name, ret = connect(sd, &uaddr->addr, addrlen); if (ret < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: connect failed: %d\n", ret); return ret; } @@ -304,7 +304,7 @@ static int dns_send_query(int sd, FAR const char *name, ret = send(sd, buffer, dest - buffer, 0); if (ret < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: sendto failed: %d\n", ret); return ret; } @@ -349,7 +349,7 @@ static int dns_recv_response(int sd, FAR union dns_addr_u *addr, int naddr, ret = recv(sd, buffer, RECV_BUFFER_SIZE, 0); if (ret < 0) { - ret = -errno; + ret = -get_errno(); nerr("ERROR: recv failed: %d\n", ret); return ret; } diff --git a/libs/libc/netdb/lib_gethostbyaddrr.c b/libs/libc/netdb/lib_gethostbyaddrr.c index aeb8251644..f8638033bf 100644 --- a/libs/libc/netdb/lib_gethostbyaddrr.c +++ b/libs/libc/netdb/lib_gethostbyaddrr.c @@ -267,7 +267,7 @@ int lib_hostfile_lookup(FAR const void *addr, socklen_t len, int type, stream = fopen(CONFIG_NETDB_HOSTCONF_PATH, "r"); if (stream == NULL) { - int errcode = -errno; + int errcode = -get_errno(); nerr("ERROR: Failed to open the hosts file %s: %d\n", CONFIG_NETDB_HOSTCONF_PATH, errcode); diff --git a/libs/libc/netdb/lib_gethostentbynamer.c b/libs/libc/netdb/lib_gethostentbynamer.c index 9eec05db05..ea1dd5f064 100644 --- a/libs/libc/netdb/lib_gethostentbynamer.c +++ b/libs/libc/netdb/lib_gethostentbynamer.c @@ -602,7 +602,7 @@ static int lib_hostfile_lookup(FAR const char *name, stream = fopen(CONFIG_NETDB_HOSTCONF_PATH, "r"); if (stream == NULL) { - int errcode = -errno; + int errcode = -get_errno(); nerr("ERROR: Failed to open the hosts file %s: %d\n", CONFIG_NETDB_HOSTCONF_PATH, errcode); diff --git a/libs/libc/netdb/lib_getnameinfo.c b/libs/libc/netdb/lib_getnameinfo.c index 2a9614e180..cb43f4d405 100644 --- a/libs/libc/netdb/lib_getnameinfo.c +++ b/libs/libc/netdb/lib_getnameinfo.c @@ -163,7 +163,7 @@ int getnameinfo(FAR const struct sockaddr *addr, socklen_t addrlen, { if (!inet_ntop(addr->sa_family, saddr, host, hostlen)) { - switch (errno) + switch (get_errno()) { case ENOSPC: return EAI_OVERFLOW; diff --git a/libs/libc/pwd/lib_find_pwdfile.c b/libs/libc/pwd/lib_find_pwdfile.c index 669f11abf9..f9f109b650 100644 --- a/libs/libc/pwd/lib_find_pwdfile.c +++ b/libs/libc/pwd/lib_find_pwdfile.c @@ -138,8 +138,8 @@ static int pwd_foreach(pwd_foreach_match_t match, uintptr_t arg, stream = fopen(CONFIG_LIBC_PASSWD_FILEPATH, "r"); if (stream == NULL) { - int errcode = errno; - DEBUGASSERT(errno > 0); + int errcode = get_errno(); + DEBUGASSERT(errcode > 0); return -errcode; } diff --git a/libs/libc/stdio/lib_libfwrite.c b/libs/libc/stdio/lib_libfwrite.c index 1ceb52a49d..220a27453b 100644 --- a/libs/libc/stdio/lib_libfwrite.c +++ b/libs/libc/stdio/lib_libfwrite.c @@ -90,7 +90,7 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream) #if defined(CONFIG_BUILD_FLAT) || defined(__KERNEL__) if (ret < 0) { - _NX_SETERRNO((int)-ret); + _NX_SETERRNO(ret); ret = ERROR; } #endif diff --git a/libs/libc/stdio/lib_perror.c b/libs/libc/stdio/lib_perror.c index 1df866055f..c37fb757b0 100644 --- a/libs/libc/stdio/lib_perror.c +++ b/libs/libc/stdio/lib_perror.c @@ -72,8 +72,8 @@ void perror(FAR const char *s) /* If strerror() is not enabled, then just print the error number */ #ifdef CONFIG_LIBC_STRERROR - fprintf(PERROR_STREAM, "%s: %s\n", s, strerror(errno)); + fprintf(PERROR_STREAM, "%s: %s\n", s, strerror(get_errno())); #else - fprintf(PERROR_STREAM, "%s: Error %d\n", s, errno); + fprintf(PERROR_STREAM, "%s: Error %d\n", s, get_errno()); #endif } diff --git a/libs/libc/stdio/lib_rawoutstream.c b/libs/libc/stdio/lib_rawoutstream.c index a09f200d14..48036600e3 100644 --- a/libs/libc/stdio/lib_rawoutstream.c +++ b/libs/libc/stdio/lib_rawoutstream.c @@ -98,7 +98,7 @@ static off_t rawsostream_seek(FAR struct lib_sostream_s *this, off_t offset, FAR struct lib_rawsostream_s *mthis = (FAR struct lib_rawsostream_s *)this; DEBUGASSERT(this); - return lseek(mthis->fd, offset, whence); + return _NX_SEEK(mthis->fd, offset, whence); } /**************************************************************************** diff --git a/libs/libc/stdio/lib_rawsistream.c b/libs/libc/stdio/lib_rawsistream.c index 9a51fb8ef1..f152ab6c77 100644 --- a/libs/libc/stdio/lib_rawsistream.c +++ b/libs/libc/stdio/lib_rawsistream.c @@ -76,7 +76,7 @@ static off_t rawsistream_seek(FAR struct lib_sistream_s *this, off_t offset, FAR struct lib_rawsistream_s *mthis = (FAR struct lib_rawsistream_s *)this; DEBUGASSERT(this); - return lseek(mthis->fd, offset, whence); + return _NX_SEEK(mthis->fd, offset, whence); } /**************************************************************************** diff --git a/libs/libc/stdlib/lib_mktemp.c b/libs/libc/stdlib/lib_mktemp.c index eb3c438074..40114bc1a3 100644 --- a/libs/libc/stdlib/lib_mktemp.c +++ b/libs/libc/stdlib/lib_mktemp.c @@ -240,7 +240,7 @@ FAR char *mktemp(FAR char *path_template) /* Attempt to stat the candidate file */ ret = stat(path_template, &buf); - if (ret < 0 && errno == ENOENT) + if (ret < 0 && get_errno() == ENOENT) { /* We have it... Clear the errno and return the template */ diff --git a/libs/libc/stdlib/lib_realpath.c b/libs/libc/stdlib/lib_realpath.c index c6581edc49..466432a7a0 100644 --- a/libs/libc/stdlib/lib_realpath.c +++ b/libs/libc/stdlib/lib_realpath.c @@ -52,13 +52,13 @@ FAR char *realpath(FAR const char *path, FAR char *resolved) if (path == NULL) { - errno = EINVAL; + set_errno(EINVAL); return NULL; } if (*path == '\0') { - errno = ENOENT; + set_errno(ENOENT); return NULL; } @@ -159,7 +159,7 @@ loop: if (p - resolved + 1 + q - path + 1 > PATH_MAX) { - errno = ENAMETOOLONG; + set_errno(ENAMETOOLONG); goto out; } @@ -181,7 +181,7 @@ loop: { if (nlnk++ >= SYMLOOP_MAX) { - errno = ELOOP; + set_errno(ELOOP); goto out; } @@ -190,7 +190,7 @@ loop: { if (n == 0) { - errno = ENOENT; + set_errno(ENOENT); } goto out; @@ -200,7 +200,7 @@ loop: if (n + (len = strlen(q)) + 1 > sizeof(wbuf[0])) { - errno = ENAMETOOLONG; + set_errno(ENAMETOOLONG); goto out; } @@ -221,7 +221,7 @@ loop: if (*q == '/' && !S_ISDIR(sb.st_mode)) { - errno = ENOTDIR; + set_errno(ENOTDIR); goto out; } diff --git a/libs/libc/unistd/lib_posix_fallocate.c b/libs/libc/unistd/lib_posix_fallocate.c index d432f49b6c..e3bf307bf4 100644 --- a/libs/libc/unistd/lib_posix_fallocate.c +++ b/libs/libc/unistd/lib_posix_fallocate.c @@ -79,14 +79,14 @@ int posix_fallocate(int fd, off_t offset, off_t len) if (fstat(fd, &st) != 0) { - return errno; + return get_errno(); } if (st.st_size < len) { if (ftruncate(fd, len) != 0) { - return errno; + return get_errno(); } } diff --git a/libs/libc/userfs/lib_userfs.c b/libs/libc/userfs/lib_userfs.c index 349877a4e0..ab471b793a 100644 --- a/libs/libc/userfs/lib_userfs.c +++ b/libs/libc/userfs/lib_userfs.c @@ -167,7 +167,7 @@ static inline int userfs_open_dispatch(FAR struct userfs_info_s *info, sizeof(struct sockaddr_in)); if (nsent < 0) { - ret = -errno; + ret = -get_errno(); ferr("ERROR: Send open response failed: %d\n", ret); return ret; } @@ -865,7 +865,7 @@ static inline int userfs_destroy_dispatch(FAR struct userfs_info_s *info, sizeof(struct sockaddr_in)); if (nsent < 0) { - int ret = -errno; + int ret = -get_errno(); ferr("ERROR: sendto failed: %d\n", ret); return ret; } diff --git a/libs/libnx/nxmu/nx_connect.c b/libs/libnx/nxmu/nx_connect.c index 465131b688..59f2eddf8d 100644 --- a/libs/libnx/nxmu/nx_connect.c +++ b/libs/libnx/nxmu/nx_connect.c @@ -160,7 +160,7 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname) ret = nxmu_sendserver(conn, &outmsg, sizeof(struct nxsvrmsg_s)); if (ret < 0) { - gerr("ERROR: nxmu_sendserver failed: %d\n", errno); + gerr("ERROR: nxmu_sendserver failed: %d\n", get_errno()); goto errout_with_wmq; } @@ -176,7 +176,7 @@ NXHANDLE nx_connectinstance(FAR const char *svrmqname) ret = nx_eventhandler((NXHANDLE)conn); if (ret < 0) { - gerr("ERROR: nx_message failed: %d\n", errno); + gerr("ERROR: nx_message failed: %d\n", get_errno()); goto errout_with_wmq; } diff --git a/libs/libnx/nxmu/nx_redrawreq.c b/libs/libnx/nxmu/nx_redrawreq.c index 692313dca1..56f3375fbf 100644 --- a/libs/libnx/nxmu/nx_redrawreq.c +++ b/libs/libnx/nxmu/nx_redrawreq.c @@ -71,6 +71,6 @@ void nx_redrawreq(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect) ret = nxmu_sendwindow(wnd, &outmsg, sizeof(struct nxsvrmsg_redrawreq_s)); if (ret < 0) { - gerr("ERROR: nxmu_sendwindow failed: %d\n", errno); + gerr("ERROR: nxmu_sendwindow failed: %d\n", get_errno()); } } diff --git a/net/local/local_fifo.c b/net/local/local_fifo.c index a8b2599866..1dc66a17e5 100644 --- a/net/local/local_fifo.c +++ b/net/local/local_fifo.c @@ -174,14 +174,11 @@ static int local_create_fifo(FAR const char *path) if (!local_fifo_exists(path)) { - ret = mkfifo(path, 0644); + ret = nx_mkfifo(path, 0644, CONFIG_DEV_FIFO_SIZE); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - nerr("ERROR: Failed to create FIFO %s: %d\n", path, errcode); - return -errcode; + nerr("ERROR: Failed to create FIFO %s: %d\n", path, ret); + return ret; } } @@ -215,14 +212,11 @@ static int local_release_fifo(FAR const char *path) * by the device instance will also be freed. */ - ret = unlink(path); + ret = nx_unlink(path); if (ret < 0) { - int errcode = get_errno(); - DEBUGASSERT(errcode > 0); - - nerr("ERROR: Failed to unlink FIFO %s: %d\n", path, errcode); - return -errcode; + nerr("ERROR: Failed to unlink FIFO %s: %d\n", path, ret); + return ret; } } diff --git a/net/local/local_recvutils.c b/net/local/local_recvutils.c index 67b31a8d84..0cd7451f36 100644 --- a/net/local/local_recvutils.c +++ b/net/local/local_recvutils.c @@ -79,7 +79,7 @@ int local_fifo_read(FAR struct file *filep, FAR uint8_t *buf, size_t *len) if (nread != -EINTR) { ret = (int)nread; - nerr("ERROR: nx_read() failed: %d\n", ret); + nerr("ERROR: file_read() failed: %d\n", ret); goto errout; } diff --git a/net/local/local_sendpacket.c b/net/local/local_sendpacket.c index e12c5ebb0f..500786f766 100644 --- a/net/local/local_sendpacket.c +++ b/net/local/local_sendpacket.c @@ -87,7 +87,7 @@ static int local_fifo_write(FAR struct file *filep, FAR const uint8_t *buf, { if (nwritten != -EINTR) { - nerr("ERROR: nx_write failed: %zd\n", nwritten); + nerr("ERROR: file_write failed: %zd\n", nwritten); return (int)nwritten; } diff --git a/sched/init/nx_bringup.c b/sched/init/nx_bringup.c index 04d9ed8d26..4f010d0d76 100644 --- a/sched/init/nx_bringup.c +++ b/sched/init/nx_bringup.c @@ -28,10 +28,10 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -269,9 +269,9 @@ static inline void nx_start_application(void) #ifdef CONFIG_INIT_MOUNT /* Mount the file system containing the init program. */ - ret = mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET, - CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS, - CONFIG_INIT_MOUNT_DATA); + ret = nx_mount(CONFIG_INIT_MOUNT_SOURCE, CONFIG_INIT_MOUNT_TARGET, + CONFIG_INIT_MOUNT_FSTYPE, CONFIG_INIT_MOUNT_FLAGS, + CONFIG_INIT_MOUNT_DATA); DEBUGASSERT(ret >= 0); #endif diff --git a/sched/task/task_execv.c b/sched/task/task_execv.c index 212f942203..326874eff3 100644 --- a/sched/task/task_execv.c +++ b/sched/task/task_execv.c @@ -122,7 +122,7 @@ int execv(FAR const char *path, FAR char * const argv[]) ret = exec(path, (FAR char * const *)argv, symtab, nsymbols); if (ret < 0) { - serr("ERROR: exec failed: %d\n", errno); + serr("ERROR: exec failed: %d\n", get_errno()); return ERROR; } diff --git a/sched/task/task_vfork.c b/sched/task/task_vfork.c index ec0a565c0e..6df5eea7bf 100644 --- a/sched/task/task_vfork.c +++ b/sched/task/task_vfork.c @@ -459,7 +459,7 @@ pid_t nxtask_start_vfork(FAR struct task_tcb_s *child) ret = waitpid(pid, &rc, 0); if (ret < 0) { - serr("ERROR: waitpid failed: %d\n", errno); + serr("ERROR: waitpid failed: %d\n", get_errno()); } #else waitpid(pid, &rc, 0);