drivers/Kconfig: Add an option, CONFIG_DRVR_MKRD, to control whether or not the mkrd() implementation is build. Otherwise, if mkrd() is built unconditionally, it will be drawn into every build whether it is used or not and will increase the build size.

This commit is contained in:
Gregory Nutt 2019-10-26 11:43:34 -06:00
parent 03bf18d097
commit 07edaa088c
7 changed files with 26 additions and 11 deletions

9
TODO
View File

@ -1,4 +1,4 @@
NuttX TODO List (Last updated August 24, 2019)
NuttX TODO List (Last updated September 26, 2019)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This file summarizes known NuttX bugs, limitations, inconsistencies with
@ -2845,7 +2845,7 @@ o Other Applications & Tests (apps/examples/)
Priority: Medium.
Title: ILLEGAL CALLS TO romdisk_register()
Desription: Several examples (and other things under apps/) make illegal
Description: Several examples (and other things under apps/) make illegal
calls to romdisk_register(). This both violates the portable
POSIX OS interface and makes these applications un-usable in
PROTECTED and KERNEL build modes.
@ -2856,7 +2856,10 @@ o Other Applications & Tests (apps/examples/)
examples/nxflat, examples/posix_spawn, examples/romfs,
examples/sotest, examples/thttpd, examples/unionfs
Other non-compliant logic:
These examples are simple demos and, hence, you could argue that
it is not so bad that they violate the interface for the purpose
of demonstration (although they do set a bad example because of
this). But there is other non-compliant logic:
graphics/traveler/trv_romfs.c, nshlib/nsh_romfsetc.c

View File

@ -358,11 +358,11 @@ int boardctl(unsigned int cmd, uintptr_t arg)
break;
#endif
#ifdef CONFIG_FS_WRITABLE
#ifdef CONFIG_DRVR_MKRD
/* CMD: BOARDIOC_MKRD
* DESCRIPTION: Create a RAM disk
* ARG: Pointer to read-only instance of struct boardioc_mkrd_s.
* CONFIGURATION: CONFIG_FS_WRITABLE
* CONFIGURATION: CONFIG_DRVR_MKRD
* DEPENDENCIES: None
*/

View File

@ -14,6 +14,15 @@ config DEV_ZERO
source drivers/crypto/Kconfig
source drivers/loop/Kconfig
config DRVR_MKRD
bool "RAM disk wrapper (mkrd)"
default n
---help---
Build the mkrd() function which serves as a wrapper to simplify
creation of RAM disks. If the boardctrl() interface is enabled,
the selecting this option will also enable the BOARDIOC_MKRD
command that will support creation of RAM disks from applications.
menu "Buffering"
config DRVR_WRITEBUFFER

View File

@ -90,7 +90,10 @@ endif
CSRCS += dev_null.c dev_zero.c
ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y)
CSRCS += ramdisk.c mkrd.c
CSRCS += ramdisk.c
ifeq ($(CONFIG_DRVR_MKRD),y)
CSRCS += mkrd.c
endif
ifeq ($(CONFIG_DRVR_WRITEBUFFER),y)
CSRCS += rwbuffer.c
else

View File

@ -42,7 +42,7 @@
#include <nuttx/kmalloc.h>
#include <nuttx/drivers/ramdisk.h>
#ifdef CONFIG_FS_WRITABLE
#ifdef CONFIG_DRVR_MKRD
/****************************************************************************
* Public Functions
@ -99,4 +99,4 @@ int mkrd(int minor, uint32_t nsectors, uint16_t sectsize, uint8_t rdflags)
return ret;
}
#endif /* CONFIG_FS_WRITABLE */
#endif /* CONFIG_DRVR_MKRD */

View File

@ -122,7 +122,7 @@ int romdisk_register(int minor, FAR const uint8_t *buffer, uint32_t nsectors,
*
****************************************************************************/
#ifdef CONFIG_FS_WRITABLE
#ifdef CONFIG_DRVR_MKRD
int mkrd(int minor, uint32_t nsectors, uint16_t sectsize, uint8_t rdflags);
#endif

View File

@ -99,7 +99,7 @@
* CMD: BOARDIOC_MKRD
* DESCRIPTION: Create a RAM disk
* ARG: Pointer to read-only instance of struct boardioc_mkrd_s.
* CONFIGURATION: CONFIG_FS_WRITABLE
* CONFIGURATION: CONFIG_DRVR_MKRD
* DEPENDENCIES: None
*
* CMD: BOARDIOC_APP_SYMTAB
@ -213,7 +213,7 @@
/* Structures used with IOCTL commands */
#ifdef CONFIG_FS_WRITABLE
#ifdef CONFIG_DRVR_MKRD
/* Describes the RAM disk to be created */
struct boardioc_mkrd_s