fs: update hostfs structure definition

Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
yinshengkai 2023-12-26 23:52:52 +08:00 committed by Xiang Xiao
parent 9b10255088
commit ca99e69c28
2 changed files with 14 additions and 12 deletions

View File

@ -125,7 +125,7 @@ static void host_stat_convert(struct stat *hostbuf, struct nuttx_stat_s *buf)
* Name: host_open
****************************************************************************/
int host_open(const char *pathname, int flags, nuttx_mode_t mode)
int host_open(const char *pathname, int flags, int mode)
{
int mapflags = 0;
@ -545,7 +545,7 @@ int host_unlink(const char *pathname)
* Name: host_mkdir
****************************************************************************/
int host_mkdir(const char *pathname, nuttx_mode_t mode)
int host_mkdir(const char *pathname, int mode)
{
/* Just call the host's mkdir routine */

View File

@ -130,6 +130,7 @@ typedef int32_t nuttx_off_t;
typedef uint32_t nuttx_blkcnt_t;
# endif
typedef unsigned int nuttx_mode_t;
typedef int nuttx_fsid_t[2];
/* These must match the definition in include/time.h */
@ -157,14 +158,15 @@ struct nuttx_dirent_s
struct nuttx_statfs_s
{
uint32_t f_type; /* Type of filesystem */
nuttx_size_t f_namelen; /* Maximum length of filenames */
nuttx_size_t f_bsize; /* Optimal block size for transfers */
nuttx_off_t f_blocks; /* Total data blocks in the file system of this size */
nuttx_off_t f_bfree; /* Free blocks in the file system */
nuttx_off_t f_bavail; /* Free blocks avail to non-superuser */
nuttx_off_t f_files; /* Total file nodes in the file system */
nuttx_off_t f_ffree; /* Free file nodes in the file system */
uint32_t f_type; /* Type of filesystem */
nuttx_size_t f_namelen; /* Maximum length of filenames */
nuttx_size_t f_bsize; /* Optimal block size for transfers */
nuttx_blkcnt_t f_blocks; /* Total data blocks in the file system of this size */
nuttx_blkcnt_t f_bfree; /* Free blocks in the file system */
nuttx_blkcnt_t f_bavail; /* Free blocks avail to non-superuser */
nuttx_blkcnt_t f_files; /* Total file nodes in the file system */
nuttx_blkcnt_t f_ffree; /* Free file nodes in the file system */
nuttx_fsid_t f_fsid; /* Encode device type, not yet in use */
};
/* These must exactly match the definition from include/sys/stat.h: */
@ -193,7 +195,7 @@ struct nuttx_stat_s
****************************************************************************/
#ifdef __SIM__
int host_open(const char *pathname, int flags, nuttx_mode_t mode);
int host_open(const char *pathname, int flags, int mode);
int host_close(int fd);
nuttx_ssize_t host_read(int fd, void *buf, nuttx_size_t count);
nuttx_ssize_t host_write(int fd, const void *buf, nuttx_size_t count);
@ -212,7 +214,7 @@ void host_rewinddir(void *dirp);
int host_closedir(void *dirp);
int host_statfs(const char *path, struct nuttx_statfs_s *buf);
int host_unlink(const char *pathname);
int host_mkdir(const char *pathname, nuttx_mode_t mode);
int host_mkdir(const char *pathname, int mode);
int host_rmdir(const char *pathname);
int host_rename(const char *oldpath, const char *newpath);
int host_stat(const char *path, struct nuttx_stat_s *buf);