lib9p

Go 9P library.
Log | Files | Refs

commit e304c760455f17ff8245bdd15a0aa9fa27d02365
parent 497a942661c9113976dd5db8df9d0e31aa3fb96a
Author: Matsuda Kenji <info@mtkn.jp>
Date:   Sat, 26 Aug 2023 10:16:57 +0900

move function

Diffstat:
Mdisk_unix.go | 13+++++++++++++
Mfile.go | 13-------------
2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/disk_unix.go b/disk_unix.go @@ -14,6 +14,19 @@ type DiskFile struct { path string // absolute path from the root of the fs. } +func openFile(fsys *FS, fpath string) (File, error) { + file, err := fsys.fs.Open(fpath) + if err != nil { + return nil, fmt.Errorf("open fs: %v", err) + } + f := &DiskFile{ + fs: fsys, + file: file, + path: fpath, + } + return f, nil +} + func (f *DiskFile) pathName() string { return f.path } func (f *DiskFile) t() uint16 { return 0 } func (f *DiskFile) dev() uint32 { return 0 } diff --git a/file.go b/file.go @@ -186,19 +186,6 @@ func sameFile(fi0, fi1 fs.FileInfo) bool { } -func openFile(fsys *FS, fpath string) (*DiskFile, error) { - file, err := fsys.fs.Open(fpath) - if err != nil { - return nil, fmt.Errorf("open fs: %v", err) - } - f := &DiskFile{ - fs: fsys, - file: file, - path: fpath, - } - return f, nil -} - type DirEntry struct { dirEnt fs.DirEntry // underlying fs.DirEntry info *FileInfo