Make lib/mountcheck.c a stand-alone library
authorTomohiro Kusumi <tkusumi@tuxera.com>
Fri, 14 Apr 2017 21:06:24 +0000 (00:06 +0300)
committerJens Axboe <axboe@fb.com>
Wed, 26 Apr 2017 18:43:10 +0000 (12:43 -0600)
commit19192959b8725e5acf15a5fb5246e81934266689
treebbf9782489bb58fe8d59be957d9d288c77a157b3
parentb58e3cee98842a9333de90202dc217e421e6c8f2
Make lib/mountcheck.c a stand-alone library

It needs to include mountcheck.h from local directory where
mountcheck.c is also located, to be able to use this as
a stand-alone library, which is useful for debugging purpose.
In fact, most of the files under lib/ directory do things this way.

--
 # cat ./test11.c
 #include <stdio.h>
 #include "lib/mountcheck.h"
 int main(int argc, char **argv) {
         printf("%d\n", device_is_mounted(argv[1]));
         return 0;
 }

--
 # uname
 Linux
 # gcc -Wall -g -DCONFIG_GETMNTENT ./test11.c ./lib/mountcheck.c
 # ./a.out /dev/sda1
 1

--
 # uname
 DragonFly
 # gcc -Wall -g -DCONFIG_GETMNTINFO ./test11.c ./lib/mountcheck.c
 # ./a.out /dev/da0s1a
 1

--
 # uname
 NetBSD
 # gcc -Wall -g -DCONFIG_GETMNTINFO_STATVFS ./test11.c ./lib/mountcheck.c
 # ./a.out /dev/sd0a
 1

Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
lib/mountcheck.c