.. _file_sys_calls: File System Services ====================== Types of File Access --------------------- Sequential Access ^^^^^^^^^^^^^^^^^^ .. figure:: sequential_access.png :align: center Most files are accessed in linear manner from the beginning. It is possible to repositon (seek system call) the current file position pointer. Direct Access ^^^^^^^^^^^^^^^^^^ .. figure:: direct_access.png :align: center File systems that are optimized for use with data bases are accessed in terms of records rather than a byte sequence. Permissions ------------- .. figure:: permissions.png :align: center An import attribute of files is their set of permissions. File Descriptors ----------------- .. figure:: open_file.png :align: center The set of open files for each process is tracked in the process control block (PCB). System Calls ------------- * Create a file * Delete a file * Open a file * Close a file * Read data from a file * Write data to a file * Reposition the current file pointer in a file * Append data to the end of a file * Truncate a file (delete its contents) * Rename a file * Copy a file Directory Trees ----------------- .. figure:: dir_tree.png :align: center The notion of directories allows files and directories to be organized in a tree like manner. Path Names ------------ An **absolute path name** begins at the root and specifies each step down the tree until it reaches the desired file or directory. A **relative path** name begins from the current working directory. File Object Links -------------------- Links between files and directories make it easier to access files. Links that span file systems can also provide a convenient means of extending the effective size of a file system. .. figure:: sym_link.png :align: center Link mechanisms include: hard and symbolic links in Unix, and Shortcuts and Junction points in Windows. .. seealso:: Introduction to Unix, `Notes on Hard and Soft (Symbolic) Links `_