Documentation
¶
Index ¶
Constants ¶
View Source
const ( // KiBPow2 defines 10. KiBPow2 = (iota + 1) * 10 // 10 MiBPow2 // 20 GiBPow2 // 30 TiBPow2 // 40 PiBPow2 // 50 EiBPow2 // 60 ZiBPow2 // 70 YiBPow2 // 80 KiB = 1 << 10 // 2^10 bytes MiB = 1 << 20 // 2^20 bytes GiB = 1 << 30 // 2^30 bytes TiB = 1 << 40 // 2^40 bytes PiB = 1 << 50 // 2^50 bytes EiB = 1 << 60 // 2^60 bytes ZiB = 1 << 70 // 2^70 bytes (overflows uint64, use math/big or float64) YiB = 1 << 80 // 2^80 bytes " KB // 1e3 (10^3) MB // 1e6 (10^6) GB // 1e9 (10^9) TB // 1e12 (10^12) PB // 1e15 (10^15) EB // 1e18 (10^18) ZB // 1e21 (10^21) YB // 1e24 (10^24) MaxChars255 = 255 MaxChars32767 = 32767 CharSizeByte = 1 CharSizeUTF16 = 2 CharSizeUTF8 = 4 MaxUint32 = (1 << 32) - 1 //nolint:mnd MaxUint64 = (1 << 64) - 1 //nolint:mnd )
View Source
const ( CaseMappingUnknown = 0 + iota CaseMappingASCII CaseMappingUnicode )
View Source
const ( UnicodeNormalizationUnknown = 0 + iota UnicodeNormalizationUnsupported // exFAT on Linux 6.8 UnicodeNormalizationNone UnicodeNormalizationNFC UnicodeNormalizationNFD )
View Source
const ( FilesystemAPFS = "apfs" // APFS FilesystemBtrfs = "btrfs" // Btrfs FilesystemExFAT = "exfat" // exFAT FilesystemExt2 = "ext2" FilesystemExt3 = "ext3" FilesystemExt4 = "ext4" FilesystemFAT32 = "fat32" // FAT32 FilesystemF2FS = "f2fs" // F2FS FilesystemHFSPlus = "hfs+" // HFS+ FilesystemNTFS = "ntfs" // NTFS FilesystemReFS = "refs" // ReFS FilesystemReiserFS = "reiserfs" // ReiserFS FilesystemSquashFS = "squashfs" // SquashFS FilesystemUDF = "udf" // UDF FilesystemXFS = "xfs" // XFS FilesystemZFS = "zfs" // ZFS )
Variables ¶
View Source
var ( DisallowedRunesNone = []RuneRange{} DisallowedRunesNUL = []RuneRange{ {0x00, 0x00}, } DisallowedRunesNULSlash = []RuneRange{ {0x00, 0x00}, {'/', '/'}, } DisallowedRunesNULColon = []RuneRange{ {0x00, 0x00}, {':', ':'}, } DisallowedRunesFAT = []RuneRange{ {0x00, 0x1f}, {'"', '"'}, {'*', '*'}, {'/', '/'}, {':', ':'}, {'<', '<'}, {'>', '>'}, {'?', '?'}, {'\\', '\\'}, {'|', '|'}, } DisallowedRunesAndroid = []RuneRange{ {0x00, 0x1f}, {'"', '"'}, {'*', '*'}, {'/', '/'}, {':', ':'}, {'<', '<'}, {'>', '>'}, {'?', '?'}, {'\\', '\\'}, {'|', '|'}, {0x7f, 0x7f}, } )
View Source
var FeaturesNone = map[Feature]Availability{}
View Source
var OSFeaturesNone = map[OSFeature]Availability{}
Functions ¶
This section is empty.
Types ¶
type Availability ¶
type Availability uint
const ( AvailabilityNever Availability = 0 + iota AvailabilityOptional AvailabilityAlways )
type CaseMapping ¶
type CaseMapping uint
type DisallowedRunes ¶
type DisallowedRunes []RuneRange
func (DisallowedRunes) String ¶
func (v DisallowedRunes) String() string
type Feature ¶
type Feature uint
const ( FeatureStoresFileOwner Feature = 1 << iota FeaturePOSIXPermissions FeatureCreationTimestamps FeatureLastAccessTimestamps FeatureLastMetadataChangeTimestamps FeatureLastArchiveTimestamps FeatureACLs FeatureMACLabels FeatureExtendedFilesystem FeatureMetadataChecksums FeatureHardLinks FeatureSymbolicLinks FeatureBlockJournaling FeatureMetadataOnlyJournaling FeatureCaseSensitive FeatureCasePreserving FeatureXIP FeatureSnapshots FeatureEncryption FeatureDeduplication FeatureDataChecksums FeaturePersistentCache FeatureMultipleDevices FeatureCompression FeatureSelfHealing FeatureOfflineGrow FeatureOnlineGrow FeatureOfflineShrink FeatureOnlineShrink FeatureAddRemoveVolumes FeatureSparseFiles FeatureBlockSuballocation FeatureTailPacking FeatureExtents FeatureVariableFileBlockSize FeatureAllocateOnFlush FeatureCopyOnWrite FeatureTrimSupport FeatureIsCompressed FeatureIsEncrypted FeatureIsReadOnly FeatureCreationTimestampsUpdateable FeatureLastMetadataChangeTimestampsUpdateable FeatureLastArchiveTimestampsUpdateable )
type Filesystem ¶
type Filesystem struct {
Name string // Filesystem name, in all lowercase.
MaxNameLength uint32 // maximum length (in CharSize units) of filename component*
MaxPathLength uint32 // maximum length (in CharSize units) of an entire path*
CharSize uint8 // 1 for bytes, 2 for UTF-16/UCS-2, 4 for UTF-8/Unicode
MaxFileSize Size // maxiumum file size*
MaxVolumeSize Size // maxiumum file size*
MaxFiles uint64 // maximum number of files*
ATimeGranularity time.Duration // Last Accessed timestamp granularity (0=not supported)
BTimeGranularity time.Duration // Creation (Birthed) timestamp granularity (0=not supported)
CTimeGranularity time.Duration // Last metadata Change timestamp granularity (0=not supported)
MTimeGranularity time.Duration // Last Modified timestamp granularity (0=not supported)
CaseMapping CaseMapping
UnicodeNormalization UnicodeNormalization
// Mostly related to FAT/NTFS/ReFS filesystems:
DisallowedRunes DisallowedRunes // characters disallowed by the filesystem.
ReservedFilenames ReservedFilenames // regexes of filenames that are reserved by the filesystem.
Features map[Feature]Availability
OSFeatures map[OSFeature]Availability
}
func NewFilesystem ¶
func NewFilesystem(name string) Filesystem
func (Filesystem) String ¶
func (a Filesystem) String() string
type Mount ¶
type Mount struct {
// Device is the device name for disk partition. For example, on unix-like
// systems, /dev/sda1. On Windows systems, \\.\Device{GUID}
Device string
// Mountpoint is the location in the filesystem, where the device is mounted.
// For example, on unix-like systems, /mnt/sda1. On Windows systems, D:.
Mountpoint string
// Fstype is the name of the type of filesystem the disk partition is
// formatted as, in lowercase ("ext4", "fat", etc.).
Fstype string
// Opts are the mount options used to mount the device, if any (e.g., "rw", "ro", etc.)
Opts []string
}
Mount contains a volume's device name, mount point, filesystem type, and mount options, if any. It is the same structure as gopsutil's disk.PartitionType struct.
type ReservedFilenames ¶
type ReservedFilenames []string
var ( ReservedFilenamesNone ReservedFilenames = []string{} ReservedFilenamesNTFS ReservedFilenames = []string{ `^((CON|PRN|AUX|NUL|COM[1-9¹²³]|LPT[1-9¹²³])(\..*)?|CONIN\$|CONOUT\$)$`, } ReservedFilenamesNTFSSuffixes ReservedFilenames = []string{ `(\. )$`, } )
type UnicodeNormalization ¶
type UnicodeNormalization uint
type Volume ¶
type Volume struct {
Device string // /dev/sda1
Mountpoint string // /mnt/sda1
ID uint64 // unique device ID
Label string
// UUID string
SerialNumber string
Type Type
// FilesystemName string // ext4, etc.
Options []string
//
Total uint64
Used uint64
Free uint64
InodesTotal uint64
InodesUsed uint64
InodesFree uint64
KnownFilesystem bool
// Default for the filesystem found on the volume/partition
Filesystem Filesystem
}
Click to show internal directories.
Click to hide internal directories.