diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-06-09 19:11:00 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-06-09 19:11:00 +0000 |
commit | cf0426d5964d50da8b21db6549ed19a987ee85e2 (patch) | |
tree | bfbdb400743a05f683c58cc1d8217d2f1d6ce8b9 | |
parent | 05dd8c79b40af0221973ba0ee19ee0066c3a8dde (diff) | |
download | px4-nuttx-cf0426d5964d50da8b21db6549ed19a987ee85e2.tar.gz px4-nuttx-cf0426d5964d50da8b21db6549ed19a987ee85e2.tar.bz2 px4-nuttx-cf0426d5964d50da8b21db6549ed19a987ee85e2.zip |
Simply conditional build; fix conditional compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@275 42af7a65-404d-4744-a932-0658087f49c3
55 files changed, 87 insertions, 199 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 4280c0b61..d5f148c2c 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -164,5 +164,10 @@ * examples/ostest/sighand.c: Don't call fflush() if streams are disabled * include/limits.h, include/time.h, sched/clock_internal.h: A support for using selectable system timer frequency. + * Fixed error in mountpoint related conditional compilation introduced + in 0.2.5 + * Restructured some Makefiles to better handle enabling and disabling + NuttX features without having so much conditional compilation in the + source files. * Started m68322 diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 6b5d03248..32ce071ba 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -598,6 +598,11 @@ Other memory: * examples/ostest/sighand.c: Don't call fflush() if streams are disabled * include/limits.h, include/time.h, sched/clock_internal.h: A support for using selectable system timer frequency. + * Fixed error in mountpoint related conditional compilation introduced + in 0.2.5 + * Restructured some Makefiles to better handle enabling and disabling + NuttX features without having so much conditional compilation in the + source files. * Started m68322 </pre></ul> diff --git a/nuttx/Makefile b/nuttx/Makefile index c7351b0e6..2844bbf3b 100644 --- a/nuttx/Makefile +++ b/nuttx/Makefile @@ -37,17 +37,45 @@ TOPDIR = ${shell pwd} -include ${TOPDIR}/.config -include ${TOPDIR}/Make.defs +# Process architecture and board-specific directories + ARCH_DIR = arch/$(CONFIG_ARCH) ARCH_SRC = $(ARCH_DIR)/src ARCH_INC = $(ARCH_DIR)/include BOARD_DIR = configs/$(CONFIG_ARCH_BOARD) -SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE) +# FSDIRS depend on file descriptor support; NONFSDIRS do not +# (except for parts of FSDIRS). We will exclude FSDIRS +# from the build if file descriptor support is disabled + +NONFSDIRS = sched lib $(ARCH_SRC) mm examples/$(CONFIG_EXAMPLE) +FSDIRS = fs drivers + +# CLEANDIRS are the directories that will clean in. These are +# all directories that we know about. +# MAKEDIRS are the directories in which we will build targets + +CLEANDIRS = $(NONFSDIRS) $(FSDIRS) + +ifeq ($(CONFIG_NFILE_DESCRIPTORS),0) +MAKEDIRS = $(NONFSDIRS) +else +MAKEDIRS = $(NONFSDIRS) $(FSDIRS) +endif + +# LINKLIBS is the list of NuttX libraries that is passed to the +# processor-specific Makefile to build the final target. +# Libraries in FSDIRS are excluded if file descriptor support +# is disabled. LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \ - fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \ - examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT) + lib/liblib$(LIBEXT) examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT) + +ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) +LINKLIBS += fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) +endif +# This is the name of the final target BIN = nuttx$(EXEEXT) all: $(BIN) @@ -169,12 +197,12 @@ $(BIN): context depend $(LINKLIBS) $(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN) depend: - @for dir in $(SUBDIRS) ; do \ + @for dir in $(MAKEDIRS) ; do \ $(MAKE) -C $$dir TOPDIR=$(TOPDIR) depend ; \ done subdir_clean: - @for dir in $(SUBDIRS) ; do \ + @for dir in $(CLEANDIRS) ; do \ if [ -e $$dir/Makefile ]; then \ $(MAKE) -C $$dir TOPDIR=$(TOPDIR) clean ; \ fi \ @@ -186,7 +214,7 @@ clean: subdir_clean rm -f $(BIN) $(BIN).* mm_test *.map *~ subdir_distclean: - @for dir in $(SUBDIRS) ; do \ + @for dir in $(CLEANDIRS) ; do \ if [ -e $$dir/Makefile ]; then \ $(MAKE) -C $$dir TOPDIR=$(TOPDIR) distclean ; \ fi \ diff --git a/nuttx/TODO b/nuttx/TODO index 3c5a1e83e..aaa68683c 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -51,7 +51,7 @@ o Build system - Some names under arch are still incorrect. These should be processor architecture names: pjrc-8051 should be 805x - configs/pjrc-8051 should be configs/pjrc-87c52 -- Last change to create the arch/arm directory breaks dependencies in arch/arm/src. +- 0.2.4 changes to create the arch/arm directory breaks dependency target in arch/arm/src. Probably need to add the path to the chip or common subdirectorys when running tools/mkdeps.sh diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 0bae52215..ad99c137c 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -42,18 +42,21 @@ AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = fs_open.c fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_dup.c \ fs_opendir.c fs_closedir.c fs_stat.c fs_readdir.c fs_readdirr.c \ - fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_fsync.c fs_files.c \ + fs_seekdir.c fs_telldir.c fs_rewinddir.c fs_files.c \ fs_inode.c fs_inodefind.c fs_inodereserve.c fs_statfs.c \ fs_inoderemove.c fs_registerdriver.c fs_unregisterdriver.c \ fs_inodeaddref.c fs_inoderelease.c ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \ - fs_mount.c fs_umount.c fs_unlink.c fs_mkdir.c fs_rmdir.c \ - fs_rename.c + fs_mount.c fs_umount.c \ + fs_fsync.c fs_unlink.c fs_rename.c \ + fs_mkdir.c fs_rmdir.c + ifeq ($(CONFIG_FS_FAT),y) CSRCS += fs_fat32.c fs_fat32util.c fs_fat32attrib.c endif endif + COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/fs/fs_close.c b/nuttx/fs/fs_close.c index 91480e077..a704d1d5e 100644 --- a/nuttx/fs/fs_close.c +++ b/nuttx/fs/fs_close.c @@ -49,8 +49,6 @@ * Global Functions ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int close(int fd) { FAR struct filelist *list; @@ -112,4 +110,3 @@ int close(int fd) return ERROR; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_closedir.c b/nuttx/fs/fs_closedir.c index c99853110..5f20743c8 100644 --- a/nuttx/fs/fs_closedir.c +++ b/nuttx/fs/fs_closedir.c @@ -71,8 +71,6 @@ * ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int closedir(FAR DIR *dirp) { struct internal_dir_s *idir = (struct internal_dir_s *)dirp; @@ -95,7 +93,7 @@ int closedir(FAR DIR *dirp) * inode we have open. */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode) && !DIRENT_ISPSUEDONODE(idir->fd_flags)) { /* The node is a file system mointpoint. Verify that the mountpoint @@ -145,4 +143,3 @@ errout: return ERROR; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_dup.c b/nuttx/fs/fs_dup.c index efa8f56ba..9149e53aa 100644 --- a/nuttx/fs/fs_dup.c +++ b/nuttx/fs/fs_dup.c @@ -65,8 +65,6 @@ * Global Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int dup(int fildes) { FAR struct filelist *list; @@ -146,4 +144,3 @@ int dup2(int fildes1, int fildes2) return files_dup(&list->fl_files[fildes1], &list->fl_files[fildes2]); } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_fat32.c b/nuttx/fs/fs_fat32.c index 22dd3b237..9d1b273f2 100644 --- a/nuttx/fs/fs_fat32.c +++ b/nuttx/fs/fs_fat32.c @@ -61,9 +61,6 @@ #include "fs_internal.h" #include "fs_fat32.h" -#ifdef CONFIG_FS_FAT -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -2188,5 +2185,3 @@ static int fat_stat(struct inode *mountpt, const char *relpath, struct stat *buf * Public Functions ****************************************************************************/ -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_FS_FAT */ diff --git a/nuttx/fs/fs_fat32attrib.c b/nuttx/fs/fs_fat32attrib.c index 6c7c8c6b3..7537fbf98 100644 --- a/nuttx/fs/fs_fat32attrib.c +++ b/nuttx/fs/fs_fat32attrib.c @@ -51,8 +51,6 @@ #include "fs_internal.h" #include "fs_fat32.h" -#if defined(CONFIG_FS_FAT) && !defined(CONFIG_DISABLE_MOUNTPOUNT) - /************************************************************ * Private Functions ************************************************************/ @@ -190,5 +188,3 @@ int fat_setattrib(const char *path, fat_attrib_t setbits, fat_attrib_t clearbits return fat_attrib(path, NULL, setbits, clearbits); } -#endif /* CONFIG_FS_FAT && !CONFIG_DISABLE_MOUNTPOUNT */ - diff --git a/nuttx/fs/fs_fat32util.c b/nuttx/fs/fs_fat32util.c index a21783e01..bf2df78f6 100644 --- a/nuttx/fs/fs_fat32util.c +++ b/nuttx/fs/fs_fat32util.c @@ -58,9 +58,6 @@ #include "fs_internal.h" #include "fs_fat32.h" -#ifdef CONFIG_FS_FAT -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -2445,5 +2442,3 @@ int fat_nfreeclusters(struct fat_mountpt_s *fs, size_t *pfreeclusters) return OK; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_FS_FAT */ diff --git a/nuttx/fs/fs_files.c b/nuttx/fs/fs_files.c index 88f905ef4..8ed7c615e 100644 --- a/nuttx/fs/fs_files.c +++ b/nuttx/fs/fs_files.c @@ -67,8 +67,6 @@ * Private Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS >0 - static void _files_semtake(FAR struct filelist *list) { /* Take the semaphore (perhaps waiting) */ @@ -279,4 +277,3 @@ void files_release(int filedes) } } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_fsync.c b/nuttx/fs/fs_fsync.c index 6aec06daa..403bce280 100644 --- a/nuttx/fs/fs_fsync.c +++ b/nuttx/fs/fs_fsync.c @@ -47,9 +47,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -138,5 +135,3 @@ int fsync(int fd) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOINT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_inode.c b/nuttx/fs/fs_inode.c index 274dcf1a4..73a8601b3 100644 --- a/nuttx/fs/fs_inode.c +++ b/nuttx/fs/fs_inode.c @@ -48,8 +48,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS >0 - /************************************************************ * Definitions ************************************************************/ @@ -330,5 +328,4 @@ const char *inode_nextname(const char *name) if (*name) name++; return name; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_inodefind.c b/nuttx/fs/fs_inodefind.c index 215710311..4f525f83c 100644 --- a/nuttx/fs/fs_inodefind.c +++ b/nuttx/fs/fs_inodefind.c @@ -43,8 +43,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS >0 - /************************************************************ * Definitions ************************************************************/ @@ -97,6 +95,3 @@ FAR struct inode *inode_find(const char *path, const char **relpath) return node; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ - - diff --git a/nuttx/fs/fs_inoderelease.c b/nuttx/fs/fs_inoderelease.c index 360f07298..73ca72603 100644 --- a/nuttx/fs/fs_inoderelease.c +++ b/nuttx/fs/fs_inoderelease.c @@ -44,8 +44,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS >0 - /************************************************************ * Definitions ************************************************************/ @@ -105,4 +103,3 @@ void inode_release(FAR struct inode *node) } } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_inoderemove.c b/nuttx/fs/fs_inoderemove.c index c227cfacc..b1900d498 100644 --- a/nuttx/fs/fs_inoderemove.c +++ b/nuttx/fs/fs_inoderemove.c @@ -119,7 +119,7 @@ STATUS inode_remove(const char *path) /* Find the node to delete */ - node = inode_search(&name, &left, &parent, NULL); + node = inode_search(&name, &left, &parent, (const char **)NULL); if (node) { /* Found it, now remove it from the tree */ diff --git a/nuttx/fs/fs_inodereserve.c b/nuttx/fs/fs_inodereserve.c index 4895cda03..95e08e401 100644 --- a/nuttx/fs/fs_inodereserve.c +++ b/nuttx/fs/fs_inodereserve.c @@ -156,7 +156,7 @@ FAR struct inode *inode_reserve(const char *path) /* Find the location to insert the new subtree */ - if (inode_search(&name, &left, &parent, NULL) != NULL) + if (inode_search(&name, &left, &parent, (const char **)NULL) != NULL) { /* Is is an error if the node already exists in the tree */ diff --git a/nuttx/fs/fs_internal.h b/nuttx/fs/fs_internal.h index 8bfc52f21..79c4ab9d7 100644 --- a/nuttx/fs/fs_internal.h +++ b/nuttx/fs/fs_internal.h @@ -207,11 +207,9 @@ EXTERN void inode_release(FAR struct inode *inode); /* fs_files.c ***************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS >0 EXTERN void weak_function files_initialize(void); EXTERN int files_allocate(FAR struct inode *inode, int oflags, off_t pos); EXTERN void files_release(int filedes); -#endif #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/fs/fs_ioctl.c b/nuttx/fs/fs_ioctl.c index 8035c4cc4..e40ae25a5 100644 --- a/nuttx/fs/fs_ioctl.c +++ b/nuttx/fs/fs_ioctl.c @@ -52,8 +52,6 @@ * Global Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int ioctl(int fd, int req, unsigned long arg) { FAR struct filelist *list; @@ -87,4 +85,3 @@ int ioctl(int fd, int req, unsigned long arg) return ret; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_mkdir.c b/nuttx/fs/fs_mkdir.c index 4b828e4df..5ac6f845a 100644 --- a/nuttx/fs/fs_mkdir.c +++ b/nuttx/fs/fs_mkdir.c @@ -45,9 +45,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -131,5 +128,3 @@ int mkdir(const char *pathname, mode_t mode) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c index 00b80a574..8a3bd73ae 100644 --- a/nuttx/fs/fs_mount.c +++ b/nuttx/fs/fs_mount.c @@ -45,9 +45,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /* At least one filesystem must be defined, or this file will not compile. * It may be desire-able to make filesystems dynamically registered at * some time in the future, but at present, this file needs to know about @@ -279,6 +276,5 @@ int mount(const char *source, const char *target, return ERROR; } -#endif /* Need at least filesystem */ -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* Need file descriptor support */ +#endif /* Need at least one filesystem */ + diff --git a/nuttx/fs/fs_open.c b/nuttx/fs/fs_open.c index b401aebf7..094710d31 100644 --- a/nuttx/fs/fs_open.c +++ b/nuttx/fs/fs_open.c @@ -56,8 +56,6 @@ * Public Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int inode_checkflags(FAR struct inode *inode, int oflags) { if (((oflags & O_RDOK) != 0 && !inode->u.i_ops->read) || @@ -153,7 +151,7 @@ int open(const char *path, int oflags, ...) ret = OK; if (inode->u.i_ops->open) { -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode)) { ret = inode->u.i_mops->open((FAR struct file*)&list->fl_files[fd], @@ -183,4 +181,3 @@ int open(const char *path, int oflags, ...) return ERROR; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_opendir.c b/nuttx/fs/fs_opendir.c index 58a1f4bb2..6890de1ea 100644 --- a/nuttx/fs/fs_opendir.c +++ b/nuttx/fs/fs_opendir.c @@ -82,8 +82,6 @@ * ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - FAR DIR *opendir(const char *path) { FAR struct inode *inode = NULL; @@ -228,4 +226,3 @@ errout_with_semaphore: return NULL; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_read.c b/nuttx/fs/fs_read.c index 1cd291936..5d7ac2c54 100644 --- a/nuttx/fs/fs_read.c +++ b/nuttx/fs/fs_read.c @@ -53,8 +53,6 @@ * Global Functions ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int read(int fd, void *buf, unsigned int nbytes) { FAR struct filelist *list; @@ -99,4 +97,3 @@ int read(int fd, void *buf, unsigned int nbytes) return ret; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_readdir.c b/nuttx/fs/fs_readdir.c index 0c15d04e9..9611aa7da 100644 --- a/nuttx/fs/fs_readdir.c +++ b/nuttx/fs/fs_readdir.c @@ -53,8 +53,6 @@ * Name: readpsuedodir ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - static inline int readpsuedodir(struct internal_dir_s *idir) { FAR struct inode *prev; @@ -228,4 +226,3 @@ errout: return NULL; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_readdirr.c b/nuttx/fs/fs_readdirr.c index 930856041..b08aa06b8 100644 --- a/nuttx/fs/fs_readdirr.c +++ b/nuttx/fs/fs_readdirr.c @@ -82,8 +82,6 @@ * ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, FAR struct dirent **result) { @@ -120,4 +118,3 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, return 0; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_registerblockdriver.c b/nuttx/fs/fs_registerblockdriver.c index 7e6b26157..e48f58dc9 100644 --- a/nuttx/fs/fs_registerblockdriver.c +++ b/nuttx/fs/fs_registerblockdriver.c @@ -43,8 +43,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /************************************************************ * Definitions ************************************************************/ @@ -101,4 +99,3 @@ STATUS register_blockdriver(const char *path, return ret; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ diff --git a/nuttx/fs/fs_rename.c b/nuttx/fs/fs_rename.c index 40c29e80b..d017caf16 100644 --- a/nuttx/fs/fs_rename.c +++ b/nuttx/fs/fs_rename.c @@ -45,9 +45,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -155,5 +152,3 @@ int rename(const char *oldpath, const char *newpath) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_rewinddir.c b/nuttx/fs/fs_rewinddir.c index f276fa5a5..088eb587d 100644 --- a/nuttx/fs/fs_rewinddir.c +++ b/nuttx/fs/fs_rewinddir.c @@ -52,8 +52,6 @@ * Name: rewindpsuedodir ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - static inline void rewindpsuedodir(struct internal_dir_s *idir) { struct inode *prev; @@ -104,7 +102,7 @@ static inline void rewindpsuedodir(struct internal_dir_s *idir) void rewinddir(FAR DIR *dirp) { struct internal_dir_s *idir = (struct internal_dir_s *)dirp; -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT struct inode *inode; #endif @@ -119,7 +117,7 @@ void rewinddir(FAR DIR *dirp) * that we are dealing with. */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT inode = idir->fd_root; if (INODE_IS_MOUNTPT(inode)) { @@ -143,4 +141,3 @@ void rewinddir(FAR DIR *dirp) } } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_rmdir.c b/nuttx/fs/fs_rmdir.c index 22631957e..5f31ab89a 100644 --- a/nuttx/fs/fs_rmdir.c +++ b/nuttx/fs/fs_rmdir.c @@ -45,9 +45,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -131,5 +128,3 @@ int rmdir(const char *pathname) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_seekdir.c b/nuttx/fs/fs_seekdir.c index 5a4dae6c3..b1a40fa2f 100644 --- a/nuttx/fs/fs_seekdir.c +++ b/nuttx/fs/fs_seekdir.c @@ -48,8 +48,6 @@ * Private Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - /************************************************************ * Name: seekpsuedodir ************************************************************/ @@ -111,7 +109,7 @@ static inline void seekpsuedodir(struct internal_dir_s *idir, off_t offset) * Name: seekmountptdir ************************************************************/ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT static inline void seekmountptdir(struct internal_dir_s *idir, off_t offset) { struct inode *inode; @@ -212,7 +210,7 @@ void seekdir(FAR DIR *dirp, off_t offset) * that we are dealing with. */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(idir->fd_root)) { /* The node is a file system mointpoint */ @@ -228,4 +226,3 @@ void seekdir(FAR DIR *dirp, off_t offset) } } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_stat.c b/nuttx/fs/fs_stat.c index ac72658ba..f0b85d911 100644 --- a/nuttx/fs/fs_stat.c +++ b/nuttx/fs/fs_stat.c @@ -53,8 +53,6 @@ * Private Functions ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - /**************************************************************************** * Name: statpsuedo ****************************************************************************/ @@ -161,7 +159,7 @@ int stat(const char *path, FAR struct stat *buf) * are dealing with. */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode)) { /* The node is a file system mointpoint. Verify that the mountpoint @@ -205,4 +203,3 @@ int stat(const char *path, FAR struct stat *buf) return ERROR; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_statfs.c b/nuttx/fs/fs_statfs.c index 515723ed6..fbafe0bf5 100644 --- a/nuttx/fs/fs_statfs.c +++ b/nuttx/fs/fs_statfs.c @@ -54,8 +54,6 @@ * Private Functions ****************************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - /**************************************************************************** * Name: statpsuedo ****************************************************************************/ @@ -125,7 +123,7 @@ int statfs(const char *path, struct statfs *buf) * are dealing with. */ -#ifndef CONFIG_DISABLE_MOUNTPOUNT +#ifndef CONFIG_DISABLE_MOUNTPOINT if (INODE_IS_MOUNTPT(inode)) { /* The node is a file system mointpoint. Verify that the mountpoint @@ -168,5 +166,3 @@ int statfs(const char *path, struct statfs *buf) *get_errno_ptr() = ret; return ERROR; } - -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_telldir.c b/nuttx/fs/fs_telldir.c index dc886ba24..ebcef94c6 100644 --- a/nuttx/fs/fs_telldir.c +++ b/nuttx/fs/fs_telldir.c @@ -72,8 +72,6 @@ * ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - off_t telldir(FAR DIR *dirp) { struct internal_dir_s *idir = (struct internal_dir_s *)dirp; @@ -89,4 +87,3 @@ off_t telldir(FAR DIR *dirp) return idir->fd_position; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_umount.c b/nuttx/fs/fs_umount.c index d6a6351f4..1cb6a1d2b 100644 --- a/nuttx/fs/fs_umount.c +++ b/nuttx/fs/fs_umount.c @@ -44,9 +44,6 @@ #include <nuttx/fs.h> #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -206,5 +203,3 @@ int umount(const char *target) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_unlink.c b/nuttx/fs/fs_unlink.c index 2c7386b19..a3a689411 100644 --- a/nuttx/fs/fs_unlink.c +++ b/nuttx/fs/fs_unlink.c @@ -45,9 +45,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -131,5 +128,3 @@ int unlink(const char *pathname) return ERROR; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif /* CONFIG_NFILE_DESCRIPTORS */ diff --git a/nuttx/fs/fs_unregisterblockdriver.c b/nuttx/fs/fs_unregisterblockdriver.c index cae8d931c..094e90d2e 100644 --- a/nuttx/fs/fs_unregisterblockdriver.c +++ b/nuttx/fs/fs_unregisterblockdriver.c @@ -43,9 +43,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 -#ifndef CONFIG_DISABLE_MOUNTPOUNT - /**************************************************************************** * Definitions ****************************************************************************/ @@ -83,5 +80,3 @@ STATUS unregister_blockdriver(const char *path) return ret; } -#endif /* CONFIG_DISABLE_MOUNTPOUNT */ -#endif diff --git a/nuttx/fs/fs_unregisterdriver.c b/nuttx/fs/fs_unregisterdriver.c index 1e13e598f..e43a2b594 100644 --- a/nuttx/fs/fs_unregisterdriver.c +++ b/nuttx/fs/fs_unregisterdriver.c @@ -43,8 +43,6 @@ #include "fs_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 - /**************************************************************************** * Definitions ****************************************************************************/ @@ -82,4 +80,3 @@ STATUS unregister_driver(const char *path) return ret; } -#endif diff --git a/nuttx/fs/fs_write.c b/nuttx/fs/fs_write.c index cebb49e60..60a6b8290 100644 --- a/nuttx/fs/fs_write.c +++ b/nuttx/fs/fs_write.c @@ -53,8 +53,6 @@ * Global Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - int write(int fd, const void *buf, unsigned int nbytes) { FAR struct filelist *list; @@ -94,5 +92,3 @@ int write(int fd, const void *buf, unsigned int nbytes) return ret; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ - diff --git a/nuttx/lib/Makefile b/nuttx/lib/Makefile index a01dbcb91..d13cc7b1e 100644 --- a/nuttx/lib/Makefile +++ b/nuttx/lib/Makefile @@ -40,27 +40,43 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -MISC_SRCS = lib_init.c lib_streamsem.c lib_filesem.c +MISC_SRCS = lib_init.c lib_filesem.c +ifneq ($(CONFIG_NFILE_STREAMS),0) +MISC_SRCS += lib_streamsem.c +endif + STRING_SRCS = lib_memset.c lib_memcpy.c lib_memcmp.c lib_memmove.c \ lib_strcpy.c lib_strncpy.c lib_strcmp.c \ lib_strlen.c lib_strdup.c lib_strtol.c lib_strchr.c \ lib_strspn.c lib_strcspn.c \ lib_strtok.c lib_strtokr.c lib_strerror.c + CTYPE_SRCS = -STDIO_SRCS = lib_fopen.c lib_fclose.c \ + +STDIO_SRCS = lib_printf.c lib_rawprintf.c lib_lowprintf.c \ + lib_sprintf.c lib_libsprintf.c lib_vsprintf.c lib_libvsprintf.c \ + lib_memstream.c lib_lowstream.c lib_nullstream.c \ + lib_sscanf.c +ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) +STDIO_SRCS += lib_rawstream.c +ifneq ($(CONFIG_NFILE_STREAMS),0) +STDIO_SRCS += lib_fopen.c lib_fclose.c \ lib_fread.c lib_libfread.c lib_fgetc.c lib_fgets.c lib_gets.c \ lib_fwrite.c lib_libfwrite.c lib_fflush.c \ lib_fputc.c lib_puts.c lib_fputs.c \ lib_ungetc.c \ - lib_printf.c lib_vprintf.c lib_fprintf.c lib_rawprintf.c lib_lowprintf.c \ - lib_vfprintf.c lib_sprintf.c lib_libsprintf.c lib_vsprintf.c \ - lib_libvsprintf.c lib_stdstream.c lib_memstream.c \ - lib_rawstream.c lib_lowstream.c lib_nullstream.c \ - lib_sscanf.c + lib_vprintf.c lib_fprintf.c lib_vfprintf.c \ + lib_stdstream.c +endif +endif + STDLIB_SRCS = lib_getenv.c lib_rand.c + MATH_SRCS = lib_rint.c + SQ_SRCS = sq_addlast.c sq_addfirst.c sq_addafter.c \ sq_rem.c sq_remlast.c sq_remfirst.c sq_remafter.c + DQ_SRCS = dq_addlast.c dq_addfirst.c dq_addafter.c dq_addbefore.c \ dq_rem.c dq_remlast.c dq_remfirst.c diff --git a/nuttx/lib/lib_fclose.c b/nuttx/lib/lib_fclose.c index a7960e823..f6271e18c 100644 --- a/nuttx/lib/lib_fclose.c +++ b/nuttx/lib/lib_fclose.c @@ -53,8 +53,6 @@ * Global Functions ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - int fclose(FILE *stream) { int ret = OK; @@ -95,4 +93,3 @@ int fclose(FILE *stream) return ret; } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_fflush.c b/nuttx/lib/lib_fflush.c index 12dfd8b12..1af9305fb 100644 --- a/nuttx/lib/lib_fflush.c +++ b/nuttx/lib/lib_fflush.c @@ -88,8 +88,6 @@ * Called by the OS when a task exits ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - void lib_flushall(FAR struct streamlist *list) { /* Make sure that there are streams associated with this thread */ @@ -181,4 +179,3 @@ int fflush(FILE *stream) #endif } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_fgets.c b/nuttx/lib/lib_fgets.c index 561d4a85e..613314191 100644 --- a/nuttx/lib/lib_fgets.c +++ b/nuttx/lib/lib_fgets.c @@ -44,8 +44,6 @@ #include <ctype.h> #include <debug.h> -#if CONFIG_NFILE_STREAMS > 0 - /************************************************************ * Definitions ************************************************************/ @@ -322,4 +320,3 @@ char *fgets(FAR char *s, int n, FILE *stream) } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_fopen.c b/nuttx/lib/lib_fopen.c index ec699c340..d5c6bdf6f 100644 --- a/nuttx/lib/lib_fopen.c +++ b/nuttx/lib/lib_fopen.c @@ -55,8 +55,6 @@ * Private Functions ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - static int lib_mode2oflags(const char *mode) { int oflags = 0; @@ -126,14 +124,10 @@ static int lib_mode2oflags(const char *mode) return oflags; } -#endif /* CONFIG_NFILE_STREAMS */ - /************************************************************ * Public Functions ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - FAR struct file_struct *lib_fdopen(int fd, const char *mode, FAR struct filelist *flist, FAR struct streamlist *slist) @@ -232,5 +226,3 @@ FILE *fopen(const char *path, const char *mode) } return ret; } - -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_fread.c b/nuttx/lib/lib_fread.c index 25461545e..61e3daa5f 100644 --- a/nuttx/lib/lib_fread.c +++ b/nuttx/lib/lib_fread.c @@ -79,8 +79,6 @@ * fwrite ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - size_t fread(void *ptr, size_t size, size_t n_items, FILE *stream) { size_t full_size = n_items * (size_t)size; @@ -99,5 +97,4 @@ size_t fread(void *ptr, size_t size, size_t n_items, FILE *stream) return items_read; } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_gets.c b/nuttx/lib/lib_gets.c index db2145cfa..944e5266d 100644 --- a/nuttx/lib/lib_gets.c +++ b/nuttx/lib/lib_gets.c @@ -41,8 +41,6 @@ #include <limits.h> #include <string.h> -#if CONFIG_NFILE_STREAMS > 0 - /************************************************************ * Definitions ************************************************************/ @@ -123,4 +121,3 @@ char *gets(char *s) return ret; } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_libfread.c b/nuttx/lib/lib_libfread.c index 92e53025d..6607b55cc 100644 --- a/nuttx/lib/lib_libfread.c +++ b/nuttx/lib/lib_libfread.c @@ -85,8 +85,6 @@ * lib_fread ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - ssize_t lib_fread(void *ptr, size_t count, FILE *stream) { unsigned char *dest = (unsigned char*)ptr; @@ -260,4 +258,3 @@ ssize_t lib_fread(void *ptr, size_t count, FILE *stream) return bytes_read; } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_libfwrite.c b/nuttx/lib/lib_libfwrite.c index f62e8ddb9..20accc9e9 100644 --- a/nuttx/lib/lib_libfwrite.c +++ b/nuttx/lib/lib_libfwrite.c @@ -83,8 +83,6 @@ * lib_fwrite ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - ssize_t lib_fwrite(const void *ptr, size_t count, FILE *stream) #if CONFIG_STDIO_BUFFER_SIZE > 0 { @@ -164,4 +162,3 @@ ssize_t lib_fwrite(const void *ptr, size_t count, FILE *stream) } #endif /* CONFIG_STDIO_BUFFER_SIZE */ -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_puts.c b/nuttx/lib/lib_puts.c index 365f726d6..ad9a4061f 100644 --- a/nuttx/lib/lib_puts.c +++ b/nuttx/lib/lib_puts.c @@ -88,8 +88,6 @@ * stdout. ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - int puts(const char *s) { int nwritten; @@ -115,4 +113,3 @@ int puts(const char *s) return nput; } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_rawprintf.c b/nuttx/lib/lib_rawprintf.c index fa2f5a63e..7748fb14e 100644 --- a/nuttx/lib/lib_rawprintf.c +++ b/nuttx/lib/lib_rawprintf.c @@ -98,7 +98,7 @@ int lib_rawvprintf(const char *fmt, va_list ap) struct lib_stream_s stream; - /* Wrap the stdout in a stream object and let lib_vsprintf + /* Wrap the low-level output in a stream object and let lib_vsprintf * do the work. */ diff --git a/nuttx/lib/lib_rawstream.c b/nuttx/lib/lib_rawstream.c index 8ec80bacd..899175620 100644 --- a/nuttx/lib/lib_rawstream.c +++ b/nuttx/lib/lib_rawstream.c @@ -45,8 +45,6 @@ * Private Functions ************************************************************/ -#if CONFIG_NFILE_DESCRIPTORS > 0 - static void rawstream_putc(struct lib_stream_s *this, int ch) { struct lib_rawstream_s *rthis = (struct lib_rawstream_s *)this; @@ -77,6 +75,3 @@ void lib_rawstream(struct lib_rawstream_s *rawstream, int fd) rawstream->fd = fd; } -#endif /* CONFIG_NFILE_DESCRIPTORS */ - - diff --git a/nuttx/lib/lib_streamsem.c b/nuttx/lib/lib_streamsem.c index 4f349c90b..1394a5501 100644 --- a/nuttx/lib/lib_streamsem.c +++ b/nuttx/lib/lib_streamsem.c @@ -71,8 +71,6 @@ * Public Functions ************************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - void stream_semtake(FAR struct streamlist *list) { /* Take the semaphore (perhaps waiting) */ @@ -92,5 +90,4 @@ void stream_semgive(FAR struct streamlist *list) sem_post(&list->sl_sem); } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_ungetc.c b/nuttx/lib/lib_ungetc.c index fe333344c..34f760aa2 100644 --- a/nuttx/lib/lib_ungetc.c +++ b/nuttx/lib/lib_ungetc.c @@ -88,8 +88,6 @@ * fgetc **********************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - int ungetc(int c, FILE *stream) { #if CONFIG_NUNGET_CHARS > 0 @@ -121,4 +119,3 @@ int ungetc(int c, FILE *stream) } } -#endif /* CONFIG_NFILE_STREAMS */ diff --git a/nuttx/lib/lib_vprintf.c b/nuttx/lib/lib_vprintf.c index 1507851f7..2d345ec6f 100644 --- a/nuttx/lib/lib_vprintf.c +++ b/nuttx/lib/lib_vprintf.c @@ -83,8 +83,6 @@ * vprintf **********************************************************/ -#if CONFIG_NFILE_STREAMS > 0 - int vprintf(const char *fmt, va_list ap) { /* vfprintf into stdout */ @@ -92,5 +90,3 @@ int vprintf(const char *fmt, va_list ap) return vfprintf(stdout, fmt, ap); } -#endif /* CONFIG_NFILE_STREAMS */ - |