• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ scan_mounted_volumes函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中scan_mounted_volumes函数的典型用法代码示例。如果您正苦于以下问题:C++ scan_mounted_volumes函数的具体用法?C++ scan_mounted_volumes怎么用?C++ scan_mounted_volumes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了scan_mounted_volumes函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ensure_path_mounted

int ensure_path_mounted(const char* path) {
    Volume* v = volume_for_path(path);
    if (v == NULL) {
        LOGE("unknown volume for path [%s]\n", path);
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted.
        return 0;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv) {
        // volume is already mounted
        return 0;
    }

    mkdir("/mnt", 0755);  // in case it doesn't already exist
    mkdir(v->mount_point, 0755);  // in case it doesn't already exist

    if (strcmp(v->fs_type, "yaffs2") == 0) {
        // mount an MTD partition as a YAFFS2 filesystem.
        mtd_scan_partitions();
        const MtdPartition* partition;
        partition = mtd_find_partition_by_name(v->device);
        if (partition == NULL) {
            LOGE("failed to find \"%s\" partition to mount at \"%s\"\n",
                 v->device, v->mount_point);
            return -1;
        }
        return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0);
    } else if (strcmp(v->fs_type, "ext4") == 0 ||
               strcmp(v->fs_type, "vfat") == 0) {
        result = mount(v->device, v->mount_point, v->fs_type,
                       MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
        if (result == 0) return 0;

        if (v->device2) {
            LOGW("failed to mount %s (%s); trying %s\n",
                 v->device, strerror(errno), v->device2);
            result = mount(v->device2, v->mount_point, v->fs_type,
                           MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
            if (result == 0) return 0;
        }

        LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
        return -1;
    }

    LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point);
    return -1;
}
开发者ID:TheTypoMaster,项目名称:x86-android-5.0,代码行数:60,代码来源:roots.c


示例2: ensure_path_unmounted

int ensure_path_unmounted(const char* path) {
    // if we are using /data/media, do not ever unmount volumes /data or /sdcard
    if (strstr(path, "/data") == path && is_data_media()) {
        return 0;
    }

    Volume* v = volume_for_path(path);
    if (v == NULL) {
        LOGE("unknown volume for path [%s]\n", path);
        return -1;
    }
    if (is_data_media_volume_path(path)) {
        return ensure_path_unmounted("/data");
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted; you can't unmount it.
        return -1;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        // volume is already unmounted
        return 0;
    }

    return unmount_mounted_volume(mv);
}
开发者ID:1998-yhf,项目名称:android_bootable_recovery,代码行数:35,代码来源:roots.c


示例3: is_path_mounted

int is_path_mounted(const char* path) {
    Volume* v = volume_for_path(path);
    if (v == NULL) {
        return 0;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted.
        return 1;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return 0;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv) {
        // volume is already mounted
        return 1;
    }
    return 0;
}
开发者ID:ghbhaha,项目名称:mtk6589_bootable_recovery,代码行数:25,代码来源:extendedcommands.c


示例4: get_restore_handler

static nandroid_restore_handler get_restore_handler(const char *backup_path) {
    Volume *v = volume_for_path(backup_path);
    if (v == NULL) {
        ui_print("Unable to find volume.\n");
        return NULL;
    }
    scan_mounted_volumes();
    const MountedVolume *mv = find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        ui_print("Unable to find mounted volume: %s\n", v->mount_point);
        return NULL;
    }

    if (strcmp(backup_path, "/data") == 0 && is_data_media()) {
        return tar_extract_wrapper;
    }

    // Disable tar backups of yaffs2 by default
    char prefer_tar[PROPERTY_VALUE_MAX];
    property_get("ro.cwm.prefer_tar", prefer_tar, "false");
    if (strcmp("yaffs2", mv->filesystem) == 0 && strcmp("false", prefer_tar) == 0) {
        return unyaffs_wrapper;
    }

    return tar_extract_wrapper;
}
开发者ID:iebie,项目名称:bootmenu_z1_and_z1c,代码行数:26,代码来源:nandroid.c


示例5: ensure_path_mounted

int ensure_path_mounted(const char* path) {
    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    const MountedVolume* mv = find_mounted_volume_by_mount_point("/data");
    const MountedVolume* m_v = find_mounted_volume_by_mount_point("/cache");
    if (mv && m_v) {
        // volume is already mounted
        return 0;
    }

    if (!mv) {
	    result = mount("/[email protected]", "/data", "ext4",
                       MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
	    if (result < 0) {
  		   LOGE("failed to mount /data (%s)\n", strerror(errno));
		   return -1;
	    }
    }
    if (!m_v) {
	    result = mount("/[email protected]", "/cache", "ext4",
                       MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
	    if (result < 0) {
  		   LOGE("failed to mount /cache (%s)\n", strerror(errno));
		   return -1;
	    }
    }
    if (result == 0) 
	 	return 0;
}
开发者ID:AwaisKing,项目名称:mt6577_aosp_source,代码行数:34,代码来源:meta_clr_emmc.c


示例6: check_root_path_mounted

static int check_root_path_mounted(const char* root_path)
{   
    const MountedVolume *volume;

    LOGD(TAG "%s: Start\n", __FUNCTION__);

    /* scan the volumes already mounted */
    int ret = scan_mounted_volumes();
    
    if (ret < 0) 
    {
        return ret;
    }

    /* Find if the path is already mounted */
    volume = find_mounted_volume_by_mount_point(root_path);
    
    if (volume == NULL) 
    {
        /* It's not mounted. */
        return -1;
    }    

    return 0;
}
开发者ID:4Fwolf,项目名称:mt6572_x201,代码行数:25,代码来源:ftm_flash.c


示例7: internal_root_mounted

static int
internal_root_mounted(const RootInfo *info)
{
    if (info->mount_point == NULL) {
        return -1;
    }
    if(info->device == NULL)
        return 0;
//xxx if TMP: (or similar) just say "yes"

    /* See if this root is already mounted.
     */
    int ret = scan_mounted_volumes();
    if (ret < 0) {
        return ret;
    }
    const MountedVolume *volume;
    volume = find_mounted_volume_by_mount_point(info->mount_point);
    if (volume != NULL) {
        /* It's already mounted.
         */
        return 0;
    }
    return -1;
}
开发者ID:Tasssadar,项目名称:Amon-Ra-Style-Recovery-Optimus_Lineup,代码行数:25,代码来源:roots.c


示例8: UnmountFn

Value* UnmountFn(const char* name, State* state, int argc, Expr* argv[]) {
    char* result = NULL;
    if (argc != 1) {
        return ErrorAbort(state, "%s() expects 1 arg, got %d", name, argc);
    }
    char* mount_point;
    if (ReadArgs(state, argv, 1, &mount_point) < 0) {
        return NULL;
    }
    if (strlen(mount_point) == 0) {
        ErrorAbort(state, "mount_point argument to unmount() can't be empty");
        goto done;
    }

    scan_mounted_volumes();
    const MountedVolume* vol = find_mounted_volume_by_mount_point(mount_point);
    if (vol == NULL) {
        fprintf(stderr, "unmount of %s failed; no such volume\n", mount_point);
        result = strdup("");
    } else {
        unmount_mounted_volume(vol);
        result = mount_point;
    }

done:
    if (result != mount_point) free(mount_point);
    return StringValue(result);
}
开发者ID:fjy2003,项目名称:fortwone_recovery_cn,代码行数:28,代码来源:install.c


示例9: ensure_path_unmounted

int ensure_path_unmounted(const char* path) {
    Volume* v = volume_for_path(path);

#if defined(CACHE_MERGE_SUPPORT)
    if (strncmp(path, "/cache", 6) == 0) {
        unlink(path);
        return 0;
    }
#endif

    if (v == NULL) {
        LOGE("unknown volume for path [%s]\n", path);
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted; you can't unmount it.
        return -1;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        // volume is already unmounted
        return 0;
    }

    return unmount_mounted_volume(mv);
}
开发者ID:bju2000,项目名称:MT6797,代码行数:35,代码来源:roots.cpp


示例10: get_restore_handler

static nandroid_restore_handler get_restore_handler(const char *backup_path) {
    Volume *v = volume_for_path(backup_path);
    if (v == NULL) {
        ui_print("Unable to find volume.\n");
        return NULL;
    }
    scan_mounted_volumes();
    MountedVolume *mv = find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        ui_print("Unable to find mounted volume: %s\n", v->mount_point);
        return NULL;
    }

    if (strcmp(backup_path, "/data") == 0 && is_data_media()) {
        return tar_extract_wrapper;
    }

    // cwr 5, we prefer tar for everything unless it is yaffs2
    char str[255];
    char* partition;
    property_get("ro.cwm.prefer_tar", str, "false");
    if (strcmp("true", str) != 0) {
        return unyaffs_wrapper;
    }

    if (strcmp("yaffs2", mv->filesystem) == 0) {
        return unyaffs_wrapper;
    }

    return tar_extract_wrapper;
}
开发者ID:Atlant777,项目名称:philz_touch_cwm6,代码行数:31,代码来源:nandroid.c


示例11: ensure_path_unmounted

int ensure_path_unmounted(const char* path) {
	if (PartitionManager.UnMount_By_Path(path, true))
		return 0;
	else
		return -1;
    Volume* v = volume_for_path(path);
    if (v == NULL) {
        LOGE("unknown volume for path [%s]\n", path);
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted; you can't unmount it.
        return -1;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        // volume is already unmounted
        return 0;
    }

    return unmount_mounted_volume(mv);
}
开发者ID:111111111,项目名称:TWRP_CN,代码行数:31,代码来源:roots.cpp


示例12: ensure_root_path_unmounted

int
ensure_root_path_unmounted(const char *root_path)
{
    const RootInfo *info = get_root_info_for_path(root_path);
    if (info == NULL) {
        return -1;
    }
    if (info->mount_point == NULL) {
        /* This root can't be mounted, so by definition it isn't.
         */
        return 0;
    }
//xxx if TMP: (or similar) just return error

    /* See if this root is already mounted.
     */
    int ret = scan_mounted_volumes();
    if (ret < 0) {
        return ret;
    }
    const MountedVolume *volume;
    volume = find_mounted_volume_by_mount_point(info->mount_point);
    if (volume == NULL) {
        /* It's not mounted.
         */
        return 0;
    }

    return unmount_mounted_volume(volume);
}
开发者ID:chibucks,项目名称:i5700-leshak-recovery2,代码行数:30,代码来源:roots.c


示例13: ensure_volume_mounted

int ensure_volume_mounted(fstab_rec* v) {
    if (v == NULL) {
        LOGE("cannot mount unknown volume\n");
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted.
        return 0;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    if (!fs_mgr_is_voldmanaged(v)) {
        const MountedVolume* mv =
            find_mounted_volume_by_mount_point(v->mount_point);
        if (mv) {
            // volume is already mounted
            return 0;
        }
    }

    mkdir_p(v->mount_point, 0755);  // in case it doesn't already exist

    if (fs_mgr_is_voldmanaged(v)) {
        if (!strcmp(v->mount_point, "auto")) {
            return vold_mount_auto_volume(v->label, 1);
        }
        return vold_mount_volume(v->mount_point, 1);

    } else if (strcmp(v->fs_type, "yaffs2") == 0) {
        // mount an MTD partition as a YAFFS2 filesystem.
        mtd_scan_partitions();
        const MtdPartition* partition;
        partition = mtd_find_partition_by_name(v->blk_device);
        if (partition == NULL) {
            LOGE("failed to find \"%s\" partition to mount at \"%s\"\n",
                 v->blk_device, v->mount_point);
            return -1;
        }
        return mtd_mount_partition(partition, v->mount_point, v->fs_type, 0);
    } else if (strcmp(v->fs_type, "ext4") == 0 ||
               strcmp(v->fs_type, "f2fs") == 0 ||
               strcmp(v->fs_type, "vfat") == 0) {
        result = mount(v->blk_device, v->mount_point, v->fs_type,
                       MS_NOATIME | MS_NODEV | MS_NODIRATIME, "");
        if (result == 0) return 0;

        LOGE("failed to mount %s (%s)\n", v->mount_point, strerror(errno));
        return -1;
    }

    LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, v->mount_point);
    return -1;
}
开发者ID:daddy366,项目名称:anarchy-bootable,代码行数:59,代码来源:roots.cpp


示例14: ensure_path_mounted_at

// Mount the volume specified by path at the given mount_point.
int ensure_path_mounted_at(const char* path, const char* mount_point) {
    Volume* v = volume_for_path(path);
    if (v == NULL) {
        LOGE("unknown volume for path [%s]\n", path);
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted.
        return 0;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    if (!mount_point) {
        mount_point = v->mount_point;
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(mount_point);
    if (mv) {
        // volume is already mounted
        return 0;
    }

    mkdir(mount_point, 0755);  // in case it doesn't already exist

    if (strcmp(v->fs_type, "yaffs2") == 0) {
        // mount an MTD partition as a YAFFS2 filesystem.
        mtd_scan_partitions();
        const MtdPartition* partition;
        partition = mtd_find_partition_by_name(v->blk_device);
        if (partition == NULL) {
            LOGE("failed to find \"%s\" partition to mount at \"%s\"\n",
                 v->blk_device, mount_point);
            return -1;
        }
        return mtd_mount_partition(partition, mount_point, v->fs_type, 0);
    } else if (strcmp(v->fs_type, "ext4") == 0 ||
               strcmp(v->fs_type, "squashfs") == 0 ||
               strcmp(v->fs_type, "vfat") == 0) {
        result = mount(v->blk_device, mount_point, v->fs_type,
                       v->flags, v->fs_options);
        if (result == 0) return 0;

        LOGE("failed to mount %s (%s)\n", mount_point, strerror(errno));
        return -1;
    }

    LOGE("unknown fs_type \"%s\" for %s\n", v->fs_type, mount_point);
    return -1;
}
开发者ID:Khaon,项目名称:android_bootable_recovery,代码行数:57,代码来源:roots.cpp


示例15: device_truedualboot_mount

int device_truedualboot_mount(const char* path, const char* mount_point) {
	if(strcmp(path, "/data") != 0)
		return 1;
	else if(mount_point!=NULL && strcmp(mount_point, MOUNTPOINT_DATAROOT)==0)
		return 1;

	if(!dualboot_is_tdb_enabled())
		return 1;

	ensure_path_mounted_at_mount_point("/data", MOUNTPOINT_DATAROOT);

	Volume* v = volume_for_path(path);
	if (v == NULL) {
		LOGE("unknown volume for path [%s]\n", path);
		return -1;
	}

	int result = scan_mounted_volumes();
	if (result < 0) {
		LOGE("failed to scan mounted volumes\n");
		return -1;
	}

	if (NULL == mount_point)
		mount_point = v->mount_point;

	const MountedVolume* mv =
		find_mounted_volume_by_mount_point(mount_point);
	if (mv) {
		// volume is already mounted
		return 0;
	}

	char* bind_path;
	if(get_selected_system()==SYSTEM1)
		bind_path = MOUNTPOINT_DATAROOT "/system0";
	else if(get_selected_system()==SYSTEM2)
		bind_path = MOUNTPOINT_DATAROOT "/system1";
	else return -1;

	mkdir(mount_point, 0755);  // in case it doesn't already exist
	mkdir(bind_path, 0755);

	char mount_cmd[PATH_MAX];
	sprintf(mount_cmd, "mount -o bind %s %s", bind_path, mount_point);
	int ret = __system(mount_cmd);
	if(ret!=0) return ret>0?-ret:ret;

	return 0;

}
开发者ID:Rohirimor,项目名称:android_device_xiaomi_mione_plus-carbon,代码行数:51,代码来源:recovery_ui.c


示例16: nandroid_backup_partition_extended

int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {

    int ret = 0;
    char name[PATH_MAX];
    char tmp[PATH_MAX];
    strcpy(name, basename(mount_point));

    struct stat file_info;
    build_configuration_path(tmp, NANDROID_HIDE_PROGRESS_FILE);
    ensure_path_mounted(tmp);
    int callback = stat(tmp, &file_info) != 0;

    ui_print("Backing up %s...\n", name);
    if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
        ui_print("Can't mount %s!\n", mount_point);
        return ret;
    }
    compute_directory_stats(mount_point);
    scan_mounted_volumes();
    Volume *v = volume_for_path(mount_point);
    const MountedVolume *mv = NULL;
    if (v != NULL)
        mv = find_mounted_volume_by_mount_point(v->mount_point);

    if (strcmp(backup_path, "-") == 0)
        sprintf(tmp, "/proc/self/fd/1");
    else if (mv == NULL || mv->filesystem == NULL)
        sprintf(tmp, "%s/%s.auto", backup_path, name);
    else
        sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
    nandroid_backup_handler backup_handler = get_backup_handler(mount_point);

    if (backup_handler == NULL) {
        ui_print("Error finding an appropriate backup handler.\n");
        return -2;
    }
    ret = backup_handler(mount_point, tmp, callback);
    if (umount_when_finished) {
        ensure_path_unmounted(mount_point);
    }
    if (0 != ret) {
        ui_print("Error while making a backup image of %s!\n", mount_point);
        return ret;
    }
    ui_print("Backup of %s completed.\n", name);
    return 0;
}
开发者ID:iebie,项目名称:bootmenu_z1_and_z1c,代码行数:47,代码来源:nandroid.c


示例17: replace_device_node

static int replace_device_node(int num, struct stat* statbuf) {
	scan_mounted_volumes();
	MountedVolume * mv = find_mounted_volume_by_real_node(part_table[num].path);

	if(mv!=NULL && unmount_mounted_volume(mv)!=0) {
		LOGE("could not unmount device!\n");
		return -1;
	}

	unlink(part_table[num].path);
	if(mknod(part_table[num].path, statbuf->st_mode, statbuf->st_rdev)!=0) {
		LOGE("could not create node!\n");
		return -1;
	}

	return 0;
}
开发者ID:Rohirimor,项目名称:android_device_xiaomi_mione_plus-carbon,代码行数:17,代码来源:dualboot.c


示例18: nandroid_backup_partition_extended

int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {

    int ret = 0;
    char name[PATH_MAX];
    strcpy(name, basename(mount_point));

    struct stat file_info;
    int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) != 0;

    ui_print("备份中 %s...\n", name);
    if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
        ui_print("无法挂载 %s!\n", mount_point);
        return ret;
    }
    compute_directory_stats(mount_point);
    char tmp[PATH_MAX];
    scan_mounted_volumes();
    Volume *v = volume_for_path(mount_point);
    MountedVolume *mv = NULL;
    if (v != NULL)
        mv = find_mounted_volume_by_mount_point(v->mount_point);

    if (strcmp(backup_path, "-") == 0)
        sprintf(tmp, "/proc/self/fd/1");
    else if (mv == NULL || mv->filesystem == NULL)
        sprintf(tmp, "%s/%s.auto", backup_path, name);
    else
        sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
    nandroid_backup_handler backup_handler = get_backup_handler(mount_point);

    if (backup_handler == NULL) {
        ui_print("找不到合适的备份方案.\n");
        return -2;
    }
    ret = backup_handler(mount_point, tmp, callback);
    if (umount_when_finished) {
        ensure_path_unmounted(mount_point);
    }
    if (0 != ret) {
        ui_print("生成下列镜像文件时失败:  %s!\n", mount_point);
        return ret;
    }
    ui_print("备份 %s 完成.\n", name);
    return 0;
}
开发者ID:Aromer-room,项目名称:mtk6589_recovery_cn,代码行数:45,代码来源:nandroid.c


示例19: nandroid_backup_partition_extended

int nandroid_backup_partition_extended(const char* backup_path, const char* mount_point, int umount_when_finished) {
    int ret = 0;
    char name[PATH_MAX];
    strcpy(name, basename(mount_point));

    ensure_path_mounted("/sdcard");
    struct stat file_info;
    int callback = stat("/sdcard/clockworkmod/.hidenandroidprogress", &file_info) != 0;

    ui_print("Backing up %s...\n", name);
    if (0 != (ret = ensure_path_mounted(mount_point) != 0)) {
        ui_print("Can't mount %s!\n", mount_point);
        return ret;
    }
    compute_directory_stats(mount_point);
    char tmp[PATH_MAX];
    scan_mounted_volumes();
    Volume *v = volume_for_path(mount_point);
    MountedVolume *mv = NULL;
    if (v != NULL)
        mv = find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL || mv->filesystem == NULL)
        sprintf(tmp, "%s/%s.auto", backup_path, name);
    else
        sprintf(tmp, "%s/%s.%s", backup_path, name, mv->filesystem);
    nandroid_backup_handler backup_handler = get_backup_handler(mount_point);
    if (backup_handler == NULL) {
        ui_print("Error finding an appropriate backup handler.\n");
        return -2;
    }
    ret = backup_handler(mount_point, tmp, callback);
    if (umount_when_finished) {
        ensure_path_unmounted(mount_point);
    }
    if (0 != ret) {
        ui_print("Error while making a backup image of %s!\n", mount_point);
        return ret;
    }
    ui_print("Backup of %s completed.\n", name);
    return 0;
}
开发者ID:regina-book,项目名称:touch_recovery_cm10,代码行数:41,代码来源:nandroid.c


示例20: ensure_volume_unmounted

int ensure_volume_unmounted(fstab_rec* v, bool detach) {
    if (v == NULL) {
        LOGE("cannot unmount unknown volume\n");
        return -1;
    }
    if (strcmp(v->fs_type, "ramdisk") == 0) {
        // the ramdisk is always mounted; you can't unmount it.
        return -1;
    }

    int result;
    result = scan_mounted_volumes();
    if (result < 0) {
        LOGE("failed to scan mounted volumes\n");
        return -1;
    }

    if (fs_mgr_is_voldmanaged(v)) {
        if (!strcmp(v->mount_point, "auto")) {
            return vold_unmount_auto_volume(v->label, 0, 1, detach);
        }
        return vold_unmount_volume(v->mount_point, 0, 1, detach);
    }

    const MountedVolume* mv =
        find_mounted_volume_by_mount_point(v->mount_point);
    if (mv == NULL) {
        // volume is already unmounted
        return 0;
    }

    if (detach) {
        result = unmount_mounted_volume_detach(mv);
    }
    else {
        result = unmount_mounted_volume(mv);
    }

    return result;
}
开发者ID:daddy366,项目名称:anarchy-bootable,代码行数:40,代码来源:roots.cpp



注:本文中的scan_mounted_volumes函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ scan_ulong函数代码示例发布时间:2022-05-30
下一篇:
C++ scan_files函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap