Ensure the kernel component don't call userspace API

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2021-02-15 16:08:51 +08:00
committed by Masayuki Ishikawa
parent cf73496d9e
commit 9473434587
224 changed files with 769 additions and 809 deletions
+14 -15
View File
@@ -891,7 +891,7 @@ static int cxd56_gnss_save_backup_data(FAR struct file *filep,
unsigned long arg) unsigned long arg)
{ {
FAR char *buf; FAR char *buf;
int fd; struct file file;
int n = 0; int n = 0;
int32_t offset = 0; int32_t offset = 0;
@@ -901,30 +901,30 @@ static int cxd56_gnss_save_backup_data(FAR struct file *filep,
return -ENOMEM; return -ENOMEM;
} }
fd = nx_open(CONFIG_CXD56_GNSS_BACKUP_FILENAME, n = file_open(&file, CONFIG_CXD56_GNSS_BACKUP_FILENAME,
O_WRONLY | O_CREAT | O_TRUNC); O_WRONLY | O_CREAT | O_TRUNC);
if (fd < 0) if (n < 0)
{ {
kmm_free(buf); kmm_free(buf);
return fd; return n;
} }
do do
{ {
n = fw_gd_readbuffer(CXD56_CPU1_DATA_TYPE_BACKUP, offset, buf, 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) if (n <= 0)
{ {
break; break;
} }
n = nx_write(fd, buf, n); n = file_write(&file, buf, n);
offset += n; offset += n;
} }
while (n == CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE); while (n == CONFIG_CXD56_GNSS_BACKUP_BUFFER_SIZE);
kmm_free(buf); kmm_free(buf);
nx_close(fd); file_close(&file);
return n < 0 ? n : 0; 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, static int cxd56_gnss_erase_backup_data(FAR struct file *filep,
unsigned long arg) 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) static void cxd56_gnss_read_backup_file(FAR int *retval)
{ {
FAR char * buf; FAR char * buf;
int fd; struct file file;
int32_t offset = 0; int32_t offset = 0;
size_t n; size_t n;
int ret = 0; int ret = 0;
@@ -2220,17 +2220,16 @@ static void cxd56_gnss_read_backup_file(FAR int *retval)
goto _err; goto _err;
} }
fd = nx_open(CONFIG_CXD56_GNSS_BACKUP_FILENAME, O_RDONLY); ret = file_open(&file, CONFIG_CXD56_GNSS_BACKUP_FILENAME, O_RDONLY);
if (fd < 0) if (ret < 0)
{ {
kmm_free(buf); kmm_free(buf);
ret = fd;
goto _err; goto _err;
} }
do 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) if (n <= 0)
{ {
ret = n; ret = n;
@@ -2247,7 +2246,7 @@ static void cxd56_gnss_read_backup_file(FAR int *retval)
} }
while (n > 0); while (n > 0);
nx_close(fd); file_close(&file);
kmm_free(buf); kmm_free(buf);
/* Notify the termination of backup sequence by write zero length data */ /* Notify the termination of backup sequence by write zero length data */
+1 -2
View File
@@ -151,7 +151,7 @@ static int icc_semtake(sem_t *semid)
static int icc_semtrytake(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) 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); ret = icc_semtrytake(&priv->rxwait);
if (ret < 0) if (ret < 0)
{ {
ret = -get_errno();
return ret; return ret;
} }
} }
+10 -9
View File
@@ -26,7 +26,6 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <debug.h> #include <debug.h>
#include <string.h> #include <string.h>
@@ -39,6 +38,8 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/signal.h> #include <nuttx/signal.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_FS_EVFAT #ifdef CONFIG_FS_EVFAT
# include <nuttx/fs/mkevfatfs.h> # include <nuttx/fs/mkevfatfs.h>
#endif #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) static int install_recovery(const char *srcpath)
{ {
int rfd; struct file rfile;
int i; int i;
int len; int len;
int rem; int rem;
@@ -188,9 +189,9 @@ static int install_recovery(const char *srcpath)
return -1; 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"); _info("read head");
ret = -EIO; ret = -EIO;
@@ -228,7 +229,7 @@ static int install_recovery(const char *srcpath)
goto err; 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), ((void *)&upg_image.chunk[upg_image.chunknum] - (void *)&upg_image),
SEEK_SET); SEEK_SET);
@@ -236,7 +237,7 @@ static int install_recovery(const char *srcpath)
while (rem > 0) while (rem > 0)
{ {
len = read(rfd, copybuf, rem > 512 ? 512 : rem); len = file_read(&rfile, copybuf, rem > 512 ? 512 : rem);
if (len < 0) if (len < 0)
{ {
@@ -255,7 +256,7 @@ err:
bchlib_teardown(handle); bchlib_teardown(handle);
} }
close(rfd); file_close(&rfile);
_info("DONE\n"); _info("DONE\n");
return ret; return ret;
} }
@@ -585,7 +586,7 @@ static int msc_enable(int forced)
/* check recovery kernel update */ /* 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); nxsig_usleep(10000);
/* recovery kernel install from UPG.img */ /* recovery kernel install from UPG.img */
@@ -677,7 +678,7 @@ int ipl2_main(int argc, char *argv[])
{ {
/* check recovery kernel update */ /* 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); nxsig_usleep(10000);
/* recovery kernel install from UPG.img */ /* recovery kernel install from UPG.img */
-2
View File
@@ -1183,7 +1183,6 @@ nrf52_radio_initialize(int intf, FAR struct nrf52_radio_board_s *board)
if (ret < 0) if (ret < 0)
{ {
wlerr("ERROR: failed to reset radio interface %d\n", ret); wlerr("ERROR: failed to reset radio interface %d\n", ret);
errno = ret;
goto errout; goto errout;
} }
@@ -1193,7 +1192,6 @@ nrf52_radio_initialize(int intf, FAR struct nrf52_radio_board_s *board)
if (ret < 0) if (ret < 0)
{ {
wlerr("ERROR: failed to setup radio interface %d\n", ret); wlerr("ERROR: failed to setup radio interface %d\n", ret);
errno = ret;
goto errout; goto errout;
} }
+2 -2
View File
@@ -1355,7 +1355,7 @@ static int ssc_rxdma_setup(struct sam_ssc_s *priv)
if (ret < 0) 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) if (ret < 0)
{ {
i2serr("ERROR: wd_start failed: %d\n", errno); i2serr("ERROR: wd_start failed: %d\n", ret);
} }
} }
+2 -2
View File
@@ -1331,7 +1331,7 @@ static int ssc_rxdma_setup(struct sam_ssc_s *priv)
if (ret < 0) 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) if (ret < 0)
{ {
i2serr("ERROR: wd_start failed: %d\n", errno); i2serr("ERROR: wd_start failed: %d\n", ret);
} }
} }
+2 -2
View File
@@ -1106,7 +1106,7 @@ static int i2s_rxdma_setup(struct stm32_i2s_s *priv)
if (ret < 0) 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) if (ret < 0)
{ {
i2serr("ERROR: wd_start failed: %d\n", errno); i2serr("ERROR: wd_start failed: %d\n", ret);
} }
} }
+2 -2
View File
@@ -40,7 +40,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
# include <sys/mount.h> # include <nuttx/fs/fs.h>
#endif #endif
#include <syslog.h> #include <syslog.h>
@@ -100,7 +100,7 @@ int a1x_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -39,9 +39,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <debug.h> #include <debug.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_USERLED #ifdef CONFIG_USERLED
# include <nuttx/leds/userled.h> # include <nuttx/leds/userled.h>
#endif #endif
@@ -160,7 +161,7 @@ int am335x_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -27,8 +27,8 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <sys/mount.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include "cxd56_emmc.h" #include "cxd56_emmc.h"
@@ -76,10 +76,10 @@ int board_emmc_initialize(void)
/* Mount the eMMC deivce */ /* 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) 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; return ret;
+5 -5
View File
@@ -27,8 +27,8 @@
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <sys/mount.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#include <nuttx/mtd/mtd.h> #include <nuttx/mtd/mtd.h>
@@ -89,10 +89,10 @@ int board_flash_initialize(void)
return ret; return ret;
} }
ret = mount("/dev/smart0d1", "/mnt/spif", "smartfs", 0, NULL); ret = nx_mount("/dev/smart0d1", "/mnt/spif", "smartfs", 0, NULL);
if (ret < 0) 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; return ret;
} }
@@ -106,10 +106,10 @@ int board_flash_initialize(void)
return ret; return ret;
} }
ret = mount(NULL, "/mnt/spif", "nxffs", 0, NULL); ret = nx_mount(NULL, "/mnt/spif", "nxffs", 0, NULL);
if (ret < 0) 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; return ret;
} }
#endif #endif
@@ -208,7 +208,7 @@ static sem_t g_rotexc;
static sem_t g_geexc; static sem_t g_geexc;
static sem_t g_abexc; static sem_t g_abexc;
static int g_gfd = -1; static struct file g_gfile;
static char g_gcmdbuf[256] __attribute__ ((aligned(16))); static char g_gcmdbuf[256] __attribute__ ((aligned(16)));
/**************************************************************************** /****************************************************************************
@@ -534,7 +534,7 @@ void imageproc_initialize(void)
cxd56_ge2dinitialize(GEDEVNAME); cxd56_ge2dinitialize(GEDEVNAME);
g_gfd = open(GEDEVNAME, O_RDWR); file_open(&g_gfile, GEDEVNAME, O_RDWR);
putreg32(1, ROT_INTR_CLEAR); putreg32(1, ROT_INTR_CLEAR);
putreg32(0, ROT_INTR_ENABLE); putreg32(0, ROT_INTR_ENABLE);
@@ -549,10 +549,9 @@ void imageproc_finalize(void)
up_disable_irq(CXD56_IRQ_ROT); up_disable_irq(CXD56_IRQ_ROT);
irq_detach(CXD56_IRQ_ROT); irq_detach(CXD56_IRQ_ROT);
if (g_gfd > 0) if (g_gfile.f_inode)
{ {
close(g_gfd); file_close(&g_gfile);
g_gfd = -1;
} }
cxd56_ge2duninitialize(GEDEVNAME); cxd56_ge2duninitialize(GEDEVNAME);
@@ -605,7 +604,7 @@ int imageproc_resize(uint8_t * ibuf,
size_t len; size_t len;
int ret; int ret;
if (g_gfd <= 0) if (g_gfile.f_inode == NULL)
{ {
return -ENODEV; return -ENODEV;
} }
@@ -663,7 +662,7 @@ int imageproc_resize(uint8_t * ibuf,
/* Process resize */ /* Process resize */
len = (uintptr_t) cmd - (uintptr_t) g_gcmdbuf; 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) if (ret < 0)
{ {
ip_semgive(&g_geexc); ip_semgive(&g_geexc);
@@ -691,7 +690,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf,
uint16_t clip_width = 0; uint16_t clip_width = 0;
uint16_t clip_height = 0; uint16_t clip_height = 0;
if (g_gfd <= 0) if (g_gfile.f_inode == NULL)
{ {
return -ENODEV; return -ENODEV;
} }
@@ -782,7 +781,7 @@ int imageproc_clip_and_resize(uint8_t * ibuf,
/* Process resize */ /* Process resize */
len = (uintptr_t) cmd - (uintptr_t) g_gcmdbuf; 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) if (ret < 0)
{ {
ip_semgive(&g_geexc); ip_semgive(&g_geexc);
@@ -973,7 +972,7 @@ int imageproc_alpha_blend(imageproc_imginfo_t *dst,
/* Process alpha blending */ /* Process alpha blending */
len = (uintptr_t)cmd - (uintptr_t)g_gcmdbuf; 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) if (ret < 0)
{ {
ip_semgive(&g_abexc); ip_semgive(&g_abexc);
+3 -3
View File
@@ -25,9 +25,9 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <debug.h> #include <debug.h>
#include <sys/mount.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include "cxd56_spi.h" #include "cxd56_spi.h"
#include "cxd56_gpio.h" #include "cxd56_gpio.h"
@@ -91,10 +91,10 @@ int board_spisd_initialize(int minor, int bus)
/* Mount filesystem */ /* Mount filesystem */
ret = mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL); ret = nx_mount("/dev/mmcsd0", "/mnt/sd0", "vfat", 0, NULL);
if (ret < 0) 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; return OK;
@@ -25,14 +25,13 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <stdio.h> #include <stdio.h>
#include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/board.h> #include <nuttx/fs/fs.h>
#include <arch/board/board.h> #include <arch/board/board.h>
#ifdef CONFIG_RNDIS #ifdef CONFIG_RNDIS
@@ -325,10 +324,10 @@ int cxd56_bringup(void)
} }
#endif #endif
ret = mount(NULL, CXD56_PROCFS_MOUNTPOINT, "procfs", 0, NULL); ret = nx_mount(NULL, CXD56_PROCFS_MOUNTPOINT, "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
_err("ERROR: Failed to mount the procfs: %d\n", errno); _err("ERROR: Failed to mount the procfs: %d\n", ret);
} }
#endif #endif
@@ -360,7 +359,7 @@ int cxd56_bringup(void)
ret = board_flash_initialize(); ret = board_flash_initialize();
if (ret < 0) if (ret < 0)
{ {
_err("ERROR: Failed to initialize SPI-Flash. %d\n", errno); _err("ERROR: Failed to initialize SPI-Flash. %d\n", ret);
} }
#endif #endif
@@ -376,13 +375,13 @@ int cxd56_bringup(void)
ret = board_isx012_initialize(IMAGER_I2C); ret = board_isx012_initialize(IMAGER_I2C);
if (ret < 0) 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(); devops = isx012_initialize();
if (devops == NULL) 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; ret = ERROR;
} }
#endif /* CONFIG_VIDEO_ISX012 */ #endif /* CONFIG_VIDEO_ISX012 */
@@ -24,7 +24,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdint.h> #include <stdint.h>
@@ -34,6 +33,7 @@
#include <debug.h> #include <debug.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/fs/fs.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/sdio.h> #include <nuttx/sdio.h>
#include <nuttx/wqueue.h> #include <nuttx/wqueue.h>
@@ -148,7 +148,7 @@ static void board_sdcard_enable(FAR void *arg)
{ {
if (S_ISBLK(stat_sdio.st_mode)) 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) if (ret == 0)
{ {
finfo( finfo(
@@ -156,7 +156,7 @@ static void board_sdcard_enable(FAR void *arg)
} }
else 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); cxd56_sdio_resetstatus(g_sdhci.sdhci);
goto release_frequency_lock; goto release_frequency_lock;
} }
@@ -189,10 +189,10 @@ static void board_sdcard_disable(FAR void *arg)
{ {
/* un-mount */ /* un-mount */
ret = umount("/mnt/sd0"); ret = nx_umount2("/mnt/sd0", 0);
if (ret < 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 */ /* Report the new state to the SDIO driver */
@@ -23,7 +23,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <debug.h> #include <debug.h>
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#include "sabre-6quad.h" #include "sabre-6quad.h"
/**************************************************************************** /****************************************************************************
@@ -64,7 +65,7 @@ int imx_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,11 +40,11 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <syslog.h> #include <syslog.h>
#include <debug.h> #include <debug.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/wireless/bluetooth/bt_uart.h> #include <nuttx/wireless/bluetooth/bt_uart.h>
@@ -178,7 +178,7 @@ int imxrt_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -39,11 +39,11 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h> #include <debug.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <imxrt_lpi2c.h> #include <imxrt_lpi2c.h>
@@ -151,7 +151,7 @@ int imxrt_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,11 +40,11 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h> #include <debug.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <imxrt_lpi2c.h> #include <imxrt_lpi2c.h>
@@ -165,7 +165,7 @@ int imxrt_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -24,11 +24,11 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <sys/types.h> #include <sys/types.h>
#include <debug.h> #include <debug.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
#include <imxrt_lpi2c.h> #include <imxrt_lpi2c.h>
@@ -127,7 +127,7 @@ int imxrt_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -24,7 +24,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include <debug.h> #include <debug.h>
@@ -32,6 +31,8 @@
#include "freedom-k28f.h" #include "freedom-k28f.h"
#include <nuttx/fs/fs.h>
#ifdef CONFIG_PL2303 #ifdef CONFIG_PL2303
# include <nuttx/usb/pl2303.h> # include <nuttx/usb/pl2303.h>
#endif #endif
@@ -66,7 +67,7 @@ int k28_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); 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 */ /* Mount the volume on HSMCI0 */
ret = mount(CONFIG_FRDMK28F_SDHC_MOUNT_BLKDEV, ret = nx_mount(CONFIG_FRDMK28F_SDHC_MOUNT_BLKDEV,
CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT,
CONFIG_FRDMK28F_SDHC_MOUNT_FSTYPE, CONFIG_FRDMK28F_SDHC_MOUNT_FSTYPE,
0, NULL); 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, errno); CONFIG_FRDMK28F_SDHC_MOUNT_MOUNTPOINT, ret);
} }
} }
@@ -48,6 +48,7 @@
#include <assert.h> #include <assert.h>
#include <debug.h> #include <debug.h>
#include <nuttx/fs/fs.h>
#include <nuttx/irq.h> #include <nuttx/irq.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/usb/usbdev.h> #include <nuttx/usb/usbdev.h>
@@ -288,15 +289,11 @@ static void usb_msc_connect(FAR void *arg)
/* Mount */ /* 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); CONFIG_FRDMK28F_USB_AUTOMOUNT_FSTYPE, 0, NULL);
if (ret < 0) if (ret < 0)
{ {
int errcode = get_errno(); ferr("ERROR: Mount failed: %d\n", ret);
DEBUGASSERT(errcode > 0);
ferr("ERROR: Mount failed: %d\n", errcode);
UNUSED(errcode);
} }
} }
@@ -364,18 +361,15 @@ static void usb_msc_disconnect(FAR void *arg)
/* Unmount */ /* Unmount */
ret = umount2((FAR const char *)mntpnt, MNT_FORCE); ret = nx_umount2((FAR const char *)mntpnt, MNT_FORCE);
if (ret < 0) if (ret < 0)
{ {
int errcode = get_errno();
DEBUGASSERT(errcode > 0);
/* We expect the error to be EBUSY meaning that the volume could /* We expect the error to be EBUSY meaning that the volume could
* not be unmounted because there are currently reference via open * not be unmounted because there are currently reference via open
* files or directories. * files or directories.
*/ */
if (errcode == EBUSY) if (ret == -EBUSY)
{ {
finfo("WARNING: Volume is busy, try again later\n"); finfo("WARNING: Volume is busy, try again later\n");
@@ -40,11 +40,12 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/fs/fs.h>
#ifdef HAVE_RTC_DRIVER #ifdef HAVE_RTC_DRIVER
# include <nuttx/timers/rtc.h> # include <nuttx/timers/rtc.h>
# include "kinetis_alarm.h" # include "kinetis_alarm.h"
@@ -78,12 +79,11 @@ int k64_bringup(void)
syslog(LOG_INFO, "Mounting procfs to /proc\n"); 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) if (ret < 0)
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n", "ERROR: Failed to mount the PROC filesystem: %d\n", ret);
ret, errno);
return ret; return ret;
} }
#endif #endif
@@ -108,15 +108,15 @@ int k64_bringup(void)
{ {
/* Mount the volume on HSMCI0 */ /* Mount the volume on HSMCI0 */
ret = mount(CONFIG_FRDMK64F_SDHC_MOUNT_BLKDEV, ret = nx_mount(CONFIG_FRDMK64F_SDHC_MOUNT_BLKDEV,
CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT,
CONFIG_FRDMK64F_SDHC_MOUNT_FSTYPE, CONFIG_FRDMK64F_SDHC_MOUNT_FSTYPE,
0, NULL); 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, errno); CONFIG_FRDMK64F_SDHC_MOUNT_MOUNTPOINT, ret);
} }
} }
@@ -41,11 +41,12 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/input/buttons.h> #include <nuttx/input/buttons.h>
@@ -79,12 +80,11 @@ int k66_bringup(void)
syslog(LOG_INFO, "Mounting procfs to /proc\n"); 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) if (ret < 0)
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n", "ERROR: Failed to mount the PROC filesystem: %d\n", ret);
ret, errno);
return ret; return ret;
} }
#endif #endif
@@ -103,15 +103,15 @@ int k66_bringup(void)
{ {
/* Mount the volume on HSMCI0 */ /* Mount the volume on HSMCI0 */
ret = mount(CONFIG_FRDMK66F_SDHC_MOUNT_BLKDEV, ret = nx_mount(CONFIG_FRDMK66F_SDHC_MOUNT_BLKDEV,
CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT,
CONFIG_FRDMK66F_SDHC_MOUNT_FSTYPE, CONFIG_FRDMK66F_SDHC_MOUNT_FSTYPE,
0, NULL); 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n", syslog(LOG_ERR, "ERROR: Failed to mount %s: %d\n",
CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, errno); CONFIG_FRDMK66F_SDHC_MOUNT_MOUNTPOINT, ret);
} }
} }
@@ -43,9 +43,9 @@
#include <stdio.h> #include <stdio.h>
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <sys/mount.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_KINETIS_SDHC #ifdef CONFIG_KINETIS_SDHC
# include <nuttx/sdio.h> # include <nuttx/sdio.h>
@@ -93,12 +93,11 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_INFO, "Mounting procfs to /proc\n"); 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) if (ret < 0)
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n", "ERROR: Failed to mount the PROC filesystem: %d\n", ret);
ret, errno);
return ret; return ret;
} }
#endif #endif
@@ -25,7 +25,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <stdbool.h> #include <stdbool.h>
#include <syslog.h> #include <syslog.h>
@@ -34,6 +33,7 @@
# include <sched.h> # include <sched.h>
#endif #endif
#include <nuttx/fs/fs.h>
#include <nuttx/sched.h> #include <nuttx/sched.h>
#ifdef CONFIG_RNDIS #ifdef CONFIG_RNDIS
@@ -78,7 +78,7 @@ int lc823450_bringup(void)
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -86,7 +86,7 @@ int lc823450_bringup(void)
#endif #endif
#ifdef CONFIG_FS_FAT #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) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount vfat at /mnt/sd0: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount vfat at /mnt/sd0: %d\n", ret);
@@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <syslog.h> #include <syslog.h>
@@ -49,6 +48,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/sdio.h> #include <nuttx/sdio.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
@@ -354,7 +354,7 @@ int lpc4088_devkit_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system at the default location, /proc */ /* 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) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret);
@@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <syslog.h> #include <syslog.h>
@@ -49,6 +48,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/sdio.h> #include <nuttx/sdio.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
@@ -390,7 +390,7 @@ int lpc4088_quickstart_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system at the default location, /proc */ /* 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) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret);
@@ -44,11 +44,11 @@
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <sys/mount.h>
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/sdio.h> #include <nuttx/sdio.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
@@ -390,7 +390,7 @@ int lx_cpu_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system at the default location, /proc */ /* 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) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret);
@@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <syslog.h> #include <syslog.h>
@@ -47,6 +46,7 @@
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/usb/usbhost.h> #include <nuttx/usb/usbhost.h>
@@ -373,7 +373,7 @@ int mcb1700_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -39,12 +39,12 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
@@ -392,7 +392,7 @@ int lpc17_40_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -39,7 +39,6 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/mount.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <syslog.h> #include <syslog.h>
@@ -49,6 +48,7 @@
#include <nuttx/arch.h> #include <nuttx/arch.h>
#include <nuttx/kthread.h> #include <nuttx/kthread.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/sdio.h> #include <nuttx/sdio.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <nuttx/video/fb.h> #include <nuttx/video/fb.h>
@@ -389,7 +389,7 @@ int open1788_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system at the default location, /proc */ /* 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) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs: %d\n", ret);
@@ -42,9 +42,9 @@
#include <stdio.h> #include <stdio.h>
#include <syslog.h> #include <syslog.h>
#include <errno.h> #include <errno.h>
#include <sys/mount.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/binfmt/elf.h> #include <nuttx/binfmt/elf.h>
#include <nuttx/binfmt/nxflat.h> #include <nuttx/binfmt/nxflat.h>
@@ -120,21 +120,20 @@ int pnev5180b_bringup(void)
int ret = OK; int ret = OK;
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d (%d)\n", syslog(LOG_ERR, "ERROR: Failed to mount the PROC filesystem: %d\n",
ret, errno); ret);
goto done; goto done;
} }
#endif #endif
#ifdef CONFIG_FS_BINFS #ifdef CONFIG_FS_BINFS
ret = mount(NULL, "/bin", "binfs", 0, NULL); ret = nx_mount(NULL, "/bin", "binfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d (%d)\n", syslog(LOG_ERR, "ERROR: Failed to mount the BIN filesystem: %d\n", ret);
ret, errno);
goto done; goto done;
} }
#endif #endif
@@ -51,6 +51,7 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include <nuttx/fs/fs.h>
#include <nuttx/drivers/ramdisk.h> #include <nuttx/drivers/ramdisk.h>
#include "lpc17_40_romfs.h" #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", finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
CONFIG_LPC17_40_ROMFS_MOUNTPOINT, MOUNT_DEVNAME); 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); "romfs", MS_RDONLY, NULL);
if (ret < 0) if (ret < 0)
{ {
ferr("ERROR: mount(%s,%s,romfs) failed: %d\n", ferr("ERROR: nx_mount(%s,%s,romfs) failed: %d\n",
MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, errno); MOUNT_DEVNAME, CONFIG_LPC17_40_ROMFS_MOUNTPOINT, ret);
return ret; return ret;
} }
@@ -44,11 +44,10 @@
#include <errno.h> #include <errno.h>
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/fs/fs.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h> #include <nuttx/mmcsd.h>
#include <sys/mount.h>
#include "lpc17_40_ssp.h" #include "lpc17_40_ssp.h"
/**************************************************************************** /****************************************************************************
@@ -156,12 +155,11 @@ int board_app_initialize(uintptr_t arg)
syslog(LOG_INFO, "Mounting procfs to /proc\n"); 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) if (ret < 0)
{ {
syslog(LOG_ERR, syslog(LOG_ERR,
"ERROR: Failed to mount the PROC filesystem: %d (%d)\n", "ERROR: Failed to mount the PROC filesystem: %d\n", ret);
ret, errno);
return ret; return ret;
} }
#endif #endif
@@ -84,7 +84,7 @@ int board_app_initialize(uintptr_t arg)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -183,7 +183,7 @@
struct pg_source_s struct pg_source_s
{ {
bool initialized; /* TRUE: we are initialized */ 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 #endif
@@ -272,16 +272,16 @@ static inline void lpc31_initsrc(void)
/* Now mount the file system */ /* Now mount the file system */
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3131_PAGING_MINOR); snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3131_PAGING_MINOR);
ret = mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat", MS_RDONLY, ret = nx_mount(devname, CONFIG_EA3131_PAGING_MOUNTPT, "vfat",
NULL); MS_RDONLY, NULL);
DEBUGASSERT(ret == OK); DEBUGASSERT(ret == OK);
#endif /* CONFIG_EA3131_PAGING_SDSLOT */ #endif /* CONFIG_EA3131_PAGING_SDSLOT */
/* Open the selected path for read-only access */ /* Open the selected path for read-only access */
g_pgsrc.fd = nx_open(CONFIG_PAGING_BINPATH, O_RDONLY); file_open(&g_pgsrc.file, CONFIG_PAGING_BINPATH, O_RDONLY);
DEBUGASSERT(g_pgsrc.fd >= 0); DEBUGASSERT(g_pgsrc.file.f_inode != NULL);
/* Then we are initialized */ /* Then we are initialized */
@@ -443,12 +443,12 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage)
/* Seek to that position */ /* 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); DEBUGASSERT(pos != (off_t)-1);
/* And read the page data from that offset */ /* 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); DEBUGASSERT(nbytes == PAGESIZE);
return OK; return OK;
@@ -182,7 +182,7 @@
struct pg_source_s struct pg_source_s
{ {
bool initialized; /* TRUE: we are initialized */ 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 #endif
@@ -272,16 +272,16 @@ static inline void lpc31_initsrc(void)
/* Now mount the file system */ /* Now mount the file system */
snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3152_PAGING_MINOR); snprintf(devname, 16, "/dev/mmcsd%d", CONFIG_EA3152_PAGING_MINOR);
ret = mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat", MS_RDONLY, ret = nx_mount(devname, CONFIG_EA3152_PAGING_MOUNTPT, "vfat",
NULL); MS_RDONLY, NULL);
DEBUGASSERT(ret == OK); DEBUGASSERT(ret == OK);
#endif /* CONFIG_EA3152_PAGING_SDSLOT */ #endif /* CONFIG_EA3152_PAGING_SDSLOT */
/* Open the selected path for read-only access */ /* Open the selected path for read-only access */
g_pgsrc.fd = nx_open(CONFIG_PAGING_BINPATH, O_RDONLY); file_open(&g_pgsrc.file, CONFIG_PAGING_BINPATH, O_RDONLY);
DEBUGASSERT(g_pgsrc.fd >= 0); DEBUGASSERT(g_pgsrc.file.f_inode != NULL);
/* Then we are initialized */ /* Then we are initialized */
@@ -444,12 +444,12 @@ int up_fillpage(FAR struct tcb_s *tcb, FAR void *vpage)
/* Seek to that position */ /* 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); DEBUGASSERT(pos != (off_t)-1);
/* And read the page data from that offset */ /* 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); DEBUGASSERT(nbytes == PAGESIZE);
return OK; return OK;
@@ -53,7 +53,7 @@
# include "lpc43_spifi.h" # include "lpc43_spifi.h"
# ifdef CONFIG_SPFI_NXFFS # ifdef CONFIG_SPFI_NXFFS
# include <sys/mount.h> # include <nuttx/fs/fs.h>
# include <nuttx/fs/nxffs.h> # include <nuttx/fs/nxffs.h>
# endif # endif
#endif #endif
@@ -125,10 +125,10 @@ static int nsh_spifi_initialize(void)
/* Mount the file system at /mnt/spifi */ /* 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) 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; return ret;
} }
#endif #endif
@@ -52,7 +52,7 @@
# include "lpc43_spifi.h" # include "lpc43_spifi.h"
# ifdef CONFIG_SPFI_NXFFS # ifdef CONFIG_SPFI_NXFFS
# include <sys/mount.h> # include <nuttx/fs/fs.h>
# include <nuttx/fs/nxffs.h> # include <nuttx/fs/nxffs.h>
# endif # endif
#endif #endif
@@ -116,10 +116,10 @@ static int nsh_spifi_initialize(void)
/* Mount the file system at /mnt/spifi */ /* 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) 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; return ret;
} }
#endif #endif
@@ -52,7 +52,7 @@
# include "lpc43_spifi.h" # include "lpc43_spifi.h"
# ifdef CONFIG_SPFI_NXFFS # ifdef CONFIG_SPFI_NXFFS
# include <sys/mount.h> # include <nuttx/fs/fs.h>
# include <nuttx/fs/nxffs.h> # include <nuttx/fs/nxffs.h>
# endif # endif
#endif #endif
@@ -116,10 +116,10 @@ static int nsh_spifi_initialize(void)
/* Mount the file system at /mnt/spifi */ /* 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) 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; return ret;
} }
#endif #endif
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_VIDEO_FB #ifdef CONFIG_VIDEO_FB
# include <nuttx/video/fb.h> # include <nuttx/video/fb.h>
#endif #endif
@@ -95,7 +96,7 @@ int lpc54_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#include "max32660-evsys.h" #include "max32660-evsys.h"
/**************************************************************************** /****************************************************************************
@@ -87,7 +88,7 @@ int max326_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -28,7 +28,7 @@
#include <syslog.h> #include <syslog.h>
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
#include <sys/mount.h> #include <nuttx/fs/fs.h>
#endif #endif
#ifdef CONFIG_NRF52_WDT #ifdef CONFIG_NRF52_WDT
@@ -66,7 +66,7 @@ int nrf52_bringup(void)
int ret; int ret;
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
mount(NULL, "/proc", "procfs", 0, NULL); nx_mount(NULL, "/proc", "procfs", 0, NULL);
#endif #endif
#ifdef CONFIG_NRF52_WDT #ifdef CONFIG_NRF52_WDT
@@ -26,7 +26,8 @@
#include <debug.h> #include <debug.h>
#include <stddef.h> #include <stddef.h>
#include <sys/mount.h>
#include <nuttx/fs/fs.h>
#include "rp2040_pico.h" #include "rp2040_pico.h"
@@ -45,7 +46,7 @@ int rp2040_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret); serr("ERROR: Failed to mount procfs at %s: %d\n", "/proc", ret);
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_BUTTONS #ifdef CONFIG_BUTTONS
# include <nuttx/input/buttons.h> # include <nuttx/input/buttons.h>
#endif #endif
@@ -108,7 +109,7 @@ int s32k1xx_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_BUTTONS #ifdef CONFIG_BUTTONS
# include <nuttx/input/buttons.h> # include <nuttx/input/buttons.h>
#endif #endif
@@ -108,7 +109,7 @@ int s32k1xx_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_BUTTONS #ifdef CONFIG_BUTTONS
# include <nuttx/input/buttons.h> # include <nuttx/input/buttons.h>
#endif #endif
@@ -102,7 +103,7 @@ int s32k1xx_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);
@@ -40,9 +40,10 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/mount.h>
#include <syslog.h> #include <syslog.h>
#include <nuttx/fs/fs.h>
#ifdef CONFIG_BUTTONS #ifdef CONFIG_BUTTONS
# include <nuttx/input/buttons.h> # include <nuttx/input/buttons.h>
#endif #endif
@@ -107,7 +108,7 @@ int s32k1xx_bringup(void)
#ifdef CONFIG_FS_PROCFS #ifdef CONFIG_FS_PROCFS
/* Mount the procfs file system */ /* Mount the procfs file system */
ret = mount(NULL, "/proc", "procfs", 0, NULL); ret = nx_mount(NULL, "/proc", "procfs", 0, NULL);
if (ret < 0) if (ret < 0)
{ {
syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret); syslog(LOG_ERR, "ERROR: Failed to mount procfs at /proc: %d\n", ret);

Some files were not shown because too many files have changed in this diff Show More