sim: Update hostfs after the recent struct stat timespec changes
Fix it after the following change:
commit bb4458b63f
Author: Ouss4 <abdelatif.guettouche@gmail.com>
Date: Thu Apr 30 19:05:12 2020 +0100
include/sys/stat.h: Per the POSIX standard, the atime, ctime and mtime field
s
have changed their type from time_t to struct timespec.
This commit is contained in:
parent
6b4cc3011c
commit
8b054dba98
@ -104,9 +104,21 @@ static void host_stat_convert(struct stat *hostbuf, struct nuttx_stat_s *buf)
|
||||
buf->st_gid = hostbuf->st_gid;
|
||||
buf->st_rdev = hostbuf->st_rdev;
|
||||
buf->st_size = hostbuf->st_size;
|
||||
buf->st_atim = hostbuf->st_atime;
|
||||
buf->st_mtim = hostbuf->st_mtime;
|
||||
buf->st_ctim = hostbuf->st_ctime;
|
||||
#if defined(__APPLE__)
|
||||
buf->st_atim.tv_sec = hostbuf->st_atimespec.tv_sec;
|
||||
buf->st_atim.tv_nsec = hostbuf->st_atimespec.tv_nsec;
|
||||
buf->st_mtim.tv_sec = hostbuf->st_mtimespec.tv_sec;
|
||||
buf->st_mtim.tv_nsec = hostbuf->st_mtimespec.tv_nsec;
|
||||
buf->st_ctim.tv_sec = hostbuf->st_ctimespec.tv_sec;
|
||||
buf->st_ctim.tv_nsec = hostbuf->st_ctimespec.tv_nsec;
|
||||
#else
|
||||
buf->st_atim.tv_sec = hostbuf->st_atim.tv_sec;
|
||||
buf->st_atim.tv_nsec = hostbuf->st_atim.tv_nsec;
|
||||
buf->st_mtim.tv_sec = hostbuf->st_mtim.tv_sec;
|
||||
buf->st_mtim.tv_nsec = hostbuf->st_mtim.tv_nsec;
|
||||
buf->st_ctim.tv_sec = hostbuf->st_ctim.tv_sec;
|
||||
buf->st_ctim.tv_nsec = hostbuf->st_ctim.tv_nsec;
|
||||
#endif
|
||||
buf->st_blksize = hostbuf->st_blksize;
|
||||
buf->st_blocks = hostbuf->st_blocks;
|
||||
}
|
||||
|
@ -118,6 +118,12 @@ typedef uintptr_t nuttx_size_t;
|
||||
|
||||
typedef uint32_t nuttx_time_t;
|
||||
|
||||
struct nuttx_timespec
|
||||
{
|
||||
nuttx_time_t tv_sec;
|
||||
long tv_nsec;
|
||||
};
|
||||
|
||||
/* These must exactly match the definition from include/dirent.h: */
|
||||
|
||||
struct nuttx_dirent_s
|
||||
@ -152,9 +158,9 @@ struct nuttx_stat_s
|
||||
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_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 */
|
||||
struct nuttx_timespec st_atim; /* Time of last access */
|
||||
struct nuttx_timespec st_mtim; /* Time of last modification */
|
||||
struct nuttx_timespec 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 */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user