commit da3122002853a361cce4960b1b267ccc2df8509a
parent b9db79996dc0fe3b866b09ba4199f2a0bebb9f1e
Author: Matsuda Kenji <info@mtkn.jp>
Date: Sun, 20 Aug 2023 10:26:03 +0900
remove info from File struct
Diffstat:
3 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/fcall.go b/fcall.go
@@ -1,7 +1,6 @@
package lib9p
import (
- "encoding/binary"
"fmt"
)
diff --git a/file.go b/file.go
@@ -160,6 +160,10 @@ type File struct {
// File data
Qid Qid // unique id from server
+
+ // The following data should be derived from fs.Stat()
+ // every time.
+/*
Mode FileMode // permissions
Atime uint32 // last read time
Mtime uint32 // last write time
@@ -168,6 +172,7 @@ type File struct {
Uid string // owner name
Gid string // group name
Muid string // last modifier name
+*/
}
func openFile(fsys *FS, fpath string) (*File, error) {
@@ -183,7 +188,7 @@ func openFile(fsys *FS, fpath string) (*File, error) {
fs: fsys,
file: file,
path: fpath,
-
+/*
Name: path.Base(fpath),
Mode: fsModeTo9Mode(fsfi.Mode()),
Atime: uint32(fsfi.ModTime().Unix()),
@@ -192,6 +197,7 @@ func openFile(fsys *FS, fpath string) (*File, error) {
Uid: "kenji", // TODO: use syscall.Stat_t's Uid
Gid: "kenji",
Muid: "",
+*/
}
qtype := fsModeToQidType(fsfi.Mode())
@@ -216,16 +222,15 @@ func (f *File) Stat() (*FileInfo, error) {
info: fsfi,
stat: &stat{
qid: &f.Qid,
- name: f.Name,
+ name: fsfi.Name(),
mode: fsModeTo9Mode(fsfi.Mode()),
aTime: uint32(fsfi.ModTime().Unix()),
mTime: uint32(fsfi.ModTime().Unix()),
- length: f.Length,
- uid: f.Uid,
- gid: f.Gid,
- muid: f.Muid,
+ length: fsfi.Size(),
+ uid: "", // TODO: uid, gid, muid
+ gid: "",
+ muid: "",
},
- // TODO: ..., uid, gid, muid
}
return fi, nil
}
diff --git a/parse.go b/parse.go
@@ -1,6 +1,7 @@
package lib9p
import (
+ "encoding/binary"
"fmt"
"io"
)