-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#164 (comment) Signed-off-by: Roman Volosatovs <[email protected]>
- Loading branch information
1 parent
a7b76d0
commit 81bd8bb
Showing
3 changed files
with
43 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package wasi:filesystem@0.3.0-draft; | ||
|
||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
interface preopens { | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
use types.{descriptor}; | ||
|
||
/// Return the set of preopened directories, and their paths. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
get-directories: func() -> list<tuple<descriptor, string>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,19 +23,19 @@ package wasi:[email protected]; | |
/// [WASI filesystem path resolution]. | ||
/// | ||
/// [WASI filesystem path resolution]: https://github.com/WebAssembly/wasi-filesystem/blob/main/path-resolution.md | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
interface types { | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
use wasi:clocks/wall-clock@0.3.0.{datetime}; | ||
|
||
/// File size or length of a region within a file. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
type filesize = u64; | ||
|
||
/// The type of a filesystem object referenced by a descriptor. | ||
/// | ||
/// Note: This was called `filetype` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
enum descriptor-type { | ||
/// The type of the descriptor or file is unknown or is different from | ||
/// any of the other types specified. | ||
|
@@ -59,7 +59,7 @@ interface types { | |
/// Descriptor flags. | ||
/// | ||
/// Note: This was called `fdflags` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
flags descriptor-flags { | ||
/// Read mode: Data can be read. | ||
read, | ||
|
@@ -103,7 +103,7 @@ interface types { | |
/// File attributes. | ||
/// | ||
/// Note: This was called `filestat` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
record descriptor-stat { | ||
/// File type. | ||
%type: descriptor-type, | ||
|
@@ -130,15 +130,15 @@ interface types { | |
} | ||
|
||
/// Flags determining the method of how paths are resolved. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
flags path-flags { | ||
/// As long as the resolved path corresponds to a symbolic link, it is | ||
/// expanded. | ||
symlink-follow, | ||
} | ||
|
||
/// Open flags used by `open-at`. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
flags open-flags { | ||
/// Create file if it does not exist, similar to `O_CREAT` in POSIX. | ||
create, | ||
|
@@ -151,11 +151,11 @@ interface types { | |
} | ||
|
||
/// Number of hard links to an inode. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
type link-count = u64; | ||
|
||
/// When setting a timestamp, this gives the value to set it to. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
variant new-timestamp { | ||
/// Leave the timestamp set to its previous value. | ||
no-change, | ||
|
@@ -255,7 +255,7 @@ interface types { | |
} | ||
|
||
/// File or memory access pattern advisory information. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
enum advice { | ||
/// The application has no advice to give on its behavior with respect | ||
/// to the specified data. | ||
|
@@ -279,7 +279,7 @@ interface types { | |
|
||
/// A 128-bit hash value, split into parts because wasm doesn't have a | ||
/// 128-bit integer type. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
record metadata-hash-value { | ||
/// 64 bits of a 128-bit hash value. | ||
lower: u64, | ||
|
@@ -290,7 +290,7 @@ interface types { | |
/// A descriptor is a reference to a filesystem object, which may be a file, | ||
/// directory, named pipe, special file, or other object on which filesystem | ||
/// calls may be made. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
resource descriptor { | ||
/// Return a stream for reading from a file, if available. | ||
/// | ||
|
@@ -346,7 +346,7 @@ interface types { | |
/// Provide file advisory information on a descriptor. | ||
/// | ||
/// This is similar to `posix_fadvise` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
advise: func( | ||
/// The offset within the file to which the advisory applies. | ||
offset: filesize, | ||
|
@@ -362,7 +362,7 @@ interface types { | |
/// opened for writing. | ||
/// | ||
/// Note: This is similar to `fdatasync` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
sync-data: func() -> result<_, error-code>; | ||
|
||
/// Get flags associated with a descriptor. | ||
|
@@ -371,7 +371,7 @@ interface types { | |
/// | ||
/// Note: This returns the value that was the `fs_flags` value returned | ||
/// from `fdstat_get` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
get-flags: func() -> result<descriptor-flags, error-code>; | ||
|
||
/// Get the dynamic type of a descriptor. | ||
|
@@ -384,22 +384,22 @@ interface types { | |
/// | ||
/// Note: This returns the value that was the `fs_filetype` value returned | ||
/// from `fdstat_get` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
get-type: func() -> result<descriptor-type, error-code>; | ||
|
||
/// Adjust the size of an open file. If this increases the file's size, the | ||
/// extra bytes are filled with zeros. | ||
/// | ||
/// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
set-size: func(size: filesize) -> result<_, error-code>; | ||
|
||
/// Adjust the timestamps of an open file or directory. | ||
/// | ||
/// Note: This is similar to `futimens` in POSIX. | ||
/// | ||
/// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
set-times: func( | ||
/// The desired values of the data access timestamp. | ||
data-access-timestamp: new-timestamp, | ||
|
@@ -416,7 +416,7 @@ interface types { | |
/// This always returns a new stream which starts at the beginning of the | ||
/// directory. Multiple streams may be active on the same directory, and they | ||
/// do not interfere with each other. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
read-directory: func() -> result<directory-entry-stream, error-code>; | ||
|
||
/// Synchronize the data and metadata of a file to disk. | ||
|
@@ -425,13 +425,13 @@ interface types { | |
/// opened for writing. | ||
/// | ||
/// Note: This is similar to `fsync` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
sync: func() -> result<_, error-code>; | ||
|
||
/// Create a directory. | ||
/// | ||
/// Note: This is similar to `mkdirat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
create-directory-at: func( | ||
/// The relative path at which to create the directory. | ||
path: string, | ||
|
@@ -446,7 +446,7 @@ interface types { | |
/// modified, use `metadata-hash`. | ||
/// | ||
/// Note: This was called `fd_filestat_get` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
stat: func() -> result<descriptor-stat, error-code>; | ||
|
||
/// Return the attributes of a file or directory. | ||
|
@@ -456,7 +456,7 @@ interface types { | |
/// discussion of alternatives. | ||
/// | ||
/// Note: This was called `path_filestat_get` in earlier versions of WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
stat-at: func( | ||
/// Flags determining the method of how the path is resolved. | ||
path-flags: path-flags, | ||
|
@@ -470,7 +470,7 @@ interface types { | |
/// | ||
/// Note: This was called `path_filestat_set_times` in earlier versions of | ||
/// WASI. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
set-times-at: func( | ||
/// Flags determining the method of how the path is resolved. | ||
path-flags: path-flags, | ||
|
@@ -485,7 +485,7 @@ interface types { | |
/// Create a hard link. | ||
/// | ||
/// Note: This is similar to `linkat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
link-at: func( | ||
/// Flags determining the method of how the path is resolved. | ||
old-path-flags: path-flags, | ||
|
@@ -509,7 +509,7 @@ interface types { | |
/// `error-code::read-only`. | ||
/// | ||
/// Note: This is similar to `openat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
open-at: func( | ||
/// Flags determining the method of how the path is resolved. | ||
path-flags: path-flags, | ||
|
@@ -527,7 +527,7 @@ interface types { | |
/// filesystem, this function fails with `error-code::not-permitted`. | ||
/// | ||
/// Note: This is similar to `readlinkat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
readlink-at: func( | ||
/// The relative path of the symbolic link from which to read. | ||
path: string, | ||
|
@@ -538,7 +538,7 @@ interface types { | |
/// Return `error-code::not-empty` if the directory is not empty. | ||
/// | ||
/// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
remove-directory-at: func( | ||
/// The relative path to a directory to remove. | ||
path: string, | ||
|
@@ -547,7 +547,7 @@ interface types { | |
/// Rename a filesystem object. | ||
/// | ||
/// Note: This is similar to `renameat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
rename-at: func( | ||
/// The relative source path of the file or directory to rename. | ||
old-path: string, | ||
|
@@ -563,7 +563,7 @@ interface types { | |
/// `error-code::not-permitted`. | ||
/// | ||
/// Note: This is similar to `symlinkat` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
symlink-at: func( | ||
/// The contents of the symbolic link. | ||
old-path: string, | ||
|
@@ -575,7 +575,7 @@ interface types { | |
/// | ||
/// Return `error-code::is-directory` if the path refers to a directory. | ||
/// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
unlink-file-at: func( | ||
/// The relative path to a file to unlink. | ||
path: string, | ||
|
@@ -587,7 +587,7 @@ interface types { | |
/// same device (`st_dev`) and inode (`st_ino` or `d_ino`) numbers. | ||
/// wasi-filesystem does not expose device and inode numbers, so this function | ||
/// may be used instead. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
is-same-object: func(other: borrow<descriptor>) -> bool; | ||
|
||
/// Return a hash of the metadata associated with a filesystem object referred | ||
|
@@ -609,14 +609,14 @@ interface types { | |
/// computed hash. | ||
/// | ||
/// However, none of these is required. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
metadata-hash: func() -> result<metadata-hash-value, error-code>; | ||
|
||
/// Return a hash of the metadata associated with a filesystem object referred | ||
/// to by a directory descriptor and a relative path. | ||
/// | ||
/// This performs the same hash computation as `metadata-hash`. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
metadata-hash-at: func( | ||
/// Flags determining the method of how the path is resolved. | ||
path-flags: path-flags, | ||
|
@@ -626,10 +626,10 @@ interface types { | |
} | ||
|
||
/// A stream of directory entries. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
resource directory-entry-stream { | ||
/// Read a single directory entry from a `directory-entry-stream`. | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
read-directory-entry: func() -> result<option<directory-entry>, error-code>; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
package wasi:filesystem@0.3.0-draft; | ||
|
||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
world imports { | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
import types; | ||
@since(version = 0.2.0) | ||
@since(version = 0.3.0) | ||
import preopens; | ||
} |