wasmer_wasix/journal/effector/syscalls/
path_symlink.rs1use super::*;
2
3impl JournalEffector {
4 pub fn save_path_symlink(
5 ctx: &mut FunctionEnvMut<'_, WasiEnv>,
6 old_path: String,
7 fd: Fd,
8 new_path: String,
9 ) -> anyhow::Result<()> {
10 Self::save_event(
11 ctx,
12 JournalEntry::CreateSymbolicLinkV1 {
13 old_path: old_path.into(),
14 fd,
15 new_path: new_path.into(),
16 },
17 )
18 }
19
20 pub fn apply_path_symlink(
21 ctx: &mut FunctionEnvMut<'_, WasiEnv>,
22 old_path: &str,
23 fd: Fd,
24 new_path: &str,
25 ) -> anyhow::Result<()> {
26 crate::syscalls::path_symlink_internal(ctx, old_path, fd, new_path)
27 .map_err(|err| {
28 anyhow::format_err!(
29 "journal restore error: failed to create symlink (old_path={old_path}, fd={fd}, new_path={new_path}) - {err}")
30 })?;
31 Ok(())
32 }
33}