fsutil

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fsutil provides filesystem utilities for hardlink operations.

Index

Constants

View Source
const ContentDirMode os.FileMode = 0o777

ContentDirMode is the mode passed to os.MkdirAll for directories that hold torrent content / hardlink / reflink trees. It is intentionally 0o777 so the process umask controls the final permissions (0o777 & ~022 = 0755 default; 0o777 & ~002 = 0775 for shared-group setups where qBittorrent and qui run as different users). See discussion #1704.

Do NOT tighten this to 0755. That re-breaks umask-controlled group write: the group-write bit can only be preserved by the umask if it is requested here first.

View Source
const LinkTreeBaseDirMode os.FileMode = 0o770

LinkTreeBaseDirMode is like ContentDirMode but for base directories that were historically created without any "other" access (the dir-scan hardlink base was 0o750). It carries no other-bits, so it can never grant world access regardless of umask, while still letting the umask decide group permissions (0o770 & ~022 = 0750 default; 0o770 & ~002 = 0770 for shared-group setups).

Variables

This section is empty.

Functions

func SameFilesystem

func SameFilesystem(path1, path2 string) (bool, error)

SameFilesystem checks if two paths are on the same filesystem. This is required for hardlinks, which cannot span filesystems. Returns true if both paths are on the same filesystem, false otherwise. Returns an error if either path doesn't exist or cannot be accessed.

Implementation is platform-specific:

  • Unix: compares device IDs from stat(2)
  • Windows: compares volume serial numbers

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL