diff --git a/fs/Makefile b/fs/Makefile index 5b521cac6b..a5c538340b 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -40,54 +40,18 @@ AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = -# If there are no file descriptors configured, then a small part of the -# logic in this directory may still apply to socket descriptors - -ifeq ($(CONFIG_NFILE_DESCRIPTORS),0) -ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0) - -# Socket descriptor support - -CSRCS += fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_poll.c fs_select.c -endif - -# Support for network access using streams - -ifneq ($(CONFIG_NFILE_STREAMS),0) -CSRCS += fs_fdopen.c -endif - -else - -# Common file/socket descriptor support - -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_stat.c fs_statfs.c fs_select.c -CSRCS += fs_unlink.c fs_write.c - DEPPATH = --dep-path . VPATH = . include inode/Make.defs +include vfs/Make.defs include driver/Make.defs include dirent/Make.defs include mmap/Make.defs -# Stream support - -ifneq ($(CONFIG_NFILE_STREAMS),0) -CSRCS += fs_fdopen.c -endif - -# Support for sendfile() - -ifeq ($(CONFIG_NET_SENDFILE),y) -CSRCS += fs_sendfile.c -endif - # Additional files required is mount-able file systems are supported +ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) include mount/Make.defs diff --git a/fs/vfs/Make.defs b/fs/vfs/Make.defs new file mode 100644 index 0000000000..1fb98da497 --- /dev/null +++ b/fs/vfs/Make.defs @@ -0,0 +1,91 @@ +############################################################################ +# fs/vfs/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. +# +############################################################################ + +# If there are no file descriptors configured, then a small part of the +# logic in this directory may still apply to socket descriptors + +ifeq ($(CONFIG_NFILE_DESCRIPTORS),0) +ifneq ($(CONFIG_NSOCKET_DESCRIPTORS),0) + +# Socket descriptor support + +CSRCS += fs_close.c fs_read.c fs_write.c fs_ioctl.c fs_poll.c fs_select.c + +# Support for network access using streams + +ifneq ($(CONFIG_NFILE_STREAMS),0) +CSRCS += fs_fdopen.c +endif + +# Support for sendfile() + +ifeq ($(CONFIG_NET_SENDFILE),y) +CSRCS += fs_sendfile.c +endif + +# Include vfs build support + +DEPPATH += --dep-path vfs +VPATH += :vfs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)vfs} +endif + +else + +# Common file/socket descriptor support + +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_stat.c fs_statfs.c fs_select.c +CSRCS += fs_unlink.c fs_write.c + +# Stream support + +ifneq ($(CONFIG_NFILE_STREAMS),0) +CSRCS += fs_fdopen.c +endif + +# Support for sendfile() + +ifeq ($(CONFIG_NET_SENDFILE),y) +CSRCS += fs_sendfile.c +endif + +# Include vfs build support + +DEPPATH += --dep-path vfs +VPATH += :vfs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)vfs} +endif diff --git a/fs/fs_close.c b/fs/vfs/fs_close.c similarity index 99% rename from fs/fs_close.c rename to fs/vfs/fs_close.c index 5845feb3d6..3ed7b41659 100644 --- a/fs/fs_close.c +++ b/fs/vfs/fs_close.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_close.c + * fs/vfs/fs_close.c * * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_dup.c b/fs/vfs/fs_dup.c similarity index 99% rename from fs/fs_dup.c rename to fs/vfs/fs_dup.c index a6467a3afe..e7b6487da3 100644 --- a/fs/fs_dup.c +++ b/fs/vfs/fs_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_dup.c + * fs/vfs/fs_dup.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_dup2.c b/fs/vfs/fs_dup2.c similarity index 99% rename from fs/fs_dup2.c rename to fs/vfs/fs_dup2.c index e6b74a3bab..4a8a52b9ee 100644 --- a/fs/fs_dup2.c +++ b/fs/vfs/fs_dup2.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_dup2.c + * fs/vfs/fs_dup2.c * * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_fcntl.c b/fs/vfs/fs_fcntl.c similarity index 99% rename from fs/fs_fcntl.c rename to fs/vfs/fs_fcntl.c index b962960da4..12afad4bdf 100644 --- a/fs/fs_fcntl.c +++ b/fs/vfs/fs_fcntl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_fcntl.c + * fs/vfs/fs_fcntl.c * * Copyright (C) 2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_fdopen.c b/fs/vfs/fs_fdopen.c similarity index 99% rename from fs/fs_fdopen.c rename to fs/vfs/fs_fdopen.c index ec0409c2fe..ece6f0fe9b 100644 --- a/fs/fs_fdopen.c +++ b/fs/vfs/fs_fdopen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_fdopen.c + * fs/vfs/fs_fdopen.c * * Copyright (C) 2007-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_filedup.c b/fs/vfs/fs_filedup.c similarity index 99% rename from fs/fs_filedup.c rename to fs/vfs/fs_filedup.c index c291c2f0fd..81748e7a84 100644 --- a/fs/fs_filedup.c +++ b/fs/vfs/fs_filedup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_filedup.c + * fs/vfs/fs_filedup.c * * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_filedup2.c b/fs/vfs/fs_filedup2.c similarity index 99% rename from fs/fs_filedup2.c rename to fs/vfs/fs_filedup2.c index fd6799dacb..c45cf951f1 100644 --- a/fs/fs_filedup2.c +++ b/fs/vfs/fs_filedup2.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_filedup2.c + * fs/vfs/fs_filedup2.c * * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_fsync.c b/fs/vfs/fs_fsync.c similarity index 99% rename from fs/fs_fsync.c rename to fs/vfs/fs_fsync.c index 5073c7f7f9..87d36a30e6 100644 --- a/fs/fs_fsync.c +++ b/fs/vfs/fs_fsync.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_fsync.c + * fs/vfs/fs_fsync.c * * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_ioctl.c b/fs/vfs/fs_ioctl.c similarity index 99% rename from fs/fs_ioctl.c rename to fs/vfs/fs_ioctl.c index 2ccda792ff..38d297f920 100644 --- a/fs/fs_ioctl.c +++ b/fs/vfs/fs_ioctl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_ioctl.c + * fs/vfs/fs_ioctl.c * * Copyright (C) 2007-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_lseek.c b/fs/vfs/fs_lseek.c similarity index 99% rename from fs/fs_lseek.c rename to fs/vfs/fs_lseek.c index eb05c5615f..41bfb8d9ce 100644 --- a/fs/fs_lseek.c +++ b/fs/vfs/fs_lseek.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_lseek.c + * fs/vfs/fs_lseek.c * * Copyright (C) 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_mkdir.c b/fs/vfs/fs_mkdir.c similarity index 99% rename from fs/fs_mkdir.c rename to fs/vfs/fs_mkdir.c index 5f13b9183b..924dde43a6 100644 --- a/fs/fs_mkdir.c +++ b/fs/vfs/fs_mkdir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_mkdir.c + * fs/vfs/fs_mkdir.c * * Copyright (C) 2007, 2008, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_open.c b/fs/vfs/fs_open.c similarity index 99% rename from fs/fs_open.c rename to fs/vfs/fs_open.c index 5d73e71878..3f2e97ee2c 100644 --- a/fs/fs_open.c +++ b/fs/vfs/fs_open.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs_open.c + * fs/vfs/fs_open.c * * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_poll.c b/fs/vfs/fs_poll.c similarity index 99% rename from fs/fs_poll.c rename to fs/vfs/fs_poll.c index 9a7f84b46c..1f8aff0da1 100644 --- a/fs/fs_poll.c +++ b/fs/vfs/fs_poll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_poll.c + * fs/vfs/fs_poll.c * * Copyright (C) 2008-2009, 2012-2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_read.c b/fs/vfs/fs_read.c similarity index 99% rename from fs/fs_read.c rename to fs/vfs/fs_read.c index 1e7bc51063..4bf8f7947d 100644 --- a/fs/fs_read.c +++ b/fs/vfs/fs_read.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_read.c + * fs/vfs/fs_read.c * * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_rename.c b/fs/vfs/fs_rename.c similarity index 99% rename from fs/fs_rename.c rename to fs/vfs/fs_rename.c index 4a563c3393..97a084d23e 100644 --- a/fs/fs_rename.c +++ b/fs/vfs/fs_rename.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_rename.c + * fs/vfs/fs_rename.c * * Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_rmdir.c b/fs/vfs/fs_rmdir.c similarity index 99% rename from fs/fs_rmdir.c rename to fs/vfs/fs_rmdir.c index 407aa58a05..3bd70acb86 100644 --- a/fs/fs_rmdir.c +++ b/fs/vfs/fs_rmdir.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_rmdir.c + * fs/vfs/fs_rmdir.c * * Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_select.c b/fs/vfs/fs_select.c similarity index 99% rename from fs/fs_select.c rename to fs/vfs/fs_select.c index 3f05d42be3..6adc89bc7a 100644 --- a/fs/fs_select.c +++ b/fs/vfs/fs_select.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_select.c + * fs/vfs/fs_select.c * * Copyright (C) 2008-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_sendfile.c b/fs/vfs/fs_sendfile.c similarity index 99% rename from fs/fs_sendfile.c rename to fs/vfs/fs_sendfile.c index 39533a4f2c..e5d9356963 100644 --- a/fs/fs_sendfile.c +++ b/fs/vfs/fs_sendfile.c @@ -1,5 +1,5 @@ /************************************************************************ - * fs/fs_sendfile.c + * fs/vfs/fs_sendfile.c * * Copyright (C) 2007, 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_stat.c b/fs/vfs/fs_stat.c similarity index 99% rename from fs/fs_stat.c rename to fs/vfs/fs_stat.c index 416e360c1a..b1526de41c 100644 --- a/fs/fs_stat.c +++ b/fs/vfs/fs_stat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_stat.c + * fs/vfs/fs_stat.c * * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_statfs.c b/fs/vfs/fs_statfs.c similarity index 99% rename from fs/fs_statfs.c rename to fs/vfs/fs_statfs.c index e19fe7a919..6ca91593dc 100644 --- a/fs/fs_statfs.c +++ b/fs/vfs/fs_statfs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_statfs.c + * fs/vfs/fs_statfs.c * * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_unlink.c b/fs/vfs/fs_unlink.c similarity index 99% rename from fs/fs_unlink.c rename to fs/vfs/fs_unlink.c index 9ba1748ba8..577f804711 100644 --- a/fs/fs_unlink.c +++ b/fs/vfs/fs_unlink.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs_unlink.c + * fs/vfs/fs_unlink.c * * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/fs/fs_write.c b/fs/vfs/fs_write.c similarity index 99% rename from fs/fs_write.c rename to fs/vfs/fs_write.c index 070960c3dc..93cd970672 100644 --- a/fs/fs_write.c +++ b/fs/vfs/fs_write.c @@ -1,5 +1,5 @@ /**************************************************************************** - * fs/fs_write.c + * fs/vfs/fs_write.c * * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt