System.Unix.SpecialDevice

Unixutils-1.54.1: A crude interface between Haskell and Unix-like operating systems

Safe Haskell | None
Language | Haskell98

System.Unix.SpecialDevice

Description

Construct an ADT representing block and character devices (but mostly block devices) by interpreting the contents of the Linux sysfs filesystem.

Synopsis

- data SpecialDevice
- sysMountPoint :: FilePath
- ofNode :: FilePath -> IO (Maybe SpecialDevice)
- ofNodeStatus :: FileStatus -> Maybe SpecialDevice
- ofPath :: FilePath -> IO (Maybe SpecialDevice)
- rootPart :: IO (Maybe SpecialDevice)
- ofDevNo :: (DeviceID -> SpecialDevice) -> Int -> SpecialDevice
- ofSysName :: String -> IO (Maybe SpecialDevice)
- ofSysPath :: (DeviceID -> SpecialDevice) -> FilePath -> IO (Maybe SpecialDevice)
- toDevno :: SpecialDevice -> DeviceID
- ofMajorMinor :: (DeviceID -> SpecialDevice) -> Int -> Int -> SpecialDevice
- node :: SpecialDevice -> IO (Maybe FilePath)
- nodes :: SpecialDevice -> IO [FilePath]
- sysName :: SpecialDevice -> IO (Maybe String)
- splitPart :: String -> (String, Int)
- sysDir :: SpecialDevice -> IO (Maybe FilePath)
- diskOfPart :: SpecialDevice -> IO (Maybe SpecialDevice)
- getAllDisks :: IO [SpecialDevice]
- getAllPartitions :: IO [SpecialDevice]
- getAllCdroms :: IO [SpecialDevice]
- getAllRemovable :: IO [SpecialDevice]

# Documentation

data SpecialDevice #

Instances

Eq SpecialDevice # |
Methods (==) :: SpecialDevice -> SpecialDevice -> Bool # (/=) :: SpecialDevice -> SpecialDevice -> Bool #
Ord SpecialDevice # |
Methods compare :: SpecialDevice -> SpecialDevice -> Ordering # (<) :: SpecialDevice -> SpecialDevice -> Bool # (<=) :: SpecialDevice -> SpecialDevice -> Bool # (>) :: SpecialDevice -> SpecialDevice -> Bool # (>=) :: SpecialDevice -> SpecialDevice -> Bool # max :: SpecialDevice -> SpecialDevice -> SpecialDevice # min :: SpecialDevice -> SpecialDevice -> SpecialDevice #
Show SpecialDevice # |
Methods showsPrec :: Int -> SpecialDevice -> ShowS # show :: SpecialDevice -> String # showList :: [SpecialDevice] -> ShowS #

sysMountPoint :: FilePath #

FIXME: We should really get this value from the mount table.

ofNode :: FilePath -> IO (Maybe SpecialDevice) #

Return the device represented by a device node, such as /dev/sda2. Returns Nothing if there is an exception trying to stat the node, or if the node turns out not to be a special device.

ofNodeStatus :: FileStatus -> Maybe SpecialDevice #

ofPath :: FilePath -> IO (Maybe SpecialDevice) #

rootPart :: IO (Maybe SpecialDevice) #

ofDevNo :: (DeviceID -> SpecialDevice) -> Int -> SpecialDevice #

ofSysName :: String -> IO (Maybe SpecialDevice) #

ofSysPath :: (DeviceID -> SpecialDevice) -> FilePath -> IO (Maybe SpecialDevice) #

toDevno :: SpecialDevice -> DeviceID #

ofMajorMinor :: (DeviceID -> SpecialDevice) -> Int -> Int -> SpecialDevice #

node :: SpecialDevice -> IO (Maybe FilePath) #

nodes :: SpecialDevice -> IO [FilePath] #

sysName :: SpecialDevice -> IO (Maybe String) #

splitPart :: String -> (String, Int) #

sysDir :: SpecialDevice -> IO (Maybe FilePath) #

diskOfPart :: SpecialDevice -> IO (Maybe SpecialDevice) #

getAllDisks :: IO [SpecialDevice] #

getAllPartitions :: IO [SpecialDevice] #

getAllCdroms :: IO [SpecialDevice] #

getAllRemovable :: IO [SpecialDevice] #