Improve capability to traverse inodes in the NuttX psuedo-filesystem; now returns statfs

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5005 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-08-03 22:04:14 +00:00
parent d4c88180c3
commit 1e1e828a3d
11 changed files with 711 additions and 75 deletions
+21 -3
View File
@@ -49,8 +49,26 @@
/********************************************************************************
* Pre-processor Definitions
********************************************************************************/
/* Default values for user configurable limits **********************************/
/* Maximum number of bytes in a filename (not including terminating null). */
/* Configurable limits required by POSIX
#ifndef CONFIG_NAME_MAX
# define CONFIG_NAME_MAX 32
#endif
/* Maximum number of bytes in a pathname, including the terminating null
* character.
*/
#ifndef CONFIG_PATH_MAX
# if CONFIG_NAME_MAX < 64
# define CONFIG_PATH_MAX (4*CONFIG_NAME_MAX + 1)
# else
# define CONFIG_PATH_MAX 256
# endif
#endif
/* Configurable limits required by POSIX ****************************************
*
* Required for all implementations:
*
@@ -62,7 +80,7 @@
* _POSIX_NAME_MAX Number of bytes in a file or pathname component
* _POSIX_NGROUPS_MAX Number supplementary group IDs
* _POSIX_OPEN_MAX Number of files a task can have open at once
* _POSIX_PATH_MAX Number of bytes in a full pathname
* _POSIX_PATH_MAX Number of bytes in a full pathname (including NULL)
* _POSIX_PIPE_BUF Number of bytes for atomic write into pipe
* _POSIX_SSIZE_MAX Largest filesystem write; also max value of ssize_t
* _POSIX_STREAM_MAX Number of std I/O streams open at once
@@ -103,7 +121,7 @@
#define _POSIX_NAME_MAX CONFIG_NAME_MAX
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX CONFIG_NFILE_DESCRIPTORS
#define _POSIX_PATH_MAX 255
#define _POSIX_PATH_MAX CONFIG_PATH_MAX
#define _POSIX_PIPE_BUF 512
#define _POSIX_SSIZE_MAX INT_MAX
#define _POSIX_STREAM_MAX CONFIG_NFILE_STREAMS
+9 -23
View File
@@ -216,11 +216,16 @@ struct inode
};
#define FSNODE_SIZE(n) (sizeof(struct inode) + (n))
/* Callback used by foreach_inode to traverse all inodes in the pseudo-
* file system.
/* Callback used by foreach_mountpoints to traverse all mountpoints in the
* pseudo-file system.
*/
typedef int (*foreach_inode_t)(FAR struct inode *inode, FAR void *arg);
#ifndef CONFIG_DISABLE_MOUNTPOUNT
struct statfs; /* Forward reference */
typedef int (*foreach_mountpoint_t)(FAR const char *mountpoint,
FAR struct statfs *statbuf,
FAR void *arg);
#endif
/* This is the underlying representation of an open file. A file
* descriptor is an index into an array of such types. The type associates
@@ -324,25 +329,6 @@ extern "C" {
EXTERN void weak_function fs_initialize(void);
/* fs_foreachinode.c ********************************************************/
/****************************************************************************
* Name: foreach_inode
*
* Description:
* Visit each inode in the pseudo-file system. The traversal is terminated
* when the callback 'handler' returns a non-zero value, or when all of
* the inodes have been visited.
*
* NOTE 1: Use with caution... The psuedo-file system is locked throughout
* the traversal.
* NOTE 2: The search algorithm is recursive and could, in principle, use
* an indeterminant amount of stack space. This will not usually be a
* real work issue.
*
****************************************************************************/
EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg);
/* fs_foreachmountpoint.c ***************************************************/
/****************************************************************************
* Name: foreach_mountpoint
@@ -365,7 +351,7 @@ EXTERN int foreach_inode(foreach_inode_t handler, FAR void *arg);
****************************************************************************/
#ifndef CONFIG_DISABLE_MOUNTPOUNT
EXTERN int foreach_mountpoint(foreach_inode_t handler, FAR void *arg);
EXTERN int foreach_mountpoint(foreach_mountpoint_t handler, FAR void *arg);
#endif
/* fs_registerdriver.c ******************************************************/