Skip to content

Is it possible to differentiate between operations on different file descriptors? #60

Open

Description

@ericpruitt

In my filesystem, I want to be able to differentiate between operations that take place on different file descriptors, but since the I/O operations only include the path, I don't see a way to do that. Is it possible at all? If not, is it a limitation of FUSE or the python-fuse library? I see in the FUSE struct that there's a an "fh" value that looks like it might be what I need, but I'm not certain.

Activity

  1. SimonHeimberg commented on Jul 24, 2024

    @SimonHeimberg

    Reading a chapter in new_fusepy_api[1] I see two possibilities:

    • The method YourFuseClass.open(...) returns any object (like a dict, a list, a class instance, ...). Then the other methods (read(...), write(...) get this object as additional fh argument.
    • Set YourFuseClass.file_class = YourOwnFileClass before calling main(). Then the related I/O methods (read(...), write(...) are called on a separate class instance (of YourOwnFileClass) for each file handle. (And __init__(...) is called instead of open().)

    [1] https://github.com/libfuse/python-fuse/blob/master/README.new_fusepy_api.rst#filehandles-can-also-be-objects-if-you-want

  2. ericpruitt commented on Jul 24, 2024

    @ericpruitt
    ContributorAuthor

    I don't understand how that's supposed to work. python-fuse will still pass in strings to indicate the open file regardless of the underlying class. If you open the same file multiple times, regardless of the underlying IO type, python-fuse will still use the exact same string for all handles.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions