Skip to content

Commit f0a10fc

Browse files
committed
Disk (BSD): improve disk type detection
1 parent c70b9cb commit f0a10fc

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/detection/disk/disk_bsd.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
#include <sys/mount.h>
44

55
#ifdef __FreeBSD__
6+
#include "util/stringUtils.h"
7+
68
static void detectFsInfo(struct statfs* fs, FFDisk* disk)
79
{
8-
if(
9-
ffStrbufStartsWithS(&disk->mountpoint, "/boot") ||
10-
ffStrbufStartsWithS(&disk->mountpoint, "/dev") ||
11-
ffStrbufStartsWithS(&disk->mountpoint, "/var") ||
12-
ffStrbufStartsWithS(&disk->mountpoint, "/tmp") ||
13-
ffStrbufStartsWithS(&disk->mountpoint, "/proc") ||
14-
ffStrbufStartsWithS(&disk->mountpoint, "/zroot") ||
15-
ffStrbufStartsWithS(&disk->mountpoint, "/compat/linux/")
16-
)
10+
if(ffStrbufEqualS(&disk->filesystem, "zfs"))
11+
{
12+
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;
15+
}
16+
else if(!ffStrStartsWith(fs->f_mntfromname, "/dev/"))
1717
disk->type = FF_DISK_TYPE_HIDDEN_BIT;
18-
else if((fs->f_flags & MNT_NOSUID) || !(fs->f_flags & MNT_LOCAL))
18+
else if(!(fs->f_flags & MNT_LOCAL))
1919
disk->type = FF_DISK_TYPE_EXTERNAL_BIT;
2020
else
2121
disk->type = FF_DISK_TYPE_REGULAR_BIT;

0 commit comments

Comments
 (0)