Link Counter
Most file systems that support hard links use reference counting. An integer value is stored with each physical data section. This integer represents the total number of links that have been created to point to the data. When a new link is created, this value is increased by one. When a link is removed, the value is decreased by one. If the link count becomes zero, the operating system usually automatically deallocates the data space of the file if no process has the file opened for access. The maintenance of this value assists users in preventing data loss. This is a simple method for the file system to track the use of a given area of storage, as zero values indicate free space and nonzero values indicate used space.
On POSIX-compliant operating systems, such as many Unix-variants, the reference count for a file or directory is returned by the stat or fstat system calls in the st_nlink
field of struct stat
.
Read more about this topic: Hard Link
Famous quotes containing the words link and/or counter:
“I know that there are many persons to whom it seems derogatory to link a body of philosophic ideas to the social life and culture of their epoch. They seem to accept a dogma of immaculate conception of philosophical systems.”
—John Dewey (18591952)
“The individual protests against the world, but he doesnt get beyond protest, he is just a single protester. When he wants to be more than that, he has to counter power with power, he has to oppose the system with another system.”
—Friedrich Dürrenmatt (19211990)