public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* quick question about filename length
@ 2009-05-16 16:15 Chris Walker
  2009-05-16 17:04 ` Eric Sandeen
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Walker @ 2009-05-16 16:15 UTC (permalink / raw)
  To: xfs

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: quick question about filename length
  2009-05-16 16:15 quick question about filename length Chris Walker
@ 2009-05-16 17:04 ` Eric Sandeen
  2009-05-16 18:06   ` Chris Walker
  0 siblings, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2009-05-16 17:04 UTC (permalink / raw)
  To: Chris Walker; +Cc: xfs

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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: quick question about filename length
  2009-05-16 17:04 ` Eric Sandeen
@ 2009-05-16 18:06   ` Chris Walker
  2009-05-16 20:25     ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Walker @ 2009-05-16 18:06 UTC (permalink / raw)
  To: Eric Sandeen; +Cc: xfs

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
>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: quick question about filename length
  2009-05-16 18:06   ` Chris Walker
@ 2009-05-16 20:25     ` Christoph Hellwig
  2009-05-16 21:42       ` Martin Steigerwald
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2009-05-16 20:25 UTC (permalink / raw)
  To: Chris Walker; +Cc: Eric Sandeen, xfs

On Sat, May 16, 2009 at 02:06:22PM -0400, Chris Walker wrote:
> 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

XFS doesn't actually see the whole filename in normal operation (except
for copying out the data out of symbolic links), as the resolution to
individual components is done by the VFS.   Long file name should work
just fine on Linux and do in my test.  Maybe some buffer is sized using
incorrect in userspace?

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: quick question about filename length
  2009-05-16 20:25     ` Christoph Hellwig
@ 2009-05-16 21:42       ` Martin Steigerwald
  0 siblings, 0 replies; 5+ messages in thread
From: Martin Steigerwald @ 2009-05-16 21:42 UTC (permalink / raw)
  To: xfs; +Cc: Christoph Hellwig, Eric Sandeen, Chris Walker

Am Samstag 16 Mai 2009 schrieb Christoph Hellwig:
> On Sat, May 16, 2009 at 02:06:22PM -0400, Chris Walker wrote:
> > 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
>
> XFS doesn't actually see the whole filename in normal operation (except
> for copying out the data out of symbolic links), as the resolution to
> individual components is done by the VFS.   Long file name should work
> just fine on Linux and do in my test.  Maybe some buffer is sized using
> incorrect in userspace?

And while a link name itself also can't be longer than about 256 
characters (I only tested 250 and 260), a link can point to a longer 
path ;-):

martin@shambhala:~/Zeit> mkdir -p 
$(ruby -e 'puts "1234567890"*25')/$(ruby -e 'puts "1234567890"*25')
martin@shambhala:~/Zeit> ln -s 
$(ruby -e 'puts "1234567890"*25')/$(ruby -e 'puts "1234567890"*25') 
testlink
martin@shambhala:~/Zeit> ls -l testlink
lrwxrwxrwx 1 martin martin 501 16. Mai 23:40 testlink -> 
12345678901234567890123456789012345678901234567890123456789[...]
martin@shambhala:~/Zeit> (df -hT . | grep -q xfs) && echo "Is XFS"
Is XFS

-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-05-16 21:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-16 16:15 quick question about filename length Chris Walker
2009-05-16 17:04 ` Eric Sandeen
2009-05-16 18:06   ` Chris Walker
2009-05-16 20:25     ` Christoph Hellwig
2009-05-16 21:42       ` Martin Steigerwald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox