aboutsummaryrefslogtreecommitdiffstats
path: root/mounts.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'mounts.cpp')
-rw-r--r--mounts.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/mounts.cpp b/mounts.cpp
index f23376b0..9491f5d1 100644
--- a/mounts.cpp
+++ b/mounts.cpp
@@ -83,6 +83,15 @@ int unmount_mounted_volume(MountedVolume* volume) {
return umount(mount_point.c_str());
}
+int unmount_mounted_volume_detach(MountedVolume* volume) {
+ // Intentionally pass the empty string to umount if the caller tries
+ // to unmount a volume they already unmounted using this
+ // function.
+ std::string mount_point = volume->mount_point;
+ volume->mount_point.clear();
+ return umount2(mount_point.c_str(), MNT_DETACH);
+}
+
int remount_read_only(MountedVolume* volume) {
return mount(volume->device.c_str(), volume->mount_point.c_str(), volume->filesystem.c_str(),
MS_NOATIME | MS_NODEV | MS_NODIRATIME | MS_RDONLY | MS_REMOUNT, 0);