You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/05/12 11:42:04 UTC
[incubator-nuttx-apps] branch master updated: Apps Issue #246:
Replace romdisk_register() with boardctl(BOARDIOC_ROMDISK) C file changes:
examples/bastest/bastest_main.c examples/elf/elf_main.c
examples/module/module_main.c examples/posix_spawn/spawn_main.c
examples/romfs/romfs_main.c examples/sotest/sotest_main.c
examples/unionfs/unionfs_main.c
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new f0c044a Apps Issue #246: Replace romdisk_register() with boardctl(BOARDIOC_ROMDISK) C file changes: examples/bastest/bastest_main.c examples/elf/elf_main.c examples/module/module_main.c examples/posix_spawn/spawn_main.c examples/romfs/romfs_main.c examples/sotest/sotest_main.c examples/unionfs/unionfs_main.c
f0c044a is described below
commit f0c044adb11bd10c23da5ec8e785b57a2671f1dc
Author: Tanushree Baindur <ta...@gmail.com>
AuthorDate: Sat May 8 13:33:52 2021 -0500
Apps Issue #246: Replace romdisk_register() with boardctl(BOARDIOC_ROMDISK)
C file changes:
examples/bastest/bastest_main.c
examples/elf/elf_main.c
examples/module/module_main.c
examples/posix_spawn/spawn_main.c
examples/romfs/romfs_main.c
examples/sotest/sotest_main.c
examples/unionfs/unionfs_main.c
Update examples/elf/elf_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
Update examples/unionfs/unionfs_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
Update examples/unionfs/unionfs_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
Update examples/posix_spawn/spawn_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
Update examples/elf/elf_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
Update examples/elf/elf_main.c
Co-authored-by: Xiang Xiao <xi...@gmail.com>
---
examples/bastest/bastest_main.c | 25 ++++++++++++++++-------
examples/elf/elf_main.c | 43 +++++++++++++++++++--------------------
examples/module/module_main.c | 40 ++++++++++++------------------------
examples/posix_spawn/spawn_main.c | 33 +++++++++++++++++-------------
examples/romfs/romfs_main.c | 16 ++++++++++-----
examples/sotest/sotest_main.c | 31 ++++++++++++++--------------
examples/unionfs/unionfs_main.c | 33 ++++++++++++++++++++----------
7 files changed, 119 insertions(+), 102 deletions(-)
diff --git a/examples/bastest/bastest_main.c b/examples/bastest/bastest_main.c
index f38e2af..fa244af 100644
--- a/examples/bastest/bastest_main.c
+++ b/examples/bastest/bastest_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * examples/bastest/bastest_main.c
+ * apps/examples/bastest/bastest_main.c
*
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gn...@nuttx.org>
@@ -40,7 +40,9 @@
#include <nuttx/config.h>
#include <sys/mount.h>
+#include <sys/boardctl.h>
#include <stdio.h>
+#include <string.h>
#include <errno.h>
#include <nuttx/drivers/ramdisk.h>
@@ -92,15 +94,23 @@
int main(int argc, FAR char *argv[])
{
int ret;
+ struct boardioc_romdisk_s desc;
/* Create a ROM disk for the ROMFS filesystem */
- printf("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_BASTEST_DEVMINOR);
- ret = romdisk_register(CONFIG_EXAMPLES_BASTEST_DEVMINOR, (FAR uint8_t *)romfs_img,
- NSECTORS(romfs_img_len), SECTORSIZE);
+ printf("Registering romdisk at /dev/ram%d\n",
+ CONFIG_EXAMPLES_BASTEST_DEVMINOR);
+
+ desc.minor = CONFIG_EXAMPLES_BASTEST_DEVMINOR; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)romfs_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
if (ret < 0)
{
- fprintf(stderr, "ERROR: romdisk_register failed: %d\n", ret);
+ fprintf(stderr, "ERROR: romdisk_register failed: %s\n",
+ strerror(errno));
return 1;
}
@@ -109,11 +119,12 @@ int main(int argc, FAR char *argv[])
printf("Mounting ROMFS filesystem at target=%s with source=%s\n",
MOUNTPT, CONFIG_EXAMPLES_BASTEST_DEVPATH);
- ret = mount(CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL);
+ ret = mount(CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, "romfs",
+ MS_RDONLY, NULL);
if (ret < 0)
{
fprintf(stderr, "ERROR: mount(%s,%s,romfs) failed: %s\n",
- CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, errno);
+ CONFIG_EXAMPLES_BASTEST_DEVPATH, MOUNTPT, strerror(errno));
return 1;
}
diff --git a/examples/elf/elf_main.c b/examples/elf/elf_main.c
index d72d5a9..352f835 100644
--- a/examples/elf/elf_main.c
+++ b/examples/elf/elf_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * examples/elf/elf_main.c
+ * apps/examples/elf/elf_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -24,6 +24,7 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
+#include <sys/boardctl.h>
#include <sys/mount.h>
#include <sys/stat.h>
@@ -205,36 +206,32 @@ int main(int argc, FAR char *argv[])
FAR char *args[1];
int ret;
int i;
+ struct boardioc_romdisk_s desc;
/* Initialize the memory monitor */
mm_initmonitor();
#if defined(CONFIG_EXAMPLES_ELF_ROMFS)
-#if defined(CONFIG_BUILD_FLAT)
- /* This example violates the portable POSIX interface by calling the OS
- * internal function romdisk_register() (aka ramdisk_register()). We can
- * squeak by in with this violation in the FLAT build mode, but not in
- * other build modes. In other build modes, the following logic must be
- * performed in the OS board initialization logic (where it really belongs
- * anyway).
- */
/* Create a ROM disk for the ROMFS filesystem */
message("Registering romdisk at /dev/ram%d\n",
CONFIG_EXAMPLES_ELF_DEVMINOR);
- ret = romdisk_register(CONFIG_EXAMPLES_ELF_DEVMINOR,
- (FAR uint8_t *)romfs_img,
- NSECTORS(romfs_img_len), SECTORSIZE);
+
+ desc.minor = CONFIG_EXAMPLES_ELF_DEVMINOR; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)romfs_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
if (ret < 0)
{
- errmsg("ERROR: romdisk_register failed: %d\n", ret);
+ errmsg("ERROR: romdisk_register failed: %s\n", strerror(errno));
exit(1);
}
mm_update(&g_mmstep, "after romdisk_register");
-#endif
/* Mount the ROMFS file system */
@@ -245,8 +242,8 @@ int main(int argc, FAR char *argv[])
MS_RDONLY, NULL);
if (ret < 0)
{
- errmsg("ERROR: mount(%s,%s,romfs) failed: %d\n",
- CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
+ errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n",
+ CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, strerror(errno));
}
#elif defined(CONFIG_EXAMPLES_ELF_CROMFS)
@@ -257,7 +254,8 @@ int main(int argc, FAR char *argv[])
ret = mount(NULL, MOUNTPT, "cromfs", MS_RDONLY, NULL);
if (ret < 0)
{
- errmsg("ERROR: mount(%s, cromfs) failed: %d\n", MOUNTPT, errno);
+ errmsg("ERROR: mount(%s, cromfs) failed: %s\n",
+ MOUNTPT, strerror(errno));
}
#elif defined(CONFIG_EXAMPLES_ELF_EXTERN)
/* An external file system is being used */
@@ -280,8 +278,8 @@ int main(int argc, FAR char *argv[])
}
else
{
- printf("ERROR: stat(%s) failed: %d Aborting...\n",
- CONFIG_EXAMPLES_ELF_DEVPATH, errcode);
+ printf("ERROR: stat(%s) failed: %s Aborting...\n",
+ CONFIG_EXAMPLES_ELF_DEVPATH, strerror(errcode));
exit(EXIT_FAILURE);
}
}
@@ -304,9 +302,9 @@ int main(int argc, FAR char *argv[])
CONFIG_EXAMPLES_ELF_FSTYPE, MS_RDONLY, NULL);
if (ret < 0)
{
- errmsg("ERROR: mount(%s, %s, %s) failed: %d\n",
+ errmsg("ERROR: mount(%s, %s, %s) failed: %s\n",
CONFIG_EXAMPLES_ELF_DEVPATH, CONFIG_EXAMPLES_ELF_FSTYPE,
- MOUNTPT, errno);
+ MOUNTPT, strerror(errno));
}
#endif
#else
@@ -364,7 +362,8 @@ int main(int argc, FAR char *argv[])
if (ret < 0)
{
- errmsg("ERROR: exec(%s) failed: %d\n", dirlist[i], errno);
+ errmsg("ERROR: exec(%s) failed: %s\n",
+ dirlist[i], strerror(errno));
}
else
{
diff --git a/examples/module/module_main.c b/examples/module/module_main.c
index 26ff585..fcf07cf 100644
--- a/examples/module/module_main.c
+++ b/examples/module/module_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * examples/module/module_main.c
+ * apps/examples/module/module_main.c
*
* Copyright (C) 2015, 2017-2018 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gn...@nuttx.org>
@@ -160,6 +160,7 @@ int main(int argc, FAR char *argv[])
ssize_t nbytes;
int ret;
int fd;
+ struct boardioc_romdisk_s desc;
#ifdef CONFIG_BUILD_FLAT
/* Set the OS symbol table indirectly through the boardctl() */
@@ -169,8 +170,8 @@ int main(int argc, FAR char *argv[])
ret = boardctl(BOARDIOC_OS_SYMTAB, (uintptr_t)&symdesc);
if (ret < 0)
{
- fprintf(stderr, "ERROR: boardctl(BOARDIOC_OS_SYMTAB) failed: %d\n",
- ret);
+ fprintf(stderr, "ERROR: boardctl(BOARDIOC_OS_SYMTAB) failed: %s\n",
+ strerror(errno));
exit(EXIT_FAILURE);
}
#endif
@@ -182,33 +183,18 @@ int main(int argc, FAR char *argv[])
printf("main: Registering romdisk at /dev/ram%d\n",
CONFIG_EXAMPLES_MODULE_DEVMINOR);
-#if defined(CONFIG_BUILD_FLAT)
- /* This example violates the portable POSIX interface by calling the OS
- * internal function romdisk_register() (aka ramdisk_register()). We can
- * squeak by in with this violation in the FLAT build mode, but not in
- * other build modes. In other build modes, the following logic must be
- * performed in the OS board initialization logic (where it really belongs
- * anyway).
- */
-
- ret = romdisk_register(CONFIG_EXAMPLES_MODULE_DEVMINOR,
- (FAR uint8_t *)romfs_img,
- NSECTORS(romfs_img_len), SECTORSIZE);
+ desc.minor = CONFIG_EXAMPLES_MODULE_DEVMINOR; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)romfs_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
if (ret < 0)
{
- /* This will happen naturally if we registered the ROM disk
- * previously.
- */
-
- if (ret != -EEXIST)
- {
- fprintf(stderr, "ERROR: romdisk_register failed: %d\n", ret);
- exit(EXIT_FAILURE);
- }
-
- printf("main: ROM disk already registered\n");
+ fprintf(stderr, "ERROR: romdisk_register failed: %s\n",
+ strerror(errno));
+ exit(EXIT_FAILURE);
}
-#endif
/* Mount the file system */
diff --git a/examples/posix_spawn/spawn_main.c b/examples/posix_spawn/spawn_main.c
index 911a9f2..23ec90a 100644
--- a/examples/posix_spawn/spawn_main.c
+++ b/examples/posix_spawn/spawn_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * examples/posix_spawn/spawn_main.c
+ * apps/examples/posix_spawn/spawn_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -83,12 +83,12 @@
#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE)
#define MOUNTPT "/mnt/romfs"
-#ifndef CONFIG_EXAMPLES_ELF_DEVMINOR
-# define CONFIG_EXAMPLES_ELF_DEVMINOR 0
+#ifndef CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR
+# define CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR 0
#endif
-#ifndef CONFIG_EXAMPLES_ELF_DEVPATH
-# define CONFIG_EXAMPLES_ELF_DEVPATH "/dev/ram0"
+#ifndef CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH
+# define CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH "/dev/ram0"
#endif
/* If CONFIG_DEBUG_FEATURES is enabled, use info/err instead of printf so
@@ -207,6 +207,7 @@ int main(int argc, FAR char *argv[])
FAR const char *filepath;
pid_t pid;
int ret;
+ struct boardioc_romdisk_s desc;
/* Initialize the memory monitor */
@@ -214,15 +215,19 @@ int main(int argc, FAR char *argv[])
/* Create a ROM disk for the ROMFS filesystem */
+ desc.minor = CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)romfs_img; /* File system image */
+
message("Registering romdisk at /dev/ram%d\n",
- CONFIG_EXAMPLES_ELF_DEVMINOR);
+ CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR);
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
- ret = romdisk_register(CONFIG_EXAMPLES_ELF_DEVMINOR,
- (FAR uint8_t *)romfs_img, NSECTORS(romfs_img_len),
- SECTORSIZE);
if (ret < 0)
{
- errmsg("ERROR: romdisk_register failed: %d\n", ret);
+ errmsg("ERROR: romdisk_register failed: %s\n", strerror(errno));
exit(1);
}
@@ -231,14 +236,14 @@ int main(int argc, FAR char *argv[])
/* Mount the file system */
message("Mounting ROMFS filesystem at target=%s with source=%s\n",
- MOUNTPT, CONFIG_EXAMPLES_ELF_DEVPATH);
+ MOUNTPT, CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH);
- ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs",
+ ret = mount(CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH, MOUNTPT, "romfs",
MS_RDONLY, NULL);
if (ret < 0)
{
- errmsg("ERROR: mount(%s,%s,romfs) failed: %d\n",
- CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno);
+ errmsg("ERROR: mount(%s,%s,romfs) failed: %s\n",
+ CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH, MOUNTPT, strerror(errno));
}
mm_update(&g_mmstep, "after mount");
diff --git a/examples/romfs/romfs_main.c b/examples/romfs/romfs_main.c
index a963f07..7162722 100644
--- a/examples/romfs/romfs_main.c
+++ b/examples/romfs/romfs_main.c
@@ -60,6 +60,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <sys/boardctl.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stdint.h>
@@ -474,15 +475,20 @@ static void checkdirectories(struct node_s *entry)
int main(int argc, FAR char *argv[])
{
int ret;
+ struct boardioc_romdisk_s desc;
/* Create a RAM disk for the test */
- ret = romdisk_register(CONFIG_EXAMPLES_ROMFS_RAMDEVNO, testdir_img,
- NSECTORS(testdir_img_len),
- CONFIG_EXAMPLES_ROMFS_SECTORSIZE);
+ desc.minor = CONFIG_EXAMPLES_ROMFS_RAMDEVNO; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(testdir_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = CONFIG_EXAMPLES_ROMFS_SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)testdir_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
+
if (ret < 0)
{
- printf("ERROR: Failed to create RAM disk\n");
+ printf("ERROR: Failed to create RAM disk: %s\n", strerror(errno));
return 1;
}
@@ -495,7 +501,7 @@ int main(int argc, FAR char *argv[])
MS_RDONLY, NULL);
if (ret < 0)
{
- printf("ERROR: Mount failed: %d\n", errno);
+ printf("ERROR: Mount failed: %s\n", strerror(errno));
return 1;
}
diff --git a/examples/sotest/sotest_main.c b/examples/sotest/sotest_main.c
index e1a4b31..0a7a1f6 100644
--- a/examples/sotest/sotest_main.c
+++ b/examples/sotest/sotest_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * examples/sotest/sotest_main.c
+ * apps/examples/sotest/sotest_main.c
*
* Copyright (C) 2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gn...@nuttx.org>
@@ -41,6 +41,7 @@
#ifdef CONFIG_EXAMPLES_SOTEST_BUILTINFS
# include <sys/mount.h>
+# include <sys/boardctl.h>
#endif
#include <stdio.h>
@@ -124,7 +125,9 @@ int main(int argc, FAR char *argv[])
CODE void (*testfunc)(FAR const char *msg);
FAR const char *msg;
int ret;
-
+#ifdef CONFIG_EXAMPLES_SOTEST_BUILTINFS
+ struct boardioc_romdisk_s desc;
+#endif
/* Set the shared library symbol table */
ret = dlsymtab((FAR struct symtab_s *)g_sot_exports, g_sot_nexports);
@@ -137,25 +140,21 @@ int main(int argc, FAR char *argv[])
#ifdef CONFIG_EXAMPLES_SOTEST_BUILTINFS
/* Create a ROM disk for the ROMFS filesystem */
+ desc.minor = CONFIG_EXAMPLES_SOTEST_DEVMINOR; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(romfs_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)romfs_img; /* File system image */
+
printf("main: Registering romdisk at /dev/ram%d\n",
CONFIG_EXAMPLES_SOTEST_DEVMINOR);
- ret = romdisk_register(CONFIG_EXAMPLES_SOTEST_DEVMINOR,
- (FAR uint8_t *)romfs_img,
- NSECTORS(romfs_img_len), SECTORSIZE);
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
+
if (ret < 0)
{
- /* This will happen naturally if we registered the ROM disk
- * previously.
- */
-
- if (ret != -EEXIST)
- {
- fprintf(stderr, "ERROR: romdisk_register failed: %d\n", ret);
- exit(EXIT_FAILURE);
- }
-
- printf("main: ROM disk already registered\n");
+ fprintf(stderr, "ERROR: romdisk_register failed: %s\n",
+ strerror(errno));
+ exit(EXIT_FAILURE);
}
/* Mount the file system */
diff --git a/examples/unionfs/unionfs_main.c b/examples/unionfs/unionfs_main.c
index b622624..ca0b711 100644
--- a/examples/unionfs/unionfs_main.c
+++ b/examples/unionfs/unionfs_main.c
@@ -43,6 +43,7 @@
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/mman.h>
+#include <sys/boardctl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -128,15 +129,21 @@
int main(int argc, FAR char *argv[])
{
int ret;
+ struct boardioc_romdisk_s desc;
/* Create a RAM disk for file system 1 */
- ret = romdisk_register(CONFIG_EXAMPLES_UNIONFS_RAMDEVNO_A, atestdir_img,
- NSECTORS(atestdir_img_len),
- CONFIG_EXAMPLES_UNIONFS_SECTORSIZE);
+ desc.minor = CONFIG_EXAMPLES_UNIONFS_RAMDEVNO_A; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(atestdir_img_len); /* The number of sectors in the ROM disk */
+ desc.sectsize = CONFIG_EXAMPLES_UNIONFS_SECTORSIZE; /* The size of one sector in bytes */
+ desc.image = (FAR uint8_t *)atestdir_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
+
if (ret < 0)
{
- printf("ERROR: Failed to create file system 1 RAM disk\n");
+ printf("ERROR: Failed to create file system 1 RAM disk: %s\n",
+ strerror(errno));
return EXIT_FAILURE;
}
@@ -149,18 +156,22 @@ int main(int argc, FAR char *argv[])
MS_RDONLY, NULL);
if (ret < 0)
{
- printf("ERROR: File system 1 mount failed: %d\n", errno);
+ printf("ERROR: File system 1 mount failed: %s\n", strerror(errno));
return EXIT_FAILURE;
}
- /* Create a RAM disk for file system 2 */
+ /* Create a RAM disk for file system 2 */
+
+ desc.minor = CONFIG_EXAMPLES_UNIONFS_RAMDEVNO_B; /* Minor device number of the ROM disk. */
+ desc.nsectors = NSECTORS(btestdir_img_len); /* The number of sectors in the ROM disk */
+ desc.image = (FAR uint8_t *)btestdir_img; /* File system image */
+
+ ret = boardctl(BOARDIOC_ROMDISK, (uintptr_t)&desc);
- ret = romdisk_register(CONFIG_EXAMPLES_UNIONFS_RAMDEVNO_B, btestdir_img,
- NSECTORS(btestdir_img_len),
- CONFIG_EXAMPLES_UNIONFS_SECTORSIZE);
if (ret < 0)
{
- printf("ERROR: Failed to register file system 1: %d\n", ret);
+ printf("ERROR: Failed to create file system 2 RAM disk: %s\n",
+ strerror(errno));
return EXIT_FAILURE;
}
@@ -173,7 +184,7 @@ int main(int argc, FAR char *argv[])
MS_RDONLY, NULL);
if (ret < 0)
{
- printf("ERROR: Failed to register file system 1: %d\n", ret);
+ printf("ERROR: File system 2 mount failed: %s\n", strerror(errno));
return EXIT_FAILURE;
}