[RFC 10/32] fs/coda: convert to struct inode_time

From: Arnd Bergmann
Date: Fri May 30 2014 - 16:06:08 EST


This converts the coda file system to use inode_time, which we will
need to fix the y2038 limit. However, inode time stamps in coda
are communicated to user space through coda_pioctl() as a 'struct
timespec', so this cannot be fixed for coda without changing the
user space interface.

Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Cc: Jan Harkes <jaharkes@xxxxxxxxxx>
Cc: coda@xxxxxxxxxx
Cc: codalist@xxxxxxxxxxxxxxx
---
fs/coda/coda_linux.c | 18 ++++++++++++------
include/uapi/linux/coda.h | 1 +
2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c
index 2849f41..f2fcec5 100644
--- a/fs/coda/coda_linux.c
+++ b/fs/coda/coda_linux.c
@@ -110,11 +110,14 @@ void coda_vattr_to_iattr(struct inode *inode, struct coda_vattr *attr)
if (attr->va_size != -1)
inode->i_blocks = (attr->va_size + 511) >> 9;
if (attr->va_atime.tv_sec != -1)
- inode->i_atime = attr->va_atime;
+ inode->i_atime = (struct inode_time)
+ { attr->va_atime.tv_sec, attr->va_atime.tv_nsec };
if (attr->va_mtime.tv_sec != -1)
- inode->i_mtime = attr->va_mtime;
+ inode->i_mtime = (struct inode_time)
+ { attr->va_mtime.tv_sec, attr->va_mtime.tv_nsec };
if (attr->va_ctime.tv_sec != -1)
- inode->i_ctime = attr->va_ctime;
+ inode->i_ctime = (struct inode_time)
+ { attr->va_ctime.tv_sec, attr->va_ctime.tv_nsec };
}


@@ -180,13 +183,16 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr)
vattr->va_size = iattr->ia_size;
}
if ( valid & ATTR_ATIME ) {
- vattr->va_atime = iattr->ia_atime;
+ vattr->va_atime = (struct timespec)
+ { iattr->ia_atime.tv_sec, iattr->ia_atime.tv_nsec };
}
if ( valid & ATTR_MTIME ) {
- vattr->va_mtime = iattr->ia_mtime;
+ vattr->va_mtime = (struct timespec)
+ { iattr->ia_mtime.tv_sec, iattr->ia_mtime.tv_nsec };
}
if ( valid & ATTR_CTIME ) {
- vattr->va_ctime = iattr->ia_ctime;
+ vattr->va_ctime = (struct timespec)
+ { iattr->ia_ctime.tv_sec, iattr->ia_ctime.tv_nsec };
}
}

diff --git a/include/uapi/linux/coda.h b/include/uapi/linux/coda.h
index 695fade..e7258f7 100644
--- a/include/uapi/linux/coda.h
+++ b/include/uapi/linux/coda.h
@@ -220,6 +220,7 @@ struct coda_vattr {
long va_fileid; /* file id */
u_quad_t va_size; /* file size in bytes */
long va_blocksize; /* blocksize preferred for i/o */
+ /* FIXME: timespec in user API */
struct timespec va_atime; /* time of last access */
struct timespec va_mtime; /* time of last modification */
struct timespec va_ctime; /* time file changed */
--
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/