Information Technology Reference
In-Depth Information
Alice's Disk
Bob's Disk
/
/
Volumes
media
USB Volume
USB Volume
Mount
Point
Mount
Point
usb1
disk-1
/
/
bin
Programs
Movies
Movies
home
users
vacation.mov
vacation.mov
Alice
Bob
Backup
Backup
Figure11.5: A volume can be mounted to another file system to join their directory hierarchies. For
example, when the USB drive is connected to Alice's computer, she can access the vacation.mov
movie using the path /Volumes/usb1/Movies/vacation.mov , and when the drive is connected to
Bob's computer, he can access the movie using the path /media/disk-1/Movies/vacation.mov .
11.2
API
For concreteness, Figure 11.6 shows a simple file system API for accessing files
and directories.
Creating and deleting files. Processes create and destroy files with create()
and unlink() . Create() does two things: it creates a new file that has initial
metadata but no other data, and it creates a name for that file in a directory.
Link() creates a hard link|a new path name for an existing le. After a
successful call to link() , there are multiple path names that refer to the same
underlying file.
Unlink() removes a name for a file from its directory. If a file has multiple
names or links, unlink() only removes the specified name, leaving the file ac-
cessible via other names. If the specified name is the last (or only) link to a file,
then unlink() also deletes the underlying file and frees its resources.
Mkdir() and rmdir() create and delete directories.
Example: Linking to files v. linking to directories.
Question: Systems such as Linux support a link() system call, but they
do not allow new hard links to be created to a directory.
E.g.,
 
Search WWH ::




Custom Search