lib9p

Go 9P library.
Log | Files | Refs

commit 0992cc760c2083abc929711d1a53891f96d0c41f
parent 4b0bbc9a09ed5a609ce81a26717afb22b28f67d2
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue, 19 Sep 2023 07:29:03 +0900

rename func

Diffstat:
Mfid.go | 5+++--
Mfile.go | 1-
Mserver.go | 6+++---
3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fid.go b/fid.go @@ -7,7 +7,8 @@ import ( type OpenMode int8 // defined by 9P -const ( // TODO: is the mode should be implemented using interfaces? +// -1 = not open +const ( OREAD OpenMode = 0 OWRITE = 1 ORDWR = 2 @@ -63,7 +64,7 @@ func (pool *FidPool) lookup(fid uint32) (*Fid, bool) { return f, ok } -func (pool *FidPool) alloc(fid uint32) (*Fid, error) { +func (pool *FidPool) add(fid uint32) (*Fid, error) { pool.lock.Lock() defer pool.lock.Unlock() diff --git a/file.go b/file.go @@ -4,7 +4,6 @@ import "fmt" type File interface { Parent() (File, error) - Child() ([]File, error) // Children Stat() (*FileInfo, error) diff --git a/server.go b/server.go @@ -147,7 +147,7 @@ func rVersion(r *Req, err error) { func sAuth(s *Server, r *Req) { ifcall := r.ifcall.(*TAuth) - afid, err := s.fPool.alloc(ifcall.AFid()) + afid, err := s.fPool.add(ifcall.AFid()) if err != nil { respond(r, ErrDupFid) } @@ -168,7 +168,7 @@ func rAuth(r *Req, err error) { func sAttach(s *Server, r *Req) { ifcall := r.ifcall.(*TAttach) - fid, err := s.fPool.alloc(ifcall.Fid()) + fid, err := s.fPool.add(ifcall.Fid()) if err != nil { respond(r, ErrDupFid) return @@ -238,7 +238,7 @@ func sWalk(s *Server, r *Req) { newFid = oldFid } else { var err error - newFid, err = s.fPool.alloc(ifcall.NewFid()) + newFid, err = s.fPool.add(ifcall.NewFid()) if err != nil { log.Printf("alloc: %v", err) respond(r, fmt.Errorf("internal error"))