aboutsummaryrefslogtreecommitdiff
path: root/Utility/InodeCache.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-01-20 19:35:50 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-01-20 19:35:50 -0400
commitcb50de905ca5b63cbb972cf587f74ff563b2573b (patch)
tree6ecedc8ac397a6912133cca6c4fc8e023dc84807 /Utility/InodeCache.hs
parent745525e80bb6915f3eb63554de9b735b75991f7d (diff)
on second thought, InodeCache should use getFileSize
This is necessary for interop between inode caches created on unix and windows. Which is more important than supporting inodecaches for large keys with the wrong size, which are broken anyway. There should be no slowdown from this change, except on Windows.
Diffstat (limited to 'Utility/InodeCache.hs')
-rw-r--r--Utility/InodeCache.hs14
1 files changed, 6 insertions, 8 deletions
diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs
index 0b0b040cb..d068e3801 100644
--- a/Utility/InodeCache.hs
+++ b/Utility/InodeCache.hs
@@ -40,15 +40,12 @@ module Utility.InodeCache (
import Common
import System.PosixCompat.Types
import Utility.QuickCheck
--- While fileSize overflows and wraps at 2gb on Windows,
--- it's ok for purposes of comparison.
-import System.PosixCompat.Files (fileSize)
#ifdef mingw32_HOST_OS
import Data.Word (Word64)
#endif
-data InodeCachePrim = InodeCachePrim FileID FileOffset EpochTime
+data InodeCachePrim = InodeCachePrim FileID Integer EpochTime
deriving (Show, Eq, Ord)
newtype InodeCache = InodeCache InodeCachePrim
@@ -115,15 +112,16 @@ readInodeCache s = case words s of
genInodeCache :: FilePath -> TSDelta -> IO (Maybe InodeCache)
genInodeCache f delta = catchDefaultIO Nothing $
- toInodeCache delta =<< getFileStatus f
+ toInodeCache delta f =<< getFileStatus f
-toInodeCache :: TSDelta -> FileStatus -> IO (Maybe InodeCache)
-toInodeCache (TSDelta getdelta) s
+toInodeCache :: TSDelta -> FilePath -> FileStatus -> IO (Maybe InodeCache)
+toInodeCache (TSDelta getdelta) f s
| isRegularFile s = do
delta <- getdelta
+ sz <- getFileSize' f s
return $ Just $ InodeCache $ InodeCachePrim
(fileID s)
- (fileSize s)
+ sz
(modificationTime s + delta)
| otherwise = pure Nothing