This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NAME_MAX and RAMFS


Stephen Polkowski wrote:
> 
> Hi all,
> 
>         I've noticed a problem with the NAME_MAX and the RAMFS filesystem.  My
> problem is with the lenght of a filename.  When you read directory the
> name it is copied from the directory entry.  The amount copied is based
> on NAME_MAX which is set by _POSIX_NAME_MAX.  The default is only 15
> bytes (kind of small).  However, the size of a filename in RAMFS is the
> left over space from a ramfs_dirent.  The default ramfs_dirent is 32.
> The size of a RAMFS dirent is controlled by CYGNUM_RAMFS_DIRENT_SIZE,
> which is user settable.
> 
>         Ok, my problem is that the length of a filename is controlled in two
> separate places, namely NAME_MAX and CYGNUM_RAMFS_DIRENT_SIZE. It
> appears that the two different sizes aren't kept in check.  Which of the
> two should control the size of a filename?  Shouldn't the configuration
> tools keep the two values in check?  What do you think?

Imagine a FAT FS with only 8.3 names, versus a wonderfully complex fully
featured FS capable of any name length. What should NAME_MAX be then?
Surely not 11 for the whole system! So NAME_MAX is specified by the OS, but
that doesn't necessarily reflect the true requirements of nor provision by
any particular underlying FS. The two quantities are unrelated.

Although if we had a more thorough POSIX implementation you could use
pathconf/fpathconf to get the correct value for a particular FS, but we
don't :).

In the meantime I'll increase the default NAME_MAX to something a little
nicer like 64. I note that a standards committee is proposing upping the
*minimum* to 256 (and PATH_MAX to 1024) in future versions of POSIX, but
that's a bit much to jump now.

Jifl
-- 
Red Hat, Rustat House, Clifton Road, Cambridge, UK. Tel: +44 (1223) 271062
--[ "You can complain because roses have thorns, or you ]--
--[  can rejoice because thorns have roses." -Lincoln   ]-- Opinions==mine

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]