From ac7ca2c7543b0ee41a4c234e64751afbe6938500 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Wed, 22 Mar 2023 18:20:44 +0300 Subject: [PATCH] Add missing poll and notify request structures --- internal/fusekernel/fuse_kernel.go | 80 ++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/internal/fusekernel/fuse_kernel.go b/internal/fusekernel/fuse_kernel.go index c1aded9..c46e404 100644 --- a/internal/fusekernel/fuse_kernel.go +++ b/internal/fusekernel/fuse_kernel.go @@ -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 @@ -386,6 +414,7 @@ const ( OpDestroy = 38 OpIoctl = 39 // Linux? OpPoll = 40 // Linux? + OpNotifyReply = 41 OpBatchForget = 42 OpFallocate = 43 @@ -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 @@ -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 @@ -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 +}