X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Fmountcheck.c;h=2fb6fe742faa3e3348c994e9e75a8167b633013b;hb=b76d85a4d2e61546b40135db141972eba4ecd981;hp=e8780eb3b46a166f81726c9a2966a1a0c901a465;hpb=a89ba4b12939c802875a3548a5de3eb64ce86a0a;p=fio.git diff --git a/lib/mountcheck.c b/lib/mountcheck.c index e8780eb3..2fb6fe74 100644 --- a/lib/mountcheck.c +++ b/lib/mountcheck.c @@ -4,7 +4,7 @@ #ifdef CONFIG_GETMNTENT #include -#include "lib/mountcheck.h" +#include "mountcheck.h" #define MTAB "/etc/mtab" @@ -32,7 +32,7 @@ int device_is_mounted(const char *dev) } #elif defined(CONFIG_GETMNTINFO) -/* for BSDs */ +/* for most BSDs */ #include #include @@ -53,6 +53,27 @@ int device_is_mounted(const char *dev) return 0; } +#elif defined(CONFIG_GETMNTINFO_STATVFS) +/* for NetBSD */ +#include + +int device_is_mounted(const char *dev) +{ + struct statvfs *st; + int i, ret; + + ret = getmntinfo(&st, MNT_NOWAIT); + if (ret <= 0) + return 0; + + for (i = 0; i < ret; i++) { + if (!strcmp(st[i].f_mntfromname, dev)) + return 1; + } + + return 0; +} + #else /* others */