diff options
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/limits.h | 24 | ||||
-rw-r--r-- | nuttx/include/nuttx/fs/fs.h | 32 |
2 files changed, 30 insertions, 26 deletions
diff --git a/nuttx/include/limits.h b/nuttx/include/limits.h index 3d075e7319..056e2ada83 100644 --- a/nuttx/include/limits.h +++ b/nuttx/include/limits.h @@ -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 diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h index 96a9e1ed27..4990d87734 100644 --- a/nuttx/include/nuttx/fs/fs.h +++ b/nuttx/include/nuttx/fs/fs.h @@ -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 ******************************************************/ |