This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: Do we really need correct st_nlink count for directories?
On Fri, 25 Apr 2008, Eric Blake wrote:
> According to Igor Peshansky on 4/25/2008 12:38 PM:
> >
> > Would it make sense to use 0 as the link count on directories? Unless I'm
> > missing something, every directory has to have at least the '.' link,
> > which makes 0 an obviously invalid value (that can be used to trigger the
> > fallback code).
>
> When link counts are accurate, every directory has a link count of at
> least 2 (. and ..) (in fact, the optimization is to abort the readdir()
> after discovering st_nlink-2 subdirs). Therefore, a link count of 1 is
> sufficient to trigger the fallback code.
I thought leaf directories had a legitimate link count of 1.
Igor
--
http://cs.nyu.edu/~pechtcha/
|\ _,,,---,,_ pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`' -. ;-;;,_ Igor Peshansky, Ph.D. (name changed!)
|,4- ) )-,_. ,\ ( `'-' old name: Igor Pechtchanski
'---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow!
"That which is hateful to you, do not do to your neighbor. That is the whole
Torah; the rest is commentary. Go and study it." -- Rabbi Hillel