struct dirent question

Micah micahjon at ywave.com
Sat Aug 19 23:10:10 UTC 2006


M. Warner Losh wrote:
> In message: <44E3A221.1070905 at ywave.com>
>             Micah <micahjon at ywave.com> writes:
> : #define MAXNAMLEN 255
> :          char    d_name[MAXNAMLEN + 1];  /* name must be no longer than 
> : this */
> : #if !__BSD_VISIBLE
> : #undef MAXNAMLEN
> : #endif
> : };
> : I'm not sure if it's more readable, but it puts 255 in only one location.
> 
> And if I defined MAXNAMLEN before I included this file?  You can't do
> it that way :-(
> 
> Warner

I stand corrected. I assumed that since any defined MAXNAMLEN's get 
clobbered if __BSD_VISIBLE is set there was no desire to have a 
MAXNAMLEN defined when __BSD_VISIBLE was cleared. Seems like the current 
way might lead to unexpected behavior if you're trying to define a 
custom MAXNAMLEN. But I haven't really hacked much kernel code yet, I 
just hang out here to learn.

- Micah


More information about the freebsd-hackers mailing list