From af30085f9c23d7e48ba71d85fa273a0caac9da38 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 5 Aug 2018 17:03:08 -0600 Subject: [PATCH] apps/examples/module: Fix some error introduced with last changes to this example. Found in build testing. --- examples/module/Kconfig | 2 +- examples/module/module_main.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/examples/module/Kconfig b/examples/module/Kconfig index 99a3e7019..e99f602d1 100644 --- a/examples/module/Kconfig +++ b/examples/module/Kconfig @@ -32,7 +32,7 @@ config EXAMPLES_MODULE_BUILTINFS for testing on the target. That file system will need to be mounted such that CONFIG_EXAMPLES_MODULE_BINDIR refers to the directory containing the module binaries (unless the file system is auto- - automounted) + mounted) NOTE: This option can only be used in the FLAT build mode because it makes an illegal OS call to ramdisk_register(). diff --git a/examples/module/module_main.c b/examples/module/module_main.c index be75a0903..dcae27cc5 100644 --- a/examples/module/module_main.c +++ b/examples/module/module_main.c @@ -80,7 +80,7 @@ #endif #if defined(CONFIG_EXAMPLES_MODULE_BUILTINFS) -# if !defined(CONFIG_FS_ROMFS) || !defined(CONFIG_FS_CROMFS) +# if !defined(CONFIG_FS_ROMFS) && !defined(CONFIG_FS_CROMFS) # error "You must select CONFIG_FS_ROMFS or CONFIG_FS_CROMFS in your configuration file" # endif @@ -88,9 +88,9 @@ # error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" # endif - /* Describe the ROMFS file system */ +# if defined(CONFIG_EXAMPLES_MODULE_ROMFS) +/* Describe the ROMFS file system */ -# if defined(CONFIG_EXAMPLES_MODULE_CROMFS) # define SECTORSIZE 64 # define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) # define MOUNTPT "/mnt/romfs" @@ -102,6 +102,7 @@ # ifndef CONFIG_EXAMPLES_MODULE_DEVPATH # define CONFIG_EXAMPLES_MODULE_DEVPATH "/dev/ram0" # endif + # elif defined(CONFIG_EXAMPLES_MODULE_CROMFS) /* Describe the CROMFS file system */ @@ -111,10 +112,14 @@ # define BINDIR MOUNTPT #elif defined(CONFIG_EXAMPLES_MODULE_FSMOUNT) +/* Describe how to auto-mount the external file system */ + # define MOUNTPT "/mnt/" CONFIG_EXAMPLES_MODULE_FSTYPE # define BINDIR MOUNTPT #else +/* Describe how to use the pre-mounted external file system */ + # define BINDIR CONFIG_EXAMPLES_MODULE_BINDIR #endif /* CONFIG_EXAMPLES_MODULE_BUILTINFS */ @@ -275,7 +280,7 @@ int module_main(int argc, char *argv[]) MOUNTPT, errno); } -#endif +#endif /* CONFIG_EXAMPLES_MODULE_FSMOUNT */ #endif /* CONFIG_EXAMPLES_MODULE_BUILTINFS */ /* Install the character driver */ @@ -284,7 +289,8 @@ int module_main(int argc, char *argv[]) if (handle == NULL) { int errcode = errno; - fprintf(stderr, "ERROR: insmod failed: %d\n", errcode); + fprintf(stderr, "ERROR: insmod(%s/chardev, chardev) failed: %d\n", + BINDIR, errcode); exit(EXIT_FAILURE); }