#include <mntent.h>
#include <system_info.h>
#include <sys/mount.h>
+#include <libsyscommon/common.h>
#include "log.h"
#include "common.h"
return run_child(argc, argv);
}
-int mount_check(const char *path)
-{
- int ret = false;
- struct mntent *mnt;
- const char *table = "/etc/mtab";
- FILE *fp;
- int len;
-
- fp = setmntent(table, "r");
- if (!fp)
- return ret;
-
- len = strlen(path) + 1;
- while (1) {
- mnt = getmntent(fp);
- if (mnt == NULL)
- break;
- if (!strncmp(mnt->mnt_dir, path, len)) {
- ret = true;
- break;
- }
- }
- endmntent(fp);
- return ret;
-}
-
static int get_num_processes_on_partition(const char *part_path)
{
FILE *fp;
char *cmd = NULL;
/* if the path is not a mountpoint, do not perform umounting and killing */
- if (!mount_check(path))
+ if (!syscommon_is_mounted(path))
return;
ret = asprintf(&cmd, "mount | grep \" on %s \" | awk '{print $1}'", path);
int run_child(int argc, const char *argv[]);
int get_systemd_reboot_param(char *buf, unsigned bufsize);
-int mount_check(const char* path);
void umount_partition_by_kill(const char *path, const int max_retry);
bool is_emulator(void);
int do_mkdir(const char *path, mode_t mode);
#include <libsyscommon/libsystemd.h>
#include <libsyscommon/list.h>
#include <libsyscommon/ini-parser.h>
+#include <libsyscommon/common.h>
#include "core/log.h"
#include "shared/device-notifier.h"
/* Workaround: "modprobe usb_f_fs" doesn't guarantee that /sys/kernel/config is mounted */
for (i = 0; i < 10; i++) {
- if (mount_check(CONFIGFS_PATH))
+ if (syscommon_is_mounted(CONFIGFS_PATH))
break;
sleep (1);