2016-10-31 16:50:02 +01:00
|
|
|
package fuse
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Protocol is a FUSE protocol version number.
|
|
|
|
type Protocol struct {
|
|
|
|
Major uint32
|
|
|
|
Minor uint32
|
|
|
|
}
|
|
|
|
|
|
|
|
func (p Protocol) String() string {
|
|
|
|
return fmt.Sprintf("%d.%d", p.Major, p.Minor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// LT returns whether a is less than b.
|
|
|
|
func (a Protocol) LT(b Protocol) bool {
|
|
|
|
return a.Major < b.Major ||
|
|
|
|
(a.Major == b.Major && a.Minor < b.Minor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// GE returns whether a is greater than or equal to b.
|
|
|
|
func (a Protocol) GE(b Protocol) bool {
|
|
|
|
return a.Major > b.Major ||
|
|
|
|
(a.Major == b.Major && a.Minor >= b.Minor)
|
|
|
|
}
|
|
|
|
|
|
|
|
// HasAttrBlockSize returns whether Attr.BlockSize is respected by the
|
|
|
|
// kernel.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasAttrBlockSize() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// HasReadWriteFlags returns whether ReadRequest/WriteRequest
|
|
|
|
// fields Flags and FileFlags are valid.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasReadWriteFlags() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// HasGetattrFlags returns whether GetattrRequest field Flags is
|
|
|
|
// valid.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasGetattrFlags() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// HasOpenNonSeekable returns whether OpenResponse field Flags flag
|
|
|
|
// OpenNonSeekable is supported.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasOpenNonSeekable() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// HasUmask returns whether CreateRequest/MkdirRequest/MknodRequest
|
|
|
|
// field Umask is valid.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasUmask() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// HasInvalidate returns whether InvalidateNode/InvalidateEntry are
|
|
|
|
// supported.
|
2020-06-27 16:45:12 +02:00
|
|
|
//
|
|
|
|
// Deprecated: Guaranteed to be true with our minimum supported
|
|
|
|
// protocol version.
|
2016-10-31 16:50:02 +01:00
|
|
|
func (a Protocol) HasInvalidate() bool {
|
2020-06-27 16:45:12 +02:00
|
|
|
return true
|
2016-10-31 16:50:02 +01:00
|
|
|
}
|