lib9p

Go 9P library.
Log | Files | Refs

commit f8e86bad641d8f440179b294f5dd6602c6babeda
parent 0d53fe51b41876573d312291237c62b77ee3ea8a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Tue, 24 Oct 2023 10:40:33 +0900

gofmt

Diffstat:
Mclient.go | 4++--
Mclient2.go | 14+++++++-------
Mdiskfs/diskfs.go | 2+-
Mdiskfs/file.go | 12+++++-------
Mdiskfs/qid_unix.go | 4++--
Mdiskfs/stat_unix.go | 3+--
Miofs/file.go | 4+---
Miofs/fs.go | 7+++----
8 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/client.go b/client.go @@ -65,7 +65,7 @@ func (c *Client) runListener(ctx context.Context, r io.Reader) <-chan Msg { rmsgc := make(chan Msg, 3) go func() { wg := new(sync.WaitGroup) - defer func(){ + defer func() { wg.Wait() close(rmsgc) c.wg.Done() @@ -82,7 +82,7 @@ func (c *Client) runListener(ctx context.Context, r io.Reader) <-chan Msg { msg Msg err error ) - go func () { + go func() { defer close(done) msg, err = recv(r) }() diff --git a/client2.go b/client2.go @@ -10,7 +10,7 @@ import ( ) type ClientFS struct { - c *Client + c *Client tPool *tagPool } @@ -86,11 +86,11 @@ func (fsys *ClientFS) walkFile(name string) (*ClientFile, error) { return nil, fmt.Errorf("invalid wqid: %v", wqid) } f := &ClientFile{ - name: path.Base(name), - path: name, - fid: fid, - qid: qid, - fs: fsys, + name: path.Base(name), + path: name, + fid: fid, + qid: qid, + fs: fsys, } fid.file = f return f, nil @@ -103,7 +103,7 @@ func Mount(r io.Reader, w io.Writer, uname, aname string) (fs *ClientFS, err err ctx = context.TODO() ) cfs := &ClientFS{ - c: NewClient(mSize, uname, r, w), + c: NewClient(mSize, uname, r, w), tPool: newTagPool(), } defer func() { diff --git a/diskfs/diskfs.go b/diskfs/diskfs.go @@ -39,7 +39,7 @@ func Open(name string) (*FS, error) { func (fsys *FS) OpenFile(name string, omode lib9p.OpenMode, perm fs.FileMode) (lib9p.File, error) { fp := filepath.Join(fsys.rootPath, name) var m int - switch omode&3 { + switch omode & 3 { case lib9p.OREAD: m = os.O_RDONLY case lib9p.OWRITE: diff --git a/diskfs/file.go b/diskfs/file.go @@ -13,9 +13,9 @@ import ( ) type File struct { - fs *FS // file system to which this file belongs - path string // relative path from the root of the fs. - file *os.File // underlying file. nil if not open. + fs *FS // file system to which this file belongs + path string // relative path from the root of the fs. + file *os.File // underlying file. nil if not open. } func (f *File) Fsys() lib9p.FS { @@ -107,14 +107,13 @@ func (f *File) Create(name string, uid string, return nil, fmt.Errorf("set file mode: %v", err) } - file, err := f.fs.OpenFile(filepath.Join(f.path,name) , mode, 0) + file, err := f.fs.OpenFile(filepath.Join(f.path, name), mode, 0) if err != nil { return nil, fmt.Errorf("open new file: %v", err) } return file, nil } - func (f *File) Close() error { if f.file == nil { return fmt.Errorf("not open") @@ -176,4 +175,4 @@ func (f *File) Remove() error { return fmt.Errorf("remove: %v", err) } return nil -} -\ No newline at end of file +} diff --git a/diskfs/qid_unix.go b/diskfs/qid_unix.go @@ -3,10 +3,10 @@ package diskfs import ( "fmt" "io/fs" + "os" + "path/filepath" "syscall" "time" - "path/filepath" - "os" "lib9p" ) diff --git a/diskfs/stat_unix.go b/diskfs/stat_unix.go @@ -116,4 +116,4 @@ func (f *File) WStat(s *lib9p.Stat) error { } return nil -} -\ No newline at end of file +} diff --git a/iofs/file.go b/iofs/file.go @@ -15,7 +15,6 @@ type File struct { path string // absolute path from the root of the fs. } - func (f *File) Stat() (*lib9p.FileInfo, error) { fsfile, err := f.fs.fs.Open(f.path) if err != nil { @@ -85,4 +84,4 @@ func (f *File) ReadDir(n int) ([]*lib9p.DirEntry, error) { de[i] = &lib9p.FileInfo{Stat: *st} } return de, nil -} -\ No newline at end of file +} diff --git a/iofs/fs.go b/iofs/fs.go @@ -1,8 +1,8 @@ package iofs import ( - "io/fs" "errors" + "io/fs" "lib9p" ) @@ -32,8 +32,8 @@ func (fsys *FS) OpenFile(name string, omode lib9p.OpenMode, perm fs.FileMode) (l return nil, err } return &File{ - fs: fsys, + fs: fsys, file: f, path: name, }, nil -} -\ No newline at end of file +}