File System Abstraction
- File system can be viewed as an abstract data type.
- Present the reading, writing and other operations to
to the client.
- Implement using blocks of file storage.
- Changes to the system must survive the processes make them,
and across system reboot.
- Visible file structure.
- A file is a sequence of bytes.
- A sequence of fixed-size records.
- Key/value pairs.
- Current practice is to allow applications or library to build
whatever needed structure in the byte-array file.
- File names
- Various limits on length or characters.
- Case sensitive or not.
- Unix is case-sensitive.
- DOS is famous 8/3, case insensitive.
- Windows is case insensitive, but remembers the case used when the
name was created.
- Extensions and applications.
- Some (notably Windows) use part of the file name to indicate content.
- Associate an application with a file by its ending.
- Some systems record this separately from the file name.
- Some just leave it to the user.
- File types.
- Special types recognized by the kernel.
- Directories (most OSs).
- Device files which represent a device instead of storage.
- Communications channels (Unix).
- File formats
- A particular arrangement of the bytes in the file, eg. jpg image
format, mpg audio format, favorite word processor format, etc.
- Any OS must recognize
- It's own executable format.
- It may recognize others, or leave them to applications.
- Associating files with applications which understand them.
- Windows uses file extensions (part of the name). Windows.
- Some OS's record this with the file apart from the name.
- Sometimes applications use name extensions, but not the kernel.
- File access.
- Sequential. Start to finish in order.
- Random. Read in order directed by a program.
- File attributes
- Information associated with the file besides the data.
- Most essential: name.
- Write date and other dates.
- Creator, owner, permissions.
- Many others.
- Some OSs support arbitrary user-defined attributes.
- There are many file operations, varying a bit by OS.
Create, delete, open, close, read, write, append, seek, get attributes,
set attributes, rename.
- Directory layout.
- Early OSs had a single directory for the whole system.
- Some have had one directory per user, and other special arrangements.
- Modern systems have general trees.
- Files arranged in a tree, where files are leaves and internal nodes
- Root node at the top of the tree.
- File Paths.
- Full file names represent paths through the tree.
- Separator character varies.
- Windows uses one tree per device, rather than a single tree.
- File names starting with the separator are full path names.
- File names starting without the separator are relative.
- Each process has a current directory to which the kernel
treats them as relative.
- Other software may have directory name or names which it
uses to build a full path.
- Directory operations.
Create, delete, opendir, closedir, readdir, rename, link, unlink
- Read and write operations are specialized to reading directory
entries, rather than general reading ans writing.
- Link and unlink refer to adding and removing directory entries.