summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bushnell <thomas@gnu.org>1999-01-31 23:49:56 +0000
committerThomas Bushnell <thomas@gnu.org>1999-01-31 23:49:56 +0000
commiteef100d3e42e30b98b2218a102d98841e2e5e41f (patch)
treeca3a541bd3a9d361fafef569a9a95c0a12336fed
parente5b20b2e303e29c99192846d550df4532410688e (diff)
Sun Jan 31 18:27:42 1999 Thomas Bushnell, BSG <tb@mit.edu>
* file-utimes.c (netfs_S_file_utimes): Understand new semantics for setting to current time. * netfs.h (netfs_attempt_utimes): Update documentation.
-rw-r--r--libnetfs/ChangeLog6
-rw-r--r--libnetfs/file-utimes.c21
-rw-r--r--libnetfs/netfs.h5
3 files changed, 24 insertions, 8 deletions
diff --git a/libnetfs/ChangeLog b/libnetfs/ChangeLog
index e9081385..6774fa1b 100644
--- a/libnetfs/ChangeLog
+++ b/libnetfs/ChangeLog
@@ -1,3 +1,9 @@
+Sun Jan 31 18:27:42 1999 Thomas Bushnell, BSG <tb@mit.edu>
+
+ * file-utimes.c (netfs_S_file_utimes): Understand new semantics
+ for setting to current time.
+ * netfs.h (netfs_attempt_utimes): Update documentation.
+
1999-01-22 Roland McGrath <roland@baalperazim.frob.com>
* file-set-translator.c: Remove makedev, major, minor macro definition.
diff --git a/libnetfs/file-utimes.c b/libnetfs/file-utimes.c
index abe2f6c4..45adf825 100644
--- a/libnetfs/file-utimes.c
+++ b/libnetfs/file-utimes.c
@@ -1,5 +1,5 @@
/*
- Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
Written by Michael I. Bushnell, p/BSG.
This file is part of the GNU Hurd.
@@ -28,17 +28,26 @@ netfs_S_file_utimes (struct protid *user,
{
struct timespec atime, mtime;
error_t err;
+
+ if (atimein.microseconds != -1)
+ {
+ atime.tv_sec = atimein.seconds;
+ atime.tv_nsec = atimein.microseconds * 1000;
+ }
- atime.tv_sec = atimein.seconds;
- atime.tv_nsec = atimein.microseconds * 1000;
- mtime.tv_sec = mtimein.seconds;
- mtime.tv_nsec = mtimein.microseconds * 1000;
+ if (mtimein.microseconds != -1)
+ {
+ mtime.tv_sec = mtimein.seconds;
+ mtime.tv_nsec = mtimein.microseconds * 1000;
+ }
if (!user)
return EOPNOTSUPP;
mutex_lock (&user->po->np->lock);
- err = netfs_attempt_utimes (user->user, user->po->np, &atime, &mtime);
+ err = netfs_attempt_utimes (user->user, user->po->np,
+ atimein.microseconds != -1 ? &atime : 0,
+ mtimein.microseconds != -1 ? &mtime : 0);
mutex_unlock (&user->po->np->lock);
return err;
}
diff --git a/libnetfs/netfs.h b/libnetfs/netfs.h
index f7e97b60..b2253dff 100644
--- a/libnetfs/netfs.h
+++ b/libnetfs/netfs.h
@@ -1,6 +1,6 @@
/*
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation
+ Copyright (C) 1994, 1995, 1996, 1997, 1999 Free Software Foundation
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
@@ -153,7 +153,8 @@ error_t netfs_attempt_chflags (struct iouser *cred, struct node *np,
/* The user must define this function. This should attempt a utimes
call for the user specified by CRED on node NODE, to change the
- atime to ATIME and the mtime to MTIME. */
+ atime to ATIME and the mtime to MTIME. If ATIME or MTIME is null,
+ then set to the current time. */
error_t netfs_attempt_utimes (struct iouser *cred, struct node *np,
struct timespec *atime, struct timespec *mtime);