Skip to content

Commit 434a879

Browse files
committed
Disk: rename FFDiskType to FFDiskVolumeType
1 parent c400866 commit 434a879

File tree

8 files changed

+53
-53
lines changed

8 files changed

+53
-53
lines changed

src/detection/disk/disk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const char* ffDetectDisks(FFlist* disks)
2222
FF_LIST_FOR_EACH(FFDisk, disk, *disks)
2323
{
2424
if(disk->bytesTotal == 0)
25-
disk->type |= FF_DISK_TYPE_UNKNOWN_BIT;
25+
disk->type |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
2626
}
2727

2828
return NULL;

src/detection/disk/disk.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ typedef struct FFDisk
1010
FFstrbuf mountpoint;
1111
FFstrbuf filesystem;
1212
FFstrbuf name;
13-
FFDiskType type;
13+
FFDiskVolumeType type;
1414

1515
uint64_t bytesUsed;
1616
uint64_t bytesTotal;

src/detection/disk/disk_apple.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ void detectFsInfo(struct statfs* fs, FFDisk* disk)
77
{
88
// FreeBSD doesn't support these flags
99
if(fs->f_flags & MNT_DONTBROWSE)
10-
disk->type = FF_DISK_TYPE_HIDDEN_BIT;
10+
disk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
1111
else if(fs->f_flags & MNT_REMOVABLE)
12-
disk->type = FF_DISK_TYPE_EXTERNAL_BIT;
12+
disk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
1313
else
14-
disk->type = FF_DISK_TYPE_REGULAR_BIT;
14+
disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
1515

1616
ffStrbufInitS(&disk->name, [NSFileManager.defaultManager displayNameAtPath:@(fs->f_mntonname)].UTF8String);
1717
}

src/detection/disk/disk_bsd.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ static void detectFsInfo(struct statfs* fs, FFDisk* disk)
1010
if(ffStrbufEqualS(&disk->filesystem, "zfs"))
1111
{
1212
disk->type = !ffStrStartsWith(fs->f_mntfromname, "zroot/") || ffStrStartsWith(fs->f_mntfromname, "zroot/ROOT/")
13-
? FF_DISK_TYPE_REGULAR_BIT
14-
: FF_DISK_TYPE_SUBVOLUME_BIT;
13+
? FF_DISK_VOLUME_TYPE_REGULAR_BIT
14+
: FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
1515
}
1616
else if(!ffStrStartsWith(fs->f_mntfromname, "/dev/"))
17-
disk->type = FF_DISK_TYPE_HIDDEN_BIT;
17+
disk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
1818
else if(!(fs->f_flags & MNT_LOCAL))
19-
disk->type = FF_DISK_TYPE_EXTERNAL_BIT;
19+
disk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
2020
else
21-
disk->type = FF_DISK_TYPE_REGULAR_BIT;
21+
disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
2222

2323
ffStrbufInit(&disk->name);
2424
}

src/detection/disk/disk_linux.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ static void detectName(FFDisk* disk, const FFstrbuf* device)
155155
static void detectType(FF_MAYBE_UNUSED const FFlist* devices, FFDisk* currentDisk, FF_MAYBE_UNUSED const char* options)
156156
{
157157
if(ffStrbufEqualS(&currentDisk->mountpoint, "/") || ffStrbufEqualS(&currentDisk->mountpoint, "/storage/emulated"))
158-
currentDisk->type = FF_DISK_TYPE_REGULAR_BIT;
158+
currentDisk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
159159
else if(ffStrbufStartsWithS(&currentDisk->mountpoint, "/mnt/media_rw/"))
160-
currentDisk->type = FF_DISK_TYPE_EXTERNAL_BIT;
160+
currentDisk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
161161
else
162-
currentDisk->type = FF_DISK_TYPE_HIDDEN_BIT;
162+
currentDisk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
163163
}
164164

165165
#else
@@ -191,13 +191,13 @@ static bool isSubvolume(const FFlist* devices)
191191
static void detectType(const FFlist* devices, FFDisk* currentDisk, const char* options)
192192
{
193193
if(isSubvolume(devices))
194-
currentDisk->type = FF_DISK_TYPE_SUBVOLUME_BIT;
194+
currentDisk->type = FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
195195
else if(strstr(options, "nosuid") != NULL || strstr(options, "nodev") != NULL)
196-
currentDisk->type = FF_DISK_TYPE_EXTERNAL_BIT;
196+
currentDisk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
197197
else if(ffStrbufStartsWithS(&currentDisk->mountpoint, "/boot") || ffStrbufStartsWithS(&currentDisk->mountpoint, "/efi"))
198-
currentDisk->type = FF_DISK_TYPE_HIDDEN_BIT;
198+
currentDisk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
199199
else
200-
currentDisk->type = FF_DISK_TYPE_REGULAR_BIT;
200+
currentDisk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
201201
}
202202

203203
#endif

src/detection/disk/disk_windows.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ const char* ffDetectDisksImpl(FFlist* disks)
3434
disk->bytesUsed = disk->bytesTotal - bytesFree;
3535

3636
if(driveType == DRIVE_REMOVABLE || driveType == DRIVE_REMOTE || driveType == DRIVE_CDROM)
37-
disk->type = FF_DISK_TYPE_EXTERNAL_BIT;
37+
disk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
3838
else if(driveType == DRIVE_FIXED)
39-
disk->type = FF_DISK_TYPE_REGULAR_BIT;
39+
disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
4040
else
41-
disk->type = FF_DISK_TYPE_HIDDEN_BIT;
41+
disk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
4242

4343
ffStrbufInit(&disk->filesystem);
4444
ffStrbufInit(&disk->name);

src/modules/disk/disk.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
7979
if(disk->filesystem.length)
8080
ffStrbufAppendF(&str, "- %s ", disk->filesystem.chars);
8181

82-
if(disk->type & FF_DISK_TYPE_EXTERNAL_BIT)
82+
if(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT)
8383
ffStrbufAppendS(&str, "[External]");
84-
else if(disk->type & FF_DISK_TYPE_SUBVOLUME_BIT)
84+
else if(disk->type & FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT)
8585
ffStrbufAppendS(&str, "[Subvolume]");
86-
else if(disk->type & FF_DISK_TYPE_HIDDEN_BIT)
86+
else if(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT)
8787
ffStrbufAppendS(&str, "[Hidden]");
8888
}
8989

@@ -98,8 +98,8 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
9898
double filesPercentage = disk->filesTotal > 0 ? ((double) disk->filesUsed / (double) disk->filesTotal) * 100.0 : 0;
9999
ffAppendPercentNum(&filesPercentageStr, filesPercentage, 50, 80, false);
100100

101-
bool isExternal = !!(disk->type & FF_DISK_TYPE_EXTERNAL_BIT);
102-
bool isHidden = !!(disk->type & FF_DISK_TYPE_HIDDEN_BIT);
101+
bool isExternal = !!(disk->type & FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
102+
bool isHidden = !!(disk->type & FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
103103
ffPrintFormatString(key.chars, 0, &options->moduleArgs, FF_PRINT_TYPE_NO_CUSTOM_KEY, FF_DISK_NUM_FORMAT_ARGS, (FFformatarg[]){
104104
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
105105
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
@@ -194,7 +194,7 @@ void ffInitDiskOptions(FFDiskOptions* options)
194194
ffOptionInitModuleArg(&options->moduleArgs);
195195

196196
ffStrbufInit(&options->folders);
197-
options->showTypes = FF_DISK_TYPE_REGULAR_BIT | FF_DISK_TYPE_EXTERNAL_BIT;
197+
options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
198198
}
199199

200200
bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const char* value)
@@ -213,45 +213,45 @@ bool ffParseDiskCommandOptions(FFDiskOptions* options, const char* key, const ch
213213
if (ffStrEqualsIgnCase(subKey, "show-regular"))
214214
{
215215
if (ffOptionParseBoolean(value))
216-
options->showTypes |= FF_DISK_TYPE_REGULAR_BIT;
216+
options->showTypes |= FF_DISK_VOLUME_TYPE_REGULAR_BIT;
217217
else
218-
options->showTypes &= ~FF_DISK_TYPE_REGULAR_BIT;
218+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_REGULAR_BIT;
219219
return true;
220220
}
221221

222222
if (ffStrEqualsIgnCase(subKey, "show-external"))
223223
{
224224
if (ffOptionParseBoolean(value))
225-
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
225+
options->showTypes |= FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
226226
else
227-
options->showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
227+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
228228
return true;
229229
}
230230

231231
if (ffStrEqualsIgnCase(subKey, "show-hidden"))
232232
{
233233
if (ffOptionParseBoolean(value))
234-
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
234+
options->showTypes |= FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
235235
else
236-
options->showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
236+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
237237
return true;
238238
}
239239

240240
if (ffStrEqualsIgnCase(subKey, "show-subvolumes"))
241241
{
242242
if (ffOptionParseBoolean(value))
243-
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
243+
options->showTypes |= FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
244244
else
245-
options->showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
245+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
246246
return true;
247247
}
248248

249249
if (ffStrEqualsIgnCase(subKey, "show-unknown"))
250250
{
251251
if (ffOptionParseBoolean(value))
252-
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
252+
options->showTypes |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
253253
else
254-
options->showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
254+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
255255
return true;
256256
}
257257

@@ -285,36 +285,36 @@ void ffParseDiskJsonObject(FFDiskOptions* options, yyjson_val* module)
285285
if (ffStrEqualsIgnCase(key, "showExternal"))
286286
{
287287
if (yyjson_get_bool(val))
288-
options->showTypes |= FF_DISK_TYPE_EXTERNAL_BIT;
288+
options->showTypes |= FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
289289
else
290-
options->showTypes &= ~FF_DISK_TYPE_EXTERNAL_BIT;
290+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_EXTERNAL_BIT;
291291
continue;
292292
}
293293

294294
if (ffStrEqualsIgnCase(key, "showHidden"))
295295
{
296296
if (yyjson_get_bool(val))
297-
options->showTypes |= FF_DISK_TYPE_HIDDEN_BIT;
297+
options->showTypes |= FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
298298
else
299-
options->showTypes &= ~FF_DISK_TYPE_HIDDEN_BIT;
299+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_HIDDEN_BIT;
300300
continue;
301301
}
302302

303303
if (ffStrEqualsIgnCase(key, "showSubvolumes"))
304304
{
305305
if (yyjson_get_bool(val))
306-
options->showTypes |= FF_DISK_TYPE_SUBVOLUME_BIT;
306+
options->showTypes |= FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
307307
else
308-
options->showTypes &= ~FF_DISK_TYPE_SUBVOLUME_BIT;
308+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT;
309309
continue;
310310
}
311311

312312
if (ffStrEqualsIgnCase(key, "showUnknown"))
313313
{
314314
if (yyjson_get_bool(val))
315-
options->showTypes |= FF_DISK_TYPE_UNKNOWN_BIT;
315+
options->showTypes |= FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
316316
else
317-
options->showTypes &= ~FF_DISK_TYPE_UNKNOWN_BIT;
317+
options->showTypes &= ~FF_DISK_VOLUME_TYPE_UNKNOWN_BIT;
318318
continue;
319319
}
320320

src/modules/disk/option.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44

55
#include "common/option.h"
66

7-
typedef enum FFDiskType
7+
typedef enum FFDiskVolumeType
88
{
9-
FF_DISK_TYPE_NONE = 0,
10-
FF_DISK_TYPE_REGULAR_BIT = 1 << 0,
11-
FF_DISK_TYPE_HIDDEN_BIT = 1 << 1,
12-
FF_DISK_TYPE_EXTERNAL_BIT = 1 << 2,
13-
FF_DISK_TYPE_SUBVOLUME_BIT = 1 << 3,
14-
FF_DISK_TYPE_UNKNOWN_BIT = 1 << 4,
15-
} FFDiskType;
9+
FF_DISK_VOLUME_TYPE_NONE = 0,
10+
FF_DISK_VOLUME_TYPE_REGULAR_BIT = 1 << 0,
11+
FF_DISK_VOLUME_TYPE_HIDDEN_BIT = 1 << 1,
12+
FF_DISK_VOLUME_TYPE_EXTERNAL_BIT = 1 << 2,
13+
FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT = 1 << 3,
14+
FF_DISK_VOLUME_TYPE_UNKNOWN_BIT = 1 << 4,
15+
} FFDiskVolumeType;
1616

1717
typedef struct FFDiskOptions
1818
{
1919
FFModuleBaseInfo moduleInfo;
2020
FFModuleArgs moduleArgs;
2121

2222
FFstrbuf folders;
23-
FFDiskType showTypes;
23+
FFDiskVolumeType showTypes;
2424
} FFDiskOptions;

0 commit comments

Comments
 (0)