commit 989969061ad0ed64f5c58dd09f686b33a8fc9df3
parent e499ddaa1eb33172168d3d75a4e26e06e9db122d
Author: Matsuda Kenji <info@mtkn.jp>
Date: Wed, 6 Sep 2023 15:14:42 +0900
update test data and fix bugs
Diffstat:
6 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/fcall.go b/fcall.go
@@ -787,7 +787,7 @@ func (msg *TCreate) marshal() []byte {
func (msg *TCreate) String() string {
return fmt.Sprintf("Tcreate tag %d fid %d name %s perm %v mode %v",
- msg.Tag(), msg.Fid(), msg.Perm().PermString(), msg.Mode())
+ msg.Tag(), msg.Fid(), msg.Name(), msg.Perm().PermString(), msg.Mode())
}
type RCreate struct {
@@ -874,7 +874,7 @@ func (msg *TRead) marshal() []byte {
buf := make([]byte, msg.Size())
pbit32(buf[cur:cur+4], msg.Size())
cur += 4
- buf[cur] = uint8(Tread)
+ buf[cur] = uint8(msg.Type())
cur += 1
pbit16(buf[cur:cur+2], msg.Tag())
cur += 2
@@ -993,7 +993,7 @@ func newTWrite(buf []byte) *TWrite {
func (msg *TWrite) Size() uint32 {
return uint32(4 + 1 + 2 + 4 + 8 + 4 + len(msg.Data()))
}
-func (msg *TWrite) Type() MsgType { return Tread }
+func (msg *TWrite) Type() MsgType { return Twrite }
func (msg *TWrite) Tag() uint16 { return msg.tag }
func (msg *TWrite) Fid() uint32 { return msg.fid }
func (msg *TWrite) Offset() uint64 { return msg.offset }
@@ -1004,7 +1004,7 @@ func (msg *TWrite) marshal() []byte {
buf := make([]byte, msg.Size())
pbit32(buf[cur:cur+4], msg.Size())
cur += 4
- buf[cur] = uint8(Tread)
+ buf[cur] = uint8(msg.Type())
cur += 1
pbit16(buf[cur:cur+2], msg.Tag())
cur += 2
@@ -1040,7 +1040,7 @@ func newRWrite(buf []byte) *RWrite {
return msg
}
func (msg *RWrite) Size() uint32 {
- return uint32(4 + 1 + 2 + 4 + msg.Count())
+ return uint32(4 + 1 + 2 + 4)
}
func (msg *RWrite) Type() MsgType { return Rwrite }
func (msg *RWrite) Tag() uint16 { return msg.tag }
diff --git a/test_Rmsg.dat b/test_Rmsg.dat
Binary files differ.
diff --git a/test_Tmsg.dat b/test_Tmsg.dat
Binary files differ.
diff --git a/testdir/a b/testdir/a
diff --git a/testdir/c b/testdir/c
@@ -0,0 +1 @@
+c
diff --git a/testdir/f b/testdir/f
@@ -0,0 +1 @@
+f