pchickey opened PR #6791 from bytecodealliance:pch/sync_wasi_filesystem_wit
to bytecodealliance:main
:
<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
pchickey edited PR #6791:
See also:
https://github.com/WebAssembly/wasi-filesystem/pull/125
https://github.com/WebAssembly/wasi-filesystem/pull/126
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey has marked PR #6791 as ready for review.
pchickey requested itsrainy for a review on PR #6791.
pchickey requested wasmtime-core-reviewers for a review on PR #6791.
pchickey edited PR #6791:
This PR pulls in the latest wit files from the wasi-filesystem repo, with the addition of just one pending upstream change to remove the nonblocking descriptor-flag.
The meat of this change is:
- the
wasi:filesystem/filesystem
interface has been renamedwasi:filesystem/types
- the interface removes device and inode from the descriptor-stat struct, and provides new
metadata-hash
family functions to replace this concept
* these new methods are implemented in preview2 host, using std::hash::Hasher
* the preview 1 adapters still need to fill in a device and inode in some places. I elected to fill in1
for the device (because the stdio stream "files" use0
) and use the lower 64 bits of the metadata hash to fill in the inode.
* the preview 1 host adapter needed to use an async fn to calculate each entry in fd_readdir, so I had to move some calculation out of the iterator map and into a for loop, done eagerly for each entry in the directory. Ideally this would be lazy for only entries in the directory that are being serialized as part of the adapter, or cache it between entries, but I didn't consider this worthwhile to invest in right now- the new wasi:filesystem/preopens interface replaces the local wasi:cli-base/preopens. (There is no such thing as an upstream cli-base package, but morally it is in wasi-cli)
See also:
https://github.com/WebAssembly/wasi-filesystem/pull/125: remove nonblocking descriptor flag. still open.
https://github.com/WebAssembly/wasi-filesystem/pull/126: fix parameters to metadata functions. merged.
pchickey requested elliottt for a review on PR #6791.
pchickey edited PR #6791:
This PR pulls in the latest wit files from the wasi-filesystem repo, with the addition of just one pending upstream change to remove the nonblocking descriptor-flag.
The changes look like:
- the
wasi:filesystem/filesystem
interface has been renamedwasi:filesystem/types
. This resulted in lots of renaming across the repo. For the main filesystem impl I use the newtypes::
module prefix but in most other places I followeduse ...::filesystem::types as filesystem;
to make it clearer to read.- the interface removes
device
andinode
from the descriptor-stat struct, and provides newmetadata-hash
family functions to replace this concept.
* these new methods are implemented in preview2 host, usingstd::hash::Hasher
to hash the device and inode of the file.
* the preview 1 adapters still need to fill in adevice
andinode
in some places (fd_filestat_get
andfd_readdir
). I elected to fill in1
for thedevice
(because the stdio stream "files" use0
) and use the lower 64 bits of the metadata hash to fill in theinode
.
* the preview 1 host adapter needed to use anasync
method to calculate eachinode
infd_readdir
, so I had to move some calculation out of the iterator map and into a for loop, done eagerly for each entry in the directory. Ideally this would be lazy for only entries in the directory that are being serialized as part of the adapter, or cache it between entries, but I didn't consider this worthwhile to invest in right now.- the new wasi:filesystem/preopens interface replaces the local wasi:cli-base/preopens. (There is no such thing as an upstream cli-base package, but morally it is in wasi-cli)
See also:
https://github.com/WebAssembly/wasi-filesystem/pull/125: remove nonblocking descriptor flag. still open.
https://github.com/WebAssembly/wasi-filesystem/pull/126: fix parameters to metadata functions. merged.
pchickey requested sunfishcode for a review on PR #6791.
elliottt submitted PR review:
I think this looks great! Just had a question about the hasher choice before merging.
elliottt submitted PR review:
I think this looks great! Just had a question about the hasher choice before merging.
elliottt created PR review comment:
These will need to be updated after #6795 merges.
elliottt created PR review comment:
Why not use
std::collections::hash_map::DefaultHasher
here instead?
pchickey created PR review comment:
I missed it, but that is a better option.
pchickey submitted PR review.
pchickey updated PR #6791.
elliottt submitted PR review:
:rocket:
pchickey updated PR #6791.
pchickey has enabled auto merge for PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
pchickey updated PR #6791.
elliottt updated PR #6791.
elliottt has enabled auto merge for PR #6791.
elliottt has disabled auto merge for PR #6791.
elliottt has enabled auto merge for PR #6791.
elliottt merged PR #6791.
Last updated: Nov 22 2024 at 16:03 UTC