From a4a23ef584d22a204281302f1bb859099aa84bdc Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 13 Dec 2019 08:35:00 -0600 Subject: [PATCH] arch/sim/src/sim/up_hostfs.c, fs/hostfs/hostfs_rpmsg.c, include/nuttx/fs/hostfs.h: Sync nuttx_stat_s consistent with standard struct. Standard struct stat layout changed with commit ea577f1ddd31b3f67405cbb2a57806c47dd4dd63. --- arch/sim/src/sim/up_hostfs.c | 10 ++++++++-- fs/hostfs/hostfs_rpmsg.c | 10 ++++++++-- include/nuttx/fs/hostfs.h | 23 +++++++++++++++++------ 3 files changed, 33 insertions(+), 10 deletions(-) diff --git a/arch/sim/src/sim/up_hostfs.c b/arch/sim/src/sim/up_hostfs.c index d0c44a5c92a..941b1491dd7 100644 --- a/arch/sim/src/sim/up_hostfs.c +++ b/arch/sim/src/sim/up_hostfs.c @@ -97,12 +97,18 @@ static void host_stat_convert(struct stat *hostbuf, struct nuttx_stat_s *buf) buf->st_mode |= NUTTX_S_IFSOCK; } + buf->st_dev = hostbuf->st_dev; + buf->st_ino = hostbuf->st_ino; + buf->st_nlink = hostbuf->st_nlink; + buf->st_uid = hostbuf->st_uid; + buf->st_gid = hostbuf->st_gid; + buf->st_rdev = hostbuf->st_rdev; buf->st_size = hostbuf->st_size; - buf->st_blksize = hostbuf->st_blksize; - buf->st_blocks = hostbuf->st_blocks; buf->st_atim = hostbuf->st_atime; buf->st_mtim = hostbuf->st_mtime; buf->st_ctim = hostbuf->st_ctime; + buf->st_blksize = hostbuf->st_blksize; + buf->st_blocks = hostbuf->st_blocks; } /**************************************************************************** diff --git a/fs/hostfs/hostfs_rpmsg.c b/fs/hostfs/hostfs_rpmsg.c index 91116e8711b..afbe8abaefe 100644 --- a/fs/hostfs/hostfs_rpmsg.c +++ b/fs/hostfs/hostfs_rpmsg.c @@ -235,13 +235,19 @@ static int hostfs_rpmsg_stat_handler(FAR struct rpmsg_endpoint *ept, cookie->result = header->result; if (cookie->result >= 0) { + buf->st_dev = rsp->buf.st_dev; + buf->st_ino = rsp->buf.st_ino; buf->st_mode = rsp->buf.st_mode; + buf->st_nlink = rsp->buf.st_nlink; + buf->st_uid = rsp->buf.st_uid; + buf->st_gid = rsp->buf.st_gid; + buf->st_rdev = rsp->buf.st_rdev; buf->st_size = B2C(rsp->buf.st_size); - buf->st_blksize = B2C(rsp->buf.st_blksize); - buf->st_blocks = rsp->buf.st_blocks; buf->st_atime = rsp->buf.st_atime; buf->st_mtime = rsp->buf.st_mtime; buf->st_ctime = rsp->buf.st_ctime; + buf->st_blksize = B2C(rsp->buf.st_blksize); + buf->st_blocks = rsp->buf.st_blocks; } nxsem_post(&cookie->sem); diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h index 67bbd3a1325..5b2444dba4e 100644 --- a/include/nuttx/fs/hostfs.h +++ b/include/nuttx/fs/hostfs.h @@ -103,11 +103,16 @@ /* These must match the definitions in include/sys/types.h */ -typedef uintptr_t nuttx_size_t; -typedef int32_t nuttx_off_t; -typedef unsigned int nuttx_mode_t; typedef int16_t nuttx_blksize_t; +typedef int16_t nuttx_gid_t; +typedef int16_t nuttx_uid_t; +typedef uint16_t nuttx_dev_t; +typedef uint16_t nuttx_ino_t; +typedef uint16_t nuttx_nlink_t; +typedef int32_t nuttx_off_t; typedef uint32_t nuttx_blkcnt_t; +typedef unsigned int nuttx_mode_t; +typedef uintptr_t nuttx_size_t; /* These must match the definition in include/time.h */ @@ -139,13 +144,19 @@ struct nuttx_statfs_s struct nuttx_stat_s { - nuttx_mode_t st_mode; /* File type, atributes, and access mode bits */ + nuttx_dev_t st_dev; /* Device ID of device containing file */ + nuttx_ino_t st_ino; /* File serial number */ + nuttx_mode_t st_mode; /* File type, attributes, and access mode bits */ + nuttx_nlink_t st_nlink; /* Number of hard links to the file */ + nuttx_uid_t st_uid; /* User ID of file */ + nuttx_gid_t st_gid; /* Group ID of file */ + nuttx_dev_t st_rdev; /* Device ID (if file is character or block special) */ nuttx_off_t st_size; /* Size of file/directory, in bytes */ - nuttx_blksize_t st_blksize; /* Blocksize used for filesystem I/O */ - nuttx_blkcnt_t st_blocks; /* Number of blocks allocated */ nuttx_time_t st_atim; /* Time of last access */ nuttx_time_t st_mtim; /* Time of last modification */ nuttx_time_t st_ctim; /* Time of last status change */ + nuttx_blksize_t st_blksize; /* Block size used for filesystem I/O */ + nuttx_blkcnt_t st_blocks; /* Number of blocks allocated */ }; #endif /* __SIM__ */