Documentation
¶
Index ¶
- func DisableCopyOnWrite(dir string) error
- func IsNFS(path string) (bool, error)
- func MatchCopyOnWrite(dst, src string) error
- func TranslateWindowsToWSLPath(orig string) (string, error)
- func WarnIfFullCopy(dst, src string)
- func WindowsSubsystemPath(_ context.Context, _ string) (string, error)
- func WindowsSubsystemPathForLinux(_ context.Context, _, _ string) (string, error)
- func WindowsSubsystemPathWithCygpath(_ context.Context, _, _ string) (string, error)
- func WriteFileAtomic(path string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableCopyOnWrite ¶ added in v2.3.0
DisableCopyOnWrite sets the No_COW attribute (`chattr +C`) on dir when dir is on btrfs, like libvirt does for new storage pools. Files created in dir afterwards inherit it, so in-place writes do not fragment VM disk images there. Files already in dir are not affected. On other filesystems, and with the environment variable LIMA_BTRFS_NOCOW=false, DisableCopyOnWrite does nothing.
func IsNFS ¶
IsNFS checks if the path is on NFS. If the path does not exist yet, it will walk up parent directories until one exists, or it hits '/' or '.'. Any other stat errors will cause IsNFS to fail.
func MatchCopyOnWrite ¶ added in v2.3.0
MatchCopyOnWrite gives dst the No_COW attribute of src, or takes it away when src has none, if both are on btrfs. btrfs cannot reflink between files with and without the attribute, so the directory for a copy of an instance must follow the original, whatever LIMA_BTRFS_NOCOW says. When src is not on btrfs, dst gets what DisableCopyOnWrite gives a new directory.
func TranslateWindowsToWSLPath ¶ added in v2.3.0
TranslateWindowsToWSLPath translates a Windows path (e.g., C:\Users\...) to a WSL-compliant path (e.g., /mnt/c/Users/...).
func WarnIfFullCopy ¶ added in v2.3.0
func WarnIfFullCopy(dst, src string)
WarnIfFullCopy warns that copying src to dst will copy every block when both are on btrfs and only one of src and the directory of dst has the No_COW attribute: btrfs cannot reflink between them, and the copy functions do not report whether they made a reflink.
func WindowsSubsystemPath ¶ added in v2.2.0
WindowsSubsystemPath is the non-Windows stub for the Windows-only implementation in fsutil_windows.go.
func WindowsSubsystemPathForLinux ¶ added in v2.2.0
WindowsSubsystemPathForLinux is the non-Windows stub for the Windows-only implementation in fsutil_windows.go.
func WindowsSubsystemPathWithCygpath ¶ added in v2.2.0
WindowsSubsystemPathWithCygpath is the non-Windows stub for the Windows-only implementation in fsutil_windows.go.
func WriteFileAtomic ¶ added in v2.3.0
WriteFileAtomic writes data to a temp file in path's directory and renames it onto path, so a reader sees the old file or the whole new one, never a partial write; the rename is atomic on Unix only. os.CreateTemp requests 0600, so the result is 0600 masked by the umask (0600 under a typical umask).
Types ¶
This section is empty.