This commit is NetBSD version of
e7e136da in 2015. It's basically
the same as the one for FreeBSD/DragonFlyBSD, but NetBSD takes
statvfs instead of statfs, so I had to add CONFIG_GETMNTINFO_STATVFS
to differentiate from CONFIG_GETMNTINFO. It could be renamed if
there is any better name, as it sounds strange.
compile_prog() takes -Werror for local CFLAGS. Without -Werror,
the existing getmntinfo(3) test code for FreeBSD/DragonFlyBSD only
gives a warning on NetBSD and results in trying to compile wrong
device_is_mounted().
(The reason this hasn't been reported as a problem is because of
the ./configure bug fixed by the previous commit. It fails to
compile the test code unless st is a pointer.)
The remaining one, OpenBSD seems to have the same interface as
FreeBSD/DragonFlyBSD, so the existing test code will probably work,
but fio doesn't compile on OpenBSD 5.9 due to other compile time
errors (lex error) that have nothing to do with this.
--
# uname
NetBSD
# cat ./test1.c
#include <stdio.h>
#include "./lib/mountcheck.h"
int main(int argc, char *argv[]) {
printf("%s %d\n", argv[1], device_is_mounted(argv[1]));
return 0;
}
# gcc -Wall -g ./test1.c ./lib/mountcheck.o -o ./test1
# ./test1 /dev/wd0a /* UFS */
/dev/wd0a 1
# ./test1 procfs /* procfs */
procfs 1
# ./test1 tmpfs /* tmpfs */
tmpfs 1
# ./test1 invalid /* irrelevant string */
invalid 0
Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>