SFS

From OSDev Wiki
Jump to: navigation, search
Filesystems
Virtual Filesystems

VFS

Disk Filesystems
CD/DVD Filesystems
Network Filesystems
Flash Filesystems

There are several filesystems existing that are abbreviated SFS, but the one discussed here is the Simple File System by Brendan Trotter, designed to be very easy to implement. It has a minimal set of features. Officially it is still in its draft stage, but hasn't changed for some time.

SFS is designed to be used as a simple filesystem for use on floppy disks and other removable media to transfer data between computers.

Contents

Format Details

Layout

There are five key areas in a SimpleFS partition: The Super-block, Reserved Area, Data Area, Free Area and Index Area.

Super-block

The Super-block is located in the first sector of a disk or partition. For floppy disks that means it is contained in the boot sector. The superblock contains structural information about the partition. The SFS data of the super-block is located at offset 0x0194 and is 58 bytes long, leaving space for boot code and a partition table.

Offset Size Contents
0x0194 8 Last alteration time of super-block values (Data size or Index Size)
0x019C 8 Size of Data Area in blocks
0x01A4 8 Size of Index Area in bytes
0x01AC 3 Magic number (0x534653 'SFS')
0x01AF 1 Version number in BCD (0x10 = 1.0)
0x01B0 8 Total number of blocks in volume
0x01B8 4 Size of Reserved Area and Super-block in blocks
0x01BC 1 Block size given by BytesPerBlock = 2(BlockSize + 7)
0x01BD 1 Checksum of bytes between 0x1AC and 0x1BC such that the lower 8 bits are zero

Reserved Area

The reserved area is a segment of disk that is untouched by drivers conforming to the current specification. This allows ancillary information or data such as a kernel image or a small EXT2/FAT partition to be stored on the same volume.

Data Area

The Data Area contains file data and starts at the end of the Reserved Area. The files in the data area can only occupy sequential areas as there is no way of linking chains of blocks for a single file.

Free Area

The Free Area is the currently unused space in the volume that can be used by either the Data Area growing downwards or the Index Area growing upwards.

Index Area

Note: Because the Index Area is situated at the end of the disk the offsets are referred to in an opposite fashion to what is typical. So, the first entry is actually the closest to the end of the disk

The Index Area contains the tracking information for the Data Area and is made of a variable number of 64 byte entries extending from the end of the volume towards the beginning. The entries in the Index Area follow a few simple rules. The "first" (at the end of the disk) entry must be a Volume Identifier entry, this is used to detect if a disk has been swapped when auto-detection is unavailable. The "last" (closest to the start of the disk) must be a Starting Marker entry, this is used for file-system recovery if the super-block is damaged. Continuation entries are used to allow longer file names than can be placed in a single directory or file entry and immediately precede their respective file/directory entry.

Embedding

The GUID currently in use for GPT partitions is 4ebf0e06-11bf-450c-1a06-534653534653

Information Formatting

Timestamps

All SFS timestamps are 64-bit signed values that count the number of 1/65536ths of a second before or after the UNIX Epoch (1st of January 1970) and are in UTC.

Names

Name Strings in SFS are in UTF-8 and must be null terminated. Characters can include any character in the ranges 0x20-0x7E and 0xA1-0xFF excluding a double quote ("), asterisk (*), colon (:), less than or greater then sign (< or >), question mark (?) or backward slash (\). The forwards slash (/) is admissible only as a path separator. Note that UTF-8 means that the characters above 0x80 take up multiple bytes rather than one, which could confuse ASCII based systems.

See Also

Threads

External Links

Personal tools
Namespaces
Variants
Actions
Navigation
About
Toolbox
In other languages