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

From: Elliott.Hughes@gen... Elliott.Hughes@gen...
Subject: [9fans] allowing space (ASCII 0x20) in file names
Date: Tue, 14 Apr 1998 15:35:58 +0200 (CEST)

> > One thing I don't get is why "Fields that contain names are 28-byte
> > strings (including a terminal NUL (zero) byte)". Why send the zero,
> > if it's always zero and it's always there? Why not use these 28 bytes
> > as a sort of persistant fid?
> 
> If you don't send the zero, how do you indicate filenames less
> than 27 bytes?  How would "x.c" get transmitted?

As { 'x', '.', 'c', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }.
Not sure I counted that right, but you get the idea, I'm sure!

> I suppose you
> could increase the name length by one by adding the hack that
> there's an implicit zero on byte 29 that isn't transmitted,
> but it's an ugly hack for a questionable cause (one byte?) and
> it would make things like strlen, etc. annoying.

I assume that ease of dealing with the message (you know the name you're
pulling out of it is already a C string) is the reason for the waste. I was just
wondering out loud because most of us don't know what discussion went
on at the labs before such decisions were made. (And if outsiders question
the wisdom of these decisions and wonder about rejected alternatives, they
like as not get insulted for daring to question AT&T wisdom. That's
how it looks to me, anyway.)

But increasing the name length by one byte wasn't really my intention (though
maybe then that real-audio configuration file that's in my NFS home directory
would be available to Plan 9). I was thinking more of using all 28 bytes -- seeing
as we send them anyway -- with no NUL termination. You wouldn't use
them as UTF-8 strings, rather as 28 * 8 bit persistant fids that the server
keeps track of. [Something like the inode + device number from the old days.]

You could use a different mechanism to work out what persistant fid it
was you were looking for: you could have filenames if you chose, or you
could have a database interface (perhaps to pictures, for which filenames
aren't really sufficient).

Anyway, the point is that you'd then have a larger and much more
convenient space to play about with alternative mappings in.

There's been some mention of Styx in this discussion. Is there anywhere I can
get an up-to-date specification of Styx (and the other parts of Inferno) without
paying? I'm interested particularly in what changes, if any, there have been
since 9p (assuming, as I do, that Styx is more-or-less 9p).

-- 
http://users.ch.genedata.com/~enh/