Files
fastfetch/src/detection/disk/disk.h
T
李通洲 f93ffed57a Disk: fix Windows quota affecting free space and unify disk size calculation
- Windows: use FILE_FS_FULL_SIZE_INFORMATION_EX on Windows 10 1809+ (Build >= 17763) when calcType != AVAILABLE to get ActualTotalAllocationUnits/ActualAvailableAllocationUnits (ignoring per-user disk quotas). Fall back to legacy FILE_FS_FULL_SIZE_INFORMATION with CallerAvailableAllocationUnits when calcType is AVAILABLE or EX is unavailable.
- Unix-like: respect --disk-calc-type. Use f_bfree for FREE, f_bavail for AVAILABLE (Linux/BSD/SunOS). Haiku currently always uses free_blocks.
- Refactor FFDisk: remove bytesUsed and bytesAvailable; compute used = total - free in disk module.
- Disk module: update custom format (remove `size-available`, add `bytes-used` and `bytes-total`); update JSON output (remove `bytes.available`, `bytes.used`).
- Disk detection: stop computing used in common path; let each platform set bytesFree by chosen semantics.

Fixes #2651
2026-10-13 15:35:12 +08:00

39 lines
862 B
C

#pragma once
#include "fastfetch.h"
#include "modules/disk/option.h"
#ifdef _WIN32
#define FF_DISK_FOLDER_SEPARATOR ';'
#else
#define FF_DISK_FOLDER_SEPARATOR ':'
#endif
typedef struct FFDisk {
FFstrbuf mountFrom;
FFstrbuf mountpoint;
FFstrbuf filesystem;
FFstrbuf name;
FFDiskVolumeType type;
uint64_t bytesFree;
uint64_t bytesTotal;
uint32_t filesUsed;
uint32_t filesTotal;
uint64_t createTime;
} FFDisk;
/**
* Returns a List of FFDisk, sorted alphabetically by mountpoint.
* If error is not set, disks contains at least one disk.
*/
const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks /* list of FFDisk */);
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks);
#ifndef _WIN32
bool ffDiskMatchesFolderPatterns(FFstrbuf* folders, const char* path, char separator);
#endif