Module: fs.link
Source: ./fs/link.reef
Overview
fs/link - Symlink and hard link operations
Provides functions for creating and reading symbolic links and hard links. All three return Result[T, error.Error]: Ok on success, Err on failure.
symlink/hardlink return Result[bool, error.Error]: Ok(true) on success (the void-success convention — never Ok(false)), Err(AlreadyExists) if the link path already exists (the deterministic, checkable case), Err(IoError) for any other reason (missing parent directory, permission denied, unsupported filesystem, etc.). Reef's fs syscalls don't currently expose errno the way net does via reef_net_last_error, so PermissionDenied can't reliably be told apart from other I/O failures here — it's IoError until such a primitive exists.
readlink returns Result[string, error.Error]: Ok(target) on success,
Err(InvalidInput) if path exists but is not a symlink, Err(IoError)
for any other failure (including a missing path).
Functions
fn link_failure_kind(link_path: string): error.ErrorKind
Classifies a symlink/hardlink creation failure for link_path:
AlreadyExists if a file already sits at that path, IoError for any other
reason. See the module doc comment for why PermissionDenied isn't
distinguished from IoError here.
fn symlink(target: string, link_path: string): result.Result[bool, error.Error]
Create a symbolic link at link_path pointing to target. Ok(true) on success. Err(AlreadyExists) if link_path already exists, Err(IoError) for any other failure.
fn readlink(path: string): result.Result[string, error.Error]
Read the target of a symbolic link at path.
Ok(target) on success. Err(InvalidInput) if path exists but is not a
symlink, Err(IoError) for any other failure (including a missing path).
fn hardlink(old_path: string, new_path: string): result.Result[bool, error.Error]
Create a hard link (new_path points to same inode as old_path). Ok(true) on success. Err(AlreadyExists) if new_path already exists, Err(IoError) for any other failure.
Generated by reefc doc