From 7ec85fee2123aa6cb649bc31b79f22edb2471514 Mon Sep 17 00:00:00 2001 From: Patrick Ferris Date: Mon, 1 Apr 2024 10:10:10 +0100 Subject: [PATCH] Fix eio_linux --- lib_eio_linux/eio_linux.ml | 4 ++-- lib_eio_linux/low_level.ml | 6 +++--- lib_eio_linux/low_level.mli | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib_eio_linux/eio_linux.ml b/lib_eio_linux/eio_linux.ml index 0fc4e9e65..b8270d0ed 100644 --- a/lib_eio_linux/eio_linux.ml +++ b/lib_eio_linux/eio_linux.ml @@ -600,8 +600,8 @@ end = struct | Some fd2 -> Low_level.rename t.fd old_path fd2 new_path | None -> raise (Unix.Unix_error (Unix.EXDEV, "rename-dst", new_path)) - let symlink t old_path new_path = - Low_level.symlink old_path t.fd new_path + let symlink t path ~link_to = + Low_level.symlink link_to t.fd path let pp f t = Fmt.string f (String.escaped t.label) diff --git a/lib_eio_linux/low_level.ml b/lib_eio_linux/low_level.ml index 688ba49f8..ac74e4165 100644 --- a/lib_eio_linux/low_level.ml +++ b/lib_eio_linux/low_level.ml @@ -452,10 +452,10 @@ let rename old_dir old_path new_dir new_path = new_parent new_leaf with Unix.Unix_error (code, name, arg) -> raise @@ Err.wrap_fs code name arg -let symlink old_path new_dir new_path = - with_parent_dir "renameat-new" new_dir new_path @@ fun new_parent new_leaf -> +let symlink link_to dir path = + with_parent_dir "symlinkat-new" dir path @@ fun parent leaf -> try - eio_symlinkat old_path new_parent new_leaf + eio_symlinkat link_to parent leaf with Unix.Unix_error (code, name, arg) -> raise @@ Err.wrap_fs code name arg let shutdown socket command = diff --git a/lib_eio_linux/low_level.mli b/lib_eio_linux/low_level.mli index b3ba6f786..66543ef8d 100644 --- a/lib_eio_linux/low_level.mli +++ b/lib_eio_linux/low_level.mli @@ -151,7 +151,7 @@ val rename : dir_fd -> string -> dir_fd -> string -> unit (** [rename old_dir old_path new_dir new_path] renames [old_dir / old_path] as [new_dir / new_path]. *) val symlink : string -> dir_fd -> string -> unit -(** [symlink old_path dir new_path] symlinks to [dir / old_path] as [dir / new_path]. *) +(** [symlink link_to dir path] creates a new symlink at [dir / path] pointing to [link_to]. *) val pipe : sw:Switch.t -> fd * fd (** [pipe ~sw] returns a pair [r, w] with the readable and writeable ends of a new pipe. *)