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

Commit f74553f8 authored by Wei Wang's avatar Wei Wang Committed by Gerrit Code Review
Browse files

Merge "Split fstab mount into 2 phases"

parents 85a78f19 254f4436
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ static int handle_encryptable(const struct fstab_rec* rec)
 * first successful mount.
 * Returns -1 on error, and  FS_MGR_MNTALL_* otherwise.
 */
int fs_mgr_mount_all(struct fstab *fstab)
int fs_mgr_mount_all(struct fstab *fstab, int mount_mode)
{
    int i = 0;
    int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE;
@@ -500,8 +500,10 @@ int fs_mgr_mount_all(struct fstab *fstab)
    }

    for (i = 0; i < fstab->num_entries; i++) {
        /* Don't mount entries that are managed by vold */
        if (fstab->recs[i].fs_mgr_flags & (MF_VOLDMANAGED | MF_RECOVERYONLY)) {
        /* Don't mount entries that are managed by vold or not for the mount mode*/
        if ((fstab->recs[i].fs_mgr_flags & (MF_VOLDMANAGED | MF_RECOVERYONLY)) ||
             ((mount_mode == MOUNT_MODE_LATE) && !fs_mgr_is_latemount(&fstab->recs[i])) ||
             ((mount_mode == MOUNT_MODE_EARLY) && fs_mgr_is_latemount(&fstab->recs[i]))) {
            continue;
        }

+6 −0
Original line number Diff line number Diff line
@@ -77,6 +77,7 @@ static struct flag_list fs_mgr_flags[] = {
    { "formattable", MF_FORMATTABLE },
    { "slotselect",  MF_SLOTSELECT },
    { "nofail",      MF_NOFAIL },
    { "latemount",   MF_LATEMOUNT },
    { "defaults",    0 },
    { 0,             0 },
};
@@ -516,3 +517,8 @@ int fs_mgr_is_nofail(struct fstab_rec *fstab)
{
    return fstab->fs_mgr_flags & MF_NOFAIL;
}

int fs_mgr_is_latemount(struct fstab_rec *fstab)
{
    return fstab->fs_mgr_flags & MF_LATEMOUNT;
}
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
    fstab = fs_mgr_read_fstab(fstab_file);

    if (a_flag) {
        return fs_mgr_mount_all(fstab);
        return fs_mgr_mount_all(fstab, MOUNT_MODE_DEFAULT);
    } else if (n_flag) {
        return fs_mgr_do_mount(fstab, n_name, n_blk_dev, 0);
    } else if (u_flag) {
+2 −1
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ __BEGIN_DECLS
#define MF_FORMATTABLE  0x4000
#define MF_SLOTSELECT   0x8000
#define MF_FORCEFDEORFBE 0x10000
#define MF_LATEMOUNT    0x20000
#define MF_NOFAIL       0x40000

#define DM_BUF_SIZE 4096
+9 −1
Original line number Diff line number Diff line
@@ -42,6 +42,13 @@ enum verity_mode {
    VERITY_MODE_DEFAULT = VERITY_MODE_RESTART
};

// Mount modes
enum mount_mode {
    MOUNT_MODE_DEFAULT = 0,
    MOUNT_MODE_EARLY = 1,
    MOUNT_MODE_LATE = 2
};

/*
 * The entries must be kept in the same order as they were seen in the fstab.
 * Unless explicitly requested, a lookup on mount point should always
@@ -84,7 +91,7 @@ void fs_mgr_free_fstab(struct fstab *fstab);
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTED 1
#define FS_MGR_MNTALL_DEV_NOT_ENCRYPTABLE 0
#define FS_MGR_MNTALL_FAIL (-1)
int fs_mgr_mount_all(struct fstab *fstab);
int fs_mgr_mount_all(struct fstab *fstab, int mount_mode);

#define FS_MGR_DOMNT_FAILED (-1)
#define FS_MGR_DOMNT_BUSY (-2)
@@ -110,6 +117,7 @@ int fs_mgr_is_noemulatedsd(const struct fstab_rec *fstab);
int fs_mgr_is_notrim(struct fstab_rec *fstab);
int fs_mgr_is_formattable(struct fstab_rec *fstab);
int fs_mgr_is_nofail(struct fstab_rec *fstab);
int fs_mgr_is_latemount(struct fstab_rec *fstab);
int fs_mgr_swapon_all(struct fstab *fstab);

int fs_mgr_do_format(struct fstab_rec *fstab, bool reserve_footer);
Loading