diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-09-02 02:25:18 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-09-02 02:25:18 +0000 |
commit | 2e80f58b0d18b8dd122dc192a1cef9aa6a2da56f (patch) | |
tree | b21a43a5da78fe858a03f51c92533455195e7fdf /pkg/p9/file.go | |
parent | 01ab43f3f87e34c2a661bfdcf560dd9b5173974a (diff) | |
parent | 37a217aca4a128d66a6dd4969375ea81bd879ac7 (diff) |
Merge release-20200818.0-105-g37a217aca (automated)
Diffstat (limited to 'pkg/p9/file.go')
-rw-r--r-- | pkg/p9/file.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pkg/p9/file.go b/pkg/p9/file.go index cab35896f..c2e3a3f98 100644 --- a/pkg/p9/file.go +++ b/pkg/p9/file.go @@ -135,6 +135,14 @@ type File interface { // On the server, Close has no concurrency guarantee. Close() error + // SetAttrClose is the equivalent of calling SetAttr() followed by Close(). + // This can be used to set file times before closing the file in a single + // operation. + // + // On the server, SetAttr has a write concurrency guarantee. + // On the server, Close has no concurrency guarantee. + SetAttrClose(valid SetAttrMask, attr SetAttr) error + // Open must be called prior to using Read, Write or Readdir. Once Open // is called, some operations, such as Walk, will no longer work. // @@ -286,3 +294,19 @@ type DefaultWalkGetAttr struct{} func (DefaultWalkGetAttr) WalkGetAttr([]string) ([]QID, File, AttrMask, Attr, error) { return nil, nil, AttrMask{}, Attr{}, syscall.ENOSYS } + +// DisallowClientCalls panics if a client-only function is called. +type DisallowClientCalls struct{} + +// SetAttrClose implements File.SetAttrClose. +func (DisallowClientCalls) SetAttrClose(SetAttrMask, SetAttr) error { + panic("SetAttrClose should not be called on the server") +} + +// DisallowServerCalls panics if a server-only function is called. +type DisallowServerCalls struct{} + +// Renamed implements File.Renamed. +func (*clientFile) Renamed(File, string) { + panic("Renamed should not be called on the client") +} |