mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 16:26:39 +01:00
Chore: run clang-format
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
extern "C"
|
||||
{
|
||||
extern "C" {
|
||||
#include "disk.h"
|
||||
#include "common/stringUtils.h"
|
||||
}
|
||||
@@ -7,36 +6,40 @@ extern "C"
|
||||
#include <Directory.h>
|
||||
#include <Path.h>
|
||||
|
||||
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
{
|
||||
const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks) {
|
||||
int32 pos = 0;
|
||||
|
||||
for (dev_t dev; (dev = next_dev(&pos)) >= B_OK;)
|
||||
{
|
||||
for (dev_t dev; (dev = next_dev(&pos)) >= B_OK;) {
|
||||
fs_info fs;
|
||||
if (fs_stat_dev(dev, &fs) < 0) continue;
|
||||
if (fs_stat_dev(dev, &fs) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
node_ref node(fs.dev, fs.root);
|
||||
BDirectory dir(&node);
|
||||
BPath path(&dir);
|
||||
if (path.InitCheck() != B_OK) continue;
|
||||
|
||||
if (__builtin_expect(options->folders.length, 0))
|
||||
{
|
||||
if (!ffStrbufSeparatedContainS(&options->folders, path.Path(), FF_DISK_FOLDER_SEPARATOR))
|
||||
continue;
|
||||
if (path.InitCheck() != B_OK) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (options->hideFolders.length && ffDiskMatchesFolderPatterns(&options->hideFolders, path.Path(), FF_DISK_FOLDER_SEPARATOR))
|
||||
continue;
|
||||
if (__builtin_expect(options->folders.length, 0)) {
|
||||
if (!ffStrbufSeparatedContainS(&options->folders, path.Path(), FF_DISK_FOLDER_SEPARATOR)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (options->hideFS.length && ffStrbufSeparatedContainS(&options->hideFS, fs.fsh_name, ':'))
|
||||
if (options->hideFolders.length && ffDiskMatchesFolderPatterns(&options->hideFolders, path.Path(), FF_DISK_FOLDER_SEPARATOR)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (options->hideFS.length && ffStrbufSeparatedContainS(&options->hideFS, fs.fsh_name, ':')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
FFDisk* disk = (FFDisk*) ffListAdd(disks);
|
||||
|
||||
disk->bytesTotal = (uint64_t)fs.total_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesFree = (uint64_t)fs.free_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesTotal = (uint64_t) fs.total_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesFree = (uint64_t) fs.free_blocks * (uint64_t) fs.block_size;
|
||||
disk->bytesAvailable = disk->bytesFree;
|
||||
disk->bytesUsed = 0; // To be filled in ./disk.c
|
||||
|
||||
@@ -48,18 +51,24 @@ const char* ffDetectDisksImpl(FFDiskOptions* options, FFlist* disks)
|
||||
ffStrbufInitS(&disk->filesystem, fs.fsh_name);
|
||||
ffStrbufInitS(&disk->name, fs.volume_name);
|
||||
disk->type = FF_DISK_VOLUME_TYPE_NONE;
|
||||
if (!(fs.flags & B_FS_IS_PERSISTENT))
|
||||
if (!(fs.flags & B_FS_IS_PERSISTENT)) {
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_HIDDEN_BIT);
|
||||
if (fs.flags & B_FS_IS_READONLY)
|
||||
}
|
||||
if (fs.flags & B_FS_IS_READONLY) {
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_READONLY_BIT);
|
||||
if (fs.flags & B_FS_IS_REMOVABLE)
|
||||
}
|
||||
if (fs.flags & B_FS_IS_REMOVABLE) {
|
||||
disk->type = (FFDiskVolumeType) (disk->type | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT);
|
||||
if (disk->type == FF_DISK_VOLUME_TYPE_NONE) disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
}
|
||||
if (disk->type == FF_DISK_VOLUME_TYPE_NONE) {
|
||||
disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT;
|
||||
}
|
||||
disk->createTime = 0;
|
||||
|
||||
time_t crTime;
|
||||
if (dir.GetCreationTime(&crTime) == B_OK)
|
||||
if (dir.GetCreationTime(&crTime) == B_OK) {
|
||||
disk->createTime = (uint64_t) crTime * 1000;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user