From 97454278f2fd737610ac07aa794550ddf2f41b8e Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 6 Oct 2014 08:11:37 -0600 Subject: [PATCH] Modify FS initialization logic to handle AIO container initialization. --- nuttx/fs/Makefile | 2 +- nuttx/fs/fs_initialize.c | 90 +++++++++++++++++++++++++++++++++++++++ nuttx/fs/inode/fs_inode.c | 8 ++-- nuttx/fs/inode/inode.h | 11 +++++ 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 nuttx/fs/fs_initialize.c diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 92f1a9400..0c7250604 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -38,7 +38,7 @@ ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -CSRCS = +CSRCS = fs_initialize.c DEPPATH = --dep-path . VPATH = . diff --git a/nuttx/fs/fs_initialize.c b/nuttx/fs/fs_initialize.c new file mode 100644 index 000000000..eceb3c5c2 --- /dev/null +++ b/nuttx/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/nuttx/fs/inode/fs_inode.c b/nuttx/fs/inode/fs_inode.c index b3ed320a9..805a2de6e 100644 --- a/nuttx/fs/inode/fs_inode.c +++ b/nuttx/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/nuttx/fs/inode/inode.h b/nuttx/fs/inode/inode.h index 6bd412ac0..c1a7468a5 100644 --- a/nuttx/fs/inode/inode.h +++ b/nuttx/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 *