summaryrefslogtreecommitdiffstats
path: root/back/cmd/authfs/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'back/cmd/authfs/root.go')
-rw-r--r--back/cmd/authfs/root.go36
1 files changed, 23 insertions, 13 deletions
diff --git a/back/cmd/authfs/root.go b/back/cmd/authfs/root.go
index 70ca643..5d56045 100644
--- a/back/cmd/authfs/root.go
+++ b/back/cmd/authfs/root.go
@@ -1,21 +1,31 @@
package main
-const rootQid = p9p.Qid{
- Type: QTDIR,
- Version: 0x0,
- Path: 0x1,
+import (
+ p9 "github.com/Harvey-OS/ninep/protocol"
+
+ "git.samanthony.xyz/buth/back/qver"
+)
+
+type RootDir struct {
+ *qver.Version
}
-// Root is the root Dir which contains /users and /sessions.
-type Root struct {
- path string
+func NewRootDir() *RootDir {
+ return &RootDir{qver.New()}
}
-func (r Root) Qid() p9p.Qid { return rootQid }
+func (r *RootDir) Close() {
+ r.Version.Close()
+}
-func (r Root) Stat() (p9p.Dir, error) {
- return p9p.Dir{
- Qid: rootQid,
- Mode: DMDIR | DMREAD,
-
+func (r *RootDir) Qid() (p9.QID, error) {
+ ver, err := r.Version.Get()
+ if err != nil {
+ return p9.QID{}, err
+ }
+ return p9.QID{
+ Type: p9.QTDIR,
+ Version: ver,
+ Path: rootQidPath,
+ }, nil
}