From 490211a7f9cf9080bc913a481d8e11865931e46b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 19 Feb 2013 16:26:07 -0400 Subject: Direct mode: Support filesystems like FAT which can change their inodes each time they are mounted. --- Utility/InodeCache.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Utility') 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 -- cgit v1.2.3