9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: G. David Butler gdb@dbSystems.com
Subject: [9fans] allowing long file names with a space too
Date: Fri, 10 Apr 1998 18:16:58 -0500	[thread overview]
Message-ID: <19980410231658.xlmIeo6n56cVHt7nv1RYmd_pETurKsTDjgYA2SLIpPw@z> (raw)

From: "G. David Butler" <gdb@dbSystems.com>

>NAMELEN = 28
>FNAMELEN = 64? 128? 256!?  Hell, might as well fix it now. 256.
>
>In that case the overhead for 9p now gets quite high given all
>the Twalks.  So how about a uchar length followed by data?  Makes
>sense.

Lets say that FNAMELEN = 256 then:

DIRLEN = 344

Tclwalk tag[2] fid[2] newfid[2] name[<=256]
Twalk tag[2] fid[2] name[<=256]
Tcreate tag[2] fid[2] name[<=256] perm[4] mode[1] [move name to the end?]
Rstat tag[2] fid[2] stat[<=344]
Twstat tag[2] fid[2] stat[<=344]

[why is there a pad[1] in Twrite and Rread?]

The idea is to only send the variable data in 9P, so the
"machine independent encoding" stays fixed length.  The mount
driver will do the "right thing".  In other words, since
names must terminate with a null '\0', in 9P there will only
be one.  It is the mnt driver's responsibility to transmit
the Twstat and receive Rstat and directory Tread/Twrite that way.

On directory read, the mount driver will have to muck with
the offsets since they must be 0 mod DIRLEN.  On Tread the offset
and count will be 0 mod DIRLEN but the server will respond with
the real count of the packet.  The mnt driver will expand the names
and set the offset for the channel so the next Tread will work.
This is permissable already (see devdirread() in /sys/src/9/port/dev.c
and the comment in /sys/src/9/port/sysfile.c).  I use it now to allow
efficient reads of the large directories on my file server by
eliminating the silly "count the filled slots" algorithm.  (You see,
only the mnt driver knows the proper offsets for the channel.)

We could add count[2] to the above messages, but I don't think
that is necessary.

It's too bad that Tcreate didn't have the name at the end, then the
resulting kernel would be backward compatable with existing servers. :-(

Comments?  (the ones that look like "your crazy" to /dev/null)

David Butler
gdb@dbSystems.com




             reply	other threads:[~1998-04-10 23:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-10 23:16 G.David [this message]
1998-04-14  9:52 Elliott.Hughes
1998-04-14  9:56 Elliott.Hughes
1998-04-14 15:05 G.David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=19980410231658.xlmIeo6n56cVHt7nv1RYmd_pETurKsTDjgYA2SLIpPw@z \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).