store whole Mntents
This way, if a mount point was already mounted, but something else gets mounted there, it'll be seen as a new mount.
This commit is contained in:
parent
7298507cf2
commit
0496a3971d
2 changed files with 6 additions and 6 deletions
|
@ -74,15 +74,15 @@ handleMounts :: ThreadState -> DaemonStatusHandle -> MountPoints -> MountPoints
|
|||
handleMounts st handle wasmounted nowmounted = mapM_ (handleMount st handle) $
|
||||
S.toList $ newMountPoints wasmounted nowmounted
|
||||
|
||||
handleMount :: ThreadState -> DaemonStatusHandle -> FilePath -> IO ()
|
||||
handleMount st handle mountpoint = do
|
||||
putStrLn $ "mounted: " ++ mountpoint
|
||||
handleMount :: ThreadState -> DaemonStatusHandle -> Mntent -> IO ()
|
||||
handleMount st handle mntent = do
|
||||
putStrLn $ "mounted: " ++ mnt_dir mntent
|
||||
|
||||
type MountPoints = S.Set FilePath
|
||||
type MountPoints = S.Set Mntent
|
||||
|
||||
{- Reads mtab, getting the current set of mount points. -}
|
||||
currentMountPoints :: IO MountPoints
|
||||
currentMountPoints = S.fromList . map mnt_dir <$> getMounts
|
||||
currentMountPoints = S.fromList <$> getMounts
|
||||
|
||||
{- Finds new mount points, given an old and a new set. -}
|
||||
newMountPoints :: MountPoints -> MountPoints -> MountPoints
|
||||
|
|
|
@ -30,7 +30,7 @@ data Mntent = Mntent
|
|||
{ mnt_fsname :: String
|
||||
, mnt_dir :: String
|
||||
, mnt_type :: String
|
||||
} deriving (Read, Show, Eq)
|
||||
} deriving (Read, Show, Eq, Ord)
|
||||
|
||||
getMounts :: IO [Mntent]
|
||||
getMounts = do
|
||||
|
|
Loading…
Reference in a new issue