lib9p

Go 9P library.
Log | Files | Refs | LICENSE

commit c32ff091e2e26bb67eb6d635fd567a8f9a89ef1a
parent ae000ecdadca76c8206f5451f980f4b173d8f568
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Thu, 11 Jan 2024 06:36:47 +0900

rename variables

Diffstat:
Mserver.go | 42+++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/server.go b/server.go @@ -301,7 +301,7 @@ func sAttach(ctx context.Context, c *conn, rc <-chan *request) { } var ( fsys FS - st fs.FileInfo + fi fs.FileInfo err error ) ifcall := r.ifcall.(*TAttach) @@ -342,13 +342,13 @@ func sAttach(ctx context.Context, c *conn, rc <-chan *request) { goto resp } r.fid.fs = fsys - st, err = fs.Stat(ExportFS{c.s.fsmap[ifcall.Aname]}, ".") + fi, err = fs.Stat(ExportFS{c.s.fsmap[ifcall.Aname]}, ".") if err != nil { r.err = fmt.Errorf("stat root: %v", err) goto resp } r.ofcall = &RAttach{ - Qid: st.Sys().(*Stat).Qid, + Qid: fi.Sys().(*Stat).Qid, } resp: if r.err != nil { @@ -400,7 +400,7 @@ func sWalk(ctx context.Context, c *conn, rc <-chan *request) { } var ( err error - oldst fs.FileInfo + oldfi fs.FileInfo newFid *fid wqids []Qid cwdp string @@ -416,12 +416,12 @@ func sWalk(ctx context.Context, c *conn, rc <-chan *request) { r.err = fmt.Errorf("cannot clone open fid") goto resp } - oldst, err = fs.Stat(ExportFS{oldFid.fs}, oldFid.path) + oldfi, err = fs.Stat(ExportFS{oldFid.fs}, oldFid.path) if err != nil { r.err = fmt.Errorf("stat: %v", err) goto resp } - if len(ifcall.Wnames) > 0 && oldst.Sys().(*Stat).Qid.Type&QTDIR == 0 { + if len(ifcall.Wnames) > 0 && oldfi.Sys().(*Stat).Qid.Type&QTDIR == 0 { r.err = fmt.Errorf("walk on non-dir") goto resp } @@ -497,7 +497,7 @@ func sOpen(ctx context.Context, c *conn, rc <-chan *request) { p fs.FileMode err error qid Qid - st fs.FileInfo + fi fs.FileInfo ) ifcall := r.ifcall.(*TOpen) r.fid, ok = c.fPool.lookup(ifcall.Fid) @@ -512,19 +512,19 @@ func sOpen(ctx context.Context, c *conn, rc <-chan *request) { if afile, ok := r.fid.file.(*AuthFile); ok { // c.s.Auth should set r.fid.file to a valid *AuthFile, // so r.fid.file should not be nil. - st, err = r.fid.file.Stat() + fi, err = r.fid.file.Stat() if err != nil { r.err = fmt.Errorf("stat: %v", err) goto resp } qid = afile.Qid } else { - st, err = fs.Stat(ExportFS{r.fid.fs}, r.fid.path) + fi, err = fs.Stat(ExportFS{r.fid.fs}, r.fid.path) if err != nil { r.err = fmt.Errorf("stat: %v", err) goto resp } - qid = st.Sys().(*Stat).Qid + qid = fi.Sys().(*Stat).Qid } // Write attempt to a directory is prohibitted by the protocol. // In plan9 implementation, ifcall.Mode is ANDed with ^ORCLOSE, @@ -552,18 +552,18 @@ func sOpen(ctx context.Context, c *conn, rc <-chan *request) { r.err = ErrPerm goto resp } - if !hasPerm(r.fid.fs, st, r.fid.uid, p) { + if !hasPerm(r.fid.fs, fi, r.fid.uid, p) { r.err = ErrPerm goto resp } if ifcall.Mode&ORCLOSE != 0 { parentPath := path.Dir(r.fid.path) - st, err := fs.Stat(ExportFS{r.fid.fs}, parentPath) + fi, err := fs.Stat(ExportFS{r.fid.fs}, parentPath) if err != nil { r.err = fmt.Errorf("stat parent: %v", err) goto resp } - if !hasPerm(r.fid.fs, st, r.fid.uid, AWRITE) { + if !hasPerm(r.fid.fs, fi, r.fid.uid, AWRITE) { r.err = ErrPerm goto resp } @@ -620,8 +620,8 @@ func sCreate(ctx context.Context, c *conn, rc <-chan *request) { return } var ( - st fs.FileInfo - dirstat fs.FileInfo + fi fs.FileInfo + dirfi fs.FileInfo err error cfs CreaterFS cpath string @@ -638,16 +638,16 @@ func sCreate(ctx context.Context, c *conn, rc <-chan *request) { r.err = ErrBotch goto resp } - dirstat, err = fs.Stat(ExportFS{r.fid.fs}, r.fid.path) + dirfi, err = fs.Stat(ExportFS{r.fid.fs}, r.fid.path) if err != nil { r.err = fmt.Errorf("stat: %v", err) goto resp } - if !dirstat.IsDir() { + if !dirfi.IsDir() { r.err = fmt.Errorf("create in non-dir") goto resp } - if !hasPerm(r.fid.fs, dirstat, r.fid.uid, AWRITE) { + if !hasPerm(r.fid.fs, dirfi, r.fid.uid, AWRITE) { r.err = ErrPerm goto resp } @@ -657,7 +657,7 @@ func sCreate(ctx context.Context, c *conn, rc <-chan *request) { goto resp } perm = ifcall.Perm - dirperm = dirstat.Mode() + dirperm = dirfi.Mode() if perm&fs.ModeDir == 0 { perm &= ^FileMode(0666) | (dirperm & FileMode(0666)) } else { @@ -671,13 +671,13 @@ func sCreate(ctx context.Context, c *conn, rc <-chan *request) { } r.fid.path = cpath r.fid.omode = ifcall.Mode - st, err = r.fid.file.Stat() + fi, err = r.fid.file.Stat() if err != nil { r.err = fmt.Errorf("stat: %v", err) goto resp } r.ofcall = &RCreate{ - Qid: st.Sys().(*Stat).Qid, + Qid: fi.Sys().(*Stat).Qid, Iounit: c.mSize() - IOHDRSZ, } resp: