diff options
author | elfmz <fenix1905@tut.by> | 2022-10-27 23:22:15 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2022-10-27 23:25:40 +0300 |
commit | 78458d8afb5216c55ebe384b08e688e4ffc79b3d (patch) | |
tree | dd5fadfe599d5b598d7daf7a5f7ddee2329a0162 | |
parent | 6cae1adec50281fa695649f01f682189a1ec9234 (diff) |
minor
-rwxr-xr-x | far2l/bootstrap/unmount.sh | 6 | ||||
-rw-r--r-- | far2l/src/mix/MountInfo.cpp | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/far2l/bootstrap/unmount.sh b/far2l/bootstrap/unmount.sh new file mode 100755 index 00000000..85441baf --- /dev/null +++ b/far2l/bootstrap/unmount.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if [ "$2" = 'force' ]; then + sudo umount -f "$1" +else + umount "$1" +fi diff --git a/far2l/src/mix/MountInfo.cpp b/far2l/src/mix/MountInfo.cpp index 669cd6b5..16c4e096 100644 --- a/far2l/src/mix/MountInfo.cpp +++ b/far2l/src/mix/MountInfo.cpp @@ -162,7 +162,6 @@ public: } }; - static bool SkipForLocationMenu(const char *path) { if (StrStartsFrom(path, "/System/") @@ -195,7 +194,7 @@ MountInfo::MountInfo(bool for_location_menu) #ifdef __linux__ // manual parsing mounts file instead of using setmntent cuz later doesnt return // mounted device path that is needed to determine if its 'rotational' - std::ifstream is("/proc/mounts"); + std::ifstream is("/etc/mtab"); if (is.is_open()) { std::string line, sys_path; std::vector<std::string> parts; @@ -205,7 +204,11 @@ MountInfo::MountInfo(bool for_location_menu) if (parts.size() > 1 && StrStartsFrom(parts[1], "/") && (!for_location_menu || !SkipForLocationMenu(parts[1].c_str()))) { bool multi_thread_friendly; - if (StrStartsFrom(parts[0], "/dev/")) { + if (for_location_menu) { + // Location menu doesn't care about this, so dont waist time + multi_thread_friendly = false; + + } else if (StrStartsFrom(parts[0], "/dev/")) { sys_path = "/sys/block/"; sys_path+= parts[0].substr(5); // strip device suffix, sda1 -> sda, mmcblk0p1 -> mmcblk0 @@ -222,6 +225,7 @@ MountInfo::MountInfo(bool for_location_menu) fprintf(stderr, "%s: can't read '%s'\n", __FUNCTION__, sys_path.c_str()); } multi_thread_friendly = (c == '0'); + } else { multi_thread_friendly = (parts[0] == "tmpfs" || parts[0] == "proc"); } |