Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
2.5 Case Study: unix File System Layering and Naming 101 which the directory it is. When a directory is created, the directory's inode has a refer- ence count of two: one for the inode of the directory and one for the link ".", because it points to itself. Because "." introduces a cycle of length 0, there is no risk that part of the naming network will become disconnected when removing a directory. When unlinking a directory, the file system just decreases the reference count of the direc- tory's inode by 2. Second, by default, each directory also contains a link to a parent directory; the file system reserves the string ".." (two consecutive dots) for this purpose. The name ".." allows a process to name a parent directory and, for example, move up the file hierarchy by invoking chdir ("..") . The link doesn't create problems. Only when a direc- tory has no other entries than "." and ".." can it be removed. If a user wants to remove a directory "a", which contains a directory "b", then the file system refuses to do so until the user first has removed "b". This rule ensures that the naming network cannot become disconnected. 2.5.8 renaming Using link and unlink , Version 6 implemented rename ( from_name , to_name ) as follows: