Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d1bec30d authored by Dan Pasanen's avatar Dan Pasanen
Browse files

fs_mgr: skip an fstab entry if we detect a different filesystem type

* also add fs_mgr_get_entry_for_mount_point_after to header for
  recovery to use.

Change-Id: I1bc1a1aad3328d139ab0d3d81b8b8c4b1b6bc49f
parent 4ec3924d
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -8,8 +8,8 @@ LOCAL_SRC_FILES:= fs_mgr.c fs_mgr_verity.c fs_mgr_fstab.c
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include

LOCAL_MODULE:= libfs_mgr
LOCAL_STATIC_LIBRARIES := liblogwrap libmincrypt libext4_utils_static
LOCAL_C_INCLUDES += system/extras/ext4_utils
LOCAL_STATIC_LIBRARIES := liblogwrap libmincrypt libext4_utils_static libext2_blkid libext2_uuid
LOCAL_C_INCLUDES += system/extras/ext4_utils external/e2fsprogs/lib
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/include
LOCAL_CFLAGS := -Werror

@@ -30,7 +30,7 @@ LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT)/sbin
LOCAL_UNSTRIPPED_PATH := $(TARGET_ROOT_OUT_UNSTRIPPED)

LOCAL_STATIC_LIBRARIES := libfs_mgr liblogwrap libcutils liblog libc libmincrypt libext4_utils_static
LOCAL_STATIC_LIBRARIES := libfs_mgr liblogwrap libcutils liblog libc libmincrypt libext4_utils_static libext2_blkid libext2_uuid

LOCAL_CFLAGS := -Werror

+9 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <cutils/partition_utils.h>
#include <cutils/properties.h>
#include <logwrap/logwrap.h>
#include <blkid/blkid.h>

#include "mincrypt/rsa.h"
#include "mincrypt/sha.h"
@@ -328,6 +329,7 @@ int fs_mgr_mount_all(struct fstab *fstab)
    int mret = -1;
    int mount_errno = 0;
    int attempted_idx = -1;
    char *detected_fs_type;

    if (!fstab) {
        return -1;
@@ -358,6 +360,13 @@ int fs_mgr_mount_all(struct fstab *fstab)
                continue;
            }
        }

        /* Skip fstab entries for partitions that we KNOW are wrong */
        detected_fs_type = blkid_get_tag_value(NULL, "TYPE", fstab->recs[i].blk_device);
        if (detected_fs_type && strcmp(fstab->recs[i].fs_type, detected_fs_type) != 0) {
            continue;
        }

        int last_idx_inspected;
        mret = mount_with_alternatives(fstab, i, &last_idx_inspected, &attempted_idx);
        i = last_idx_inspected;
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ int fs_mgr_add_entry(struct fstab *fstab,
                     const char *mount_point, const char *fs_type,
                     const char *blk_device);
struct fstab_rec *fs_mgr_get_entry_for_mount_point(struct fstab *fstab, const char *path);
struct fstab_rec *fs_mgr_get_entry_for_mount_point_after(struct fstab_rec *start_rec, struct fstab *fstab, const char *path);
int fs_mgr_is_voldmanaged(struct fstab_rec *fstab);
int fs_mgr_is_nonremovable(struct fstab_rec *fstab);
int fs_mgr_is_encryptable(struct fstab_rec *fstab);
+3 −1
Original line number Diff line number Diff line
@@ -60,7 +60,9 @@ LOCAL_STATIC_LIBRARIES := \
	libc \
	libselinux \
	libmincrypt \
	libext4_utils_static
	libext4_utils_static \
	libext2_blkid \
	libext2_uuid

LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
ifneq ($(strip $(TARGET_PLATFORM_DEVICE_BASE)),)