Commit 334a5a5f authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

fuse: update for kernel API version 40

Add definitions and print routines for FUSE_NO_EXPORT_SUPPORT,
FUSE_NOTIFY_RESEND and FOPEN_PASSTHROUGH and associated fields.

Change-Id: I5bd52c44a91484ac78ea5413cbd4bf5dc927501e
parent 7c6fe740
...@@ -99,40 +99,41 @@ func doInit(server *Server, req *request) { ...@@ -99,40 +99,41 @@ func doInit(server *Server, req *request) {
return return
} }
kernelFlags := uint64(input.Flags) | uint64(input.Flags2)<<32
server.reqMu.Lock() server.reqMu.Lock()
server.kernelSettings = *input server.kernelSettings = *input
server.kernelSettings.Flags = input.Flags & (CAP_ASYNC_READ | CAP_BIG_WRITES | CAP_FILE_OPS | kernelFlags &= (CAP_ASYNC_READ | CAP_BIG_WRITES | CAP_FILE_OPS |
CAP_READDIRPLUS | CAP_NO_OPEN_SUPPORT | CAP_PARALLEL_DIROPS | CAP_MAX_PAGES | CAP_RENAME_SWAP) CAP_READDIRPLUS | CAP_NO_OPEN_SUPPORT | CAP_PARALLEL_DIROPS | CAP_MAX_PAGES | CAP_RENAME_SWAP)
if server.opts.EnableLocks { if server.opts.EnableLocks {
server.kernelSettings.Flags |= CAP_FLOCK_LOCKS | CAP_POSIX_LOCKS kernelFlags |= CAP_FLOCK_LOCKS | CAP_POSIX_LOCKS
} }
if server.opts.EnableSymlinkCaching { if server.opts.EnableSymlinkCaching {
server.kernelSettings.Flags |= CAP_CACHE_SYMLINKS kernelFlags |= CAP_CACHE_SYMLINKS
} }
if server.opts.EnableAcl { if server.opts.EnableAcl {
server.kernelSettings.Flags |= CAP_POSIX_ACL kernelFlags |= CAP_POSIX_ACL
} }
if server.opts.SyncRead { if server.opts.SyncRead {
// Clear CAP_ASYNC_READ // Clear CAP_ASYNC_READ
server.kernelSettings.Flags &= ^uint32(CAP_ASYNC_READ) kernelFlags &= ^uint64(CAP_ASYNC_READ)
} }
if server.opts.DisableReadDirPlus { if server.opts.DisableReadDirPlus {
// Clear CAP_READDIRPLUS // Clear CAP_READDIRPLUS
server.kernelSettings.Flags &= ^uint32(CAP_READDIRPLUS) kernelFlags &= ^uint64(CAP_READDIRPLUS)
} }
dataCacheMode := input.Flags & CAP_AUTO_INVAL_DATA dataCacheMode := kernelFlags & CAP_AUTO_INVAL_DATA
if server.opts.ExplicitDataCacheControl { if server.opts.ExplicitDataCacheControl {
// we don't want CAP_AUTO_INVAL_DATA even if we cannot go into fully explicit mode // we don't want CAP_AUTO_INVAL_DATA even if we cannot go into fully explicit mode
dataCacheMode = 0 dataCacheMode = 0
explicit := input.Flags & CAP_EXPLICIT_INVAL_DATA explicit := kernelFlags & CAP_EXPLICIT_INVAL_DATA
if explicit != 0 { if explicit != 0 {
dataCacheMode = explicit dataCacheMode = explicit
} }
} }
server.kernelSettings.Flags |= dataCacheMode kernelFlags |= dataCacheMode
if input.Minor >= 13 { if input.Minor >= 13 {
server.setSplice() server.setSplice()
...@@ -149,13 +150,12 @@ func doInit(server *Server, req *request) { ...@@ -149,13 +150,12 @@ func doInit(server *Server, req *request) {
Major: _FUSE_KERNEL_VERSION, Major: _FUSE_KERNEL_VERSION,
Minor: _OUR_MINOR_VERSION, Minor: _OUR_MINOR_VERSION,
MaxReadAhead: input.MaxReadAhead, MaxReadAhead: input.MaxReadAhead,
Flags: server.kernelSettings.Flags,
MaxWrite: uint32(server.opts.MaxWrite), MaxWrite: uint32(server.opts.MaxWrite),
CongestionThreshold: uint16(server.opts.MaxBackground * 3 / 4), CongestionThreshold: uint16(server.opts.MaxBackground * 3 / 4),
MaxBackground: uint16(server.opts.MaxBackground), MaxBackground: uint16(server.opts.MaxBackground),
MaxPages: uint16(maxPages), MaxPages: uint16(maxPages),
} }
out.setFlags(kernelFlags)
if server.opts.MaxReadAhead != 0 && uint32(server.opts.MaxReadAhead) < out.MaxReadAhead { if server.opts.MaxReadAhead != 0 && uint32(server.opts.MaxReadAhead) < out.MaxReadAhead {
out.MaxReadAhead = uint32(server.opts.MaxReadAhead) out.MaxReadAhead = uint32(server.opts.MaxReadAhead)
} }
......
...@@ -50,6 +50,9 @@ var ( ...@@ -50,6 +50,9 @@ var (
{CAP_CREATE_SUPP_GROUP, "CREATE_SUPP_GROUP"}, {CAP_CREATE_SUPP_GROUP, "CREATE_SUPP_GROUP"},
{CAP_HAS_EXPIRE_ONLY, "HAS_EXPIRE_ONLY"}, {CAP_HAS_EXPIRE_ONLY, "HAS_EXPIRE_ONLY"},
{CAP_DIRECT_IO_RELAX, "DIRECT_IO_RELAX"}, {CAP_DIRECT_IO_RELAX, "DIRECT_IO_RELAX"},
{CAP_PASSTHROUGH, "PASSTHROUGH"},
{CAP_NO_EXPORT_SUPPORT, "NO_EXPORT_SUPPORT"},
{CAP_HAS_RESEND, "HAS_RESEND"},
}) })
releaseFlagNames = newFlagNames([]flagNameEntry{ releaseFlagNames = newFlagNames([]flagNameEntry{
{RELEASE_FLUSH, "FLUSH"}, {RELEASE_FLUSH, "FLUSH"},
...@@ -74,6 +77,9 @@ var ( ...@@ -74,6 +77,9 @@ var (
{FOPEN_NONSEEKABLE, "NONSEEK"}, {FOPEN_NONSEEKABLE, "NONSEEK"},
{FOPEN_CACHE_DIR, "CACHE_DIR"}, {FOPEN_CACHE_DIR, "CACHE_DIR"},
{FOPEN_STREAM, "STREAM"}, {FOPEN_STREAM, "STREAM"},
{FOPEN_NOFLUSH, "NOFLUSH"},
{FOPEN_PARALLEL_DIRECT_WRITES, "PARALLEL_DIRECT_WRITES"},
{FOPEN_PASSTHROUGH, "PASSTHROUGH"},
}) })
accessFlagName = newFlagNames([]flagNameEntry{ accessFlagName = newFlagNames([]flagNameEntry{
{X_OK, "x"}, {X_OK, "x"},
...@@ -205,7 +211,11 @@ func (in *OpenIn) string() string { ...@@ -205,7 +211,11 @@ func (in *OpenIn) string() string {
} }
func (in *OpenOut) string() string { func (in *OpenOut) string() string {
return fmt.Sprintf("{Fh %d %s}", in.Fh, backing := ""
if in.BackingID != 0 {
backing = fmt.Sprintf("backing=%d ", in.BackingID)
}
return fmt.Sprintf("{Fh %d %s %s}", in.Fh, backing,
flagString(fuseOpenFlagNames, int64(in.OpenFlags), "")) flagString(fuseOpenFlagNames, int64(in.OpenFlags), ""))
} }
...@@ -216,11 +226,11 @@ func (in *InitIn) string() string { ...@@ -216,11 +226,11 @@ func (in *InitIn) string() string {
} }
func (o *InitOut) string() string { func (o *InitOut) string() string {
return fmt.Sprintf("{%d.%d Ra %d %s %d/%d Wr %d Tg %d MaxPages %d}", return fmt.Sprintf("{%d.%d Ra %d %s %d/%d Wr %d Tg %d MaxPages %d MaxStack %d}",
o.Major, o.Minor, o.MaxReadAhead, o.Major, o.Minor, o.MaxReadAhead,
flagString(initFlagNames, int64(o.Flags), ""), flagString(initFlagNames, int64(o.Flags)|int64(o.Flags2)<<32, ""),
o.CongestionThreshold, o.MaxBackground, o.MaxWrite, o.CongestionThreshold, o.MaxBackground, o.MaxWrite,
o.TimeGran, o.MaxPages) o.TimeGran, o.MaxPages, o.MaxStackDepth)
} }
func (s *FsyncIn) string() string { func (s *FsyncIn) string() string {
......
...@@ -256,12 +256,13 @@ const ( ...@@ -256,12 +256,13 @@ const (
FOPEN_STREAM = (1 << 4) FOPEN_STREAM = (1 << 4)
FOPEN_NOFLUSH = (1 << 5) FOPEN_NOFLUSH = (1 << 5)
FOPEN_PARALLEL_DIRECT_WRITES = (1 << 6) FOPEN_PARALLEL_DIRECT_WRITES = (1 << 6)
FOPEN_PASSTHROUGH = (1 << 7)
) )
type OpenOut struct { type OpenOut struct {
Fh uint64 Fh uint64
OpenFlags uint32 OpenFlags uint32
Padding uint32 BackingID int32
} }
// To be set in InitIn/InitOut.Flags. // To be set in InitIn/InitOut.Flags.
...@@ -303,7 +304,10 @@ const ( ...@@ -303,7 +304,10 @@ const (
CAP_HAS_INODE_DAX = (1 << 33) CAP_HAS_INODE_DAX = (1 << 33)
CAP_CREATE_SUPP_GROUP = (1 << 34) CAP_CREATE_SUPP_GROUP = (1 << 34)
CAP_HAS_EXPIRE_ONLY = (1 << 35) CAP_HAS_EXPIRE_ONLY = (1 << 35)
CAP_DIRECT_IO_RELAX = (1 << 36) CAP_DIRECT_IO_RELAX = (1 << 36) // DIRECT_IO_ALLOW_MMAP ?
CAP_PASSTHROUGH = (1 << 37)
CAP_NO_EXPORT_SUPPORT = (1 << 38)
CAP_HAS_RESEND = (1 << 39)
) )
type InitIn struct { type InitIn struct {
...@@ -329,7 +333,13 @@ type InitOut struct { ...@@ -329,7 +333,13 @@ type InitOut struct {
MaxPages uint16 MaxPages uint16
Padding uint16 Padding uint16
Flags2 uint32 Flags2 uint32
Unused [7]uint32 MaxStackDepth uint32
Unused [6]uint32
}
func (o *InitOut) setFlags(flags uint64) {
o.Flags = uint32(flags)
o.Flags2 = uint32(flags >> 32)
} }
type _CuseInitIn struct { type _CuseInitIn struct {
...@@ -516,6 +526,7 @@ const ( ...@@ -516,6 +526,7 @@ const (
NOTIFY_STORE_CACHE = -4 // store data into kernel cache of an inode NOTIFY_STORE_CACHE = -4 // store data into kernel cache of an inode
NOTIFY_RETRIEVE_CACHE = -5 // retrieve data from kernel cache of an inode NOTIFY_RETRIEVE_CACHE = -5 // retrieve data from kernel cache of an inode
NOTIFY_DELETE = -6 // notify kernel that a directory entry has been deleted NOTIFY_DELETE = -6 // notify kernel that a directory entry has been deleted
NOTIFY_RESEND = -7
// NOTIFY_CODE_MAX = -6 // NOTIFY_CODE_MAX = -6
) )
......
...@@ -23,12 +23,13 @@ const ( ...@@ -23,12 +23,13 @@ const (
const ( const (
CAP_NO_OPENDIR_SUPPORT = (1 << 24) CAP_NO_OPENDIR_SUPPORT = (1 << 24)
CAP_EXPLICIT_INVAL_DATA = (1 << 25) CAP_EXPLICIT_INVAL_DATA = (1 << 25)
CAP_MAP_ALIGNMENT = (1 << 26)
CAP_SUBMOUNTS = (1 << 27) CAP_MAP_ALIGNMENT = (1 << 26)
CAP_HANDLE_KILLPRIV_V2 = (1 << 28) CAP_SUBMOUNTS = (1 << 27)
CAP_SETXATTR_EXT = (1 << 29) CAP_HANDLE_KILLPRIV_V2 = (1 << 28)
CAP_INIT_EXT = (1 << 30) CAP_SETXATTR_EXT = (1 << 29)
CAP_INIT_RESERVED = (1 << 31) CAP_INIT_EXT = (1 << 30)
CAP_INIT_RESERVED = (1 << 31)
// CAP_RENAME_SWAP only exists on OSX. // CAP_RENAME_SWAP only exists on OSX.
CAP_RENAME_SWAP = 0x0 CAP_RENAME_SWAP = 0x0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment