ukernel: output dataversion in stat struct if possible
authorDerrick Brashear <shadow@dementix.org>
Wed, 28 Sep 2011 14:23:19 +0000 (10:23 -0400)
committerDerrick Brashear <shadow@dementix.org>
Wed, 28 Sep 2011 18:53:26 +0000 (11:53 -0700)
we already have this data; if we can output it, do so.

Change-Id: Ibc445a152e4e1e61be50003dd8683d2a4b32d190
Reviewed-on: http://gerrit.openafs.org/5510
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

acinclude.m4
src/afs/UKERNEL/afs_usrops.c

index 99e0edf..f9de460 100644 (file)
@@ -1350,6 +1350,9 @@ AC_CHECK_TYPES([fsblkcnt_t],,,[
 #endif
 ])
 
+dnl see what struct stat has for timestamps
+AC_CHECK_MEMBERS([struct stat.st_ctimespec, struct stat.st_ctimensec])
+
 dnl check for curses-lib
 save_LIBS=$LIBS
 AC_CHECK_LIB( [ncurses], [setupterm],
index 1db43c5..b5d5a2b 100644 (file)
@@ -2458,6 +2458,16 @@ uafs_GetAttr(struct usr_vnode *vp, struct stat *stats)
     stats->st_atime = attrs.va_atime.tv_sec;
     stats->st_mtime = attrs.va_mtime.tv_sec;
     stats->st_ctime = attrs.va_ctime.tv_sec;
+    /* preserve dv if possible */
+#if defined(HAVE_STRUCT_STAT_ST_CTIMESPEC)
+    stats->st_atimespec.tv_nsec = attrs.va_atime.tv_usec * 1000;
+    stats->st_mtimespec.tv_nsec = attrs.va_mtime.tv_usec * 1000;
+    stats->st_ctimespec.tv_nsec = attrs.va_ctime.tv_usec * 1000;
+#elif defined(HAVE_STRUCT_STAT_ST_CTIMENSEC)
+    stats->st_atimensec = attrs.va_atime.tv_usec * 1000;
+    stats->st_mtimensec = attrs.va_mtime.tv_usec * 1000;
+    stats->st_ctimensec = attrs.va_ctime.tv_usec * 1000;
+#endif
     stats->st_blksize = attrs.va_blocksize;
     stats->st_blocks = attrs.va_blocks;