lib/lfsr.c gettime-thread.c helpers.c lib/flist_sort.c \
lib/hweight.c lib/getrusage.c idletime.c td_error.c \
profiles/tiobench.c profiles/act.c io_u_queue.c filelock.c \
- lib/tp.c lib/bloom.c lib/gauss.c workqueue.c
+ lib/tp.c lib/bloom.c lib/gauss.c lib/mountcheck.c workqueue.c
ifdef CONFIG_LIBHDFS
HDFSFLAGS= -I $(JAVA_HOME)/include -I $(JAVA_HOME)/include/linux -I $(FIO_LIBHDFS_INCLUDE)
echo "lex/yacc for arithmetic $arith"
+##########################################
+# Check whether we have setmntent/getmntent
+getmntent="no"
+cat > $TMPC << EOF
+#include <stdio.h>
+#include <mntent.h>
+int main(int argc, char **argv)
+{
+ FILE *mtab = setmntent(NULL, "r");
+ struct mntent *mnt = getmntent(mtab);
+ endmntent(mnt);
+ return 0;
+}
+EOF
+if compile_prog "" "" "getmntent"; then
+ getmntent="yes"
+fi
+echo "getmntent $getmntent"
+
#############################################################################
if test "$wordsize" = "64" ; then
echo "YACC=$YACC" >> $config_host_mak
fi
fi
+if test "$getmntent" = "yes" ; then
+ output_sym "CONFIG_GETMNTENT"
+fi
if test "$zlib" = "no" ; then
echo "Consider installing zlib-dev (zlib-devel), some fio features depend on it."
--- /dev/null
+#include <stdio.h>
+#include <string.h>
+#include <mntent.h>
+
+#ifdef CONFIG_GETMNTENT
+
+#define MTAB "/etc/mtab"
+
+int device_is_mounted(const char *dev)
+{
+ FILE *mtab;
+ struct mntent *mnt;
+ int ret = 0;
+
+ mtab = setmntent(MTAB, "r");
+ if (!mtab)
+ return 0;
+
+ while ((mnt = getmntent(mtab)) != NULL) {
+ if (!mnt->mnt_fsname)
+ continue;
+ if (!strcmp(mnt->mnt_fsname, dev)) {
+ ret = 1;
+ break;
+ }
+ }
+
+ endmntent(mtab);
+ return ret;
+}
+
+#else
+
+int device_is_mounted(const char *dev)
+{
+ return 0;
+}
+
+#endif