Revert "Disk (Windows): add --disk-ignore-remote"

This reverts commit c71b04ba93ae82098047b3497b3128aca660becb.
This commit is contained in:
李通洲 2024-04-30 14:46:26 +08:00
parent 8721cc1ab5
commit 1058e876a7
9 changed files with 6 additions and 38 deletions

View File

@ -18,7 +18,6 @@ Features:
* Better max CPU frequency detection support with `CPUID / 16H` instruction (CPU, Windows)
* This requires Core I Gen 6 or newer, and with `Virtual Machine Platform` Windows feature disabled. X86 only.
* Improve performance of nix packages detection (Packages, Linux)
* Add option `--disk-ignore-remote` to ignore remote disks to improve performance (Disk, Windows)
# 2.10.2

View File

@ -1265,11 +1265,6 @@
"description": "Set if unknown (unable to detect sizes) volumes should be printed",
"default": false
},
"ignoreRemote": {
"type": "boolean",
"description": "Set if remote volumes should be ignored when detecting for performance reasons. Windows only",
"default": false
},
"useAvailable": {
"type": "boolean",
"description": "Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes",

View File

@ -1007,16 +1007,6 @@
"default": false
}
},
{
"long": "disk-ignore-remote",
"desc": "Set if remote volumes should be ignored when detecting for performance reasons",
"remark": "Windows only",
"arg": {
"type": "bool",
"optional": true,
"default": false
}
},
{
"long": "disk-use-available",
"desc": "Use f_bavail (lpFreeBytesAvailableToCaller for Windows) instead of f_bfree to calculate used bytes",

View File

@ -1,6 +1,6 @@
#include "disk.h"
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks);
const char* ffDetectDisksImpl(FFlist* disks);
static int compareDisks(const FFDisk* disk1, const FFDisk* disk2)
{
@ -9,7 +9,7 @@ static int compareDisks(const FFDisk* disk1, const FFDisk* disk2)
const char* ffDetectDisks(FFDiskOptions* options, FFlist* disks)
{
const char* error = ffDetectDisksImpl(options, disks);
const char* error = ffDetectDisksImpl(disks);
if (error) return error;
if (disks->length == 0) return "No disks found";

View File

@ -90,7 +90,7 @@ void detectFsInfo(struct statfs* fs, FFDisk* disk)
}
#endif
const char* ffDetectDisksImpl(FF_MAYBE_UNUSED FFDiskOptions* options, FFlist* disks)
const char* ffDetectDisksImpl(FFlist* disks)
{
int size = getfsstat(NULL, 0, MNT_WAIT);

View File

@ -250,7 +250,7 @@ static void detectStats(FFDisk* disk)
#endif
}
const char* ffDetectDisksImpl(FF_MAYBE_UNUSED FFDiskOptions* options, FFlist* disks)
const char* ffDetectDisksImpl(FFlist* disks)
{
FILE* mountsFile = setmntent("/proc/mounts", "r");
if(mountsFile == NULL)

View File

@ -6,7 +6,7 @@
#include <winioctl.h>
#include <assert.h>
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
const char* ffDetectDisksImpl(FFlist* disks)
{
wchar_t buf[MAX_PATH + 1];
uint32_t length = GetLogicalDriveStringsW(sizeof(buf) / sizeof(*buf), buf);
@ -18,7 +18,7 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
wchar_t* mountpoint = buf + i;
UINT driveType = GetDriveTypeW(mountpoint);
if(driveType == DRIVE_NO_ROOT_DIR || (driveType == DRIVE_REMOTE && options->ignoreRemote))
if(driveType == DRIVE_NO_ROOT_DIR)
{
i += (uint32_t)wcslen(mountpoint);
continue;

View File

@ -281,12 +281,6 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
return true;
}
if (ffStrEqualsIgnCase(subKey, "ignore-remote"))
{
options->ignoreRemote = ffOptionParseBoolean(value);
return true;
}
if (ffPercentParseCommandOptions(key, subKey, value, &options->percent))
return true;
@ -357,12 +351,6 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
continue;
}
if (ffStrEqualsIgnCase(key, "ignoreRemote"))
{
options->ignoreRemote = yyjson_get_bool(val);
continue;
}
if (ffStrEqualsIgnCase(key, "useAvailable"))
{
if (yyjson_get_bool(val))
@ -410,9 +398,6 @@ void ffGenerateDiskJsonConfig(FFDiskOptions* options, yyjson_mut_doc* doc, yyjso
if (defaultOptions.calcType != options->calcType)
yyjson_mut_obj_add_bool(doc, module, "useAvailable", options->calcType == FF_DISK_CALC_TYPE_AVAILABLE);
if (defaultOptions.ignoreRemote != options->ignoreRemote)
yyjson_mut_obj_add_bool(doc, module, "ignoreRemote", options->ignoreRemote);
ffPercentGenerateJsonConfig(doc, module, defaultOptions.percent, options->percent);
}

View File

@ -31,5 +31,4 @@ typedef struct FFDiskOptions
FFDiskVolumeType showTypes;
FFDiskCalcType calcType;
FFColorRangeConfig percent;
bool ignoreRemote;
} FFDiskOptions;