Redo previous differently - just use time_second.

Pointed out by Frank Kardel.
This commit is contained in:
martin 2006-07-01 10:12:36 +00:00
parent ce9f9820ee
commit 931985243c
2 changed files with 13 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bfs.c,v 1.3 2006/07/01 08:42:39 martin Exp $ */
/* $NetBSD: bfs.c,v 1.4 2006/07/01 10:12:36 martin Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.3 2006/07/01 08:42:39 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: bfs.c,v 1.4 2006/07/01 10:12:36 martin Exp $");
#define BFS_DEBUG
#include <sys/param.h>
@ -283,9 +283,6 @@ bfs_file_write(struct bfs *bfs, const char *fname, void *buf,
struct bfs_dirent *dirent;
int8_t name[BFS_FILENAME_MAXLEN];
int err;
#ifdef _KERNEL
struct timespec ts;
#endif
strncpy(name, fname, BFS_FILENAME_MAXLEN);
@ -304,10 +301,9 @@ bfs_file_write(struct bfs *bfs, const char *fname, void *buf,
} else {
memset(&attr, 0xff, sizeof attr); /* Set VNOVAL all */
#ifdef _KERNEL
getnanotime(&ts);
attr.atime = ts.tv_sec;
attr.ctime = ts.tv_sec;
attr.mtime = ts.tv_sec;
attr.atime = time_second;
attr.ctime = time_second;
attr.mtime = time_second;
#endif
if ((err = bfs_file_create(bfs, name, buf, bufsz, &attr)) != 0)
return err;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysvbfs_vnops.c,v 1.4 2006/07/01 08:42:39 martin Exp $ */
/* $NetBSD: sysvbfs_vnops.c,v 1.5 2006/07/01 10:12:36 martin Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.4 2006/07/01 08:42:39 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: sysvbfs_vnops.c,v 1.5 2006/07/01 10:12:36 martin Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -237,19 +237,17 @@ sysvbfs_close(void *arg)
struct vnode *v = a->a_vp;
struct sysvbfs_node *bnode = v->v_data;
struct bfs_fileattr attr;
struct timespec ts;
DPRINTF("%s:\n", __FUNCTION__);
uvm_vnp_setsize(v, bnode->size);
memset(&attr, 0xff, sizeof attr); /* Set VNOVAL all */
getnanotime(&ts);
if (bnode->update_atime)
attr.atime = ts.tv_sec;
attr.atime = time_second;
if (bnode->update_ctime)
attr.ctime = ts.tv_sec;
attr.ctime = time_second;
if (bnode->update_mtime)
attr.mtime = ts.tv_sec;
attr.mtime = time_second;
bfs_inode_set_attr(bnode->bmp->bfs, bnode->inode, &attr);
VOP_FSYNC(a->a_vp, a->a_cred, FSYNC_WAIT, 0, 0, a->a_l);
@ -801,21 +799,19 @@ sysvbfs_update(struct vnode *vp, const struct timespec *acc,
{
struct sysvbfs_node *bnode = vp->v_data;
struct bfs_fileattr attr;
struct timespec ts;
DPRINTF("%s:\n", __FUNCTION__);
memset(&attr, 0xff, sizeof attr); /* Set VNOVAL all */
getnanotime(&ts);
if (bnode->update_atime) {
attr.atime = acc ? acc->tv_sec : ts.tv_sec;
attr.atime = acc ? acc->tv_sec : time_second;
bnode->update_atime = FALSE;
}
if (bnode->update_ctime) {
attr.ctime = ts.tv_sec;
attr.ctime = time_second;
bnode->update_ctime = FALSE;
}
if (bnode->update_mtime) {
attr.mtime = mod ? mod->tv_sec : ts.tv_sec;
attr.mtime = mod ? mod->tv_sec : time_second;
bnode->update_mtime = FALSE;
}
bfs_inode_set_attr(bnode->bmp->bfs, bnode->inode, &attr);