Crate libfs

source ·

Structs§

  • Struct representing a file extent metadata.

Enums§

Constants§

Functions§

  • Allocate file space on disk. Uses Posix ftruncate().
  • Copy a file. This differs from std::fs::copy in that it looks for sparse blocks and skips them.
  • File copy operation that defers file offset tracking to the underlying call. On Linux this attempts to use copy_file_range and falls back to user-space if that is not available.
  • File copy operation that that copies a block at offsetoff. On Linux this attempts to use copy_file_range and falls back to user-space if that is not available.
  • Create a clone of a special file (unix socket, char-device, etc.)
  • Copy file permissions. Will also copy xattr’s if possible.
  • Copy data between files, looking for sparse blocks and skipping them.
  • Copy file timestamps.
  • Determine if two files are the same by examining their inodes.
  • Attempt to retrieve a map of the underlying allocated extents for a file. Will return None if the filesystem doesn’t support extents. On Linux this is the raw list from fiemap. See merge_extents for a tool to merge contiguous extents.
  • Merge any contiguous extents in a list. See merge_extents.
  • Search the file for the next non-sparse file section. Returns the start and end of the data segment.
  • Guestimate if file is sparse; if it has less blocks that would be expected for its stated size. This is the same test used by coreutils cp.
  • Reflink a file. This will reuse the underlying data on disk for the target file, utilising copy-on-write for any future updates. Only certain filesystems support this; if not supported the function returns false.
  • Sync an open file to disk. Uses fsync(2).