From e8e43c10fc1072a27ecaf77b839c058248d1be66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 9 Apr 2026 10:10:51 +0800 Subject: [PATCH] PhysicalDisk: renames `hideUnknown` for `hideUnused` --- doc/json_schema.json | 4 ++-- src/detection/physicaldisk/physicaldisk_apple.c | 4 ++-- src/detection/physicaldisk/physicaldisk_bsd.c | 4 ++-- src/detection/physicaldisk/physicaldisk_haiku.c | 4 ++-- src/detection/physicaldisk/physicaldisk_linux.c | 4 ++-- src/detection/physicaldisk/physicaldisk_nbsd.c | 4 ++-- src/detection/physicaldisk/physicaldisk_obsd.c | 4 ++-- src/detection/physicaldisk/physicaldisk_sunos.c | 4 ++-- src/detection/physicaldisk/physicaldisk_windows.c | 4 ++-- src/modules/physicaldisk/option.h | 2 +- src/modules/physicaldisk/physicaldisk.c | 12 ++++++------ 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/doc/json_schema.json b/doc/json_schema.json index 16ca53b97..834a50309 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -3643,8 +3643,8 @@ "type": "boolean", "default": false }, - "hideUnknown": { - "description": "Hide disks with `size == 0`", + "hideUnused": { + "description": "Hide disks with `size == 0` (likely unused/unconnected)", "type": "boolean", "default": true }, diff --git a/src/detection/physicaldisk/physicaldisk_apple.c b/src/detection/physicaldisk/physicaldisk_apple.c index 189980dcb..d9bda6aa4 100644 --- a/src/detection/physicaldisk/physicaldisk_apple.c +++ b/src/detection/physicaldisk/physicaldisk_apple.c @@ -122,11 +122,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) } if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { continue; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result); diff --git a/src/detection/physicaldisk/physicaldisk_bsd.c b/src/detection/physicaldisk/physicaldisk_bsd.c index 88a55ecbb..daa1bd11a 100644 --- a/src/detection/physicaldisk/physicaldisk_bsd.c +++ b/src/detection/physicaldisk/physicaldisk_bsd.c @@ -49,11 +49,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) } uint64_t size = (uint64_t) provider->lg_mediasize; if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { continue; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } FF_STRBUF_AUTO_DESTROY name = ffStrbufCreateS(provider->lg_name); diff --git a/src/detection/physicaldisk/physicaldisk_haiku.c b/src/detection/physicaldisk/physicaldisk_haiku.c index eb0cf0fa2..3219d9a0a 100644 --- a/src/detection/physicaldisk/physicaldisk_haiku.c +++ b/src/detection/physicaldisk/physicaldisk_haiku.c @@ -55,11 +55,11 @@ static const char* searchRawDeviceFile(FFstrbuf* path, const char* diskType, FFl FFPhysicalDiskType type = FF_PHYSICALDISK_TYPE_NONE; uint64_t size = (uint64_t) geometry.cylinder_count * geometry.head_count * geometry.sectors_per_track * geometry.bytes_per_sector; if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { continue; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result); diff --git a/src/detection/physicaldisk/physicaldisk_linux.c b/src/detection/physicaldisk/physicaldisk_linux.c index 3dede5693..267baf7d0 100644 --- a/src/detection/physicaldisk/physicaldisk_linux.c +++ b/src/detection/physicaldisk/physicaldisk_linux.c @@ -40,11 +40,11 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption FFPhysicalDiskType type = FF_PHYSICALDISK_TYPE_NONE; if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { return; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } int devfd = openat(dfd, "device", O_RDONLY | O_CLOEXEC | O_PATH | O_DIRECTORY); diff --git a/src/detection/physicaldisk/physicaldisk_nbsd.c b/src/detection/physicaldisk/physicaldisk_nbsd.c index b8f370c57..f14fca420 100644 --- a/src/detection/physicaldisk/physicaldisk_nbsd.c +++ b/src/detection/physicaldisk/physicaldisk_nbsd.c @@ -90,11 +90,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) uint64_t size = sectorsPerUnit * sectorSize; if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { continue; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result); diff --git a/src/detection/physicaldisk/physicaldisk_obsd.c b/src/detection/physicaldisk/physicaldisk_obsd.c index 590532e31..40ae85aa6 100644 --- a/src/detection/physicaldisk/physicaldisk_obsd.c +++ b/src/detection/physicaldisk/physicaldisk_obsd.c @@ -60,11 +60,11 @@ const char* ffDetectPhysicalDisk(FFlist* result, FFPhysicalDiskOptions* options) uint64_t size = DL_GETDSIZE(&dl) * dl.d_secsize; if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { continue; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } FFPhysicalDiskResult* device = (FFPhysicalDiskResult*) ffListAdd(result); diff --git a/src/detection/physicaldisk/physicaldisk_sunos.c b/src/detection/physicaldisk/physicaldisk_sunos.c index caf7476bf..3cd3a51cb 100644 --- a/src/detection/physicaldisk/physicaldisk_sunos.c +++ b/src/detection/physicaldisk/physicaldisk_sunos.c @@ -33,11 +33,11 @@ static int walkDevTree(di_node_t node, di_minor_t minor, struct FFWalkTreeBundle int64_t* nblocks; if (di_prop_lookup_int64(DDI_DEV_T_ANY, node, "device-nblocks", &nblocks) > 0) { if (*nblocks == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { return DI_WALK_CONTINUE; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } else if (di_prop_lookup_ints(DDI_DEV_T_ANY, node, "device-blksize", &value) > 0) { size = (uint64_t) ((uint64_t) *nblocks * (uint64_t) *value); } diff --git a/src/detection/physicaldisk/physicaldisk_windows.c b/src/detection/physicaldisk/physicaldisk_windows.c index b5163abb7..dfb857e05 100644 --- a/src/detection/physicaldisk/physicaldisk_windows.c +++ b/src/detection/physicaldisk/physicaldisk_windows.c @@ -84,11 +84,11 @@ static const char* detectPhysicalDisk(const char* physicalType, const wchar_t* s } } if (size == 0) { - if (options->hideType & FF_PHYSICALDISK_TYPE_UNKNOWN) { + if (options->hideType & FF_PHYSICALDISK_TYPE_UNUSED) { return "Skipping unknown disk with size 0"; } - type |= FF_PHYSICALDISK_TYPE_UNKNOWN; + type |= FF_PHYSICALDISK_TYPE_UNUSED; } const STORAGE_DEVICE_DESCRIPTOR* sdd = NULL; diff --git a/src/modules/physicaldisk/option.h b/src/modules/physicaldisk/option.h index fbb3f4f57..d549ba5a5 100644 --- a/src/modules/physicaldisk/option.h +++ b/src/modules/physicaldisk/option.h @@ -16,7 +16,7 @@ typedef enum __attribute__((__packed__)) FFPhysicalDiskType { FF_PHYSICALDISK_TYPE_READWRITE = 1 << 5, FF_PHYSICALDISK_TYPE_READONLY = 1 << 6, - FF_PHYSICALDISK_TYPE_UNKNOWN = 1 << 7, + FF_PHYSICALDISK_TYPE_UNUSED = 1 << 7, FF_PHYSICALDISK_TYPE_FORCE_UNSIGNED = UINT8_MAX, } FFPhysicalDiskType; diff --git a/src/modules/physicaldisk/physicaldisk.c b/src/modules/physicaldisk/physicaldisk.c index 86cc27c19..ed7b678a4 100644 --- a/src/modules/physicaldisk/physicaldisk.c +++ b/src/modules/physicaldisk/physicaldisk.c @@ -151,14 +151,14 @@ void ffParsePhysicalDiskJsonObject(FFPhysicalDiskOptions* options, yyjson_val* m continue; } - if (unsafe_yyjson_equals_str(key, "hideUnknown")) { + if (unsafe_yyjson_equals_str(key, "hideUnused")) { if (!yyjson_is_bool(val)) { - ffPrintError(FF_PHYSICALDISK_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "hideUnknown must be a boolean"); + ffPrintError(FF_PHYSICALDISK_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "hideUnused must be a boolean"); } else { if (unsafe_yyjson_is_true(val)) { - options->hideType |= FF_PHYSICALDISK_TYPE_UNKNOWN; + options->hideType |= FF_PHYSICALDISK_TYPE_UNUSED; } else { - options->hideType &= ~FF_PHYSICALDISK_TYPE_UNKNOWN; + options->hideType &= ~FF_PHYSICALDISK_TYPE_UNUSED; } } continue; @@ -225,7 +225,7 @@ bool ffGeneratePhysicalDiskJsonResult(FFPhysicalDiskOptions* options, yyjson_mut yyjson_mut_obj_add_null(doc, obj, "readOnly"); } - yyjson_mut_obj_add_bool(doc, obj, "unknown", !!(dev->type & FF_PHYSICALDISK_TYPE_UNKNOWN)); + yyjson_mut_obj_add_bool(doc, obj, "unknown", !!(dev->type & FF_PHYSICALDISK_TYPE_UNUSED)); yyjson_mut_obj_add_strbuf(doc, obj, "revision", &dev->revision); @@ -253,7 +253,7 @@ void ffInitPhysicalDiskOptions(FFPhysicalDiskOptions* options) { ffStrbufInit(&options->namePrefix); options->temp = false; options->tempConfig = (FFColorRangeConfig) { 50, 70 }; - options->hideType = FF_PHYSICALDISK_TYPE_UNKNOWN; + options->hideType = FF_PHYSICALDISK_TYPE_UNUSED; } void ffDestroyPhysicalDiskOptions(FFPhysicalDiskOptions* options) {