ext2-0.1.0.0: A library for playing around with ext2. Might not work very well.

Copyright(C) 2014 Ricky Elrod
LicenseBSD2 (see LICENSE file)
MaintainerRicky Elrod <ricky@elrod.me>
Stabilityexperimental
Portabilitylens
Safe HaskellNone
LanguageHaskell2010

System.Ext2

Contents

Description

This library exists for me to learn about ext2 and to possibly be used as part of an assignment in a Computer Science course I will be taking soon.

Please feel free to use it to learn about ext2 and play around, but don't use it for anything that you care about for now, because I don't trust myself.

Synopsis

Superblock

data Superblock

Constructors

Superblock 

Fields

sbInodesCount :: Word32

Total number of inodes in the file system

sbBlocksCount :: Word32

Total number of blocks in the file system

sbRBlocksCount :: Word32

Number of blocks reserved for the superuser

sbFreeBlocksCount :: Word32

Number of unallocated blocks

sbFreeInodesCount :: Word32

Number of unallocated inodes

sbFirstDataBlock :: Word32

Block number of the block containing the superblock

sbLogBlockSize :: Word32

log2(block size) - 10

sbLogFragSize :: Word32

log2(fragment size) - 10

sbBlocksPerGroup :: Word32

Number of blocks in each group

sbFragsPerGroup :: Word32

Number of gragments in each group

sbInodesPerGroup :: Word32

Number of inodes in each group

sbMTime :: Word32

Last mount time

sbWTime :: Word32

Last write time

sbMntCount :: Word16

Number of mounts since last consistency check

sbMaxMntCount :: Word16

Number of allowed mounts before requiring a consistency check

sbMagic :: Word16

ext2 signature: 0xef53

sbState :: Word16

Filesystem state

sbErrors :: Word16

What to do on an error condition

sbMinorRevLevel :: Word16

Minor portion of version

sbLastCheck :: Word32

Time of last consistency check

sbCheckInterval :: Word32

Interval between forced consistency checks

sbCreatorOs :: Word32

Operating system ID

sbRevLevel :: Word32

Major portion of version

sbDefResuid :: Word16

User ID that can use reserved blocks

sbDefResgid :: Word16

Group ID that can use reserved blocks

sbFirstIno :: Word32

First non-reserved inode

sbInodeSize :: Word16

Size of each inode structure

sbBlockGroupNumber :: Word16

Block group of this particular superblock (if it is a copy)

sbFeatureCompat :: Word32

Optional features present

sbFeatureIncompat :: Word32

Required features present

sbFeatureRoCompat :: Word32

Features which, if not present, force read-only mounting

sbUuid :: ByteString

File system UUID

sbVolumeName :: ByteString

Volume name

sbLastMounted :: ByteString

Last mounted path

sbAlgoBitmap :: Word32

Compression algorithms used

sbPreallocBlocks :: Word8

Number of blocks to pre-allocate for files

sbPreallocDirBlocks :: Word8

Number of blocks to pre-allocate for directories

sbUnusedAlignment :: Word16

UNUSED

sbJournalUuid :: ByteString

Journal UUID

sbJournalInum :: Word32

Journal inode

sbJournalDev :: Word32

Journal device

sbJournalLastOrphan :: Word32

Head of orphan inode list

sbHashSeed :: (Word32, Word32, Word32, Word32)

Seeds for hashing algorithm for directory indexing

sbDefHashVersion :: Word8

Default hash version used for directory indexing

sbDefaultMountOptions :: Word32

Default mount options for the filesystem

sbFirstMetaBg :: Word32

Block group ID of the first meta block group

Parsers

readSuperblock :: MonadGet m => m Superblock

Reads the superblock information from an ext2 filesystem. Does not skip the first 1024 bytes to where the superblock lives.

See also readExtendedSuperblock

BlockGroupDescriptorTable

Parsers

readBlockGroupDescriptorTable :: MonadGet m => m BlockGroupDescriptorTable

Reads the block group descriptor table. The last 12 ("reserved") bytes are ignored and skipped over (consumed).

Inode

Parsers

readInode :: MonadGet m => m Inode

readInodeTable :: MonadGet m => Int -> m (Vector Inode)

Directory

Parsers

readDirectory :: MonadGet m => m Directory