mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
9p: darwin: Handle struct stat(fs) differences
Signed-off-by: Keno Fischer <keno@juliacomputing.com> Signed-off-by: Michael Roitzsch <reactorcontrol@icloud.com> [Will Cohen: - Note lack of f_namelen and f_frsize on Darwin - Ensure that tv_sec and tv_nsec are both initialized for Darwin and non-Darwin] Signed-off-by: Will Cohen <wwcohen@gmail.com> Message-Id: <20220227223522.91937-4-wwcohen@gmail.com> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com> Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
This commit is contained in:
parent
6450084a66
commit
f41db099c7
3 changed files with 37 additions and 5 deletions
16
hw/9pfs/9p.c
16
hw/9pfs/9p.c
|
@ -1313,11 +1313,17 @@ static int stat_to_v9stat_dotl(V9fsPDU *pdu, const struct stat *stbuf,
|
|||
v9lstat->st_blksize = stat_to_iounit(pdu, stbuf);
|
||||
v9lstat->st_blocks = stbuf->st_blocks;
|
||||
v9lstat->st_atime_sec = stbuf->st_atime;
|
||||
v9lstat->st_atime_nsec = stbuf->st_atim.tv_nsec;
|
||||
v9lstat->st_mtime_sec = stbuf->st_mtime;
|
||||
v9lstat->st_mtime_nsec = stbuf->st_mtim.tv_nsec;
|
||||
v9lstat->st_ctime_sec = stbuf->st_ctime;
|
||||
#ifdef CONFIG_DARWIN
|
||||
v9lstat->st_atime_nsec = stbuf->st_atimespec.tv_nsec;
|
||||
v9lstat->st_mtime_nsec = stbuf->st_mtimespec.tv_nsec;
|
||||
v9lstat->st_ctime_nsec = stbuf->st_ctimespec.tv_nsec;
|
||||
#else
|
||||
v9lstat->st_atime_nsec = stbuf->st_atim.tv_nsec;
|
||||
v9lstat->st_mtime_nsec = stbuf->st_mtim.tv_nsec;
|
||||
v9lstat->st_ctime_nsec = stbuf->st_ctim.tv_nsec;
|
||||
#endif
|
||||
/* Currently we only support BASIC fields in stat */
|
||||
v9lstat->st_result_mask = P9_STATS_BASIC;
|
||||
|
||||
|
@ -3519,9 +3525,15 @@ static int v9fs_fill_statfs(V9fsState *s, V9fsPDU *pdu, struct statfs *stbuf)
|
|||
f_bavail = stbuf->f_bavail / bsize_factor;
|
||||
f_files = stbuf->f_files;
|
||||
f_ffree = stbuf->f_ffree;
|
||||
#ifdef CONFIG_DARWIN
|
||||
fsid_val = (unsigned int)stbuf->f_fsid.val[0] |
|
||||
(unsigned long long)stbuf->f_fsid.val[1] << 32;
|
||||
f_namelen = NAME_MAX;
|
||||
#else
|
||||
fsid_val = (unsigned int) stbuf->f_fsid.__val[0] |
|
||||
(unsigned long long)stbuf->f_fsid.__val[1] << 32;
|
||||
f_namelen = stbuf->f_namelen;
|
||||
#endif
|
||||
|
||||
return pdu_marshal(pdu, offset, "ddqqqqqqd",
|
||||
f_type, f_bsize, f_blocks, f_bfree,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue