commit 8d7da12281052fa4ee2245a54974cbdd84937937
parent 4c257bcb464710f7f45c0b38661bfff7e2941420
Author: Matsuda Kenji <info@mtkn.jp>
Date: Mon, 8 Jan 2024 16:39:53 +0900
add comment about errors returned by FS.OpenFile, CreaterFS.Create
Diffstat:
1 file changed, 12 insertions(+), 0 deletions(-)
diff --git a/fs.go b/fs.go
@@ -7,6 +7,14 @@ import (
// An FS is an file system to be exported by 9P server.
type FS interface {
// OpenFile opens file named name with omode.
+ //
+ // When OpenFile returns an error, it should be of type *fs.PathError
+ // with the Op field set to "openfile", the Path field set to name,
+ // and the Err field describing the problem.
+ //
+ // Open should reject attempts to open names that do not satisfy
+ // fs.ValidPath(name), returning a *fs.PathError with Err set to
+ // fs.ErrInvalid or fs.ErrNotExist.
OpenFile(name string, omode OpenMode) (File, error)
}
@@ -24,6 +32,10 @@ type CreaterFS interface {
// Create creates a file named name.
// It sets the owner of newly created file to the specified uid,
// and file mode to the specified perm.
+ //
+ // Create should reject attempts to create names that do not satisfy
+ // fs.ValidPath(name), returning a *fs.PathError with Err set to
+ // fs.ErrInvalid.
Create(name string, uid string, mode OpenMode, perm FileMode) (File, error)
}