lib9p

Go 9P library.
Log | Files | Refs

commit 75a9e601d9185b156ddd36bb83d3eaf307679731
parent a18138e77f5a6b6346df1e2002ae444778ac8e04
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sat,  2 Sep 2023 07:54:25 +0900

change comment

Diffstat:
Mfcall.go | 6+++---
Mqid.go | 21+++------------------
2 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/fcall.go b/fcall.go @@ -42,11 +42,11 @@ const ( // Msg represents any kind of message of 9P. // It defines methods for common fields. type Msg interface { - // Size returns the size field of msg. + // Size returns the size field of message. Size() uint32 - // Type returns the type field of msg. + // Type returns the type field of message. Type() MsgType - // Tag returns the tag of msg. + // Tag returns the tag of message. Tag() uint16 // Marshal convert Msg to byte array to be transmitted. diff --git a/qid.go b/qid.go @@ -4,7 +4,7 @@ import ( "fmt" ) -// QidType represents the type of Qid. the 'QT' prefix may be redundant. +// QidType represents the type of Qid. type QidType uint8 const ( @@ -20,26 +20,10 @@ const ( type Qid struct { Type QidType - Vers uint32 + Vers uint32 // version of the file. Path uint64 } -func newQid(b []byte) *Qid { - return &Qid{ - Type: QidType(b[0]), - Vers: gbit32(b[1:5]), - Path: gbit64(b[5:13]), - } -} -/* -func (q Qid) Type() QidType { return q.Type } -func (q Qid) SetType(t QidType) { q.t = t } -func (q Qid) Vers() uint32 { return q.vers } -func (q Qid) SetVers(v uint32) { q.vers = v } -func (q Qid) Path() uint64 { return q.path } -func (q Qid) SetPath(p uint64) { q.path = p } -*/ - func (q Qid) marshal() []byte { buf := make([]byte, 13) buf[0] = uint8(q.Type) @@ -47,6 +31,7 @@ func (q Qid) marshal() []byte { pbit64(buf[5:13], q.Path) return buf } + func (q Qid) String() string { return fmt.Sprintf("(%016d %d %s)", q.Path, q.Vers, q.typeStr()) }