Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt pointer to closure #347

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

idegtiarenko
Copy link

When implementing an integration with the libfuse I noticed that the readdir callback supplies the user with a fuse_fill_dir_t that is a pointer to a function that supposed to be called for every child item in the directory.

I have not found a way to automatically nor programmatically convert that pointer to a closure so that it could be called within java.
I believe others implementations might have a similar issue that required a split package to fix.

This change adds a similar implementation to the ClosureManager/NativeClosureManager so that the pointer could be adapted to the interface callable from java.

I am new to the jnr-ffi lib. Please let me know if I miss anything or if it is a right way to resolve this issue.

Thanks!

@headius
Copy link
Member

headius commented Oct 13, 2024

Hello! I missed this PR in August, sorry about that!

What you have here looks pretty good! Do you think you can provide a test case or example to help me verify this change locally? We have a set of tests in jnr-ffi that should give you an idea how to handle this.

@idegtiarenko
Copy link
Author

I will take a look over the weekend if I can add a test case for this change.

@idegtiarenko
Copy link
Author

@headius, I have added a simple test case.
Please let me know if that looks okay to you.

@idegtiarenko
Copy link
Author

@headius, any updates?

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.

2 participants