summaryrefslogtreecommitdiff
path: root/ext/fs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2023-05-08 23:07:45 +0200
committerGitHub <noreply@github.com>2023-05-08 23:07:45 +0200
commit1f9d47b174a148dcfef2c86cfabd51b0b75f0dc7 (patch)
tree6cfcccf46646da95dc2f8116f0a89d20a2f74d74 /ext/fs
parente021070a2a564b2e972851360265f2466f7e4b22 (diff)
refactor: prefix ops w/ crate they are defined in (#19044)
Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'ext/fs')
-rw-r--r--ext/fs/30_fs.js146
-rw-r--r--ext/fs/lib.rs122
-rw-r--r--ext/fs/ops.rs128
3 files changed, 203 insertions, 193 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js
index 70cfcee6e..dbe064ab8 100644
--- a/ext/fs/30_fs.js
+++ b/ext/fs/30_fs.js
@@ -5,17 +5,17 @@
const core = globalThis.Deno.core;
const ops = core.ops;
const {
- op_chmod_async,
- op_ftruncate_async,
- op_truncate_async,
- op_link_async,
- op_flock_async,
+ op_fs_chmod_async,
+ op_fs_ftruncate_async,
+ op_fs_truncate_async,
+ op_fs_link_async,
+ op_fs_flock_async,
} = Deno.core.generateAsyncOpHandler(
- "op_chmod_async",
- "op_ftruncate_async",
- "op_truncate_async",
- "op_link_async",
- "op_flock_async",
+ "op_fs_chmod_async",
+ "op_fs_ftruncate_async",
+ "op_fs_truncate_async",
+ "op_fs_link_async",
+ "op_fs_flock_async",
);
const primordials = globalThis.__bootstrap.primordials;
const {
@@ -45,11 +45,11 @@ import {
import { pathFromURL } from "ext:deno_web/00_infra.js";
function chmodSync(path, mode) {
- ops.op_chmod_sync(pathFromURL(path), mode);
+ ops.op_fs_chmod_sync(pathFromURL(path), mode);
}
async function chmod(path, mode) {
- await op_chmod_async(pathFromURL(path), mode);
+ await op_fs_chmod_async(pathFromURL(path), mode);
}
function chownSync(
@@ -57,7 +57,7 @@ function chownSync(
uid,
gid,
) {
- ops.op_chown_sync(pathFromURL(path), uid, gid);
+ ops.op_fs_chown_sync(pathFromURL(path), uid, gid);
}
async function chown(
@@ -66,7 +66,7 @@ async function chown(
gid,
) {
await core.opAsync(
- "op_chown_async",
+ "op_fs_chown_async",
pathFromURL(path),
uid,
gid,
@@ -77,7 +77,7 @@ function copyFileSync(
fromPath,
toPath,
) {
- ops.op_copy_file_sync(
+ ops.op_fs_copy_file_sync(
pathFromURL(fromPath),
pathFromURL(toPath),
);
@@ -88,27 +88,31 @@ async function copyFile(
toPath,
) {
await core.opAsync(
- "op_copy_file_async",
+ "op_fs_copy_file_async",
pathFromURL(fromPath),
pathFromURL(toPath),
);
}
function cwd() {
- return ops.op_cwd();
+ return ops.op_fs_cwd();
}
function chdir(directory) {
- ops.op_chdir(pathFromURL(directory));
+ ops.op_fs_chdir(pathFromURL(directory));
}
function makeTempDirSync(options = {}) {
- return ops.op_make_temp_dir_sync(options.dir, options.prefix, options.suffix);
+ return ops.op_fs_make_temp_dir_sync(
+ options.dir,
+ options.prefix,
+ options.suffix,
+ );
}
function makeTempDir(options = {}) {
return core.opAsync(
- "op_make_temp_dir_async",
+ "op_fs_make_temp_dir_async",
options.dir,
options.prefix,
options.suffix,
@@ -116,7 +120,7 @@ function makeTempDir(options = {}) {
}
function makeTempFileSync(options = {}) {
- return ops.op_make_temp_file_sync(
+ return ops.op_fs_make_temp_file_sync(
options.dir,
options.prefix,
options.suffix,
@@ -125,7 +129,7 @@ function makeTempFileSync(options = {}) {
function makeTempFile(options = {}) {
return core.opAsync(
- "op_make_temp_file_async",
+ "op_fs_make_temp_file_async",
options.dir,
options.prefix,
options.suffix,
@@ -133,7 +137,7 @@ function makeTempFile(options = {}) {
}
function mkdirSync(path, options) {
- ops.op_mkdir_sync(
+ ops.op_fs_mkdir_sync(
pathFromURL(path),
options?.recursive ?? false,
options?.mode,
@@ -142,7 +146,7 @@ function mkdirSync(path, options) {
async function mkdir(path, options) {
await core.opAsync(
- "op_mkdir_async",
+ "op_fs_mkdir_async",
pathFromURL(path),
options?.recursive ?? false,
options?.mode,
@@ -150,14 +154,14 @@ async function mkdir(path, options) {
}
function readDirSync(path) {
- return ops.op_read_dir_sync(pathFromURL(path))[
+ return ops.op_fs_read_dir_sync(pathFromURL(path))[
SymbolIterator
]();
}
function readDir(path) {
const array = core.opAsync(
- "op_read_dir_async",
+ "op_fs_read_dir_async",
pathFromURL(path),
);
return {
@@ -171,26 +175,26 @@ function readDir(path) {
}
function readLinkSync(path) {
- return ops.op_read_link_sync(pathFromURL(path));
+ return ops.op_fs_read_link_sync(pathFromURL(path));
}
function readLink(path) {
- return core.opAsync("op_read_link_async", pathFromURL(path));
+ return core.opAsync("op_fs_read_link_async", pathFromURL(path));
}
function realPathSync(path) {
- return ops.op_realpath_sync(pathFromURL(path));
+ return ops.op_fs_realpath_sync(pathFromURL(path));
}
function realPath(path) {
- return core.opAsync("op_realpath_async", pathFromURL(path));
+ return core.opAsync("op_fs_realpath_async", pathFromURL(path));
}
function removeSync(
path,
options = {},
) {
- ops.op_remove_sync(
+ ops.op_fs_remove_sync(
pathFromURL(path),
!!options.recursive,
);
@@ -201,14 +205,14 @@ async function remove(
options = {},
) {
await core.opAsync(
- "op_remove_async",
+ "op_fs_remove_async",
pathFromURL(path),
!!options.recursive,
);
}
function renameSync(oldpath, newpath) {
- ops.op_rename_sync(
+ ops.op_fs_rename_sync(
pathFromURL(oldpath),
pathFromURL(newpath),
);
@@ -216,7 +220,7 @@ function renameSync(oldpath, newpath) {
async function rename(oldpath, newpath) {
await core.opAsync(
- "op_rename_async",
+ "op_fs_rename_async",
pathFromURL(oldpath),
pathFromURL(newpath),
);
@@ -322,31 +326,31 @@ function parseFileInfo(response) {
}
function fstatSync(rid) {
- ops.op_fstat_sync(rid, statBuf);
+ ops.op_fs_fstat_sync(rid, statBuf);
return statStruct(statBuf);
}
async function fstat(rid) {
- return parseFileInfo(await core.opAsync("op_fstat_async", rid));
+ return parseFileInfo(await core.opAsync("op_fs_fstat_async", rid));
}
async function lstat(path) {
- const res = await core.opAsync("op_lstat_async", pathFromURL(path));
+ const res = await core.opAsync("op_fs_lstat_async", pathFromURL(path));
return parseFileInfo(res);
}
function lstatSync(path) {
- ops.op_lstat_sync(pathFromURL(path), statBuf);
+ ops.op_fs_lstat_sync(pathFromURL(path), statBuf);
return statStruct(statBuf);
}
async function stat(path) {
- const res = await core.opAsync("op_stat_async", pathFromURL(path));
+ const res = await core.opAsync("op_fs_stat_async", pathFromURL(path));
return parseFileInfo(res);
}
function statSync(path) {
- ops.op_stat_sync(pathFromURL(path), statBuf);
+ ops.op_fs_stat_sync(pathFromURL(path), statBuf);
return statStruct(statBuf);
}
@@ -358,31 +362,31 @@ function coerceLen(len) {
}
function ftruncateSync(rid, len) {
- ops.op_ftruncate_sync(rid, coerceLen(len));
+ ops.op_fs_ftruncate_sync(rid, coerceLen(len));
}
async function ftruncate(rid, len) {
- await op_ftruncate_async(rid, coerceLen(len));
+ await op_fs_ftruncate_async(rid, coerceLen(len));
}
function truncateSync(path, len) {
- ops.op_truncate_sync(path, coerceLen(len));
+ ops.op_fs_truncate_sync(path, coerceLen(len));
}
async function truncate(path, len) {
- await op_truncate_async(path, coerceLen(len));
+ await op_fs_truncate_async(path, coerceLen(len));
}
function umask(mask) {
- return ops.op_umask(mask);
+ return ops.op_fs_umask(mask);
}
function linkSync(oldpath, newpath) {
- ops.op_link_sync(oldpath, newpath);
+ ops.op_fs_link_sync(oldpath, newpath);
}
async function link(oldpath, newpath) {
- await op_link_async(oldpath, newpath);
+ await op_fs_link_async(oldpath, newpath);
}
function toUnixTimeFromEpoch(value) {
@@ -413,7 +417,7 @@ function futimeSync(
) {
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
- ops.op_futime_sync(rid, atimeSec, atimeNsec, mtimeSec, mtimeNsec);
+ ops.op_fs_futime_sync(rid, atimeSec, atimeNsec, mtimeSec, mtimeNsec);
}
async function futime(
@@ -424,7 +428,7 @@ async function futime(
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
await core.opAsync(
- "op_futime_async",
+ "op_fs_futime_async",
rid,
atimeSec,
atimeNsec,
@@ -440,7 +444,7 @@ function utimeSync(
) {
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
- ops.op_utime_sync(
+ ops.op_fs_utime_sync(
pathFromURL(path),
atimeSec,
atimeNsec,
@@ -457,7 +461,7 @@ async function utime(
const { 0: atimeSec, 1: atimeNsec } = toUnixTimeFromEpoch(atime);
const { 0: mtimeSec, 1: mtimeNsec } = toUnixTimeFromEpoch(mtime);
await core.opAsync(
- "op_utime_async",
+ "op_fs_utime_async",
pathFromURL(path),
atimeSec,
atimeNsec,
@@ -471,7 +475,7 @@ function symlinkSync(
newpath,
options,
) {
- ops.op_symlink_sync(
+ ops.op_fs_symlink_sync(
pathFromURL(oldpath),
pathFromURL(newpath),
options?.type,
@@ -484,7 +488,7 @@ async function symlink(
options,
) {
await core.opAsync(
- "op_symlink_async",
+ "op_fs_symlink_async",
pathFromURL(oldpath),
pathFromURL(newpath),
options?.type,
@@ -492,35 +496,35 @@ async function symlink(
}
function fdatasyncSync(rid) {
- ops.op_fdatasync_sync(rid);
+ ops.op_fs_fdatasync_sync(rid);
}
async function fdatasync(rid) {
- await core.opAsync("op_fdatasync_async", rid);
+ await core.opAsync("op_fs_fdatasync_async", rid);
}
function fsyncSync(rid) {
- ops.op_fsync_sync(rid);
+ ops.op_fs_fsync_sync(rid);
}
async function fsync(rid) {
- await core.opAsync("op_fsync_async", rid);
+ await core.opAsync("op_fs_fsync_async", rid);
}
function flockSync(rid, exclusive) {
- ops.op_flock_sync(rid, exclusive === true);
+ ops.op_fs_flock_sync(rid, exclusive === true);
}
async function flock(rid, exclusive) {
- await op_flock_async(rid, exclusive === true);
+ await op_fs_flock_async(rid, exclusive === true);
}
function funlockSync(rid) {
- ops.op_funlock_sync(rid);
+ ops.op_fs_funlock_sync(rid);
}
async function funlock(rid) {
- await core.opAsync("op_funlock_async", rid);
+ await core.opAsync("op_fs_funlock_async", rid);
}
function seekSync(
@@ -528,7 +532,7 @@ function seekSync(
offset,
whence,
) {
- return ops.op_seek_sync(rid, offset, whence);
+ return ops.op_fs_seek_sync(rid, offset, whence);
}
function seek(
@@ -536,7 +540,7 @@ function seek(
offset,
whence,
) {
- return core.opAsync("op_seek_async", rid, offset, whence);
+ return core.opAsync("op_fs_seek_async", rid, offset, whence);
}
function openSync(
@@ -544,7 +548,7 @@ function openSync(
options,
) {
if (options) checkOpenOptions(options);
- const rid = ops.op_open_sync(
+ const rid = ops.op_fs_open_sync(
pathFromURL(path),
options,
);
@@ -558,7 +562,7 @@ async function open(
) {
if (options) checkOpenOptions(options);
const rid = await core.opAsync(
- "op_open_async",
+ "op_fs_open_async",
pathFromURL(path),
options,
);
@@ -685,7 +689,7 @@ function checkOpenOptions(options) {
const File = FsFile;
function readFileSync(path) {
- return ops.op_read_file_sync(pathFromURL(path));
+ return ops.op_fs_read_file_sync(pathFromURL(path));
}
async function readFile(path, options) {
@@ -700,7 +704,7 @@ async function readFile(path, options) {
try {
const read = await core.opAsync(
- "op_read_file_async",
+ "op_fs_read_file_async",
pathFromURL(path),
cancelRid,
);
@@ -716,7 +720,7 @@ async function readFile(path, options) {
}
function readTextFileSync(path) {
- return ops.op_read_file_text_sync(pathFromURL(path));
+ return ops.op_fs_read_file_text_sync(pathFromURL(path));
}
async function readTextFile(path, options) {
@@ -731,7 +735,7 @@ async function readTextFile(path, options) {
try {
const read = await core.opAsync(
- "op_read_file_text_async",
+ "op_fs_read_file_text_async",
pathFromURL(path),
cancelRid,
);
@@ -752,7 +756,7 @@ function writeFileSync(
options = {},
) {
options.signal?.throwIfAborted();
- ops.op_write_file_sync(
+ ops.op_fs_write_file_sync(
pathFromURL(path),
options.mode,
options.append ?? false,
@@ -789,7 +793,7 @@ async function writeFile(
});
} else {
await core.opAsync(
- "op_write_file_async",
+ "op_fs_write_file_async",
pathFromURL(path),
options.mode,
options.append ?? false,
diff --git a/ext/fs/lib.rs b/ext/fs/lib.rs
index fb0a6ffed..7ba6cd7ca 100644
--- a/ext/fs/lib.rs
+++ b/ext/fs/lib.rs
@@ -88,69 +88,69 @@ deno_core::extension!(deno_fs,
deps = [ deno_web ],
parameters = [P: FsPermissions],
ops = [
- op_cwd<P>,
- op_umask,
- op_chdir<P>,
+ op_fs_cwd<P>,
+ op_fs_umask,
+ op_fs_chdir<P>,
- op_open_sync<P>,
- op_open_async<P>,
- op_mkdir_sync<P>,
- op_mkdir_async<P>,
- op_chmod_sync<P>,
- op_chmod_async<P>,
- op_chown_sync<P>,
- op_chown_async<P>,
- op_remove_sync<P>,
- op_remove_async<P>,
- op_copy_file_sync<P>,
- op_copy_file_async<P>,
- op_stat_sync<P>,
- op_stat_async<P>,
- op_lstat_sync<P>,
- op_lstat_async<P>,
- op_realpath_sync<P>,
- op_realpath_async<P>,
- op_read_dir_sync<P>,
- op_read_dir_async<P>,
- op_rename_sync<P>,
- op_rename_async<P>,
- op_link_sync<P>,
- op_link_async<P>,
- op_symlink_sync<P>,
- op_symlink_async<P>,
- op_read_link_sync<P>,
- op_read_link_async<P>,
- op_truncate_sync<P>,
- op_truncate_async<P>,
- op_utime_sync<P>,
- op_utime_async<P>,
- op_make_temp_dir_sync<P>,
- op_make_temp_dir_async<P>,
- op_make_temp_file_sync<P>,
- op_make_temp_file_async<P>,
- op_write_file_sync<P>,
- op_write_file_async<P>,
- op_read_file_sync<P>,
- op_read_file_async<P>,
- op_read_file_text_sync<P>,
- op_read_file_text_async<P>,
+ op_fs_open_sync<P>,
+ op_fs_open_async<P>,
+ op_fs_mkdir_sync<P>,
+ op_fs_mkdir_async<P>,
+ op_fs_chmod_sync<P>,
+ op_fs_chmod_async<P>,
+ op_fs_chown_sync<P>,
+ op_fs_chown_async<P>,
+ op_fs_remove_sync<P>,
+ op_fs_remove_async<P>,
+ op_fs_copy_file_sync<P>,
+ op_fs_copy_file_async<P>,
+ op_fs_stat_sync<P>,
+ op_fs_stat_async<P>,
+ op_fs_lstat_sync<P>,
+ op_fs_lstat_async<P>,
+ op_fs_realpath_sync<P>,
+ op_fs_realpath_async<P>,
+ op_fs_read_dir_sync<P>,
+ op_fs_read_dir_async<P>,
+ op_fs_rename_sync<P>,
+ op_fs_rename_async<P>,
+ op_fs_link_sync<P>,
+ op_fs_link_async<P>,
+ op_fs_symlink_sync<P>,
+ op_fs_symlink_async<P>,
+ op_fs_read_link_sync<P>,
+ op_fs_read_link_async<P>,
+ op_fs_truncate_sync<P>,
+ op_fs_truncate_async<P>,
+ op_fs_utime_sync<P>,
+ op_fs_utime_async<P>,
+ op_fs_make_temp_dir_sync<P>,
+ op_fs_make_temp_dir_async<P>,
+ op_fs_make_temp_file_sync<P>,
+ op_fs_make_temp_file_async<P>,
+ op_fs_write_file_sync<P>,
+ op_fs_write_file_async<P>,
+ op_fs_read_file_sync<P>,
+ op_fs_read_file_async<P>,
+ op_fs_read_file_text_sync<P>,
+ op_fs_read_file_text_async<P>,
- op_seek_sync,
- op_seek_async,
- op_fdatasync_sync,
- op_fdatasync_async,
- op_fsync_sync,
- op_fsync_async,
- op_fstat_sync,
- op_fstat_async,
- op_flock_sync,
- op_flock_async,
- op_funlock_sync,
- op_funlock_async,
- op_ftruncate_sync,
- op_ftruncate_async,
- op_futime_sync,
- op_futime_async,
+ op_fs_seek_sync,
+ op_fs_seek_async,
+ op_fs_fdatasync_sync,
+ op_fs_fdatasync_async,
+ op_fs_fsync_sync,
+ op_fs_fsync_async,
+ op_fs_fstat_sync,
+ op_fs_fstat_async,
+ op_fs_flock_sync,
+ op_fs_flock_async,
+ op_fs_funlock_sync,
+ op_fs_funlock_async,
+ op_fs_ftruncate_sync,
+ op_fs_ftruncate_async,
+ op_fs_futime_sync,
+ op_fs_futime_async,
],
esm = [ "30_fs.js" ],
diff --git a/ext/fs/ops.rs b/ext/fs/ops.rs
index b866f8645..71526b217 100644
--- a/ext/fs/ops.rs
+++ b/ext/fs/ops.rs
@@ -34,7 +34,7 @@ use crate::FsPermissions;
use crate::OpenOptions;
#[op]
-pub fn op_cwd<P>(state: &mut OpState) -> Result<String, AnyError>
+pub fn op_fs_cwd<P>(state: &mut OpState) -> Result<String, AnyError>
where
P: FsPermissions + 'static,
{
@@ -48,7 +48,7 @@ where
}
#[op]
-fn op_chdir<P>(state: &mut OpState, directory: &str) -> Result<(), AnyError>
+fn op_fs_chdir<P>(state: &mut OpState, directory: &str) -> Result<(), AnyError>
where
P: FsPermissions + 'static,
{
@@ -61,7 +61,10 @@ where
}
#[op]
-fn op_umask(state: &mut OpState, mask: Option<u32>) -> Result<u32, AnyError>
+fn op_fs_umask(
+ state: &mut OpState,
+ mask: Option<u32>,
+) -> Result<u32, AnyError>
where
{
check_unstable(state, "Deno.umask");
@@ -69,7 +72,7 @@ where
}
#[op]
-fn op_open_sync<P>(
+fn op_fs_open_sync<P>(
state: &mut OpState,
path: String,
options: Option<OpenOptions>,
@@ -93,7 +96,7 @@ where
}
#[op]
-async fn op_open_async<P>(
+async fn op_fs_open_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
options: Option<OpenOptions>,
@@ -123,7 +126,7 @@ where
}
#[op]
-fn op_mkdir_sync<P>(
+fn op_fs_mkdir_sync<P>(
state: &mut OpState,
path: String,
recursive: bool,
@@ -148,7 +151,7 @@ where
}
#[op]
-async fn op_mkdir_async<P>(
+async fn op_fs_mkdir_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
recursive: bool,
@@ -175,7 +178,7 @@ where
}
#[op]
-fn op_chmod_sync<P>(
+fn op_fs_chmod_sync<P>(
state: &mut OpState,
path: String,
mode: u32,
@@ -193,7 +196,7 @@ where
}
#[op]
-async fn op_chmod_async<P>(
+async fn op_fs_chmod_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
mode: u32,
@@ -214,7 +217,7 @@ where
}
#[op]
-fn op_chown_sync<P>(
+fn op_fs_chown_sync<P>(
state: &mut OpState,
path: String,
uid: Option<u32>,
@@ -234,7 +237,7 @@ where
}
#[op]
-async fn op_chown_async<P>(
+async fn op_fs_chown_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
uid: Option<u32>,
@@ -256,7 +259,7 @@ where
}
#[op]
-fn op_remove_sync<P>(
+fn op_fs_remove_sync<P>(
state: &mut OpState,
path: &str,
recursive: bool,
@@ -278,7 +281,7 @@ where
}
#[op]
-async fn op_remove_async<P>(
+async fn op_fs_remove_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
recursive: bool,
@@ -304,7 +307,7 @@ where
}
#[op]
-fn op_copy_file_sync<P>(
+fn op_fs_copy_file_sync<P>(
state: &mut OpState,
from: &str,
to: &str,
@@ -327,7 +330,7 @@ where
}
#[op]
-async fn op_copy_file_async<P>(
+async fn op_fs_copy_file_async<P>(
state: Rc<RefCell<OpState>>,
from: String,
to: String,
@@ -354,7 +357,7 @@ where
}
#[op]
-fn op_stat_sync<P>(
+fn op_fs_stat_sync<P>(
state: &mut OpState,
path: String,
stat_out_buf: &mut [u32],
@@ -374,7 +377,7 @@ where
}
#[op]
-async fn op_stat_async<P>(
+async fn op_fs_stat_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
) -> Result<SerializableStat, AnyError>
@@ -396,7 +399,7 @@ where
}
#[op]
-fn op_lstat_sync<P>(
+fn op_fs_lstat_sync<P>(
state: &mut OpState,
path: String,
stat_out_buf: &mut [u32],
@@ -416,7 +419,7 @@ where
}
#[op]
-async fn op_lstat_async<P>(
+async fn op_fs_lstat_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
) -> Result<SerializableStat, AnyError>
@@ -438,7 +441,7 @@ where
}
#[op]
-fn op_realpath_sync<P>(
+fn op_fs_realpath_sync<P>(
state: &mut OpState,
path: String,
) -> Result<String, AnyError>
@@ -462,7 +465,7 @@ where
}
#[op]
-async fn op_realpath_async<P>(
+async fn op_fs_realpath_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
) -> Result<String, AnyError>
@@ -491,7 +494,7 @@ where
}
#[op]
-fn op_read_dir_sync<P>(
+fn op_fs_read_dir_sync<P>(
state: &mut OpState,
path: String,
) -> Result<Vec<FsDirEntry>, AnyError>
@@ -511,7 +514,7 @@ where
}
#[op]
-async fn op_read_dir_async<P>(
+async fn op_fs_read_dir_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
) -> Result<Vec<FsDirEntry>, AnyError>
@@ -537,7 +540,7 @@ where
}
#[op]
-fn op_rename_sync<P>(
+fn op_fs_rename_sync<P>(
state: &mut OpState,
oldpath: String,
newpath: String,
@@ -561,7 +564,7 @@ where
}
#[op]
-async fn op_rename_async<P>(
+async fn op_fs_rename_async<P>(
state: Rc<RefCell<OpState>>,
oldpath: String,
newpath: String,
@@ -589,7 +592,7 @@ where
}
#[op]
-fn op_link_sync<P>(
+fn op_fs_link_sync<P>(
state: &mut OpState,
oldpath: &str,
newpath: &str,
@@ -614,7 +617,7 @@ where
}
#[op]
-async fn op_link_async<P>(
+async fn op_fs_link_async<P>(
state: Rc<RefCell<OpState>>,
oldpath: String,
newpath: String,
@@ -643,7 +646,7 @@ where
}
#[op]
-fn op_symlink_sync<P>(
+fn op_fs_symlink_sync<P>(
state: &mut OpState,
oldpath: &str,
newpath: &str,
@@ -667,7 +670,7 @@ where
}
#[op]
-async fn op_symlink_async<P>(
+async fn op_fs_symlink_async<P>(
state: Rc<RefCell<OpState>>,
oldpath: String,
newpath: String,
@@ -695,7 +698,7 @@ where
}
#[op]
-fn op_read_link_sync<P>(
+fn op_fs_read_link_sync<P>(
state: &mut OpState,
path: String,
) -> Result<String, AnyError>
@@ -716,7 +719,7 @@ where
}
#[op]
-async fn op_read_link_async<P>(
+async fn op_fs_read_link_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
) -> Result<String, AnyError>
@@ -742,7 +745,7 @@ where
}
#[op]
-fn op_truncate_sync<P>(
+fn op_fs_truncate_sync<P>(
state: &mut OpState,
path: &str,
len: u64,
@@ -764,7 +767,7 @@ where
}
#[op]
-async fn op_truncate_async<P>(
+async fn op_fs_truncate_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
len: u64,
@@ -790,7 +793,7 @@ where
}
#[op]
-fn op_utime_sync<P>(
+fn op_fs_utime_sync<P>(
state: &mut OpState,
path: &str,
atime_secs: i64,
@@ -813,7 +816,7 @@ where
}
#[op]
-async fn op_utime_async<P>(
+async fn op_fs_utime_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
atime_secs: i64,
@@ -846,7 +849,7 @@ where
}
#[op]
-fn op_make_temp_dir_sync<P>(
+fn op_fs_make_temp_dir_sync<P>(
state: &mut OpState,
dir: Option<String>,
prefix: Option<String>,
@@ -879,7 +882,7 @@ where
}
#[op]
-async fn op_make_temp_dir_async<P>(
+async fn op_fs_make_temp_dir_async<P>(
state: Rc<RefCell<OpState>>,
dir: Option<String>,
prefix: Option<String>,
@@ -912,7 +915,7 @@ where
}
#[op]
-fn op_make_temp_file_sync<P>(
+fn op_fs_make_temp_file_sync<P>(
state: &mut OpState,
dir: Option<String>,
prefix: Option<String>,
@@ -952,7 +955,7 @@ where
}
#[op]
-async fn op_make_temp_file_async<P>(
+async fn op_fs_make_temp_file_async<P>(
state: Rc<RefCell<OpState>>,
dir: Option<String>,
prefix: Option<String>,
@@ -1067,7 +1070,7 @@ fn tmp_name(
}
#[op]
-fn op_write_file_sync<P>(
+fn op_fs_write_file_sync<P>(
state: &mut OpState,
path: String,
mode: Option<u32>,
@@ -1094,7 +1097,7 @@ where
}
#[op]
-async fn op_write_file_async<P>(
+async fn op_fs_write_file_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
mode: Option<u32>,
@@ -1138,7 +1141,7 @@ where
}
#[op]
-fn op_read_file_sync<P>(
+fn op_fs_read_file_sync<P>(
state: &mut OpState,
path: String,
) -> Result<ZeroCopyBuf, AnyError>
@@ -1157,7 +1160,7 @@ where
}
#[op]
-async fn op_read_file_async<P>(
+async fn op_fs_read_file_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
cancel_rid: Option<ResourceId>,
@@ -1194,7 +1197,7 @@ where
}
#[op]
-fn op_read_file_text_sync<P>(
+fn op_fs_read_file_text_sync<P>(
state: &mut OpState,
path: String,
) -> Result<String, AnyError>
@@ -1213,7 +1216,7 @@ where
}
#[op]
-async fn op_read_file_text_async<P>(
+async fn op_fs_read_file_text_async<P>(
state: Rc<RefCell<OpState>>,
path: String,
cancel_rid: Option<ResourceId>,
@@ -1273,7 +1276,7 @@ fn to_seek_from(offset: i64, whence: i32) -> Result<SeekFrom, AnyError> {
}
#[op]
-fn op_seek_sync(
+fn op_fs_seek_sync(
state: &mut OpState,
rid: ResourceId,
offset: i64,
@@ -1286,7 +1289,7 @@ fn op_seek_sync(
}
#[op]
-async fn op_seek_async(
+async fn op_fs_seek_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
offset: i64,
@@ -1299,7 +1302,7 @@ async fn op_seek_async(
}
#[op]
-fn op_fdatasync_sync(
+fn op_fs_fdatasync_sync(
state: &mut OpState,
rid: ResourceId,
) -> Result<(), AnyError> {
@@ -1309,7 +1312,7 @@ fn op_fdatasync_sync(
}
#[op]
-async fn op_fdatasync_async(
+async fn op_fs_fdatasync_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
) -> Result<(), AnyError> {
@@ -1319,14 +1322,17 @@ async fn op_fdatasync_async(
}
#[op]
-fn op_fsync_sync(state: &mut OpState, rid: ResourceId) -> Result<(), AnyError> {
+fn op_fs_fsync_sync(
+ state: &mut OpState,
+ rid: ResourceId,
+) -> Result<(), AnyError> {
let file = FileResource::get_file(state, rid)?;
file.sync_sync()?;
Ok(())
}
#[op]
-async fn op_fsync_async(
+async fn op_fs_fsync_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
) -> Result<(), AnyError> {
@@ -1336,7 +1342,7 @@ async fn op_fsync_async(
}
#[op]
-fn op_fstat_sync(
+fn op_fs_fstat_sync(
state: &mut OpState,
rid: ResourceId,
stat_out_buf: &mut [u32],
@@ -1349,7 +1355,7 @@ fn op_fstat_sync(
}
#[op]
-async fn op_fstat_async(
+async fn op_fs_fstat_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
) -> Result<SerializableStat, AnyError> {
@@ -1359,7 +1365,7 @@ async fn op_fstat_async(
}
#[op]
-fn op_flock_sync(
+fn op_fs_flock_sync(
state: &mut OpState,
rid: ResourceId,
exclusive: bool,
@@ -1371,7 +1377,7 @@ fn op_flock_sync(
}
#[op]
-async fn op_flock_async(
+async fn op_fs_flock_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
exclusive: bool,
@@ -1383,7 +1389,7 @@ async fn op_flock_async(
}
#[op]
-fn op_funlock_sync(
+fn op_fs_funlock_sync(
state: &mut OpState,
rid: ResourceId,
) -> Result<(), AnyError> {
@@ -1394,7 +1400,7 @@ fn op_funlock_sync(
}
#[op]
-async fn op_funlock_async(
+async fn op_fs_funlock_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
) -> Result<(), AnyError> {
@@ -1405,7 +1411,7 @@ async fn op_funlock_async(
}
#[op]
-fn op_ftruncate_sync(
+fn op_fs_ftruncate_sync(
state: &mut OpState,
rid: ResourceId,
len: u64,
@@ -1416,7 +1422,7 @@ fn op_ftruncate_sync(
}
#[op]
-async fn op_ftruncate_async(
+async fn op_fs_ftruncate_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
len: u64,
@@ -1427,7 +1433,7 @@ async fn op_ftruncate_async(
}
#[op]
-fn op_futime_sync(
+fn op_fs_futime_sync(
state: &mut OpState,
rid: ResourceId,
atime_secs: i64,
@@ -1441,7 +1447,7 @@ fn op_futime_sync(
}
#[op]
-async fn op_futime_async(
+async fn op_fs_futime_async(
state: Rc<RefCell<OpState>>,
rid: ResourceId,
atime_secs: i64,