This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Do we really need correct st_nlink count for directories?


According to Igor Peshansky on 4/25/2008 2:25 PM:
When link counts are accurate, every directory has a link count of at
least 2 (. and ..)

I thought leaf directories had a legitimate link count of 1.

Two, actually: ".", but also the entry in ".." that points to the directory's inode. There might be some alternative file systems where readdir() omits . and .. in its list, leaving a link count of 0. But I've never seen a disk-based link count of 1. And even Linux uses 1, not 0, as the link count of FAT directories. A directory with a link count of 2 is guaranteed to be a leaf directory (no subdirs); but with a link count of 1 is indeterminate.


--
Don't work too hard, make some time for fun as well!

Eric Blake ebb9@byu.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]