Commit Diff


commit - f9cc2426473a2b5619049eacdbee5fdf19c81344
commit + 7d20322689f2c839df114432c36ff372554d6a80
blob - 82597e172e28481545b1081509d53f1f7a7c13bb
blob + 6296fb7dffaf52cc6dd05d3d762673ce0dd2ca2e
--- dispatcher.go
+++ dispatcher.go
@@ -91,7 +91,7 @@ func (d *dispatcher) handle(ctx context.Context, req *
 			return nil, err
 		}
 
-		resp = newFcall(&MessageRcreate{
+		resp = newFcall(MessageRcreate{
 			Qid:    qid,
 			IOUnit: iounit,
 		})
@@ -108,7 +108,7 @@ func (d *dispatcher) handle(ctx context.Context, req *
 			return nil, err
 		}
 
-		resp = newFcall(&MessageRread{
+		resp = newFcall(MessageRread{
 			Data: p[:n],
 		})
 	case Twrite:
@@ -122,7 +122,7 @@ func (d *dispatcher) handle(ctx context.Context, req *
 			return nil, err
 		}
 
-		resp = newFcall(&MessageRwrite{
+		resp = newFcall(MessageRwrite{
 			Count: uint32(n),
 		})
 	case Tclunk:
@@ -148,7 +148,7 @@ func (d *dispatcher) handle(ctx context.Context, req *
 			return nil, err
 		}
 
-		resp = newFcall(&MessageRremove{})
+		resp = newFcall(MessageRremove{})
 	case Tstat:
 		reqmsg, ok := req.Message.(MessageTstat)
 		if !ok {
blob - 07a2464c0eb591b5e43f6f1877c7987e72d339a6
blob + 6fefda0ea6d5e2adaad6f8bd9d3713aec20b09d1
--- errors.go
+++ errors.go
@@ -1,7 +1,15 @@
 package p9pnew
 
-import "errors"
+import (
+	"errors"
+	"fmt"
+)
 
+// MessageRerror provides both a Go error type and message type.
+type MessageRerror struct {
+	Ename string
+}
+
 var (
 	// 9p wire errors returned by Session interface methods
 	ErrBadattach    = new9pError("unknown specifier in attach")
@@ -37,3 +45,11 @@ var (
 func new9pError(s string) error {
 	return MessageRerror{Ename: s}
 }
+
+func (MessageRerror) Type() FcallType {
+	return Rerror
+}
+
+func (e MessageRerror) Error() string {
+	return fmt.Sprintf("9p: %v", e.Ename)
+}
blob - 5df491e879d897817f19b55450fa6072ca331d95
blob + 144af5861daa0b6ce00ae015d1b6c9d47611dfdf
--- messages.go
+++ messages.go
@@ -92,14 +92,6 @@ type MessageRauth struct {
 	Qid Qid
 }
 
-type MessageRerror struct {
-	Ename string
-}
-
-func (e MessageRerror) Error() string {
-	return fmt.Sprintf("9p: %v", e.Ename)
-}
-
 type MessageTflush struct {
 	Oldtag Tag
 }
@@ -200,7 +192,6 @@ func (MessageTversion) Type() FcallType { return Tvers
 func (MessageRversion) Type() FcallType { return Rversion }
 func (MessageTauth) Type() FcallType    { return Tauth }
 func (MessageRauth) Type() FcallType    { return Rauth }
-func (MessageRerror) Type() FcallType   { return Rerror }
 func (MessageTflush) Type() FcallType   { return Tflush }
 func (MessageRflush) Type() FcallType   { return Rflush }
 func (MessageTattach) Type() FcallType  { return Tattach }
blob - ae206a0a4d8cb57bea8614eb2f1beb2b5933d616
blob + d909511b3e7ecd51d7f33988af702ac7245590ef
--- types.go
+++ types.go
@@ -11,11 +11,6 @@ const (
 )
 
 const (
-	NOFID = ^Fid(0)
-	NOTAG = ^Tag(0)
-)
-
-const (
 	DMDIR    = 0x80000000 // mode bit for directories
 	DMAPPEND = 0x40000000 // mode bit for append only files
 	DMEXCL   = 0x20000000 // mode bit for exclusive use files
@@ -90,8 +85,15 @@ func (qt QType) String() string {
 	return "unknown"
 }
 
+// Tag uniquely identifies an outstanding fcall in a 9p session.
+type Tag uint16
+
+const NOTAG Tag = ^Tag(0)
+
 type Fid uint32
 
+const NOFID Fid = ^Fid(0)
+
 type Qid struct {
 	Type    QType `9p:type,1`
 	Version uint32
@@ -127,6 +129,3 @@ func (d Dir) String() string {
 	return fmt.Sprintf("dir(%v mode=%v atime=%v mtime=%v length=%v name=%v uid=%v gid=%v muid=%v)",
 		d.Qid, d.Mode, d.AccessTime, d.ModTime, d.Length, d.Name, d.UID, d.GID, d.MUID)
 }
-
-//
-type Tag uint16