diff options
Diffstat (limited to 'ext/fs/ops.rs')
-rw-r--r-- | ext/fs/ops.rs | 128 |
1 files changed, 67 insertions, 61 deletions
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, |