fs/nfs: Return nanosecond from nfs_fstat and nfs_stat callback

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-08-10 15:38:51 +08:00 committed by Masayuki Ishikawa
parent 7a60efab35
commit 580de38832
3 changed files with 9 additions and 16 deletions

View File

@ -65,9 +65,9 @@ struct nfsnode
uint8_t n_type; /* File type */
uint8_t n_fhsize; /* Size in bytes of the file handle */
uint16_t n_mode; /* File mode for fstat() */
time_t n_atime; /* File access time */
time_t n_mtime; /* File modification time */
time_t n_ctime; /* File creation time */
struct timespec n_atime; /* File access time */
struct timespec n_mtime; /* File modification time */
struct timespec n_ctime; /* File creation time */
nfsfh_t n_fhandle; /* NFS File Handle */
uint64_t n_size; /* Current size of file */
};

View File

@ -514,8 +514,6 @@ int nfs_finddir(FAR struct nfsmount *nmp, FAR const char *relpath,
void nfs_attrupdate(FAR struct nfsnode *np, FAR struct nfs_fattr *attributes)
{
struct timespec ts;
/* Save a few of the files attribute values in file structure (host
* order).
*/
@ -524,12 +522,7 @@ void nfs_attrupdate(FAR struct nfsnode *np, FAR struct nfs_fattr *attributes)
np->n_mode = fxdr_unsigned(uint16_t, attributes->fa_mode);
np->n_size = fxdr_hyper(&attributes->fa_size);
fxdr_nfsv3time(&attributes->fa_atime, &ts);
np->n_atime = ts.tv_sec;
fxdr_nfsv3time(&attributes->fa_mtime, &ts);
np->n_mtime = ts.tv_sec;
fxdr_nfsv3time(&attributes->fa_ctime, &ts);
np->n_ctime = ts.tv_sec;
fxdr_nfsv3time(&attributes->fa_atime, &np->n_atime);
fxdr_nfsv3time(&attributes->fa_mtime, &np->n_mtime);
fxdr_nfsv3time(&attributes->fa_ctime, &np->n_ctime);
}

View File

@ -1227,9 +1227,9 @@ static int nfs_fstat(FAR const struct file *filep, FAR struct stat *buf)
/* Extract time values as type time_t in units of seconds. */
buf->st_atime = np->n_atime;
buf->st_mtime = np->n_mtime;
buf->st_ctime = np->n_ctime;
buf->st_atim = np->n_atime;
buf->st_mtim = np->n_mtime;
buf->st_ctim = np->n_ctime;
nfs_semgive(nmp);
return OK;