summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-10-03 10:07:58 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-10-03 10:07:58 +0200
commitbe41bc6d0330dc3fb8f602d876c4de5977e44de5 (patch)
treea7cbe15d9a7188f6ce39b8689416ded7fa6c9869 /roots.cpp
parentrelease-request-b4bc7b84-64b6-4176-8f16-ce17068fad13-for-git_pi-release-4370135 snap-temp-L93500000107644030 (diff)
parentMerge "roots: Fix an issue with volume_for_path()." am: dd7a4b5264 am: 8b8c7eb442 am: 24801a3438 (diff)
downloadandroid_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar.gz
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar.bz2
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar.lz
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar.xz
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.tar.zst
android_bootable_recovery-be41bc6d0330dc3fb8f602d876c4de5977e44de5.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/roots.cpp b/roots.cpp
index 7d7d1bdc7..c0348d715 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <stdint.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -38,7 +39,6 @@
#include <ext4_utils/wipe.h>
#include <fs_mgr.h>
-#include "common.h"
#include "mounts.h"
static struct fstab* fstab = nullptr;
@@ -69,15 +69,19 @@ void load_volume_table() {
printf("\n");
}
+Volume* volume_for_mount_point(const std::string& mount_point) {
+ return fs_mgr_get_entry_for_mount_point(fstab, mount_point);
+}
+
// Finds the volume specified by the given path. fs_mgr_get_entry_for_mount_point() does exact match
// only, so it attempts the prefixes recursively (e.g. "/cache/recovery/last_log",
// "/cache/recovery", "/cache", "/" for a given path of "/cache/recovery/last_log") and returns the
// first match or nullptr.
-Volume* volume_for_path(const char* path) {
+static Volume* volume_for_path(const char* path) {
if (path == nullptr || path[0] == '\0') return nullptr;
std::string str(path);
while (true) {
- Volume* result = fs_mgr_get_entry_for_mount_point(fstab, str.c_str());
+ Volume* result = fs_mgr_get_entry_for_mount_point(fstab, str);
if (result != nullptr || str == "/") {
return result;
}