Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions conversions.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ func convertInMessage(
Pid: inMsg.Header().Pid,
Uid: inMsg.Header().Uid,
},
OpenFlags: fusekernel.OpenFlags(in.Flags),
}

case fusekernel.OpSymlink:
Expand Down
6 changes: 6 additions & 0 deletions fuseops/ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,10 @@ type CreateFileOp struct {
// later call to ReleaseFileHandle.
Handle HandleID
OpContext OpContext

// The flags from the open(2) call, passed through the kernel's fuse driver
// to the FUSE daemon.
OpenFlags fusekernel.OpenFlags
}

// Create a symlink inode. If the name already exists, the file system should
Expand Down Expand Up @@ -681,6 +685,8 @@ type OpenFileOp struct {
// advance, for example, because contents are generated on the fly.
UseDirectIO bool

// The flags from the open(2) call, passed through the kernel's fuse driver
// to the FUSE daemon.
OpenFlags fusekernel.OpenFlags

OpContext OpContext
Expand Down
4 changes: 0 additions & 4 deletions internal/fusekernel/fuse_kernel_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ func (in *SetattrIn) Flags() uint32 {
return in.Flags_
}

func openFlags(flags uint32) OpenFlags {
return OpenFlags(flags)
}

type GetxattrIn struct {
getxattrInCommon

Expand Down
25 changes: 15 additions & 10 deletions internal/fusekernel/fuse_kernel_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package fusekernel

import "time"
import (
"syscall"
"time"
)

type Attr struct {
Ino uint64
Expand Down Expand Up @@ -49,16 +52,18 @@ func (in *SetattrIn) Flags() uint32 {
return 0
}

func openFlags(flags uint32) OpenFlags {
// on amd64, the 32-bit O_LARGEFILE flag is always seen;
// on i386, the flag probably depends on the app
// requesting, but in any case should be utterly
// uninteresting to us here; our kernel protocol messages
// are not directly related to the client app's kernel
// API/ABI
flags &^= 0x8000
const OpenDirect OpenFlags = syscall.O_DIRECT

return OpenFlags(flags)
// Return true if OpenDirect is set.
func (fl OpenFlags) IsDirect() bool {
return fl&OpenDirect != 0
}

func init() {
openFlagNames = append(openFlagNames, flagName{
bit: uint32(OpenDirect),
name: "OpenDirect",
})
}

type GetxattrIn struct {
Expand Down