Skip to content

Commit

Permalink
Make lib/mountcheck.c a stand-alone library
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
kusumi authored and axboe committed Apr 26, 2017
1 parent b58e3ce commit 1919295
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mountcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifdef CONFIG_GETMNTENT
#include <mntent.h>

#include "lib/mountcheck.h"
#include "mountcheck.h"

#define MTAB "/etc/mtab"

Expand Down

0 comments on commit 1919295

Please sign in to comment.