From 0ab154f2cd2879ea8a3cc65f66bbfc8ca3991088 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Mon, 26 Oct 2015 22:22:09 +0100 Subject: fstype for NetBSD --- lr.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'lr.c') diff --git a/lr.c b/lr.c index b323fb6..6bbefd3 100644 --- a/lr.c +++ b/lr.c @@ -697,6 +697,29 @@ scan_filesystems() scanned_filesystems = 1; } +#elif defined(__NetBSD__) +#include +#include +void +scan_filesystems() +{ + struct statvfs *mnt; + struct stat st; + int i = getmntinfo(&mnt, MNT_NOWAIT); + + while (i-- > 0) { + if (stat(mnt->f_mntonname, &st) < 0) + continue; + + struct idmap *newkey = malloc(sizeof (struct idmap)); + newkey->id = st.st_dev; + newkey->name = strdup(mnt->f_fstypename); + tsearch(newkey, &filesystems, idorder); + mnt++; + }; + + scanned_filesystems = 1; +} #else void scan_filesystems() -- cgit 1.4.1