Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(132)

Issue 157121: code review 157121: 9P2000 client and server support.

Can't Edit
Can't Publish+Mail
Start Review
Created:
16 years, 6 months ago by lucho
Modified:
16 years, 6 months ago
Reviewers:
CC:
r, rsc
Visibility:
Public.

Description

9P2000 client and server support. The srv package can be used to write custom file servers. The clnt package can be used to connect to a 9P file server and perform I/O operations on its files.

Patch Set 1 #

Patch Set 2 : code review 157121: 9P2000 client and server support. #

Patch Set 3 : code review 157121: 9P2000 client and server support. #

Total comments: 34

Patch Set 4 : code review 157121: 9P2000 client and server support. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+5210 lines, -0 lines) Patch
M src/pkg/Makefile View 1 2 3 2 chunks +6 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/Makefile View 1 chunk +12 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/Makefile View 1 chunk +16 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/clnt.go View 1 2 3 1 chunk +315 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/close.go View 1 chunk +27 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/examples/Makefile View 1 chunk +19 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/examples/ls.go View 1 2 3 1 chunk +56 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/examples/read.go View 1 2 3 1 chunk +55 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/examples/write.go View 1 2 3 1 chunk +68 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/mount.go View 1 2 3 1 chunk +81 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/open.go View 1 2 3 1 chunk +92 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/pool.go View 1 2 3 1 chunk +96 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/read.go View 1 2 3 1 chunk +113 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/remove.go View 1 chunk +38 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/stat.go View 1 2 3 1 chunk +35 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/walk.go View 1 2 3 1 chunk +101 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/clnt/write.go View 1 chunk +64 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/fmt.go View 1 2 3 1 chunk +161 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/osusers.go View 1 chunk +84 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/p9.go View 1 2 3 1 chunk +497 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/packr.go View 1 2 3 1 chunk +219 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/packt.go View 1 2 3 1 chunk +254 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/Makefile View 1 chunk +11 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/conn.go View 1 2 3 1 chunk +173 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/examples/Makefile View 1 chunk +19 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/examples/clones.go View 1 2 3 1 chunk +138 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/examples/time.go View 1 2 3 1 chunk +92 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/examples/ufs.go View 1 2 3 1 chunk +557 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/fcall.go View 1 2 3 1 chunk +415 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/file.go View 1 2 3 1 chunk +539 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/respond.go View 1 2 3 1 chunk +143 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/srv/srv.go View 1 2 3 1 chunk +506 lines, -0 lines 0 comments Download
A src/pkg/plan9/p/unpack.go View 1 2 3 1 chunk +208 lines, -0 lines 0 comments Download

Messages

Total messages: 3
lucho
Hello r, rsc, I'd like you to review the following change.
16 years, 6 months ago (2009-11-21 06:34:16 UTC) #1
rsc
I think you're right to split things into three packages - core protocol, server, and ...
16 years, 6 months ago (2009-12-14 03:54:36 UTC) #2
lucho
16 years, 6 months ago (2009-12-15 15:05:48 UTC) #3
The client implements two, a bit overlapping APIs. One is for developers that
want to access the 9P files the same way they access OS files, and the other is
for developers that need lower-level access to the 9P (sending 9P messages).

http://codereview.appspot.com/157121/diff/68/69
File src/pkg/Makefile (right):

http://codereview.appspot.com/157121/diff/68/69#newcode81
src/pkg/Makefile:81: plan9/p\
It's your call, but it may be beneficial for all Go developers if there is an
easy way to represent resources as file trees.

http://codereview.appspot.com/157121/diff/68/87
File src/pkg/plan9/p/osusers.go (right):

http://codereview.appspot.com/157121/diff/68/87#newcode10
src/pkg/plan9/p/osusers.go:10: type osUser struct {
You are correct. But both the client and the server need a way to resolve users
and groups, the core protocol directory looks like a good place. I can create a
common/ directory for it if you think it fits better.

http://codereview.appspot.com/157121/diff/68/88
File src/pkg/plan9/p/p9.go (right):

http://codereview.appspot.com/157121/diff/68/88#newcode115
src/pkg/plan9/p/p9.go:115: // Stat describes a file
Already fixed in the separate repository.

http://codereview.appspot.com/157121/diff/68/88#newcode117
src/pkg/plan9/p/p9.go:117: Size	uint16;	// size-2 of the Stat on the wire
But the value is part of the on-the-wire representation. Currently it is used
only to figure out how much data was consumed by UnpackDir.

http://codereview.appspot.com/157121/diff/68/88#newcode312
src/pkg/plan9/p/p9.go:312: if buf == nil {
gstr returns nil if the slice is smaller than the string size.

http://codereview.appspot.com/157121/diff/68/88#newcode394
src/pkg/plan9/p/p9.go:394: func ppint64(val uint64, buf []byte, pval *uint64)
[]byte {
Removed.

http://codereview.appspot.com/157121/diff/68/89
File src/pkg/plan9/p/packr.go (right):

http://codereview.appspot.com/157121/diff/68/89#newcode8
src/pkg/plan9/p/packr.go:8: func PackRversion(fc *Fcall, msize uint32, version
string) *Error {
Separate functions make it clearer which fields of the Fcall struct are actually
used by the particular message. I got bitten few times by forgetting to set a
field that was required by a 9P message.

http://codereview.appspot.com/157121/diff/68/89#newcode154
src/pkg/plan9/p/packr.go:154: for i := 0; i < len(data); i++ {
We need to copy the data from the user's buffer to the one that contains the
on-the-wire message. bytes.Copy disappeared at some point and I didn't find
copy() before I submitted the patch.

On 2009/12/14 03:54:36, rsc wrote:
> This is pretty inefficient.
> The C code would have shared the buffer:
> 
> fc.Data = data
> 
> why not do the same here?
> 
>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b