Women in Technology

Hear us Roar



Article:
  MacFUSE: New Frontiers in File Systems
Subject:   st_nlink is the number of hard links.
Date:   2007-03-19 11:21:06
From:   ralph@inputplus.co.uk
Response to: st_nlink is the number of hard links.

First off, when I say "directories don't have hard links", I mean you can't create a hard link to a directory (through link(2)). You are interpreting "hard link" to be synonymous with the link count of a file or directory.


Indeed I am since where I come from, UNIX, they are the same thing, hard links being resposible for incrementing an inode's reference count. It's even in the struct member's name: st_nlink.


Thanks for pointing out that HFS+ doesn't conform to this model. I wonder if this affects find(1)'s attempt at leaf optimisation, see -noleaf.


Cheers, Ralph.

Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • st_nlink is the number of hard links.
    2007-03-21 14:57:17  osxbook [View]

    "Indeed I am since where I come from, UNIX, they are the same thing" ... doesn't conform to this model.

    I can understand that you might be surprised by the difference in behavior, but you're assuming too much if you think that the UNIX file system style behavior is a "model" that must be conformed to.

    It's more of an implementation detail: incarnations of the UNIX file system and many inode-based file systems do things that way. In fact, it is common enough behavior amongst *nix file systems that POSIX/SUSv3 are subtly ambiguous about st_nlink for directories. Yet, if you read one of these standards carefully enough, it is not required for st_nlink for directories to be what you were expecting it to be.