diff --git a/CMakeLists.txt b/CMakeLists.txt index e4d2281d0..40a3325e1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -687,7 +687,7 @@ elseif(NetBSD) src/detection/cpucache/cpucache_nosupport.c src/detection/cpuusage/cpuusage_bsd.c src/detection/cursor/cursor_linux.c - src/detection/disk/disk_nosupport.c + src/detection/disk/disk_bsd.c src/detection/dns/dns_linux.c src/detection/physicaldisk/physicaldisk_nosupport.c src/detection/physicalmemory/physicalmemory_nosupport.c diff --git a/src/detection/disk/disk_bsd.c b/src/detection/disk/disk_bsd.c index 4060669c3..f26d5f18d 100644 --- a/src/detection/disk/disk_bsd.c +++ b/src/detection/disk/disk_bsd.c @@ -5,6 +5,14 @@ #include #include +#ifdef __NetBSD__ +#include +#include +#define getfsstat(...) getvfsstat(__VA_ARGS__) +#define statfs statvfs +#define f_flags f_flag +#endif + #ifdef __FreeBSD__ #include @@ -51,7 +59,7 @@ static void detectFsInfo(struct statfs* fs, FFDisk* disk) ? FF_DISK_VOLUME_TYPE_REGULAR_BIT : FF_DISK_VOLUME_TYPE_SUBVOLUME_BIT; } - else if(ffStrbufStartsWithS(&disk->mountpoint, "/boot") || ffStrbufStartsWithS(&disk->mountpoint, "/efi")) + else if(fs->f_flags & MNT_IGNORE) disk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT; else if(!(fs->f_flags & MNT_LOCAL)) disk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT; @@ -95,7 +103,12 @@ void detectFsInfo(struct statfs* fs, FFDisk* disk) #else static void detectFsInfo(struct statfs* fs, FFDisk* disk) { - FF_UNUSED(fs, disk); + if(fs->f_flags & MNT_IGNORE) + disk->type = FF_DISK_VOLUME_TYPE_HIDDEN_BIT; + else if(!(fs->f_flags & MNT_LOCAL)) + disk->type = FF_DISK_VOLUME_TYPE_EXTERNAL_BIT; + else + disk->type = FF_DISK_VOLUME_TYPE_REGULAR_BIT; } #endif