Exposes writeable filesystem as experimentalsys.FS (#1605)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2023-07-31 07:56:28 +08:00
committed by GitHub
parent d88286ba63
commit 1f8c908f1c
67 changed files with 1058 additions and 1000 deletions

View File

@@ -3,25 +3,25 @@ package sysfs
import (
"syscall"
"github.com/tetratelabs/wazero/internal/fsapi"
"github.com/tetratelabs/wazero/experimental/sys"
)
const supportedSyscallOflag = fsapi.O_DIRECTORY | fsapi.O_DSYNC | fsapi.O_NOFOLLOW | fsapi.O_NONBLOCK | fsapi.O_RSYNC
const supportedSyscallOflag = sys.O_DIRECTORY | sys.O_DSYNC | sys.O_NOFOLLOW | sys.O_NONBLOCK | sys.O_RSYNC
func withSyscallOflag(oflag fsapi.Oflag, flag int) int {
if oflag&fsapi.O_DIRECTORY != 0 {
func withSyscallOflag(oflag sys.Oflag, flag int) int {
if oflag&sys.O_DIRECTORY != 0 {
flag |= syscall.O_DIRECTORY
}
if oflag&fsapi.O_DSYNC != 0 {
if oflag&sys.O_DSYNC != 0 {
flag |= syscall.O_DSYNC
}
if oflag&fsapi.O_NOFOLLOW != 0 {
if oflag&sys.O_NOFOLLOW != 0 {
flag |= syscall.O_NOFOLLOW
}
if oflag&fsapi.O_NONBLOCK != 0 {
if oflag&sys.O_NONBLOCK != 0 {
flag |= syscall.O_NONBLOCK
}
if oflag&fsapi.O_RSYNC != 0 {
if oflag&sys.O_RSYNC != 0 {
flag |= syscall.O_RSYNC
}
return flag