Merge "fs_mgr: removing the dependency of requiring /vbmeta in fstab for AVB"

This commit is contained in:
Treehugger Robot 2017-02-10 06:21:13 +00:00 committed by Gerrit Code Review
commit f803afaa65
2 changed files with 10 additions and 24 deletions

View file

@ -215,8 +215,8 @@ static bool load_vbmeta_prop(androidboot_vbmeta *vbmeta_prop)
// Reads digest.
if (digest.size() != expected_digest_size) {
LERROR << "Unexpected digest size: " << digest.size() << " (expected: "
<< expected_digest_size << ")";
LERROR << "Unexpected digest size: " << digest.size()
<< " (expected: " << expected_digest_size << ")";
return false;
}
@ -482,22 +482,6 @@ static bool get_hashtree_descriptor(const std::string &partition_name,
return true;
}
static inline bool polling_vbmeta_blk_device(struct fstab *fstab)
{
// It needs the block device symlink: fstab_rec->blk_device to read
// /vbmeta partition. However, the symlink created by ueventd might
// not be ready at this point. Use test_access() to poll it before
// trying to read the partition.
struct fstab_rec *fstab_entry =
fs_mgr_get_entry_for_mount_point(fstab, "/vbmeta");
// Makes sure /vbmeta block device is ready to access.
if (fs_mgr_test_access(fstab_entry->blk_device) < 0) {
return false;
}
return true;
}
static bool init_is_avb_used()
{
// When AVB is used, boot loader should set androidboot.vbmeta.{hash_alg,
@ -529,11 +513,6 @@ int fs_mgr_load_vbmeta_images(struct fstab *fstab)
{
FS_MGR_CHECK(fstab != nullptr);
if (!polling_vbmeta_blk_device(fstab)) {
LERROR << "Failed to find block device of /vbmeta";
return FS_MGR_SETUP_AVB_FAIL;
}
// Gets the expected hash value of vbmeta images from
// kernel cmdline.
if (!load_vbmeta_prop(&fs_mgr_vbmeta_prop)) {

View file

@ -66,7 +66,7 @@ static AvbIOResult read_from_partition(AvbOps *ops ATTRIBUTE_UNUSED,
fs_mgr_get_entry_for_mount_point(fs_mgr_fstab, "/misc");
if (fstab_entry == nullptr) {
LERROR << "Partition (" << partition << ") not found in fstab";
LERROR << "/misc mount point not found in fstab";
return AVB_IO_RESULT_ERROR_IO;
}
@ -79,6 +79,13 @@ static AvbIOResult read_from_partition(AvbOps *ops ATTRIBUTE_UNUSED,
path = by_name_prefix + partition_name;
}
// Ensures the device path (a symlink created by init) is ready to
// access. fs_mgr_test_access() will test a few iterations if the
// path doesn't exist yet.
if (fs_mgr_test_access(path.c_str()) < 0) {
return AVB_IO_RESULT_ERROR_IO;
}
android::base::unique_fd fd(
TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC)));