File Systems Intro
Notes
- A file is a collection of data recorded on secondary storage.
- It is basic to the operation of a computer.
- A file normally consists of
- Blocks of data
- A block of information
- Size
- Various times
- Possibly a file type
- Owner and access information.
- File systems normally support
- Opening and Closing a file.
- Reading and writing to a file
- seeking a position within a file.
- file deletion and truncation
- The interface between program/os/file
- I am going with Kerrisk chapter 55.4
- Each process has an open file table.
- A pointer to the system wide file table.
- Some information (very little, cloexec flag)
- The kernel maintains a table of open files
- The current offset (any process with that open file will referer to the same place in the file)
- A set of status flages
- open status (r, w, rw)
- OS related (signal ( information)
- A pointer to the i-node table in the kernel.
- The kernel maintains a list of open i-nodes
- File types and permissions
- File locks
- The inode number and file system.
-
from Kerrisk
- As you know, linux maitains the file system as a tree
- File systems are mounted on this tree.
- That is a lie, this is actually a digraph.
- Hard links
- soft lnks
- Directories
- As we will see soon, linux does not keep the file name at the file leve.
- Directories are simply well formatted files.
- readdir returns a directory entry
- The Virtual File System
- An interface for file systems operations.
- A definition of functions
- An interface implementation
- Operations
- open
- read
- write
- lseek
- close
- truncate
- stat
- mount/umount
- mmap
- mkdir
- link
- unlink
- symlink
- rename.