Computer System Lecture 8, hour 3 Nov.3 Permission / Protection ----------------------- File Protection: who X what e.g. "Mike can delete" What: Read, Write, Execute, Delete, Append, List, CD(change directory) Unix-like File Directory ------- ----------- Read Yes List Write Write, Delete, Append Append Files eXecute program CD Above are all Unix supported. The most common: ACL (Access Control List) Who in Unix: user: owner of file or directory group: Unix notion of sets of users defined by the system other/universe: all users Q: How are they represented? - rwx r-- r-- --- --- --- --- file user group other e.g. 660: owner/group can read and write the file, no others. ***************************************************************************** Q: How to implement between high level interface and low interface? A: Divide the file systems. Top layer User Programs File system implementation --------------- ----------------------------- metadata ----> logical file system (VFS) ----> metadata data ----> file-organization module ----> talking about files maps logical addresses to disc blocks basic file system ----> queuing ----> only talking about blocks I/O cotroller ----> write_block / read_block Devices (disc) Low layer Q: Why? A: I/O controller depends on devices. For diversity of file system and flexibility. High-level presentation of file system would be the same, which in Linux is called VFS that doesn't depend on underlying file system. ********************************************************************************* Basic Data Structure -------------------- Per-partition (volume) - Boot control block Information neccessory to boot an OS from this partition - Volume control block Information about layout of the volume - location of root directory - file system type - list of free (empty) blocks Per-file - File control block (FCB) file metadata permission location of data access In kernel memory mount tables open file tables buffer and cache ************************************************************************************ Example Operations ------------------ Open (_filename) - check if it's opened by other process - look in system-wide open file tests - if not there - find FCB in the file system - create entry in system-wide table - create entry in per-process open file table Close (_filename) - delete per-process entry - delete the system-wide info