9fans archive / 1998 / 04 / 57 /    prev next

From: G. David Butler gdb@dbS...
Subject: [9fans] allowing long file names with a space too
Date: Tue, 14 Apr 1998 10:05:08 -0500

From: Elliott.Hughes@gen...

>So why bother with an upper limit on length at all? Why trade one
>hard-coded assumption for another? Because you're implementing
>some specific protocol?

Good point.  Because of stat/wstat the limit is MAXFDATA(8192)-88=8104
unless you include the 88 octets as part of the header.

The biggest problem with ~8k file names is practical limits of
implementations.  For example, after staring a while at calculations
of the wasted disk space that results from allocating name[256] when
most names will fit in 64 (21 unicode characters), I thought a limit
of 64 would be OK :-<.  256-64 = 192 * 6 million files = 1.1 Gigabyte,
and if only 10 are used most of the time then it is 1.5 GB wasted.

Wow.

In defense, I came up with a design for variable length file names
in the file server that limit the largest name to BUFSIZE, or 4088
octets with RBUFSIZE set to 4096.  My system doesn't expect many files
over 1k so my RBUFSIZE is 1024 (yes, I added triple indirects) and
the file name limit is 1016.

Now that 9P can support file names up to 8104 octets (including the
NULL), and the fileserver will support names that depend on tuning,
what is the best way for a server to interact with 9P?

I think a Tcreate/Twstat that has a name too long for the server
should return Enamelen "create/wstat -- file name too long".

David Butler
gdb@dbS...