Skip to content

Commit

Permalink
Add missing poll and notify request structures
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalif committed Mar 28, 2023
1 parent 86031ac commit ac7ca2c
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions internal/fusekernel/fuse_kernel.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,34 @@ var releaseFlagNames = []flagName{
{uint32(ReleaseFlush), "ReleaseFlush"},
}

// Poll flags and events are used in the Poll exchange.
type PollFlags uint32

const (
// From the kernel source:
// Ask for notification if there's someone waiting for it.
// The client may ignore the flag and always notify.
PollScheduleNotify PollFlags = 1 << 0
)

type PollEvents uint32

const (
PollInEvent PollEvents = 0x0001
PollPriEvent PollEvents = 0x0002
PollOutEvent PollEvents = 0x0004
PollErrEvent PollEvents = 0x0008
PollHupEvent PollEvents = 0x0010
PollNvalEvent PollEvents = 0x0020
PollRdNormEvent PollEvents = 0x0040
PollRdBandEvent PollEvents = 0x0080
PollWrNormEvent PollEvents = 0x0100
PollWrBandEvent PollEvents = 0x0200
PollMsgEvent PollEvents = 0x0400
PollRemoveEvent PollEvents = 0x1000
PollRdHupEvent PollEvents = 0x2000
)

// Opcodes
const (
OpLookup = 1
Expand Down Expand Up @@ -386,6 +414,7 @@ const (
OpDestroy = 38
OpIoctl = 39 // Linux?
OpPoll = 40 // Linux?
OpNotifyReply = 41
OpBatchForget = 42
OpFallocate = 43

Expand Down Expand Up @@ -552,6 +581,18 @@ func CreateInSize(p Protocol) uintptr {
}
}

type PollIn struct {
Fh uint64
Kh uint64
Flags uint32
Events uint32
}

type PollOut struct {
Revents uint32
padding uint32
}

type ReleaseIn struct {
Fh uint64
Flags uint32
Expand Down Expand Up @@ -787,8 +828,15 @@ const (
NotifyCodePoll int32 = 1
NotifyCodeInvalInode int32 = 2
NotifyCodeInvalEntry int32 = 3
NotifyCodeStore int32 = 4
NotifyCodeRetrieve int32 = 5
NotifyCodeDelete int32 = 6
)

type NotifyPollWakeupOut struct {
Kh uint64
}

type NotifyInvalInodeOut struct {
Ino uint64
Off int64
Expand All @@ -800,3 +848,35 @@ type NotifyInvalEntryOut struct {
Namelen uint32
padding uint32
}

type NotifyDeleteOut struct {
Parent uint64
Child uint64
Namelen uint32
padding uint32
}

type NotifyStoreOut struct {
Nodeid uint64
Offset uint64
Size uint32
padding uint32
}

type NotifyRetrieveOut struct {
Unique uint64
Nodeid uint64
Offset uint64
Size uint32
padding uint32
}

// Matches the size of WriteIn
type NotifyRetrieveIn struct {
dummy1 uint64
Offset uint64
Size uint32
dummy2 uint32
dummy3 uint64
dummy4 uint64
}

0 comments on commit ac7ca2c

Please sign in to comment.