sim: Correct the typedef in nuttx/hostfs.h

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I5fbfd519417c5686325822549c068b1d42f83946
This commit is contained in:
Xiang Xiao 2021-07-26 15:41:28 +08:00 committed by Masayuki Ishikawa
parent 58a5e0744b
commit 3488a98bd7
2 changed files with 15 additions and 14 deletions

View File

@ -126,7 +126,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, int mode)
int host_open(const char *pathname, int flags, nuttx_mode_t mode)
{
int mapflags = 0;
@ -212,11 +212,11 @@ int host_close(int fd)
* Name: host_read
****************************************************************************/
ssize_t host_read(int fd, void *buf, size_t count)
nuttx_ssize_t host_read(int fd, void *buf, nuttx_size_t count)
{
/* Just call the read routine */
ssize_t ret = read(fd, buf, count);
nuttx_ssize_t ret = read(fd, buf, count);
if (ret == -1)
{
ret = -errno;
@ -229,11 +229,11 @@ ssize_t host_read(int fd, void *buf, size_t count)
* Name: host_write
****************************************************************************/
ssize_t host_write(int fd, const void *buf, size_t count)
nuttx_ssize_t host_write(int fd, const void *buf, nuttx_size_t count)
{
/* Just call the write routine */
ssize_t ret = write(fd, buf, count);
nuttx_ssize_t ret = write(fd, buf, count);
if (ret == -1)
{
ret = -errno;
@ -246,12 +246,12 @@ ssize_t host_write(int fd, const void *buf, size_t count)
* Name: host_lseek
****************************************************************************/
off_t host_lseek(int fd, off_t offset, int whence)
nuttx_off_t host_lseek(int fd, nuttx_off_t offset, int whence)
{
/* Just call the lseek routine */
off_t ret = lseek(fd, offset, whence);
if (ret == (off_t)-1)
nuttx_off_t ret = lseek(fd, offset, whence);
if (ret == (nuttx_off_t)-1)
{
ret = -errno;
}
@ -317,7 +317,7 @@ int host_fstat(int fd, struct nuttx_stat_s *buf)
* Name: host_truncate
****************************************************************************/
int host_ftruncate(int fd, off_t length)
int host_ftruncate(int fd, nuttx_off_t length)
{
int ret = ftruncate(fd, length);
if (ret < 0)

View File

@ -110,6 +110,7 @@ typedef int32_t nuttx_off_t;
typedef uint32_t nuttx_blkcnt_t;
typedef unsigned int nuttx_mode_t;
typedef uintptr_t nuttx_size_t;
typedef intptr_t nuttx_ssize_t;
/* These must match the definition in include/time.h */
@ -169,16 +170,16 @@ struct nuttx_stat_s
****************************************************************************/
#ifdef __SIM__
int host_open(const char *pathname, int flags, int mode);
int host_open(const char *pathname, int flags, nuttx_mode_t mode);
int host_close(int fd);
ssize_t host_read(int fd, void *buf, nuttx_size_t count);
ssize_t host_write(int fd, const void *buf, nuttx_size_t count);
off_t host_lseek(int fd, off_t offset, int whence);
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);
nuttx_off_t host_lseek(int fd, nuttx_off_t offset, int whence);
int host_ioctl(int fd, int request, unsigned long arg);
void host_sync(int fd);
int host_dup(int fd);
int host_fstat(int fd, struct nuttx_stat_s *buf);
int host_ftruncate(int fd, off_t length);
int host_ftruncate(int fd, nuttx_off_t length);
void *host_opendir(const char *name);
int host_readdir(void *dirp, struct nuttx_dirent_s *entry);
void host_rewinddir(void *dirp);