mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:22:18 +08:00
Ensure the kernel component don't call userspace API
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Masayuki Ishikawa
parent
cf73496d9e
commit
9473434587
@@ -39,11 +39,11 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#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",
|
||||
|
||||
@@ -39,11 +39,11 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#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",
|
||||
|
||||
@@ -40,11 +40,12 @@
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <syslog.h>
|
||||
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
/****************************************************************************
|
||||
* 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);
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -39,8 +39,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -48,6 +46,7 @@
|
||||
|
||||
#include <nuttx/spi/spi.h>
|
||||
#include <nuttx/mtd/mtd.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/nxffs.h>
|
||||
|
||||
#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
|
||||
|
||||
@@ -40,8 +40,6 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
@@ -50,6 +48,7 @@
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/board.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
|
||||
#ifdef CONFIG_CDCACM
|
||||
# include <nuttx/usb/cdcacm.h>
|
||||
@@ -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
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/mount.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <debug.h>
|
||||
|
||||
#include <nuttx/mtd/mtd.h>
|
||||
#include <nuttx/fs/fs.h>
|
||||
#include <nuttx/fs/nxffs.h>
|
||||
#include <arch/board/board.h>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user