4 #ifdef CONFIG_GETMNTENT
7 #include "mountcheck.h"
9 #define MTAB "/etc/mtab"
11 int device_is_mounted(const char *dev)
17 mtab = setmntent(MTAB, "r");
21 while ((mnt = getmntent(mtab)) != NULL) {
24 if (!strcmp(mnt->mnt_fsname, dev)) {
34 #elif defined(CONFIG_GETMNTINFO)
36 #include <sys/param.h>
37 #include <sys/mount.h>
39 int device_is_mounted(const char *dev)
44 ret = getmntinfo(&st, MNT_NOWAIT);
48 for (i = 0; i < ret; i++) {
49 if (!strcmp(st[i].f_mntfromname, dev))
56 #elif defined(CONFIG_GETMNTINFO_STATVFS)
58 #include <sys/statvfs.h>
60 int device_is_mounted(const char *dev)
65 ret = getmntinfo(&st, MNT_NOWAIT);
69 for (i = 0; i < ret; i++) {
70 if (!strcmp(st[i].f_mntfromname, dev))
80 int device_is_mounted(const char *dev)