Re: quick question about filename length

Chris Walker
2009-05-16T18:06:15Z

Thanks for you quick reply, Eric.

I have a user who is having filenames (path+filename) cut off at 255
characters midway through a simulation -- but the problem must be
elsewhere

Thanks again,
Chris

On Sat, May 16, 2009 at 1:04 PM, Eric Sandeen <sandeen@sandeen.net> wrote:
> Chris Walker wrote:
>> Hello,
>>
>> I see that
>> #define MAXNAMELEN  256
>>
>> Is this the maximum length of the filename with full path?  Or is this
>> just the name of the file?
>>
>> Many thanks!
>> Chris
>
> /*
>  * MAXNAMELEN is the length (including the terminating null) of
>  * the longest permissible file (component) name.
>  */
> #define MAXNAMELEN      256
>
> "component" means path component.  So just the name of the file or dir
> in the path.
>
> See also how it's used in xfs_vn_lookup() for example:
>
>        if (dentry->d_name.len >= MAXNAMELEN)
>                return ERR_PTR(-ENAMETOOLONG);
>
> a dentry is one component of the path, not the entire path.
>
> -Eric