diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 17:37:03 +0100 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-10-26 17:37:03 +0100 |
commit | 3d8aa918783e3cd147b0059d87b236ac3e396a8e (patch) | |
tree | b440d38f1f91441b1b73b0ee049bea23eb7d0245 /lr.c | |
parent | 6775cedea1f1e4e47ff6e0c475d03204942e4bdf (diff) | |
download | lr-3d8aa918783e3cd147b0059d87b236ac3e396a8e.tar.gz lr-3d8aa918783e3cd147b0059d87b236ac3e396a8e.tar.xz lr-3d8aa918783e3cd147b0059d87b236ac3e396a8e.zip |
add fstype for freebsd
Diffstat (limited to 'lr.c')
-rw-r--r-- | lr.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/lr.c b/lr.c index 9387ab0..6951812 100644 --- a/lr.c +++ b/lr.c @@ -643,7 +643,7 @@ username(uid_t uid) return result ? (*result)->name : strid(uid); } -#ifdef __linux__ +#if defined(__linux__) #include <mntent.h> void scan_filesystems() @@ -673,6 +673,30 @@ scan_filesystems() scanned_filesystems = 1; } +#elif defined(__FreeBSD__) +#include <sys/param.h> +#include <sys/ucred.h> +#include <sys/mount.h> +void +scan_filesystems() +{ + struct statfs *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() |