Skip to content

Latest commit

 

History

History
26 lines (16 loc) · 976 Bytes

file.md

File metadata and controls

26 lines (16 loc) · 976 Bytes

File

In C

Defined in stdio.h (see also stdio), a struct around a file descriptor, which is a signed integer.

In the Kernel

The file descriptor is an index into the array of open files of a process (process->files, limit: MAX_FILES_PER_PROCESS). Each open file is represented by a struct file struct.

A file can be:

  • A regular file in a file_system
    • In this case the file points to an inode
  • A directory
    • In this case the file also points to an inode
  • A device
    • Stores the dev_t (but could also use the dev_t from the inode...)
  • A pipe

Overview: kernel | file_system

File System: init_filesystem | vfs | xv6fs | devfs | block_io | inode | file | directory