diff --git a/fs/Makefile b/fs/Makefile index 92f1a94009..0c72506041 100644 --- a/fs/Makefile +++ b/fs/Makefile @@ -38,7 +38,7 @@ ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -CSRCS = +CSRCS = fs_initialize.c DEPPATH = --dep-path . VPATH = . diff --git a/fs/fs_initialize.c b/fs/fs_initialize.c new file mode 100644 index 0000000000..eceb3c5c20 --- /dev/null +++ b/fs/fs_initialize.c @@ -0,0 +1,90 @@ +/**************************************************************************** + * fs/fs_initialize.c + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include "inode/inode.h" +#include "aio/aio.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: fs_initialize + * + * Description: + * This is called from the OS initialization logic to configure the file + * system. + * + ****************************************************************************/ + +void fs_initialize(void) +{ + /* Initial inode, file, and VFS data structures */ + + inode_initialize(); + +#ifdef CONFIG_FS_AIO + /* Initialize for asynchronous I/O */ + + aio_initialize(); + +#endif +} diff --git a/fs/inode/fs_inode.c b/fs/inode/fs_inode.c index b3ed320a9e..805a2de6e3 100644 --- a/fs/inode/fs_inode.c +++ b/fs/inode/fs_inode.c @@ -170,7 +170,7 @@ static int _inode_compare(FAR const char *fname, ****************************************************************************/ /**************************************************************************** - * Name: fs_initialize + * Name: inode_initialize * * Description: * This is called from the OS initialization logic to configure the file @@ -178,10 +178,10 @@ static int _inode_compare(FAR const char *fname, * ****************************************************************************/ -void fs_initialize(void) +void inode_initialize(void) { - /* Initialize the semaphore to one (to support one-at- - * a-time access to the inode tree). + /* Initialize the semaphore to one (to support one-at-a-time access to the + * inode tree). */ (void)sem_init(&g_inode_sem.sem, 0, 1); diff --git a/fs/inode/inode.h b/fs/inode/inode.h index 6bd412ac01..c1a7468a50 100644 --- a/fs/inode/inode.h +++ b/fs/inode/inode.h @@ -129,6 +129,17 @@ EXTERN FAR struct inode *root_inode; * Public Function Prototypes ****************************************************************************/ /* fs_inode.c ***************************************************************/ +/**************************************************************************** + * Name: inode_initialize + * + * Description: + * This is called from the OS initialization logic to configure the file + * system. + * + ****************************************************************************/ + +void inode_initialize(void); + /**************************************************************************** * Name: inode_semtake *