diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-01-16 23:53:46 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-01-16 23:53:46 +0000 |
commit | b6542333a2598ed39d96c9169302d02a809b40df (patch) | |
tree | 97ea64fbcc373bc4b189839affb8fe4518bac14f /pkg/p9 | |
parent | 894e4241a1cbbe065c8802c4ddba988c43f5c2b7 (diff) | |
parent | 1e7f0c822b3a7c643d532d40a14ab79eb1df85c6 (diff) |
Merge release-20200115.0-15-g1e7f0c8 (automated)
Diffstat (limited to 'pkg/p9')
-rw-r--r-- | pkg/p9/client_file.go | 6 | ||||
-rw-r--r-- | pkg/p9/version.go | 8 |
2 files changed, 13 insertions, 1 deletions
diff --git a/pkg/p9/client_file.go b/pkg/p9/client_file.go index 04b584383..0254e4ccc 100644 --- a/pkg/p9/client_file.go +++ b/pkg/p9/client_file.go @@ -170,6 +170,9 @@ func (c *clientFile) GetXattr(name string, size uint64) (string, error) { if atomic.LoadUint32(&c.closed) != 0 { return "", syscall.EBADF } + if !versionSupportsGetSetXattr(c.client.version) { + return "", syscall.EOPNOTSUPP + } rgetxattr := Rgetxattr{} if err := c.client.sendRecv(&Tgetxattr{FID: c.fid, Name: name, Size: size}, &rgetxattr); err != nil { @@ -184,6 +187,9 @@ func (c *clientFile) SetXattr(name, value string, flags uint32) error { if atomic.LoadUint32(&c.closed) != 0 { return syscall.EBADF } + if !versionSupportsGetSetXattr(c.client.version) { + return syscall.EOPNOTSUPP + } return c.client.sendRecv(&Tsetxattr{FID: c.fid, Name: name, Value: value, Flags: flags}, &Rsetxattr{}) } diff --git a/pkg/p9/version.go b/pkg/p9/version.go index 36a694c58..34a15eb55 100644 --- a/pkg/p9/version.go +++ b/pkg/p9/version.go @@ -26,7 +26,7 @@ const ( // // Clients are expected to start requesting this version number and // to continuously decrement it until a Tversion request succeeds. - highestSupportedVersion uint32 = 9 + highestSupportedVersion uint32 = 10 // lowestSupportedVersion is the lowest supported version X in a // version string of the format 9P2000.L.Google.X. @@ -161,3 +161,9 @@ func versionSupportsFlipcall(v uint32) bool { func VersionSupportsOpenTruncateFlag(v uint32) bool { return v >= 9 } + +// versionSupportsGetSetXattr returns true if version v supports +// the Tgetxattr and Tsetxattr messages. +func versionSupportsGetSetXattr(v uint32) bool { + return v >= 10 +} |