You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2021/07/26 22:44:41 UTC
[incubator-nuttx] 01/02: sim: Correct the typedef in nuttx/hostfs.h
This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3488a98bd73474326fff31c1c606fd92284acbc1
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Mon Jul 26 15:41:28 2021 +0800
sim: Correct the typedef in nuttx/hostfs.h
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
Change-Id: I5fbfd519417c5686325822549c068b1d42f83946
---
arch/sim/src/sim/up_hostfs.c | 18 +++++++++---------
include/nuttx/fs/hostfs.h | 11 ++++++-----
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/arch/sim/src/sim/up_hostfs.c b/arch/sim/src/sim/up_hostfs.c
index d0ce13a..e54a2f3 100644
--- a/arch/sim/src/sim/up_hostfs.c
+++ b/arch/sim/src/sim/up_hostfs.c
@@ -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)
diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h
index 9e3bfb0..fa9ea09 100644
--- a/include/nuttx/fs/hostfs.h
+++ b/include/nuttx/fs/hostfs.h
@@ -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);