Date: Wed, 16 Aug 2006 20:50:23 +0200 From: Joerg Sonnenberger <joerg@britannica.bec.de> To: freebsd-hackers@freebsd.org Subject: Re: struct dirent question Message-ID: <20060816185023.GA23879@britannica.bec.de> In-Reply-To: <p06230909c10914f68909@[128.113.24.47]> References: <44E29055.3080205@centtech.com> <20060816054925.GA11651@droopy.unibe.ch> <44E3484D.8090905@centtech.com> <p06230909c10914f68909@[128.113.24.47]>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Aug 16, 2006 at 02:45:05PM -0400, Garance A Drosihn wrote: > At 11:31 AM -0500 8/16/06, Eric Anderson wrote: > > > >My point was, that either path you take (if BSD_VISIBLE is > >defined or not), you end up with d_name having a size of > >255 + 1, so what's the point the having it at all? > > To make it clear that d_name is tied to the exact value > of MAXNAMLEN (just in case that value ever changes), and > it does not just happen to be 255+1 bytes for some reason > that is completely unrelated to MAXNAMLEN. It should be noted that the standard doesn't say anything about MAXNAMLEN (which is historically a FS specific limit). It also allows two different defitions of d_name: (1) As char[] of arbitrary length. (2) As char[1]. So portable code should always allocate storage for size(struct dirent) + NAME_MAX of the current FS. In that sense the current definition is misleading. Joerg
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060816185023.GA23879>