From 349c44ded52c762ba9a9aad0b8f9353230b8c5aa Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 28 Sep 2014 11:17:36 -0600 Subject: [PATCH] Move directory operations from fs/ to fs/dirent --- fs/Makefile | 17 +++--------- fs/dirent/Make.defs | 47 ++++++++++++++++++++++++++++++++++ fs/{ => dirent}/fs_closedir.c | 2 +- fs/{ => dirent}/fs_opendir.c | 2 +- fs/{ => dirent}/fs_readdir.c | 2 +- fs/{ => dirent}/fs_rewinddir.c | 2 +- fs/{ => driver}/fs_syslog.c | 0 7 files changed, 55 insertions(+), 17 deletions(-) create mode 100644 fs/dirent/Make.defs rename fs/{ => dirent}/fs_closedir.c (99%) rename fs/{ => dirent}/fs_opendir.c (99%) rename fs/{ => dirent}/fs_readdir.c (99%) rename fs/{ => dirent}/fs_rewinddir.c (99%) rename fs/{ => driver}/fs_syslog.c (100%) diff --git a/fs/Makefile b/fs/Makefile index 856cc231ca0..68a32ccf006 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -61,11 +61,10 @@ else # Common file/socket descriptor support -CSRCS += fs_close.c fs_closedir.c fs_dup.c fs_dup2.c fs_fcntl.c -CSRCS += fs_filedup.c fs_filedup2.c fs_ioctl.c fs_lseek.c fs_mkdir.c -CSRCS += fs_open.c fs_opendir.c fs_poll.c fs_read.c fs_readdir.c -CSRCS += fs_rename.c fs_rewinddir.c fs_rmdir.c fs_seekdir.c fs_stat.c -CSRCS += fs_statfs.c fs_select.c fs_unlink.c fs_write.c +CSRCS += fs_close.c fs_dup.c fs_dup2.c fs_fcntl.c fs_filedup.c fs_filedup2.c +CSRCS += fs_ioctl.c fs_lseek.c fs_mkdir.c fs_open.c fs_poll.c fs_read.c +CSRCS += fs_rename.c fs_rmdir.c fs_seekdir.c fs_stat.c fs_statfs.c +CSRCS += fs_select.c fs_unlink.c fs_write.c DEPPATH = --dep-path . VPATH = . @@ -86,14 +85,6 @@ ifeq ($(CONFIG_NET_SENDFILE),y) CSRCS += fs_sendfile.c endif -# System logging to a character device (or file) - -ifeq ($(CONFIG_SYSLOG),y) -ifeq ($(CONFIG_SYSLOG_CHAR),y) -CSRCS += fs_syslog.c -endif -endif - # Additional files required is mount-able file systems are supported ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) diff --git a/fs/dirent/Make.defs b/fs/dirent/Make.defs new file mode 100644 index 00000000000..392fa444ece --- /dev/null +++ b/fs/dirent/Make.defs @@ -0,0 +1,47 @@ +############################################################################ +# fs/dirent/Make.defs +# +# Copyright (C) 2014 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# 3. Neither the name NuttX nor the names of its contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# +############################################################################ + +# Don't build anything if there are no file descriptors + +ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) + +CSRCS += fs_closedir.c fs_opendir.c fs_readdir.c fs_rewinddir.c + +# Include dirent build support + +DEPPATH += --dep-path dirent +VPATH += :dirent +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)dirent} +endif diff --git a/fs/fs_closedir.c b/fs/dirent/fs_closedir.c similarity index 99% rename from fs/fs_closedir.c rename to fs/dirent/fs_closedir.c index 65c845a1a3e..2f70d851710 100644 --- a/fs/fs_closedir.c +++ b/fs/dirent/fs_closedir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_closedir.c + * fs/dirent/fs_closedir.c * * Copyright (C) 2007-2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_opendir.c b/fs/dirent/fs_opendir.c similarity index 99% rename from fs/fs_opendir.c rename to fs/dirent/fs_opendir.c index 865c644b9e6..dbbc9b78e21 100644 --- a/fs/fs_opendir.c +++ b/fs/dirent/fs_opendir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_opendir.c + * fs/dirent/fs_opendir.c * * Copyright (C) 2007-2009, 2011, 2013-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_readdir.c b/fs/dirent/fs_readdir.c similarity index 99% rename from fs/fs_readdir.c rename to fs/dirent/fs_readdir.c index eba40109ec9..6d87ce7b0c8 100644 --- a/fs/fs_readdir.c +++ b/fs/dirent/fs_readdir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_readdir.c + * fs/dirent/fs_readdir.c * * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_rewinddir.c b/fs/dirent/fs_rewinddir.c similarity index 99% rename from fs/fs_rewinddir.c rename to fs/dirent/fs_rewinddir.c index c6bb295cbb4..ccb49abd41f 100644 --- a/fs/fs_rewinddir.c +++ b/fs/dirent/fs_rewinddir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_rewinddir.c + * fs/dirent/fs_rewinddir.c * * Copyright (C) 2007-2009, 2011, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_syslog.c b/fs/driver/fs_syslog.c similarity index 100% rename from fs/fs_syslog.c rename to fs/driver/fs_syslog.c