summaryrefslogtreecommitdiff
path: root/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go
diff options
context:
space:
mode:
authorLibravatar Terin Stock <terinjokes@gmail.com>2025-03-09 17:47:56 +0100
committerLibravatar Terin Stock <terinjokes@gmail.com>2025-03-10 01:59:49 +0100
commit3ac1ee16f377d31a0fb80c8dae28b6239ac4229e (patch)
treef61faa581feaaeaba2542b9f2b8234a590684413 /vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go
parent[chore] update URLs to forked source (diff)
downloadgotosocial-3ac1ee16f377d31a0fb80c8dae28b6239ac4229e.tar.xz
[chore] remove vendor
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go')
-rw-r--r--vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go105
1 files changed, 0 insertions, 105 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go b/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go
deleted file mode 100644
index 51a9a5480..000000000
--- a/vendor/github.com/tetratelabs/wazero/internal/sysfs/adapter.go
+++ /dev/null
@@ -1,105 +0,0 @@
-package sysfs
-
-import (
- "fmt"
- "io/fs"
- "path"
-
- experimentalsys "github.com/tetratelabs/wazero/experimental/sys"
- "github.com/tetratelabs/wazero/sys"
-)
-
-type AdaptFS struct {
- FS fs.FS
-}
-
-// String implements fmt.Stringer
-func (a *AdaptFS) String() string {
- return fmt.Sprintf("%v", a.FS)
-}
-
-// OpenFile implements the same method as documented on sys.FS
-func (a *AdaptFS) OpenFile(path string, flag experimentalsys.Oflag, perm fs.FileMode) (experimentalsys.File, experimentalsys.Errno) {
- return OpenFSFile(a.FS, cleanPath(path), flag, perm)
-}
-
-// Lstat implements the same method as documented on sys.FS
-func (a *AdaptFS) Lstat(path string) (sys.Stat_t, experimentalsys.Errno) {
- // At this time, we make the assumption sys.FS instances do not support
- // symbolic links, therefore Lstat is the same as Stat. This is obviously
- // not true, but until FS.FS has a solid story for how to handle symlinks,
- // we are better off not making a decision that would be difficult to
- // revert later on.
- //
- // For further discussions on the topic, see:
- // https://github.com/golang/go/issues/49580
- return a.Stat(path)
-}
-
-// Stat implements the same method as documented on sys.FS
-func (a *AdaptFS) Stat(path string) (sys.Stat_t, experimentalsys.Errno) {
- f, errno := a.OpenFile(path, experimentalsys.O_RDONLY, 0)
- if errno != 0 {
- return sys.Stat_t{}, errno
- }
- defer f.Close()
- return f.Stat()
-}
-
-// Readlink implements the same method as documented on sys.FS
-func (a *AdaptFS) Readlink(string) (string, experimentalsys.Errno) {
- return "", experimentalsys.ENOSYS
-}
-
-// Mkdir implements the same method as documented on sys.FS
-func (a *AdaptFS) Mkdir(string, fs.FileMode) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Chmod implements the same method as documented on sys.FS
-func (a *AdaptFS) Chmod(string, fs.FileMode) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Rename implements the same method as documented on sys.FS
-func (a *AdaptFS) Rename(string, string) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Rmdir implements the same method as documented on sys.FS
-func (a *AdaptFS) Rmdir(string) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Link implements the same method as documented on sys.FS
-func (a *AdaptFS) Link(string, string) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Symlink implements the same method as documented on sys.FS
-func (a *AdaptFS) Symlink(string, string) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Unlink implements the same method as documented on sys.FS
-func (a *AdaptFS) Unlink(string) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-// Utimens implements the same method as documented on sys.FS
-func (a *AdaptFS) Utimens(string, int64, int64) experimentalsys.Errno {
- return experimentalsys.ENOSYS
-}
-
-func cleanPath(name string) string {
- if len(name) == 0 {
- return name
- }
- // fs.ValidFile cannot be rooted (start with '/')
- cleaned := name
- if name[0] == '/' {
- cleaned = name[1:]
- }
- cleaned = path.Clean(cleaned) // e.g. "sub/." -> "sub"
- return cleaned
-}