Created
May 21, 2012 08:44
-
-
Save john-peterson/2761215 to your computer and use it in GitHub Desktop.
franzinc/nfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 456cf216232cc3e7515dc836d78f9a33038d8d82 Mon Sep 17 00:00:00 2001 | |
From: John Peterson <[email protected]> | |
Date: Mon, 21 May 2012 22:55:39 -0700 | |
Subject: [PATCH] Fixing nfsd-getattr and nfsd-setattr so that it reads and writes the correct time. | |
_wstat64 and _wutime (and _futime) when called from nfs.exe read and write a time that is one hour into the future and one hour in the past, respectively. To offset this problem an adjustment is required to the value that is read and written. | |
--- | |
attr.cl | 8 +++++++- | |
unicode-file.cl | 6 +++--- | |
2 files changed, 10 insertions(+), 4 deletions(-) | |
diff --git a/attr.cl b/attr.cl | |
index e943598..c0c8393 100755 | |
--- a/attr.cl | |
+++ b/attr.cl | |
@@ -181,7 +181,13 @@ | |
(if (not (open-stream-p stream)) | |
(error "Something passed a closed stream to update-attr-times-and-size")) | |
(if set-mtime | |
- (sys-futime (excl.osi::stream-to-fd stream) 0)) | |
+ (ff:with-static-fobject (utimbuf 'excl.osi::utimbuf | |
+ :allocation :foreign-static-gc) | |
+ (setf (ff:fslot-value utimbuf 'excl.osi::actime) | |
+ (+ 3600 (excl::cl-internal-real-time))) | |
+ (setf (ff:fslot-value utimbuf 'excl.osi::modtime) | |
+ (+ 3600 (excl::cl-internal-real-time))) | |
+ (sys-futime (excl.osi::stream-to-fd stream) utimbuf))) | |
(let ((attr (update-atime-and-mtime fh)) | |
(pos (file-position stream))) | |
(when (> pos (nfs-attr-size attr)) | |
diff --git a/unicode-file.cl b/unicode-file.cl | |
index ec19e3e..032fe6c 100644 | |
--- a/unicode-file.cl | |
+++ b/unicode-file.cl | |
@@ -231,7 +231,7 @@ struct __stat64 { | |
(macrolet ((slot (&rest rest) | |
`(ff:fslot-value-typed 'stat64 :foreign-static-gc sb ,@rest))) | |
(macrolet ((timeslot (name) | |
- `(excl.osi:unix-to-universal-time (slot ,name :low)))) | |
+ `(- (excl.osi:unix-to-universal-time (slot ,name :low)) 3600))) | |
(let ((mode (slot 'mode))) | |
(if (symlink-p filename) | |
(setf mode #o0120777)) | |
@@ -327,9 +327,9 @@ struct __stat64 { | |
(ff:with-static-fobject (utimbuf 'excl.osi::utimbuf | |
:allocation :foreign-static-gc) | |
(setf (ff:fslot-value utimbuf 'excl.osi::actime) | |
- (universal-to-unix-time (or atime file-atime))) | |
+ (universal-to-unix-time (+ 3600 (or atime file-atime)))) | |
(setf (ff:fslot-value utimbuf 'excl.osi::modtime) | |
- (universal-to-unix-time (or mtime file-mtime))) | |
+ (universal-to-unix-time (+ 3600 (or mtime file-mtime)))) | |
(multiple-value-bind (res errno) (syscall-wutime filespec utimbuf) | |
(when (/= 0 res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment