Skip to content

add poll notification support#140

Merged
Nikratio merged 1 commit into
libfuse:mainfrom
obbardc:wip/obbardc/add-notify-poll
May 8, 2026
Merged

add poll notification support#140
Nikratio merged 1 commit into
libfuse:mainfrom
obbardc:wip/obbardc/add-notify-poll

Conversation

@obbardc
Copy link
Copy Markdown
Contributor

@obbardc obbardc commented May 5, 2026

Expose libfuse low-level poll support through pyfuse3.

Comment thread src/pyfuse3/__init__.pyx Outdated
Comment thread src/pyfuse3/_pyfuse3.py Outdated
Comment thread test/test_fs.py
@Nikratio
Copy link
Copy Markdown
Contributor

Nikratio commented May 5, 2026

Thanks for the MR! I only just replied on the issue tracker :-).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes libfuse low-level poll(2) readiness support through pyfuse3, allowing filesystems to implement Operations.poll() and later wake blocked poll/select/epoll waiters via notify_poll().

Changes:

  • Wire up the libfuse low-level poll callback and reply path (fuse_ops.pollfuse_pollOperations.pollfuse_reply_poll).
  • Introduce a PollHandle opaque type plus notify_poll(handle) to deliver readiness notifications.
  • Add an integration test filesystem and test case covering poll notification behavior.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/test_fs.py Adds a pollable test file and an integration test validating wakeup via notify_poll.
src/pyfuse3/internal.pxi Registers the new low-level poll handler in fuse_lowlevel_ops.
src/pyfuse3/handlers.pxi Implements fuse_poll/fuse_poll_async bridging to Operations.poll and replies with fuse_reply_poll.
src/pyfuse3/_pyfuse3.py Adds the Operations.poll() API and its documentation.
src/pyfuse3/__init__.pyx Adds PollHandle and the notify_poll() API.
src/pyfuse3/__init__.pyi Updates typing stubs for PollHandle and notify_poll().
Include/fuse_lowlevel.pxd Declares low-level poll op, fuse_reply_poll, and fuse_lowlevel_notify_poll.
Include/fuse_common.pxd Declares fuse_pollhandle and fuse_pollhandle_destroy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/pyfuse3/__init__.pyx Outdated
Comment thread src/pyfuse3/__init__.pyx Outdated
Comment thread src/pyfuse3/__init__.pyx
Comment thread src/pyfuse3/handlers.pxi Outdated
Comment thread test/test_fs.py
Comment thread test/test_fs.py Outdated
@obbardc obbardc requested a review from Nikratio May 8, 2026 12:26
Copy link
Copy Markdown
Contributor

@Nikratio Nikratio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one small idea to make it even nicer, but it's good to merge with and without that.

Comment thread src/pyfuse3/handlers.pxi Outdated
@obbardc obbardc requested a review from Nikratio May 8, 2026 13:46
@obbardc
Copy link
Copy Markdown
Contributor Author

obbardc commented May 8, 2026

@Nikratio thanks for your help with this one! I will split this into a few commits once you give me all OK.

@Nikratio
Copy link
Copy Markdown
Contributor

Nikratio commented May 8, 2026

I think this can all go in one commit.

Expose libfuse low-level poll support through pyfuse3 so that filesystems
can implement readiness notifications for poll(2), select(2) and
epoll_wait(2).

Add bindings for struct fuse_pollhandle, fuse_reply_poll(),
fuse_lowlevel_notify_poll() and fuse_pollhandle_destroy(). Introduce a
Python PollHandle wrapper with a notify() method to allow a filesystem
to retain the poll handle provided by Operations.poll() and notify it
later when readiness changes.

Wire the low-level FUSE poll callback into Operations.poll(), returning
the current readiness mask to the kernel. The default implementation
continues to raise -ENOSYS so existing filesystems keep the previous
fallback behaviour unless they opt-in.

This is needed by filesystems that emulate pollable kernel interfaces,
such as sysfs GPIO value files, where edge events must wake userspace
processes waiting for POLLPRI.

Fixes: libfuse#139
Signed-off-by: Christopher Obbard <christopher.obbard@linaro.org>
@obbardc obbardc force-pushed the wip/obbardc/add-notify-poll branch from f7f9a5e to f15e109 Compare May 8, 2026 16:25
@obbardc obbardc marked this pull request as ready for review May 8, 2026 16:26
@obbardc
Copy link
Copy Markdown
Contributor Author

obbardc commented May 8, 2026

Thanks, squashed into a single commit. Once merged, is it possible to please release a new version soonish?

@Nikratio Nikratio merged commit 8293494 into libfuse:main May 8, 2026
1 check passed
@obbardc obbardc deleted the wip/obbardc/add-notify-poll branch May 8, 2026 16:54
@Nikratio
Copy link
Copy Markdown
Contributor

Once merged, is it possible to please release a new version soonish?

Tried today, but run into some unexpected issues with generating the documentation (sphinx-build). Hopefully by the end of the week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants