aboutsummaryrefslogtreecommitdiff
path: root/Utility/InodeCache.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-19 16:26:07 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-19 17:31:03 -0400
commit490211a7f9cf9080bc913a481d8e11865931e46b (patch)
tree71fe44cb34462002aa58cb43618384eb77efc5e0 /Utility/InodeCache.hs
parent4e40b54a7516bbc9070faaef31254bd22154684e (diff)
Direct mode: Support filesystems like FAT which can change their inodes each time they are mounted.
Diffstat (limited to 'Utility/InodeCache.hs')
-rw-r--r--Utility/InodeCache.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/Utility/InodeCache.hs b/Utility/InodeCache.hs
index 023a203f8..321125bf4 100644
--- a/Utility/InodeCache.hs
+++ b/Utility/InodeCache.hs
@@ -13,6 +13,13 @@ import System.Posix.Types
data InodeCache = InodeCache FileID FileOffset EpochTime
deriving (Eq, Show)
+{- Weak comparison of the inode caches, comparing the size and mtime, but
+ - not the actual inode. Useful when inodes have changed, perhaps
+ - due to some filesystems being remounted. -}
+compareWeak :: InodeCache -> InodeCache -> Bool
+compareWeak (InodeCache _ size1 mtime1) (InodeCache _ size2 mtime2) =
+ size1 == size2 && mtime1 == mtime2
+
showInodeCache :: InodeCache -> String
showInodeCache (InodeCache inode size mtime) = unwords
[ show inode
@@ -42,9 +49,3 @@ toInodeCache s
(fileSize s)
(modificationTime s)
| otherwise = Nothing
-
-{- Compares an inode cache with the current inode of file. -}
-compareInodeCache :: FilePath -> Maybe InodeCache -> IO Bool
-compareInodeCache file old = do
- curr <- genInodeCache file
- return $ isJust curr && curr == old