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

feat(vfs) Try to unify file descriptor #2528

Merged
merged 5 commits into from
Aug 17, 2021

Commits on Aug 17, 2021

  1. feat(vfs) Unified API.

    Unfortunately, this patch contains multiple features.
    
    First off, it renames the types from `host_fs` and `mem_fs` so that
    they use the same names. Apart from the module name, the types owned
    by the module are the same, which simplifies the usage greatly.
    
    Second, the code has been cleaned up a little bit. The more important
    clean up is probably the renaming of `MemKind` to `Node`. It's OK to
    do that here, because the code is not released yet.
    
    Third, a new `FileDescriptor` type is introduced. It represents a
    “generic” file descriptor, that a `VirtualFile` can hold. It contains
    a value with the size of the larger size a file descriptor on any
    platform, namely on Windows where a file descriptor is the size of a
    pointer (compared to Unix where it's a `i32`). Then a bunch of
    `TryInto` implementations are written to convert it to `RawFd` (on
    Unix) or `RawHandle` (on Windows). I'm not confident it's the best
    design for the moment, but it's better than before where Windows file
    descriptors were impossible to represent. Note that we cannot make
    `FileDescriptor` generic over the system for 2 reasons
    
    1. We can activate multiple file systems at the same time, so the
       representation of a file descriptor can change between file system,
    
    2. If we make `FileDescriptor` generic, then the size of `dyn
       VirtualFile` is unknown at compile-time, which makes impossible to
       use in `wasmer-wasi`, hence this design decision of taking the
       larger possible size for a file descriptor so that it fits all
       scenarios.
    Hywan committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    f211130 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5583631 View commit details
    Browse the repository at this point in the history
  3. Fix merge conflict.

    Hywan committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    ab83efe View commit details
    Browse the repository at this point in the history
  4. Fix merge conflict.

    When rebasing, Git losts some of the commit. Here is a bunch of them
    in a single commit… To learn more, see
    wasmerio@f211130.
    Hywan committed Aug 17, 2021
    Configuration menu
    Copy the full SHA
    9e6c07d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    ff9c7f1 View commit details
    Browse the repository at this point in the history