Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/librump/rumpvfs PR/52738: Martin Husemann: rumpfs d...
details: https://anonhg.NetBSD.org/src/rev/853ad6f76411
branches: trunk
changeset: 357648:853ad6f76411
user: christos <christos%NetBSD.org@localhost>
date: Mon Nov 20 00:01:05 2017 +0000
description:
PR/52738: Martin Husemann: rumpfs does not support mtime
diffstat:
sys/rump/librump/rumpvfs/rumpfs.c | 59 +++++++++++++++++++++++++++++++++-----
1 files changed, 51 insertions(+), 8 deletions(-)
diffs (117 lines):
diff -r ee5a3254fda6 -r 853ad6f76411 sys/rump/librump/rumpvfs/rumpfs.c
--- a/sys/rump/librump/rumpvfs/rumpfs.c Sun Nov 19 21:54:31 2017 +0000
+++ b/sys/rump/librump/rumpvfs/rumpfs.c Mon Nov 20 00:01:05 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $ */
+/* $NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $ */
/*
* Copyright (c) 2009, 2010, 2011 Antti Kantee. All Rights Reserved.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -614,6 +614,32 @@
}
}
+#define RUMPFS_ACCESS 1
+#define RUMPFS_MODIFY 2
+#define RUMPFS_CHANGE 4
+
+static int
+rumpfs_update(int flags, struct vnode *vp, const struct timespec *acc,
+ const struct timespec *mod, const struct timespec *chg)
+{
+ struct rumpfs_node *rn = vp->v_data;
+
+ if (flags == 0)
+ return 0;
+
+ if (vp->v_mount->mnt_flag & MNT_RDONLY)
+ return EROFS;
+
+ if (flags & RUMPFS_ACCESS)
+ rn->rn_va.va_atime = *acc;
+ if (flags & RUMPFS_MODIFY)
+ rn->rn_va.va_mtime = *mod;
+ if (flags & RUMPFS_CHANGE)
+ rn->rn_va.va_ctime = *chg;
+
+ return 0;
+}
+
/*
* Simple lookup for rump file systems.
*
@@ -858,6 +884,7 @@
struct vattr *vap = ap->a_vap;
struct rumpfs_node *rn = vp->v_data;
struct vattr *attr = &rn->rn_va;
+ struct timespec now;
kauth_cred_t cred = ap->a_cred;
int error;
@@ -878,14 +905,22 @@
return error;
}
- SETIFVAL(va_atime.tv_sec, time_t);
- SETIFVAL(va_ctime.tv_sec, time_t);
- SETIFVAL(va_mtime.tv_sec, time_t);
+ int flags = 0;
+ if (vap->va_atime.tv_sec != VNOVAL)
+ if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
+ flags |= RUMPFS_ACCESS;
+ if (vap->va_mtime.tv_sec != VNOVAL) {
+ flags |= RUMPFS_CHANGE | RUMPFS_MODIFY;
+ if (vp->v_mount->mnt_flag & MNT_RELATIME)
+ flags |= RUMPFS_ACCESS;
+ }
SETIFVAL(va_birthtime.tv_sec, time_t);
- SETIFVAL(va_atime.tv_nsec, long);
- SETIFVAL(va_ctime.tv_nsec, long);
- SETIFVAL(va_mtime.tv_nsec, long);
SETIFVAL(va_birthtime.tv_nsec, long);
+ flags |= RUMPFS_CHANGE;
+ getnanotime(&now);
+ error = rumpfs_update(flags, vp, &vap->va_atime, &vap->va_mtime, &now);
+ if (error)
+ return error;
if (CHANGED(va_flags, u_long)) {
/* XXX Can we handle system flags here...? */
@@ -1345,6 +1380,7 @@
const int advice = IO_ADV_DECODE(ap->a_ioflag);
off_t chunk;
int error = 0;
+ struct timespec ts;
if (vp->v_type == VDIR)
return EISDIR;
@@ -1353,6 +1389,9 @@
if (rn->rn_flags & RUMPNODE_ET_PHONE_HOST)
return etread(rn, uio);
+ getnanotime(&ts);
+ (void)rumpfs_update(RUMPFS_ACCESS, vp, &ts, &ts, &ts);
+
/* otherwise, it's off to ubc with us */
while (uio->uio_resid > 0) {
chunk = MIN(uio->uio_resid, (off_t)rn->rn_dlen-uio->uio_offset);
@@ -1415,6 +1454,10 @@
off_t chunk;
int error = 0;
bool allocd = false;
+ struct timespec ts;
+
+ getnanotime(&ts);
+ (void)rumpfs_update(RUMPFS_MODIFY, vp, &ts, &ts, &ts);
if (ap->a_ioflag & IO_APPEND)
uio->uio_offset = vp->v_size;
Home |
Main Index |
Thread Index |
Old Index