X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=lib%2Fmountcheck.c;h=2fb6fe742faa3e3348c994e9e75a8167b633013b;hb=b57f4fd4e42672f1686fd119da522eace09d1d27;hp=e37e9f927b0c3cc2ecfca6cd26ea7017eb3c083f;hpb=4f76cfe47a8a964cbdff993a85ee55362c2845e0;p=fio.git diff --git a/lib/mountcheck.c b/lib/mountcheck.c index e37e9f92..2fb6fe74 100644 --- a/lib/mountcheck.c +++ b/lib/mountcheck.c @@ -4,6 +4,8 @@ #ifdef CONFIG_GETMNTENT #include +#include "mountcheck.h" + #define MTAB "/etc/mtab" int device_is_mounted(const char *dev) @@ -30,7 +32,7 @@ int device_is_mounted(const char *dev) } #elif defined(CONFIG_GETMNTINFO) -/* for BSDs */ +/* for most BSDs */ #include #include @@ -51,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 */