implement NoOpenSupport and NoOpendirSupport

See also:
7678ac5061
d7afaec0b5
d9a9ea94f7
geesefs-0-30-9
Michael Stapelberg 2020-02-15 08:27:23 +01:00
parent 7c2b569250
commit 2f65426467
3 changed files with 47 additions and 19 deletions

View File

@ -149,6 +149,8 @@ func (c *Connection) Init() error {
} }
cacheSymlinks := initOp.Flags&fusekernel.InitCacheSymlinks > 0 cacheSymlinks := initOp.Flags&fusekernel.InitCacheSymlinks > 0
noOpenSupport := initOp.Flags&fusekernel.InitNoOpenSupport > 0
noOpendirSupport := initOp.Flags&fusekernel.InitNoOpendirSupport > 0
// Respond to the init op. // Respond to the init op.
initOp.Library = c.protocol initOp.Library = c.protocol
@ -171,6 +173,18 @@ func (c *Connection) Init() error {
initOp.Flags |= fusekernel.InitCacheSymlinks initOp.Flags |= fusekernel.InitCacheSymlinks
} }
// Tell the kernel to treat returning -ENOSYS on OpenFile as not needing
// OpenFile calls at all (Linux >= 3.16):
if c.cfg.EnableNoOpenSupport && noOpenSupport {
initOp.Flags |= fusekernel.InitNoOpenSupport
}
// Tell the kernel to treat returning -ENOSYS on OpenDir as not needing
// OpenDir calls at all (Linux >= 5.1):
if c.cfg.EnableNoOpendirSupport && noOpendirSupport {
initOp.Flags |= fusekernel.InitNoOpendirSupport
}
c.Reply(ctx, nil) c.Reply(ctx, nil)
return nil return nil
} }

View File

@ -248,25 +248,26 @@ var openResponseFlagNames = []flagName{
type InitFlags uint32 type InitFlags uint32
const ( const (
InitAsyncRead InitFlags = 1 << 0 InitAsyncRead InitFlags = 1 << 0
InitPosixLocks InitFlags = 1 << 1 InitPosixLocks InitFlags = 1 << 1
InitFileOps InitFlags = 1 << 2 InitFileOps InitFlags = 1 << 2
InitAtomicTrunc InitFlags = 1 << 3 InitAtomicTrunc InitFlags = 1 << 3
InitExportSupport InitFlags = 1 << 4 InitExportSupport InitFlags = 1 << 4
InitBigWrites InitFlags = 1 << 5 InitBigWrites InitFlags = 1 << 5
InitDontMask InitFlags = 1 << 6 InitDontMask InitFlags = 1 << 6
InitSpliceWrite InitFlags = 1 << 7 InitSpliceWrite InitFlags = 1 << 7
InitSpliceMove InitFlags = 1 << 8 InitSpliceMove InitFlags = 1 << 8
InitSpliceRead InitFlags = 1 << 9 InitSpliceRead InitFlags = 1 << 9
InitFlockLocks InitFlags = 1 << 10 InitFlockLocks InitFlags = 1 << 10
InitHasIoctlDir InitFlags = 1 << 11 InitHasIoctlDir InitFlags = 1 << 11
InitAutoInvalData InitFlags = 1 << 12 InitAutoInvalData InitFlags = 1 << 12
InitDoReaddirplus InitFlags = 1 << 13 InitDoReaddirplus InitFlags = 1 << 13
InitReaddirplusAuto InitFlags = 1 << 14 InitReaddirplusAuto InitFlags = 1 << 14
InitAsyncDIO InitFlags = 1 << 15 InitAsyncDIO InitFlags = 1 << 15
InitWritebackCache InitFlags = 1 << 16 InitWritebackCache InitFlags = 1 << 16
InitNoOpenSupport InitFlags = 1 << 17 InitNoOpenSupport InitFlags = 1 << 17
InitCacheSymlinks InitFlags = 1 << 23 InitCacheSymlinks InitFlags = 1 << 23
InitNoOpendirSupport InitFlags = 1 << 24
InitCaseSensitive InitFlags = 1 << 29 // OS X only InitCaseSensitive InitFlags = 1 << 29 // OS X only
InitVolRename InitFlags = 1 << 30 // OS X only InitVolRename InitFlags = 1 << 30 // OS X only
@ -298,6 +299,7 @@ var initFlagNames = []flagName{
{uint32(InitWritebackCache), "InitWritebackCache"}, {uint32(InitWritebackCache), "InitWritebackCache"},
{uint32(InitNoOpenSupport), "InitNoOpenSupport"}, {uint32(InitNoOpenSupport), "InitNoOpenSupport"},
{uint32(InitCacheSymlinks), "InitCacheSymlinks"}, {uint32(InitCacheSymlinks), "InitCacheSymlinks"},
{uint32(InitNoOpendirSupport), "InitNoOpendirSupport"},
{uint32(InitCaseSensitive), "InitCaseSensitive"}, {uint32(InitCaseSensitive), "InitCaseSensitive"},
{uint32(InitVolRename), "InitVolRename"}, {uint32(InitVolRename), "InitVolRename"},

View File

@ -139,6 +139,18 @@ type MountConfig struct {
// target. // target.
EnableSymlinkCaching bool EnableSymlinkCaching bool
// Linux only.
//
// Tell the kernel to treat returning -ENOSYS on OpenFile as not needing
// OpenFile calls at all (Linux >= 3.16):
EnableNoOpenSupport bool
// Linux only.
//
// Tell the kernel to treat returning -ENOSYS on OpenDir as not needing
// OpenDir calls at all (Linux >= 5.1):
EnableNoOpendirSupport bool
// OS X only. // OS X only.
// //
// The name of the mounted volume, as displayed in the Finder. If empty, a // The name of the mounted volume, as displayed in the Finder. If empty, a