diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-05-21 14:36:00 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-05-21 14:36:00 +0000 |
commit | d7d1d7f99d0cd4549f676cf9e450124c9c4170cb (patch) | |
tree | 2df0051fc3a31dd16df7bc58a66fd5772d6f13e6 /nuttx/include | |
parent | d7ab605d158cdbd32907d87707e356414e4727dc (diff) | |
download | px4-nuttx-d7d1d7f99d0cd4549f676cf9e450124c9c4170cb.tar.gz px4-nuttx-d7d1d7f99d0cd4549f676cf9e450124c9c4170cb.tar.bz2 px4-nuttx-d7d1d7f99d0cd4549f676cf9e450124c9c4170cb.zip |
Add unlink(), mkdir(), rmdir(), and rename()
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@246 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/nuttx/fs.h | 14 | ||||
-rw-r--r-- | nuttx/include/stdio.h | 4 | ||||
-rw-r--r-- | nuttx/include/sys/stat.h | 19 | ||||
-rw-r--r-- | nuttx/include/unistd.h | 7 |
4 files changed, 35 insertions, 9 deletions
diff --git a/nuttx/include/nuttx/fs.h b/nuttx/include/nuttx/fs.h index 043514034..639f68856 100644 --- a/nuttx/include/nuttx/fs.h +++ b/nuttx/include/nuttx/fs.h @@ -139,20 +139,24 @@ struct mountpt_operations /* The two structures need not be common after this point. The following * are extended methods needed to deal with the unique needs of mounted * file systems. + * + * Additional open-file-specific mountpoint operations: */ int (*sync)(FAR struct file *filp); - /* The two structures need not be common after this point. For the - * case of struct mountpt_operations, additional operations are included - * that used only for mounting and unmounting the volume. - */ + /* General volume-related mountpoint operations: */ int (*bind)(FAR struct inode *blkdriver, const void *data, void **handle); int (*unbind)(void *handle); + int (*unlink)(struct inode *mountpt, const char *rel_path); + int (*mkdir)(struct inode *mountpt, const char *rel_path, mode_t mode); + int (*rmdir)(struct inode *mountpt, const char *rel_path); + int (*rename)(struct inode *mountpt, const char *old_relpath, const char *new_relpath); + /* NOTE: More operations will be needed here to support: disk usage stats - * stat(), unlink(), mkdir(), chmod(), rename(), etc. + * file stat(), file attributes, file truncation, etc. */ }; diff --git a/nuttx/include/stdio.h b/nuttx/include/stdio.h index b2937ed91..bdad75eb6 100644 --- a/nuttx/include/stdio.h +++ b/nuttx/include/stdio.h @@ -155,7 +155,7 @@ EXTERN char *gets(char *s); EXTERN int printf(const char *format, ...); EXTERN int puts(const char *s); -EXTERN int rename(const char *source, const char *target); +EXTERN int rename(const char *oldpath, const char *newpath); EXTERN int sprintf(char *dest, const char *format, ...); EXTERN int ungetc(int c, FILE *stream); EXTERN int vprintf(const char *s, va_list ap); @@ -168,8 +168,6 @@ EXTERN int chdir(const char *path); EXTERN FILE *fdopen(int fd, const char *type); EXTERN int fstat(int fd, FAR struct stat *buf); EXTERN char *getcwd(FAR char *buf, size_t size); -EXTERN int mkdir(const char *path, mode_t mode); -EXTERN int rmdir(const char *path); EXTERN int stat(const char *path, FAR struct stat *buf); EXTERN int statfs(const char *path, FAR struct statfs *buf); diff --git a/nuttx/include/sys/stat.h b/nuttx/include/sys/stat.h index 12e78313c..0d686e10f 100644 --- a/nuttx/include/sys/stat.h +++ b/nuttx/include/sys/stat.h @@ -46,4 +46,23 @@ * Type Definitions ************************************************************/ +/************************************************************ + * Global Function Prototypes + ************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +EXTERN int mkdir(const char *pathname, mode_t mode); + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + #endif /* __SYS_STAT_H */ diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h index 16414fc77..4e843c5eb 100644 --- a/nuttx/include/unistd.h +++ b/nuttx/include/unistd.h @@ -108,7 +108,7 @@ extern "C" { #define EXTERN extern #endif -/* Task Control Interfaces (based on ANSII APIs) */ +/* Task Control Interfaces */ EXTERN pid_t getpid(void); EXTERN void _exit(int status) noreturn_function; @@ -126,6 +126,11 @@ EXTERN int read(int fd, void *buf, unsigned int nbytes); EXTERN int unlink(const char *path); EXTERN int write(int fd, const void *buf, unsigned int nbytes); +/* File path operations */ + +EXTERN int unlink(const char *pathname); +EXTERN int rmdir(const char *pathname); + #undef EXTERN #if defined(__cplusplus) } |