Kernel support for WSTAT_{ATIME,MTIME} for the VFS
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Jul 2014 01:15:12 +0000 (18:15 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 23 Jul 2014 01:27:44 +0000 (18:27 -0700)
9ns devices need to handle this on their own, directly dealing with
wstat.  It works over devmnt for instance, though none of our other
devices support it (#r, #I, #s were tested briefly).

kern/src/syscall.c

index b982bb7..0d13c1e 100644 (file)
@@ -1796,18 +1796,13 @@ static int vfs_wstat(struct file *file, uint8_t *stat_m, size_t stat_sz,
                goto out;
        }
        if (flags & WSTAT_ATIME) {
-               printk("Got atime change for file %s to time %d\n", file_name(file),
-                      dir->atime);
-               /* Fail for now */
-               retval = -1;
-               goto out;
+               /* wstat only gives us seconds */
+               file->f_dentry->d_inode->i_atime.tv_sec = dir->atime;
+               file->f_dentry->d_inode->i_atime.tv_nsec = 0;
        }
        if (flags & WSTAT_MTIME) {
-               printk("Got mtime change for file %s to time %d\n", file_name(file),
-                      dir->mtime);
-               /* Fail for now */
-               retval = -1;
-               goto out;
+               file->f_dentry->d_inode->i_mtime.tv_sec = dir->mtime;
+               file->f_dentry->d_inode->i_mtime.tv_nsec = 0;
        }
 
 out: