9
0
Fork 0

Re-organize header files so that file systems can be built outside of the nuttx tree; add a binfs file system to apps/namedapp

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@3428 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2011-03-28 00:05:58 +00:00
parent 1840cf51cd
commit 6d31237f5e
21 changed files with 286 additions and 146 deletions

View File

@ -1619,4 +1619,8 @@
output PWMs and interrupt logic
* config/vsn/src: added basic support for Sensor Interface (GPIO and
Power Output, and the sif utility program)
* fs/ -- Reorgnize header so that file systems can be built outside
of the nuttx source tree
* apps/namedapp/binfs.c -- Create a tiny filesystem that can be used
to show the internal named apps under /bin.

View File

@ -149,7 +149,7 @@ LINKLIBS += libxx/liblibxx$(LIBEXT)
endif
# Add library for application support
# Always compile the framework which includes exec_nuttapp if users
# Always compile the framework which includes exec_namedapp if users
# or nuttX applications are to be included.
ifneq ($(APPDIR),)

View File

@ -12,7 +12,7 @@ Execution starts in the following order:
is set. It must be set for the VSN board.
- boot, performs initial chip and board initialization
- sched/os_bringup.c then calls either user_start or exec_nuttapp()
- sched/os_bringup.c then calls either user_start or exec_namedapp()
with application as set in the .config
@ -55,4 +55,4 @@ Compile notes
To link-in the sif_main() utility do, in this folder:
- make context TOPDIR=<path to nuttx top dir>
This will result in registering the application into the nuttapp.
This will result in registering the application into the namedapp.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs_fat32.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References:
@ -60,6 +60,7 @@
#include <nuttx/fs.h>
#include <nuttx/fat.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
#include "fs_fat32.h"
@ -87,9 +88,9 @@ static int fat_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int fat_sync(FAR struct file *filep);
static int fat_opendir(struct inode *mountpt, const char *relpath,
struct internal_dir_s *dir);
static int fat_readdir(struct inode *mountpt, struct internal_dir_s *dir);
static int fat_rewinddir(struct inode *mountpt, struct internal_dir_s *dir);
struct fs_dirent_s *dir);
static int fat_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
static int fat_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir);
static int fat_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
@ -1218,7 +1219,7 @@ errout_with_semaphore:
*
****************************************************************************/
static int fat_opendir(struct inode *mountpt, const char *relpath, struct internal_dir_s *dir)
static int fat_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir)
{
struct fat_mountpt_s *fs;
struct fat_dirinfo_s dirinfo;
@ -1298,7 +1299,7 @@ errout_with_semaphore:
*
****************************************************************************/
static int fat_readdir(struct inode *mountpt, struct internal_dir_s *dir)
static int fat_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
{
struct fat_mountpt_s *fs;
unsigned int dirindex;
@ -1398,7 +1399,7 @@ errout_with_semaphore:
*
****************************************************************************/
static int fat_rewinddir(struct inode *mountpt, struct internal_dir_s *dir)
static int fat_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
{
struct fat_mountpt_s *fs;
int ret;

View File

@ -48,6 +48,8 @@
#include <semaphore.h>
#include <time.h>
#include <nuttx/dirent.h>
/****************************************************************************
* Definitions
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_closedir.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +42,9 @@
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
@ -74,7 +76,7 @@
int closedir(FAR DIR *dirp)
{
struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;
struct inode *inode;
int ret;

View File

@ -84,99 +84,6 @@
* Public Types
****************************************************************************/
/* The internal representation of type DIR is just a container for an inode
* reference, a position, a dirent structure, and file-system-specific
* information.
*
* For the root psuedo-file system, we need retain only the 'next' inode
* need for the next readdir() operation. We hold a reference on this
* inode so we know that it will persist until closedir is called.
*/
struct fs_psuedodir_s
{
struct inode *fd_next; /* The inode for the next call to readdir() */
};
#ifndef CONFIG_DISABLE_MOUNTPOINT
#ifdef CONFIG_FS_FAT
/* For fat, we need to return the start cluster, current cluster, current
* sector and current directory index.
*/
struct fs_fatdir_s
{
uint32_t fd_startcluster; /* Start cluster number of the directory */
uint32_t fd_currcluster; /* Current cluster number being read */
size_t fd_currsector; /* Current sector being read */
unsigned int fd_index; /* Current index of the directory entry to read */
};
#endif /* CONFIG_FS_FAT */
#ifdef CONFIG_FS_ROMFS
/* For ROMFS, we need to return the offset to the current and start positions
* of the directory entry being read
*/
struct fs_romfsdir_s
{
uint32_t fr_firstoffset; /* Offset to the first entry in the directory */
uint32_t fr_curroffset; /* Current offset into the directory contents */
};
#endif /* CONFIG_FS_ROMFS */
#endif /* CONFIG_DISABLE_MOUNTPOINT */
struct internal_dir_s
{
/* This is the node that was opened by opendir. The type of the inode
* determines the way that the readdir() operations are performed. For the
* psuedo root psuedo-file system, it is also used to support rewind.
*
* We hold a reference on this inode so we know that it will persist until
* closedir() is called (although inodes linked to this inode may change).
*/
struct inode *fd_root;
/* At present, only mountpoints require special handling flags */
#ifndef CONFIG_DISABLE_MOUNTPOINT
unsigned int fd_flags;
#endif
/* This keeps track of the current directory position for telldir */
off_t fd_position;
/* Retained control information depends on the type of file system that
* provides is provides the mountpoint. Ideally this information should
* be hidden behind an opaque, file-system-dependent void *, but we put
* the private definitions in line here for now to reduce allocations.
*/
union
{
/* Private data used by the built-in psuedo-file system */
struct fs_psuedodir_s psuedo;
/* Private data used by other file systems */
#ifndef CONFIG_DISABLE_MOUNTPOINT
#ifdef CONFIG_FS_FAT
struct fs_fatdir_s fat;
#endif
#ifdef CONFIG_FS_ROMFS
struct fs_romfsdir_s romfs;
#endif
#endif
} u;
/* In any event, this the actual struct dirent that is returned by readdir */
struct dirent fd_dir; /* Populated when readdir is called */
};
/****************************************************************************
* Global Variables
****************************************************************************/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_mount.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -45,6 +45,10 @@
#include <errno.h>
#include <nuttx/fs.h>
#ifdef CONFIG_APPS_BINDIR
# include <apps/apps.h>
#endif
#include "fs_internal.h"
/* At least one filesystem must be defined, or this file will not compile.
@ -87,6 +91,9 @@ static const struct fsmap_t g_fsmap[] =
#endif
#ifdef CONFIG_FS_ROMFS
{ "romfs", &romfs_operations },
#endif
#ifdef CONFIG_APPS_BINDIR
{ "binfs", &binfs_operations },
#endif
{ NULL, NULL },
};

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_opendir.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -47,6 +47,7 @@
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
@ -89,7 +90,7 @@
FAR DIR *opendir(FAR const char *path)
{
FAR struct inode *inode = NULL;
FAR struct internal_dir_s *dir;
FAR struct fs_dirent_s *dir;
FAR const char *relpath;
bool isroot = false;
int ret;
@ -133,7 +134,7 @@ FAR DIR *opendir(FAR const char *path)
* container.
*/
dir = (FAR struct internal_dir_s *)zalloc(sizeof(struct internal_dir_s));
dir = (FAR struct fs_dirent_s *)zalloc(sizeof(struct fs_dirent_s));
if (!dir)
{
/* Insufficient memory to complete the operation.*/

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_readdir.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -42,7 +42,9 @@
#include <string.h>
#include <dirent.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
@ -54,7 +56,7 @@
* Name: readpsuedodir
****************************************************************************/
static inline int readpsuedodir(struct internal_dir_s *idir)
static inline int readpsuedodir(struct fs_dirent_s *idir)
{
FAR struct inode *prev;
@ -158,7 +160,7 @@ static inline int readpsuedodir(struct internal_dir_s *idir)
FAR struct dirent *readdir(DIR *dirp)
{
FAR struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
FAR struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;
#ifndef CONFIG_DISABLE_MOUNTPOINT
struct inode *inode;
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_rewinddir.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,9 @@
#include <dirent.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
@ -53,7 +55,7 @@
* Name: rewindpsuedodir
****************************************************************************/
static inline void rewindpsuedodir(struct internal_dir_s *idir)
static inline void rewindpsuedodir(struct fs_dirent_s *idir)
{
struct inode *prev;
@ -102,7 +104,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;
struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;
#ifndef CONFIG_DISABLE_MOUNTPOINT
struct inode *inode;
#endif

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_seekdir.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -38,10 +38,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
/****************************************************************************
@ -52,7 +56,7 @@
* Name: seekpsuedodir
****************************************************************************/
static inline void seekpsuedodir(struct internal_dir_s *idir, off_t offset)
static inline void seekpsuedodir(struct fs_dirent_s *idir, off_t offset)
{
struct inode *curr;
struct inode *prev;
@ -110,7 +114,7 @@ static inline void seekpsuedodir(struct internal_dir_s *idir, off_t offset)
****************************************************************************/
#ifndef CONFIG_DISABLE_MOUNTPOINT
static inline void seekmountptdir(struct internal_dir_s *idir, off_t offset)
static inline void seekmountptdir(struct fs_dirent_s *idir, off_t offset)
{
struct inode *inode;
off_t pos;
@ -197,7 +201,7 @@ static inline void seekmountptdir(struct internal_dir_s *idir, off_t offset)
void seekdir(FAR DIR *dirp, off_t offset)
{
struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;
/* Sanity checks */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/fs_telldir.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -38,10 +38,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <nuttx/fs.h>
#include <nuttx/dirent.h>
#include "fs_internal.h"
/****************************************************************************
@ -74,7 +78,7 @@
off_t telldir(FAR DIR *dirp)
{
struct internal_dir_s *idir = (struct internal_dir_s *)dirp;
struct fs_dirent_s *idir = (struct fs_dirent_s *)dirp;
if (!idir || !idir->fd_root)
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* rm/romfs/fs_romfs.h
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References: Linux/Documentation/filesystems/romfs.txt
@ -58,6 +58,7 @@
#include <nuttx/fs.h>
#include <nuttx/ioctl.h>
#include <nuttx/dirent.h>
#include "fs_romfs.h"
@ -77,9 +78,9 @@ static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence);
static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg);
static int romfs_opendir(struct inode *mountpt, const char *relpath,
struct internal_dir_s *dir);
static int romfs_readdir(struct inode *mountpt, struct internal_dir_s *dir);
static int romfs_rewinddir(struct inode *mountpt, struct internal_dir_s *dir);
struct fs_dirent_s *dir);
static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir);
static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir);
static int romfs_bind(FAR struct inode *blkdriver, const void *data,
void **handle);
@ -589,7 +590,7 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
****************************************************************************/
static int romfs_opendir(struct inode *mountpt, const char *relpath,
struct internal_dir_s *dir)
struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
struct romfs_dirinfo_s dirinfo;
@ -653,7 +654,7 @@ errout_with_semaphore:
*
****************************************************************************/
static int romfs_readdir(struct inode *mountpt, struct internal_dir_s *dir)
static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
uint32_t linkoffset;
@ -748,7 +749,7 @@ errout_with_semaphore:
*
****************************************************************************/
static int romfs_rewinddir(struct inode *mountpt, struct internal_dir_s *dir)
static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir)
{
struct romfs_mountpt_s *rm;
int ret;
@ -889,7 +890,6 @@ static int romfs_unbind(void *handle, FAR struct inode **blkdriver)
/* Check if there are sill any files opened on the filesystem. */
ret = OK; /* Assume success */
romfs_semtake(rm);
if (rm->rm_head)
{
@ -934,6 +934,7 @@ static int romfs_unbind(void *handle, FAR struct inode **blkdriver)
sem_destroy(&rm->rm_sem);
free(rm);
return OK;
}
romfs_semgive(rm);

View File

@ -1,7 +1,7 @@
/****************************************************************************
* fs/romfs/fs_romfs.h
*
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* References: Linux/Documentation/filesystems/romfs.txt
@ -47,6 +47,8 @@
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/dirent.h>
#include "../fs_internal.h"
/****************************************************************************

View File

@ -52,6 +52,7 @@
#include <debug.h>
#include <nuttx/ioctl.h>
#include <nuttx/dirent.h>
#include "fs_romfs.h"

View File

@ -52,7 +52,7 @@
* Public Types
****************************************************************************/
struct nuttapp_s
struct namedapp_s
{
const char *name; /* Invocation name and as seen under /sbin/ */
int priority; /* Use: SCHED_PRIORITY_DEFAULT */
@ -60,6 +60,19 @@ struct nuttapp_s
main_t main; /* Entry point: main(int argc, char *argv[]) */
};
/****************************************************************************
* Public Data
****************************************************************************/
/* The "bindir" is file system that supports access to the named applications.
* It is typically mounted under /bin.
*/
#ifdef CONFIG_APPS_BINDIR
struct mountpt_operations;
extern const struct mountpt_operations binfs_operations;
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
@ -73,7 +86,7 @@ extern "C" {
#endif
/****************************************************************************
* Name: check for availability of builtin NuttX application
* Name: namedapp_isavail
*
* Description:
* Checks for availabiliy of application registerred during compile time.
@ -88,10 +101,10 @@ extern "C" {
*
****************************************************************************/
EXTERN int nuttapp_isavail(FAR const char *appname);
EXTERN int namedapp_isavail(FAR const char *appname);
/****************************************************************************
* Name: get name of built-in application
* Name: namedapp_getname
*
* Description:
* Returns pointer to a name of built-in application pointed by the
@ -106,13 +119,13 @@ EXTERN int nuttapp_isavail(FAR const char *appname);
*
****************************************************************************/
EXTERN const char * nuttapp_getname(int index);
EXTERN const char *namedapp_getname(int index);
/****************************************************************************
* Name: execute builtin NuttX application
* Name: exec_namedapp
*
* Description:
* Executes builtin application registerred during compile time.
* Executes builtin named application registered during compile time.
* New application is run in a separate task context (and thread).
*
* Input Parameter:
@ -126,7 +139,7 @@ EXTERN const char * nuttapp_getname(int index);
*
****************************************************************************/
EXTERN int exec_nuttapp(FAR const char *appname, FAR const char *argv[]);
EXTERN int exec_namedapp(FAR const char *appname, FAR const char *argv[]);
#undef EXTERN
#if defined(__cplusplus)

View File

@ -0,0 +1,186 @@
/****************************************************************************
* include/nuttx/dirent.h
*
* Copyright (C) 2007, 2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* 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.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_DIRENT_H
#define __INCLUDE_NUTTX_DIRENT_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <dirent.h>
#include <nuttx/fs.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/* The internal representation of type DIR is just a container for an inode
* reference, a position, a dirent structure, and file-system-specific
* information.
*
* For the root psuedo-file system, we need retain only the 'next' inode
* need for the next readdir() operation. We hold a reference on this
* inode so we know that it will persist until closedir is called.
*/
struct fs_psuedodir_s
{
struct inode *fd_next; /* The inode for the next call to readdir() */
};
#ifndef CONFIG_DISABLE_MOUNTPOINT
#ifdef CONFIG_FS_FAT
/* For fat, we need to return the start cluster, current cluster, current
* sector and current directory index.
*/
struct fs_fatdir_s
{
uint32_t fd_startcluster; /* Start cluster number of the directory */
uint32_t fd_currcluster; /* Current cluster number being read */
size_t fd_currsector; /* Current sector being read */
unsigned int fd_index; /* Current index of the directory entry to read */
};
#endif /* CONFIG_FS_FAT */
#ifdef CONFIG_FS_ROMFS
/* For ROMFS, we need to return the offset to the current and start positions
* of the directory entry being read
*/
struct fs_romfsdir_s
{
uint32_t fr_firstoffset; /* Offset to the first entry in the directory */
uint32_t fr_curroffset; /* Current offset into the directory contents */
};
#endif /* CONFIG_FS_ROMFS */
#ifdef CONFIG_APPS_BINDIR
/* The apps/ pseudo bin/ directory. The state value is simply an index */
struct fs_binfsdir_s
{
unsigned int fb_index; /* Index to the next named entry point */
};
#endif
#endif /* CONFIG_DISABLE_MOUNTPOINT */
struct fs_dirent_s
{
/* This is the node that was opened by opendir. The type of the inode
* determines the way that the readdir() operations are performed. For the
* psuedo root psuedo-file system, it is also used to support rewind.
*
* We hold a reference on this inode so we know that it will persist until
* closedir() is called (although inodes linked to this inode may change).
*/
struct inode *fd_root;
/* At present, only mountpoints require special handling flags */
#ifndef CONFIG_DISABLE_MOUNTPOINT
unsigned int fd_flags;
#endif
/* This keeps track of the current directory position for telldir */
off_t fd_position;
/* Retained control information depends on the type of file system that
* provides is provides the mountpoint. Ideally this information should
* be hidden behind an opaque, file-system-dependent void *, but we put
* the private definitions in line here for now to reduce allocations.
*/
union
{
/* Private data used by the built-in psuedo-file system */
struct fs_psuedodir_s psuedo;
/* Private data used by other file systems */
#ifndef CONFIG_DISABLE_MOUNTPOINT
#ifdef CONFIG_FS_FAT
struct fs_fatdir_s fat;
#endif
#ifdef CONFIG_FS_ROMFS
struct fs_romfsdir_s romfs;
#endif
#ifdef CONFIG_APPS_BINDIR
struct fs_binfsdir_s binfs;
#endif
#endif
} u;
/* In any event, this the actual struct dirent that is returned by readdir */
struct dirent fd_dir; /* Populated when readdir is called */
};
/****************************************************************************
* Global Variables
****************************************************************************/
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#undef EXTERN
#if defined(__cplusplus)
#define EXTERN extern "C"
extern "C" {
#else
#define EXTERN extern
#endif
#undef EXTERN
#if defined(__cplusplus)
}
#endif
#endif /* __INCLUDE_NUTTX_DIRENT_H */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* include/nuttx/fs.h
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -124,7 +124,7 @@ struct block_operations
*/
struct inode;
struct internal_dir_s;
struct fs_dirent_s;
struct stat;
struct statfs;
struct mountpt_operations
@ -160,10 +160,10 @@ struct mountpt_operations
/* Directory operations */
int (*opendir)(FAR struct inode *mountpt, FAR const char *relpath, FAR struct internal_dir_s *dir);
int (*closedir)(FAR struct inode *mountpt, FAR struct internal_dir_s *dir);
int (*readdir)(FAR struct inode *mountpt, FAR struct internal_dir_s *dir);
int (*rewinddir)(FAR struct inode *mountpt, FAR struct internal_dir_s *dir);
int (*opendir)(FAR struct inode *mountpt, FAR const char *relpath, FAR struct fs_dirent_s *dir);
int (*closedir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int (*readdir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
int (*rewinddir)(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir);
/* General volume-related mountpoint operations: */

View File

@ -95,6 +95,7 @@
#define XENIX_SUPER_MAGIC 0x012FF7B4
#define XFS_SUPER_MAGIC 0x58465342
#define _XIAFS_SUPER_MAGIC 0x012FD16D
#define BINFS_MAGIC 0x4242
/****************************************************************************
* Type Definitions

View File

@ -157,11 +157,11 @@ int os_bringup(void)
svdbg("Starting init thread\n");
#ifdef CONFIG_BUILTIN_APP_START
/* Start the built-in application, passing an "init" argument, so that
/* Start the built-in named application, passing an "init" argument, so that
* application can distinguish different run-levels
*/
init_taskid = exec_nuttapp(CONFIG_BUILTIN_APP_START, argv);
init_taskid = exec_namedapp(CONFIG_BUILTIN_APP_START, argv);
#else
/* Start the default application at user_start() */