android文件系統掛載分析(1)---正常開機掛載


未完,更新中 。。。

 

"android"系列分為三部分:

1.正常開機掛載

2.encryption

3.dm-verity

 

  我們知道android有很多分區,如"system","userdata","cache",他們是何時掛載的?如何掛載的?這個系列的文章進行分析。這里介紹第一部分,android手機正常開機各分區的掛載。這里我們以mtk平台進行分析,高通與mtk差別不是很大。

 

  我們知道kernel起來以后執行的第一個文件是init進程,init進程會根據init.rc的規則啟動進程或者服務。init.rc通過"import /init.${ro.hardware}.rc"語句導入平台的規則。

device/mediatek/mt6797/init.mt6797.rc

on fs
    write /proc/bootprof "INIT:Mount_START" mount_all /fstab.mt6797
    chown system system /mobile_info
    chmod 0771 /mobile_info
    exec /system/bin/tune2fs -O has_journal -u 10010 -r 4096 /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/userdata
    write /proc/bootprof "INIT:Mount_END"

mount_all是一條命令,/fstab.mt6797是傳入的參數

system/core/init/keywords.h

.....
   KEYWORD(mount_all,   COMMAND, 1, do_mount_all)
.....

從上面我們可以看出,mount_all命令對應的是do_mount_all函數,/fstab.mt6797是do_mount_all函數的傳入參數

system/core/init/builtins.cpp

int do_mount_all(int nargs, char **args)
{
    pid_t pid;
    int ret = -1;
    int child_ret = -1;
    int status;
    struct fstab *fstab;

    if (nargs != 2) {
        return -1;
    }

    /*
     * Call fs_mgr_mount_all() to mount all filesystems.  We fork(2) and         //使用fs_mgr_mount_all()函數去掛載所有的文件系統,我們使用fork()函數分配一個新的進程,在子進程中做掛載的事情,這樣即使掛載出現問題,也能保護init主進程。
     * do the call in the child to provide protection to the main init
     * process if anything goes wrong (crash or memory leak), and wait for
     * the child to finish in the parent.
     */
    pid = fork();
    if (pid > 0) {                   //父進程,等待子進程(pid=0)返回
        /* Parent.  Wait for the child to return */
        int wp_ret = TEMP_FAILURE_RETRY(waitpid(pid, &status, 0));
        if (wp_ret < 0) {
            /* Unexpected error code. We will continue anyway. */
            NOTICE("waitpid failed rc=%d: %s\n", wp_ret, strerror(errno));
        }

        if (WIFEXITED(status)) {
            ret = WEXITSTATUS(status);
        } else {
            ret = -1;
        }
    } else if (pid == 0) {     //子進程
        /* child, call fs_mgr_mount_all() */
        klog_set_level(6);  /* So we can see what fs_mgr_mount_all() does */    //修改kernel log的等級,讓我們可以看到fs_mgr_mount_all函數的log
        fstab = fs_mgr_read_fstab(args[1]);      //args[1]是傳入的參數/fstab.mt6797,是一個文件。      加載分區掛載文件的內容到fstab結構體中。
        child_ret = fs_mgr_mount_all(fstab);     //掛載分區*******************
        fs_mgr_free_fstab(fstab);
        if (child_ret == -1) {
            ERROR("fs_mgr_mount_all returned an error\n");
        }
        _exit(child_ret);
    } else {
        /* fork failed, return an error */
        return -1;
    }

    if (ret == FS_MGR_MNTALL_DEV_NEEDS_ENCRYPTION) {
        property_set("vold.decrypt", "trigger_encryption");
    } else if (ret == FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED) {
        property_set("ro.crypto.state", "encrypted");
        property_set("ro.crypto.type", "block");
        property_set("vold.decrypt", "trigger_default_encryption");
    } else if (ret == FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) {
        property_set("ro.crypto.state", "unencrypted");
        /* If fs_mgr determined this is an unencrypted device, then trigger
         * that action.
         */
        action_for_each_trigger("nonencrypted", action_add_queue_tail);
    } else if (ret == FS_MGR_MNTALL_DEV_NEEDS_RECOVERY) {
        /* Setup a wipe via recovery, and reboot into recovery */
        ERROR("fs_mgr_mount_all suggested recovery, so wiping data via recovery.\n");
        ret = wipe_data_via_recovery();
        /* If reboot worked, there is no return. */
    } else if (ret == FS_MGR_MNTALL_DEV_DEFAULT_FILE_ENCRYPTED) {
        if (e4crypt_install_keyring()) {
            return -1;
        }
        property_set("ro.crypto.state", "encrypted");
        property_set("ro.crypto.type", "file");

        // Although encrypted, we have device key, so we do not need to
        // do anything different from the nonencrypted case.
        action_for_each_trigger("nonencrypted", action_add_queue_tail);
    } else if (ret == FS_MGR_MNTALL_DEV_NON_DEFAULT_FILE_ENCRYPTED) {
        if (e4crypt_install_keyring()) {
            return -1;
        }
        property_set("ro.crypto.state", "encrypted");
        property_set("ro.crypto.type", "file");
        property_set("vold.decrypt", "trigger_restart_min_framework");
    } else if (ret > 0) {
        ERROR("fs_mgr_mount_all returned unexpected error %d\n", ret);
    }
    /* else ... < 0: error */

    return ret;
}

 

fork()函數通過系統調用創建一個與原來進程幾乎完全相同的進程,也就是兩個進程可以做完全相同的事,但如果初始參數或者傳入的變量不同,兩個進程也可以做不同的事。返回值小於0為error,返回值等於0為子進程,返回值大於0為父進程。

 

args[1]是傳入的參數/fstab.mt6797,是一個文件,生成的位置在/out/target/product/xxx/root/fstab.mt6797,生成這個文件的源文件位於vendor/mediatek/proprietary/hardware/fstab/mt6797/,根據編譯規則確定fstab.mt6797文件的內容。

在do_mount_all()函數中,比較重要的兩個函數如下,我們分析一下這兩個函數

stab = fs_mgr_read_fstab(args[1]); 

child_ret = fs_mgr_mount_all(fstab);

 

首先我們看下fstab結構體和fstab.mt6797文件,fstab結構提要存儲fstab.mt6797文件中的掛載信息,

 

struct fstab {
    int num_entries;
    struct fstab_rec *recs;
    char *fstab_filename;
};

struct fstab_rec {
    char *blk_device;
    char *mount_point;
    char *fs_type;
    unsigned long flags;
    char *fs_options;
    int fs_mgr_flags;
    char *key_loc;
    char *verity_loc;
    long long length;
    char *label;
    int partnum;
    int swap_prio;
    unsigned int zram_size;
};

 

out/target/product/xxx/root/fstab.mt6797
# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6797/fstab.in"
# 1 "<built-in>"
# 1 "<命令行>"
# 1 "vendor/mediatek/proprietary/hardware/fstab/mt6797/fstab.in"
# 20 "vendor/mediatek/proprietary/hardware/fstab/mt6797/fstab.in"
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/system /system ext4 ro wait,verify

/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,forceencrypt=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata,
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/cache /cache ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/protect1 /protect_f ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/protect2 /protect_s ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/nvdata /nvdata ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/nvcfg /nvcfg ext4 noatime,nosuid,nodev,noauto_da_alloc,commit=1,nodelalloc wait,check,formattable
/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/mobile_info /mobile_info ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check
# 39 "vendor/mediatek/proprietary/hardware/fstab/mt6797/fstab.in"
/devices/mtk-msdc.0/11230000.msdc0* auto vfat defaults voldmanaged=sdcard0:auto
/devices/mtk-msdc.0/11240000.msdc1* auto auto defaults voldmanaged=sdcard1:auto,encryptable=userdata
/devices/soc/11270000.usb3_xhci* auto vfat defaults voldmanaged=usbotg:auto

.................

 

我們先分析fstab結構體存放的掛載信息,通過fs_mgr_read_fstab實現

system/core/fs_mgr_fstab.c

struct fstab *fs_mgr_read_fstab(const char *fstab_path)                //從上面可以知道fstab_path為/fstab.mt6797
{
    FILE *fstab_file;
    int cnt, entries;
    ssize_t len;
    size_t alloc_len = 0;
    char *line = NULL;
    const char *delim = " \t";
    char *save_ptr, *p;
    struct fstab *fstab = NULL;
    struct fs_mgr_flag_values flag_vals;
#define FS_OPTIONS_LEN 1024
    char tmp_fs_options[FS_OPTIONS_LEN];

    fstab_file = fopen(fstab_path, "r");           //打開文件
    if (!fstab_file) {
        ERROR("Cannot open file %s\n", fstab_path);
        return 0;
    }

    entries = 0;
    while ((len = getline(&line, &alloc_len, fstab_file)) != -1) {   //一行一行的讀取文件內容,line是指向存放該行字符的指針         第一次讀取文件內容,填充fstab結構體的內容
        /* if the last character is a newline, shorten the string by 1 byte */
        if (line[len - 1] == '\n') {          //如果最后一行是新行,縮短一字節的字符串
            line[len - 1] = '\0';
        }
        /* Skip any leading whitespace */
        p = line;                  
        while (isspace(*p)) {    
            p++;
        }
        /* ignore comments or empty lines */    //忽略注釋和空格開始的行
        if (*p == '#' || *p == '\0')
            continue;
        entries++;   //有用信息的行數
    }

    if (!entries) {       
        ERROR("No entries found in fstab\n");
        goto err;
    }

    /* Allocate and init the fstab structure */
    fstab = calloc(1, sizeof(struct fstab));        //給fstab結構體分配內存
    fstab->num_entries = entries;        //fstab->num_entries  存放可用信息的總行數
    fstab->fstab_filename = strdup(fstab_path);     // fstab->fstab_filename 存放"fstab.mt6797"名稱
    fstab->recs = calloc(fstab->num_entries, sizeof(struct fstab_rec));   //給fstab->recs結構體分配內存

    fseek(fstab_file, 0, SEEK_SET);      

    cnt = 0;
    while ((len = getline(&line, &alloc_len, fstab_file)) != -1) {        //第一次讀取文件內容,填充結構體fstab->recs的內容
        /* if the last character is a newline, shorten the string by 1 byte */
        if (line[len - 1] == '\n') {
            line[len - 1] = '\0';
        }

        /* Skip any leading whitespace */
        p = line;
        while (isspace(*p)) {
            p++;
        }
        /* ignore comments or empty lines */
        if (*p == '#' || *p == '\0')
            continue;

        /* If a non-comment entry is greater than the size we allocated, give an
         * error and quit.  This can happen in the unlikely case the file changes
         * between the two reads.
         */
        if (cnt >= entries) {
            ERROR("Tried to process more entries than counted\n");
            break;
        }
 //下面以/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/userdata /data ext4 noatime,nosuid,nodev,noauto_da_alloc,discard wait,check,resize,forceencrypt=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata,為例
        if (!(p = strtok_r(line, delim, &save_ptr))) {    //strtok_r字符串分割函數,line表示要分割的字符串,delim要分割的標志,p存放分割后的字符串
            ERROR("Error parsing mount source\n");
            goto err;
        }
        fstab->recs[cnt].blk_device = strdup(p);   //fstab->recs[cnt].blk_device  存放文件系統絕對路徑 /dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/userdata

        if (!(p = strtok_r(NULL, delim, &save_ptr))) {
            ERROR("Error parsing mount_point\n");
            goto err;
        }
        fstab->recs[cnt].mount_point = strdup(p);   //fstab->recs[cnt].mount_point  掛載點 /data

        if (!(p = strtok_r(NULL, delim, &save_ptr))) {
            ERROR("Error parsing fs_type\n");
            goto err;
        }
        fstab->recs[cnt].fs_type = strdup(p);    //fstab->recs[cnt].fs_type  文件系統類型  ext4

        if (!(p = strtok_r(NULL, delim, &save_ptr))) {   //此時的p存放的參數 noatime,nosuid,nodev,noauto_da_alloc,discard 
            ERROR("Error parsing mount_flags\n");
            goto err;
        }
        tmp_fs_options[0] = '\0';
        fstab->recs[cnt].flags = parse_flags(p, mount_flags, NULL,        //fstab->recs[cnt].flags 表示這行有無參數
                                       tmp_fs_options, FS_OPTIONS_LEN);

/*
static struct flag_list mount_flags[] = {
    { "noatime",    MS_NOATIME },
    { "noexec",     MS_NOEXEC },
    { "nosuid",     MS_NOSUID },
    { "nodev",      MS_NODEV },
    { "nodiratime", MS_NODIRATIME },
    { "ro",         MS_RDONLY },
    { "rw",         0 },
    { "remount",    MS_REMOUNT },
    { "bind",       MS_BIND },
    { "rec",        MS_REC },
    { "unbindable", MS_UNBINDABLE },
    { "private",    MS_PRIVATE },
    { "slave",      MS_SLAVE },
    { "shared",     MS_SHARED },
    { "defaults",   0 },
    { 0,            0 },
};
*/
/* fs_options are optional */ if (tmp_fs_options[0]) {                   //是個flags list,讀取noatime,nosuid,nodev,noauto_da_alloc,discard fstab->recs[cnt].fs_options = strdup(tmp_fs_options); } else { fstab->recs[cnt].fs_options = NULL; } if (!(p = strtok_r(NULL, delim, &save_ptr))) {           //此時p存放剩下的參數wait,check,resize,forceencrypt=/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata ERROR("Error parsing fs_mgr_options\n"); goto err; } fstab->recs[cnt].fs_mgr_flags = parse_flags(p, fs_mgr_flags, &flag_vals, NULL, 0);

/*
static struct flag_list fs_mgr_flags[] = {
    { "wait",        MF_WAIT },
    { "check",       MF_CHECK },
    { "encryptable=",MF_CRYPT },
    { "forceencrypt=",MF_FORCECRYPT },
    { "fileencryption",MF_FILEENCRYPTION },
    { "nonremovable",MF_NONREMOVABLE },
    { "voldmanaged=",MF_VOLDMANAGED},
    { "length=",     MF_LENGTH },
    { "recoveryonly",MF_RECOVERYONLY },
    { "swapprio=",   MF_SWAPPRIO },
    { "zramsize=",   MF_ZRAMSIZE },
    { "verify",      MF_VERIFY },
    { "noemulatedsd", MF_NOEMULATEDSD },
    { "notrim",       MF_NOTRIM },
    { "formattable", MF_FORMATTABLE },
#ifdef MTK_FSTAB_FLAGS
    { "resize",      MF_RESIZE },
#endif
    { "defaults",    0 },
    { 0,             0 },
};

*/
fstab
->recs[cnt].key_loc = flag_vals.key_loc;    //fstab->recs[cnt].key_loc 存放"="后的內容  這里是    "/dev/block/platform/mtk-msdc.0/11230000.msdc0/by-name/metadata" fstab->recs[cnt].verity_loc = flag_vals.verity_loc; fstab->recs[cnt].length = flag_vals.part_length; fstab->recs[cnt].label = flag_vals.label; fstab->recs[cnt].partnum = flag_vals.partnum; fstab->recs[cnt].swap_prio = flag_vals.swap_prio; fstab->recs[cnt].zram_size = flag_vals.zram_size; cnt++; } fclose(fstab_file); free(line); return fstab; err: fclose(fstab_file); free(line); if (fstab) fs_mgr_free_fstab(fstab); return NULL; }

 fstab.mt6797文件的內容已經讀取到fstab結構提中,下面開始分析掛載函數fs_mgr_mount_all,傳入的參數就是上面分析的fstab。

system/core/fs_mgr/fs_mgr.c

int fs_mgr_mount_all(struct fstab *fstab)
{
    int i = 0;
    int encryptable = FS_MGR_MNTALL_DEV_NOT_ENCRYPTED;            //這個變量涉及到encryption加密,后面的文章會詳細介紹這塊
    int error_count = 0;
    int mret = -1;
    int mount_errno = 0;
    int attempted_idx = -1;

    if (!fstab) {                
        return -1;
    }

    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)) {
            continue;
        }

        /* Skip swap and raw partition entries such as boot, recovery, etc */
        if (!strcmp(fstab->recs[i].fs_type, "swap") ||
            !strcmp(fstab->recs[i].fs_type, "emmc") ||
            !strcmp(fstab->recs[i].fs_type, "mtd")) {
            continue;
        }

        /* Translate LABEL= file system labels into block devices */
        if (!strcmp(fstab->recs[i].fs_type, "ext2") ||
            !strcmp(fstab->recs[i].fs_type, "ext3") ||
            !strcmp(fstab->recs[i].fs_type, "ext4")) {
            int tret = translate_ext_labels(&fstab->recs[i]);
            if (tret < 0) {
                ERROR("Could not translate label to block device\n");
                continue;
            }
        }
       ERROR("blk device name %s\n", fstab->recs[i].blk_device);
#if defined(MTK_UBIFS_SUPPORT) || defined (MTK_FTL_SUPPORT)                //這里支持UBIFS/FTL,這里沒有使用
    if (strcmp(fstab->recs[i].fs_type, "ubifs") == 0 && strncmp("ubi@", fstab->recs[i].blk_device, 4) == 0) {
        char tmp[25];
        int n = ubi_attach_mtd(fstab->recs[i].blk_device + 4);
        if (n < 0) {
            ERROR("ubi_attach_mtd fail device name %s\n", fstab->recs[i].blk_device+4);
            return -1;
        }

        n = sprintf(tmp, "/dev/ubi%d_0", n);
        free(fstab->recs[i].blk_device);
        fstab->recs[i].blk_device = malloc(n+1);
        sprintf(fstab->recs[i].blk_device, "%s", tmp);
        ERROR("debug : ubifs blk_device %s", fstab->recs[i].blk_device);
    } else if (!strcmp(fstab->recs[i].fs_type, "rawfs") || !strcmp(fstab->recs[i].fs_type, "yaffs2")) {
        char tmp[25];
        int n = mtd_name_to_number(fstab->recs[i].blk_device + 4);
        if (n < 0) {
            return -1;
        }

       n = sprintf(tmp, "/dev/block/mtdblock%d", n);
       free(fstab->recs[i].blk_device);
       fstab->recs[i].blk_device = malloc(n+1);
       sprintf(fstab->recs[i].blk_device, "%s", tmp);
       ERROR("debug : rawfs blk_device %s", fstab->recs[i].blk_device);
    }
#ifdef MTK_FTL_SUPPORT
    else if (!strcmp(fstab->recs[i].fs_type, "ext4") && strstr(fstab->recs[i].blk_device, "ftl")) {
        char tmp[30];
        int err = 0;
        int n = -1;
        int ubi_num = fstab->recs[i].blk_device[21] - '0';
        ERROR("debug : mtk_ftl_blk %s ubi_num %d\n", fstab->recs[i].blk_device, ubi_num);
        if(strstr(fstab->recs[i].mount_point, "system")){
            n = ubi_attach_mtd("system");
        }else if(strstr(fstab->recs[i].mount_point, "data")){
            n = ubi_attach_mtd("userdata");
        }else if(strstr(fstab->recs[i].mount_point, "cache")){
            n = ubi_attach_mtd("cache");
        }
        if((n != ubi_num) && (n >= 0))
        {
            ERROR("ubi number: %d == %d\n", n, ubi_num);
            ubi_num = n;
        }
        n = sprintf(tmp, "/dev/ubi%d_0", ubi_num);
        if (fstab->recs[i].fs_mgr_flags & MF_WAIT) {
            int ret = wait_for_file(tmp, WAIT_TIMEOUT);
            ERROR("wait_for_file(%s) ret = %d, errno = %s\n", fstab->recs[i].blk_device, ret, strerror(errno));
        }
        err = ftl_attach_ubi(ubi_num);
        if (err < 0) {
            return -1;
        }
    }
#endif
#endif
        if (fstab->recs[i].fs_mgr_flags & MF_WAIT) {          //當有"wait"關鍵字時,讓系統sleep一會
            wait_for_file(fstab->recs[i].blk_device, WAIT_TIMEOUT);
        }

        if ((fstab->recs[i].fs_mgr_flags & MF_VERIFY) && device_is_secure()) {        //這個if涉及到system的掛載問題,系統默認是把system掛載到dm-01上,用戶不可以remount,使能這個if,用戶可以remount,這塊會在后面的文章詳細介紹
            int rc = fs_mgr_setup_verity(&fstab->recs[i]);
            if (device_is_debuggable() && rc == FS_MGR_SETUP_VERITY_DISABLED) {      
                INFO("Verity disabled");
            } else if (rc != FS_MGR_SETUP_VERITY_SUCCESS) {
                ERROR("Could not set up verified partition, skipping!\n");
                continue;
            }
        }                     
//正常開機mount主要從是下面的代碼
int last_idx_inspected; int top_idx = i; mret = mount_with_alternatives(fstab, i, &last_idx_inspected, &attempted_idx, encryptable);     //函數掛載 i = last_idx_inspected; mount_errno = errno; /* Deal with encryptability. */ if (!mret) { int status = handle_encryptable(fstab, &fstab->recs[attempted_idx]);   //處理加密 if (status == FS_MGR_MNTALL_FAIL) { /* Fatal error - no point continuing */ return status; } if (status != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) { if (encryptable != FS_MGR_MNTALL_DEV_NOT_ENCRYPTED) { // Log and continue ERROR("Only one encryptable/encrypted partition supported\n"); } encryptable = status; } /* Success! Go get the next one */ continue; } /* mount(2) returned an error, handle the encryptable/formattable case */ bool wiped = partition_wiped(fstab->recs[top_idx].blk_device); if (mret && mount_errno != EBUSY && mount_errno != EACCES && fs_mgr_is_formattable(&fstab->recs[top_idx]) && wiped) { /* top_idx and attempted_idx point at the same partition, but sometimes * at two different lines in the fstab. Use the top one for formatting * as that is the preferred one. */ ERROR("%s(): %s is wiped and %s %s is formattable. Format it.\n", __func__, fstab->recs[top_idx].blk_device, fstab->recs[top_idx].mount_point, fstab->recs[top_idx].fs_type); if (fs_mgr_is_encryptable(&fstab->recs[top_idx]) && strcmp(fstab->recs[top_idx].key_loc, KEY_IN_FOOTER)) { int fd = open(fstab->recs[top_idx].key_loc, O_WRONLY, 0644); if (fd >= 0) { INFO("%s(): also wipe %s\n", __func__, fstab->recs[top_idx].key_loc); wipe_block_device(fd, get_file_size(fd)); close(fd); } else { ERROR("%s(): %s wouldn't open (%s)\n", __func__, fstab->recs[top_idx].key_loc, strerror(errno)); } } if (fs_mgr_do_format(&fstab->recs[top_idx]) == 0) { /* Let's replay the mount actions. */ i = top_idx - 1; continue; } } if (mret && mount_errno != EBUSY && mount_errno != EACCES && fs_mgr_is_encryptable(&fstab->recs[attempted_idx])) { if (wiped) { ERROR("%s(): %s is wiped and %s %s is encryptable. Suggest recovery...\n", __func__, fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point, fstab->recs[attempted_idx].fs_type); encryptable = FS_MGR_MNTALL_DEV_NEEDS_RECOVERY; continue; } else { /* Need to mount a tmpfs at this mountpoint for now, and set * properties that vold will query later for decrypting */ ERROR("%s(): possibly an encryptable blkdev %s for mount %s type %s )\n", __func__, fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point, fstab->recs[attempted_idx].fs_type); if (fs_mgr_do_tmpfs_mount(fstab->recs[attempted_idx].mount_point) < 0) { ++error_count; continue; } } encryptable = FS_MGR_MNTALL_DEV_MIGHT_BE_ENCRYPTED; } else { ERROR("Failed to mount an un-encryptable or wiped partition on" "%s at %s options: %s error: %s\n", fstab->recs[attempted_idx].blk_device, fstab->recs[attempted_idx].mount_point, fstab->recs[attempted_idx].fs_options, strerror(mount_errno)); ++error_count; continue; } } if (error_count) { return -1; } else { return encryptable; } }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM