aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk8
-rw-r--r--roots.cpp23
-rw-r--r--updater/Android.mk3
-rw-r--r--updater/install.c11
4 files changed, 42 insertions, 3 deletions
diff --git a/Android.mk b/Android.mk
index 0ae92de..d51e218 100644
--- a/Android.mk
+++ b/Android.mk
@@ -70,6 +70,7 @@ LOCAL_C_INCLUDES += \
system/vold \
system/extras/ext4_utils \
system/core/adb \
+ external/e2fsprogs/lib
LOCAL_STATIC_LIBRARIES := \
libext4_utils_static \
@@ -221,7 +222,9 @@ LOCAL_STATIC_LIBRARIES += \
libcutils \
liblog \
libm \
- libc
+ libc \
+ libext2_blkid \
+ libext2_uuid
LOCAL_C_INCLUDES += \
system/core/fs_mgr/include \
@@ -232,7 +235,8 @@ LOCAL_C_INCLUDES += \
external/libtar/listhash \
external/openssl/include \
external/zlib \
- bionic/libc/bionic
+ bionic/libc/bionic \
+ external/e2fsprogs/lib
include $(BUILD_EXECUTABLE)
diff --git a/roots.cpp b/roots.cpp
index d27a2dd..3c51c35 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -37,6 +37,7 @@ extern "C" {
}
#include "voldclient.h"
+#include <blkid/blkid.h>
static struct fstab *fstab = NULL;
@@ -143,7 +144,27 @@ bool volume_is_verity(Volume *v)
}
Volume* volume_for_path(const char* path) {
- return fs_mgr_get_entry_for_mount_point(fstab, path);
+ Volume *rec = fs_mgr_get_entry_for_mount_point(fstab, path);
+
+ if (rec == NULL)
+ return rec;
+
+ if (strcmp(rec->fs_type, "ext4") == 0 || strcmp(rec->fs_type, "f2fs") == 0 ||
+ strcmp(rec->fs_type, "vfat") == 0) {
+ char *detected_fs_type = blkid_get_tag_value(NULL, "TYPE", rec->blk_device);
+
+ if (detected_fs_type == NULL)
+ return rec;
+
+ Volume *fetched_rec = rec;
+ while (rec != NULL && strcmp(rec->fs_type, detected_fs_type) != 0)
+ rec = fs_mgr_get_entry_for_mount_point_after(rec, fstab, path);
+
+ if (rec == NULL)
+ return fetched_rec;
+ }
+
+ return rec;
}
Volume* volume_for_label(const char* label) {
diff --git a/updater/Android.mk b/updater/Android.mk
index 9f9da06..1ea1fb7 100644
--- a/updater/Android.mk
+++ b/updater/Android.mk
@@ -28,6 +28,9 @@ LOCAL_STATIC_LIBRARIES += \
libsparse_static \
libz
+LOCAL_C_INCLUDES += external/e2fsprogs/lib
+LOCAL_STATIC_LIBRARIES += libext2_blkid libext2_uuid
+
ifneq ($(BOARD_RECOVERY_BLDRMSG_OFFSET),)
LOCAL_CFLAGS += -DBOARD_RECOVERY_BLDRMSG_OFFSET=$(BOARD_RECOVERY_BLDRMSG_OFFSET)
endif
diff --git a/updater/install.c b/updater/install.c
index 8d569ff..43d5cfb 100644
--- a/updater/install.c
+++ b/updater/install.c
@@ -33,6 +33,7 @@
#include <sys/xattr.h>
#include <linux/xattr.h>
#include <inttypes.h>
+#include <blkid/blkid.h>
#include "bootloader.h"
#include "applypatch/applypatch.h"
@@ -167,6 +168,16 @@ Value* MountFn(const char* name, State* state, int argc, Expr* argv[]) {
}
result = mount_point;
} else {
+ char *detected_fs_type = blkid_get_tag_value(NULL, "TYPE", location);
+ if (detected_fs_type) {
+ uiPrintf(state, "detected filesystem %s for %s\n",
+ detected_fs_type, location);
+ fs_type = detected_fs_type;
+ } else {
+ uiPrintf(state, "could not detect filesystem for %s, assuming %s\n",
+ location, fs_type);
+ }
+
if (mount(location, mount_point, fs_type,
MS_NOATIME | MS_NODEV | MS_NODIRATIME,
has_mount_options ? mount_options : "") < 0) {