diff options
Diffstat (limited to 'components/dfs/include')
| -rw-r--r-- | components/dfs/include/dfs.h | 3 | ||||
| -rw-r--r-- | components/dfs/include/dfs_file.h | 5 | ||||
| -rw-r--r-- | components/dfs/include/dfs_fs.h | 12 | ||||
| -rw-r--r-- | components/dfs/include/dfs_posix.h | 3 | ||||
| -rw-r--r-- | components/dfs/include/dfs_private.h | 6 |
5 files changed, 18 insertions, 11 deletions
diff --git a/components/dfs/include/dfs.h b/components/dfs/include/dfs.h index 7fdcb1cfda..1158df93cb 100644 --- a/components/dfs/include/dfs.h +++ b/components/dfs/include/dfs.h @@ -55,6 +55,7 @@ #define FT_SOCKET 1 /* socket file */ #define FT_DIRECTORY 2 /* directory */ #define FT_USER 3 /* user defined */ +#define FT_DEVICE 4 /* device */ /* File flags */ #define DFS_F_OPEN 0x01000000 @@ -102,7 +103,7 @@ struct dfs_fd *fd_get(int fd); void fd_put(struct dfs_fd *fd); int fd_is_open(const char *pathname); -struct dfs_fdtable* dfs_fdtable_get(void); +struct dfs_fdtable *dfs_fdtable_get(void); #ifdef __cplusplus } diff --git a/components/dfs/include/dfs_file.h b/components/dfs/include/dfs_file.h index 7ef681a247..2dfacd653e 100644 --- a/components/dfs/include/dfs_file.h +++ b/components/dfs/include/dfs_file.h @@ -44,6 +44,7 @@ struct dfs_fd char *path; /* Name (below mount point) */ int ref_count; /* Descriptor reference count */ + struct dfs_filesystem *fs; const struct dfs_file_ops *fops; uint32_t flags; /* Descriptor flags */ @@ -65,6 +66,10 @@ int dfs_file_lseek(struct dfs_fd *fd, off_t offset); int dfs_file_stat(const char *path, struct stat *buf); int dfs_file_rename(const char *oldpath, const char *newpath); +int dfs_file_ftruncate(struct dfs_fd *fd, off_t length); + +/* 0x5254 is just a magic number to make these relatively unique ("RT") */ +#define RT_FIOFTRUNCATE 0x52540000U #ifdef __cplusplus } diff --git a/components/dfs/include/dfs_fs.h b/components/dfs/include/dfs_fs.h index 711771a137..a35a513044 100644 --- a/components/dfs/include/dfs_fs.h +++ b/components/dfs/include/dfs_fs.h @@ -7,7 +7,7 @@ * Date Author Notes * 2005-02-22 Bernard The first version. */ - + #ifndef __DFS_FS_H__ #define __DFS_FS_H__ @@ -60,7 +60,7 @@ struct dfs_partition uint8_t type; /* file system type */ off_t offset; /* partition start offset */ size_t size; /* partition size */ - rt_sem_t lock; + rt_sem_t lock; }; /* mount table */ @@ -75,11 +75,11 @@ struct dfs_mount_tbl int dfs_register(const struct dfs_filesystem_ops *ops); struct dfs_filesystem *dfs_filesystem_lookup(const char *path); -const char* dfs_filesystem_get_mounted_path(struct rt_device* device); +const char *dfs_filesystem_get_mounted_path(struct rt_device *device); int dfs_filesystem_get_partition(struct dfs_partition *part, - uint8_t *buf, - uint32_t pindex); + uint8_t *buf, + uint32_t pindex); int dfs_mount(const char *device_name, const char *path, @@ -90,6 +90,8 @@ int dfs_unmount(const char *specialfile); int dfs_mkfs(const char *fs_name, const char *device_name); int dfs_statfs(const char *path, struct statfs *buffer); +int dfs_mount_device(rt_device_t dev); +int dfs_unmount_device(rt_device_t dev); #ifdef __cplusplus } diff --git a/components/dfs/include/dfs_posix.h b/components/dfs/include/dfs_posix.h index bc8ff1c698..87d5f0771e 100644 --- a/components/dfs/include/dfs_posix.h +++ b/components/dfs/include/dfs_posix.h @@ -36,7 +36,7 @@ struct dirent *readdir(DIR *d); long telldir(DIR *d); void seekdir(DIR *d, off_t offset); void rewinddir(DIR *d); -int closedir(DIR* d); +int closedir(DIR *d); /* file api*/ int open(const char *file, int flags, ...); @@ -58,6 +58,7 @@ int fstat(int fildes, struct stat *buf); int fsync(int fildes); int fcntl(int fildes, int cmd, ...); int ioctl(int fildes, int cmd, ...); +int ftruncate(int fd, off_t length); /* directory api*/ int rmdir(const char *path); diff --git a/components/dfs/include/dfs_private.h b/components/dfs/include/dfs_private.h index e20680d9df..fccd260ac0 100644 --- a/components/dfs/include/dfs_private.h +++ b/components/dfs/include/dfs_private.h @@ -12,10 +12,8 @@ #include <dfs.h> -// #define DBG_ENABLE -#define DBG_SECTION_NAME "DFS" -#define DBG_COLOR -#define DBG_LEVEL DBG_LOG +#define DBG_TAG "DFS" +#define DBG_LVL DBG_INFO #include <rtdbg.h> #define NO_WORKING_DIR "system does not support working directory\n" |
