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:
“Because this age and the next age
Engender in the ditch,
No man can know a happy man
From any passing wretch,
If Folly link with Elegance
No man knows which is which....”
—William Butler Yeats (18651939)
“The technological landscape of the present day has enfranchised its own electoratesthe inhabitants of marketing zones in the consumer goods society, television audiences and news magazine readerships... vote with money at the cash counter rather than with the ballot paper at the polling booth.”
—J.G. (James Graham)