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

Abstract POSIX filesystem functions #2585

Conversation

zoraaver
Copy link
Contributor

@zoraaver zoraaver commented Sep 22, 2023

To allow non-POSIX platforms such as Windows to support WASI libc
filesystem functionality, create a set of wrapper functions which
provide a platform-agnostic interface to interact with the host
filesystem. For now, the Windows implementation is stubbed but this will
be implemented properly in a future PR. There are no functional changes
in this change, just a reorganization of code to move any direct POSIX
references out of posix.c in the libc implementation into posix_file.c
under the shared POSIX sources.

See #2495 for a
more detailed overview of the plan to port the WASI libc filesystem to Windows.

@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 21 times, most recently from 9aa004e to 1607e49 Compare September 25, 2023 21:16
@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 2 times, most recently from c94244d to fd8398a Compare September 25, 2023 21:39
@zoraaver zoraaver marked this pull request as ready for review September 25, 2023 21:40
@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 5 times, most recently from 99bc902 to 1723235 Compare October 5, 2023 07:55
@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 2 times, most recently from 6c4f8e1 to 9120fdc Compare October 17, 2023 15:36
@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 2 times, most recently from 2a68f80 to cc7c07a Compare October 17, 2023 18:26
Copy link
Contributor

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

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

LGTM

@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 2 times, most recently from 899aaf6 to 07ed266 Compare October 18, 2023 19:37
To allow non-POSIX platforms such as Windows to support WASI libc
filesystem functionality, create a set of wrapper functions which
provide a platform-agnostic interface to interact with the host
filesystem. For now, the Windows implementation is stubbed but this will
be implemented properly in a future PR. There are no functional changes
in this change, just a reorganization of code to move any direct POSIX
references out of posix.c in the libc implementation into posix_file.c
under the shared POSIX sources.

See bytecodealliance#2495 for a
more detailed overview of the plan to port the WASI libc filesystem to Windows.
@zoraaver zoraaver force-pushed the posix-filesystem-functions branch 3 times, most recently from 013166c to be7df3b Compare October 18, 2023 20:37
Copy link
Contributor

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@loganek loganek left a comment

Choose a reason for hiding this comment

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

LGTM.
@wenyongh if possible, could we wait with merging this PR before we merge this one first: #2637 ? Many thanks.

@wenyongh
Copy link
Contributor

LGTM. @wenyongh if possible, could we wait with merging this PR before we merge this one first: #2637 ? Many thanks.

Sure, I will merge this PR first.

@zoraaver, will you address the comment of #include "platform_wasi.h"? Or let's merge this PR and fix it in the next PR?

In order to get rid of the dependency of platform headers on
wasmtime_ssp.h, create a new header platform_wasi.h which defines the
WASI types. The platform filesystem implementations as well as the
wasi-libc code can then depend on this header without introducing any
dependency issues. Also, rename and move wasi_errno.h to libc_errno.h
under common platform sources since it has no depedencies except the
wasi types and libc errno codes.
@zoraaver
Copy link
Contributor Author

@zoraaver, will you address the comment of #include "platform_wasi.h"? Or let's merge this PR and fix it in the next PR?

addressed the comment 👍

@wenyongh wenyongh merged commit fa5e9d7 into bytecodealliance:dev/wasi-libc-windows Oct 19, 2023
381 checks passed
@zoraaver zoraaver deleted the posix-filesystem-functions branch October 19, 2023 17:04
hasheddan added a commit to hasheddan/wasm-micro-runtime that referenced this pull request Jan 25, 2024
Follows up the change in
bytecodealliance#2585 to
include libc utils when targeting zephyr, which abstracts posix
filesystem functions.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
To allow non-POSIX platforms such as Windows to support WASI libc
filesystem functionality, create a set of wrapper functions which provide a
platform-agnostic interface to interact with the host filesystem. For now,
the Windows implementation is stubbed but this will be implemented
properly in a future PR. There are no functional changes in this change,
just a reorganization of code to move any direct POSIX references out of
posix.c in the libc implementation into posix_file.c under the shared
POSIX sources.

See bytecodealliance#2495 for a
more detailed overview of the plan to port the WASI libc filesystem to Windows.
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.

4 participants