Merge "Use more inclusive language for #inclusivefixit"
This commit is contained in:
commit
628f288f8a
16 changed files with 45 additions and 48 deletions
|
@ -45,7 +45,7 @@ namespace fiemap {
|
|||
|
||||
using namespace android::dm;
|
||||
|
||||
// We cap the maximum number of extents as a sanity measure.
|
||||
// We cap the maximum number of extents as a robustness measure.
|
||||
static constexpr uint32_t kMaxExtents = 50000;
|
||||
|
||||
// TODO: Fallback to using fibmap if FIEMAP_EXTENT_MERGED is set.
|
||||
|
|
|
@ -266,7 +266,7 @@ bool SplitFiemap::Write(const void* data, uint64_t bytes) {
|
|||
cursor_file_pos_ += bytes_to_write;
|
||||
}
|
||||
|
||||
// If we've reached the end of the current file, close it for sanity.
|
||||
// If we've reached the end of the current file, close it.
|
||||
if (cursor_file_pos_ == file->size()) {
|
||||
cursor_fd_ = {};
|
||||
}
|
||||
|
|
|
@ -139,8 +139,7 @@ bool BlockDeviceToName(uint32_t major, uint32_t minor, std::string* bdev_name) {
|
|||
}
|
||||
|
||||
*bdev_name = ::android::base::Basename(sysfs_bdev);
|
||||
// Paranoid sanity check to make sure we just didn't get the
|
||||
// input in return as-is.
|
||||
// Check that the symlink doesn't point to itself.
|
||||
if (sysfs_bdev == *bdev_name) {
|
||||
LOG(ERROR) << "Malformed symlink for block device: " << sysfs_bdev;
|
||||
return false;
|
||||
|
|
|
@ -52,16 +52,16 @@ static AvbIOResult read_from_partition(AvbOps* ops, const char* partition, int64
|
|||
partition, offset, num_bytes, buffer, out_num_read);
|
||||
}
|
||||
|
||||
static AvbIOResult dummy_read_rollback_index(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
size_t rollback_index_location ATTRIBUTE_UNUSED,
|
||||
uint64_t* out_rollback_index) {
|
||||
static AvbIOResult no_op_read_rollback_index(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
size_t rollback_index_location ATTRIBUTE_UNUSED,
|
||||
uint64_t* out_rollback_index) {
|
||||
// rollback_index has been checked in bootloader phase.
|
||||
// In user-space, returns the smallest value 0 to pass the check.
|
||||
*out_rollback_index = 0;
|
||||
return AVB_IO_RESULT_OK;
|
||||
}
|
||||
|
||||
static AvbIOResult dummy_validate_vbmeta_public_key(
|
||||
static AvbIOResult no_op_validate_vbmeta_public_key(
|
||||
AvbOps* ops ATTRIBUTE_UNUSED, const uint8_t* public_key_data ATTRIBUTE_UNUSED,
|
||||
size_t public_key_length ATTRIBUTE_UNUSED,
|
||||
const uint8_t* public_key_metadata ATTRIBUTE_UNUSED,
|
||||
|
@ -76,8 +76,8 @@ static AvbIOResult dummy_validate_vbmeta_public_key(
|
|||
return AVB_IO_RESULT_OK;
|
||||
}
|
||||
|
||||
static AvbIOResult dummy_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
bool* out_is_unlocked) {
|
||||
static AvbIOResult no_op_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
bool* out_is_unlocked) {
|
||||
// The function is for bootloader to update the value into
|
||||
// androidboot.vbmeta.device_state in kernel cmdline.
|
||||
// In user-space, returns true as we don't need to update it anymore.
|
||||
|
@ -85,9 +85,9 @@ static AvbIOResult dummy_read_is_device_unlocked(AvbOps* ops ATTRIBUTE_UNUSED,
|
|||
return AVB_IO_RESULT_OK;
|
||||
}
|
||||
|
||||
static AvbIOResult dummy_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
const char* partition ATTRIBUTE_UNUSED,
|
||||
char* guid_buf, size_t guid_buf_size) {
|
||||
static AvbIOResult no_op_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
const char* partition ATTRIBUTE_UNUSED,
|
||||
char* guid_buf, size_t guid_buf_size) {
|
||||
// The function is for bootloader to set the correct UUID
|
||||
// for a given partition in kernel cmdline.
|
||||
// In user-space, returns a faking one as we don't need to update
|
||||
|
@ -96,9 +96,9 @@ static AvbIOResult dummy_get_unique_guid_for_partition(AvbOps* ops ATTRIBUTE_UNU
|
|||
return AVB_IO_RESULT_OK;
|
||||
}
|
||||
|
||||
static AvbIOResult dummy_get_size_of_partition(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
const char* partition ATTRIBUTE_UNUSED,
|
||||
uint64_t* out_size_num_byte) {
|
||||
static AvbIOResult no_op_get_size_of_partition(AvbOps* ops ATTRIBUTE_UNUSED,
|
||||
const char* partition ATTRIBUTE_UNUSED,
|
||||
uint64_t* out_size_num_byte) {
|
||||
// The function is for bootloader to load entire content of AVB HASH partitions.
|
||||
// In user-space, returns 0 as we only need to set up AVB HASHTHREE partitions.
|
||||
*out_size_num_byte = 0;
|
||||
|
@ -123,15 +123,15 @@ FsManagerAvbOps::FsManagerAvbOps() {
|
|||
// We only need to provide the implementation of read_from_partition()
|
||||
// operation since that's all what is being used by the avb_slot_verify().
|
||||
// Other I/O operations are only required in bootloader but not in
|
||||
// user-space so we set them as dummy operations. Also zero the entire
|
||||
// user-space so we set them as no-op operations. Also zero the entire
|
||||
// struct so operations added in the future will be set to NULL.
|
||||
memset(&avb_ops_, 0, sizeof(AvbOps));
|
||||
avb_ops_.read_from_partition = read_from_partition;
|
||||
avb_ops_.read_rollback_index = dummy_read_rollback_index;
|
||||
avb_ops_.validate_vbmeta_public_key = dummy_validate_vbmeta_public_key;
|
||||
avb_ops_.read_is_device_unlocked = dummy_read_is_device_unlocked;
|
||||
avb_ops_.get_unique_guid_for_partition = dummy_get_unique_guid_for_partition;
|
||||
avb_ops_.get_size_of_partition = dummy_get_size_of_partition;
|
||||
avb_ops_.read_rollback_index = no_op_read_rollback_index;
|
||||
avb_ops_.validate_vbmeta_public_key = no_op_validate_vbmeta_public_key;
|
||||
avb_ops_.read_is_device_unlocked = no_op_read_is_device_unlocked;
|
||||
avb_ops_.get_unique_guid_for_partition = no_op_get_unique_guid_for_partition;
|
||||
avb_ops_.get_size_of_partition = no_op_get_size_of_partition;
|
||||
|
||||
// Sets user_data for GetInstanceFromAvbOps() to convert it back to FsManagerAvbOps.
|
||||
avb_ops_.user_data = this;
|
||||
|
|
|
@ -226,7 +226,7 @@ AvbUniquePtr AvbHandle::LoadAndVerifyVbmeta(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
// Sanity check here because we have to use vbmeta_images_[0] below.
|
||||
// Validity check here because we have to use vbmeta_images_[0] below.
|
||||
if (avb_handle->vbmeta_images_.size() < 1) {
|
||||
LERROR << "LoadAndVerifyVbmetaByPartition failed, no vbmeta loaded";
|
||||
return nullptr;
|
||||
|
@ -405,11 +405,11 @@ AvbUniquePtr AvbHandle::Open() {
|
|||
// - AVB_SLOT_VERIFY_RESULT_ERROR_VERIFICATION (UNLOCKED only).
|
||||
// Might occur in either the top-level vbmeta or a chained vbmeta.
|
||||
// - AVB_SLOT_VERIFY_RESULT_ERROR_PUBLIC_KEY_REJECTED (UNLOCKED only).
|
||||
// Could only occur in a chained vbmeta. Because we have *dummy* operations in
|
||||
// Could only occur in a chained vbmeta. Because we have *no-op* operations in
|
||||
// FsManagerAvbOps such that avb_ops->validate_vbmeta_public_key() used to validate
|
||||
// the public key of the top-level vbmeta always pass in userspace here.
|
||||
//
|
||||
// The following verify result won't happen, because the *dummy* operation
|
||||
// The following verify result won't happen, because the *no-op* operation
|
||||
// avb_ops->read_rollback_index() always returns the minimum value zero. So rollbacked
|
||||
// vbmeta images, which should be caught in the bootloader stage, won't be detected here.
|
||||
// - AVB_SLOT_VERIFY_RESULT_ERROR_ROLLBACK_INDEX
|
||||
|
|
|
@ -222,7 +222,7 @@ TEST(BasicUtilTest, ListFiles) {
|
|||
base::FilePath test_dir;
|
||||
ASSERT_TRUE(base::CreateTemporaryDirInDir(tmp_dir, "list-file-tests.", &test_dir));
|
||||
|
||||
// Generates dummy files to list.
|
||||
// Generates test files to list.
|
||||
base::FilePath file_path_1 = test_dir.Append("1.txt");
|
||||
ASSERT_TRUE(base::WriteFile(file_path_1, "1", 1));
|
||||
base::FilePath file_path_2 = test_dir.Append("2.txt");
|
||||
|
@ -253,7 +253,7 @@ TEST(BasicUtilTest, ListFilesShouldDiscardSymlink) {
|
|||
base::FilePath test_dir;
|
||||
ASSERT_TRUE(base::CreateTemporaryDirInDir(tmp_dir, "list-file-tests.", &test_dir));
|
||||
|
||||
// Generates dummy files to list.
|
||||
// Generates test files to list.
|
||||
base::FilePath file_path_1 = test_dir.Append("1.txt");
|
||||
ASSERT_TRUE(base::WriteFile(file_path_1, "1", 1));
|
||||
base::FilePath file_path_2 = test_dir.Append("2.txt");
|
||||
|
@ -281,7 +281,7 @@ TEST(BasicUtilTest, ListFilesOpenDirFailure) {
|
|||
base::FilePath tmp_dir;
|
||||
ASSERT_TRUE(GetTempDir(&tmp_dir));
|
||||
|
||||
// Generates dummy files to list.
|
||||
// Generates test files to list.
|
||||
base::FilePath no_such_dir = tmp_dir.Append("not_such_dir");
|
||||
|
||||
auto fail = ListFiles(no_such_dir.value());
|
||||
|
|
|
@ -234,7 +234,7 @@ TEST_F(BuilderTest, InternalPartitionAlignment) {
|
|||
EXPECT_EQ(lba, aligned_lba);
|
||||
}
|
||||
|
||||
// Sanity check one extent.
|
||||
// Check one extent.
|
||||
EXPECT_EQ(exported->extents.back().target_data, 3072);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ TEST_F(DeviceTest, BlockDeviceInfo) {
|
|||
BlockDeviceInfo device_info;
|
||||
ASSERT_TRUE(opener.GetInfo(fs_mgr_get_super_partition_name(), &device_info));
|
||||
|
||||
// Sanity check that the device doesn't give us some weird inefficient
|
||||
// Check that the device doesn't give us some weird inefficient
|
||||
// alignment.
|
||||
EXPECT_EQ(device_info.alignment % LP_SECTOR_SIZE, 0);
|
||||
EXPECT_EQ(device_info.logical_block_size % LP_SECTOR_SIZE, 0);
|
||||
|
|
|
@ -49,7 +49,7 @@ std::string GetPartitionAbsolutePath(const std::string& path) {
|
|||
// Dynamic System Update is installed to an sdcard, which won't be in
|
||||
// the boot device list.
|
||||
//
|
||||
// We whitelist because most devices in /dev/block are not valid for
|
||||
// mmcblk* is allowed because most devices in /dev/block are not valid for
|
||||
// storing fiemaps.
|
||||
if (android::base::StartsWith(path, "mmcblk")) {
|
||||
return "/dev/block/" + path;
|
||||
|
|
|
@ -174,7 +174,7 @@ static bool ReadMetadataHeader(Reader* reader, LpMetadata* metadata) {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Do basic sanity checks before computing the checksum.
|
||||
// Do basic validity checks before computing the checksum.
|
||||
if (header.magic != LP_METADATA_HEADER_MAGIC) {
|
||||
LERROR << "Logical partition metadata has invalid magic value.";
|
||||
return false;
|
||||
|
@ -255,7 +255,7 @@ static std::unique_ptr<LpMetadata> ParseMetadata(const LpMetadataGeometry& geome
|
|||
|
||||
LpMetadataHeader& header = metadata->header;
|
||||
|
||||
// Sanity check the table size.
|
||||
// Check the table size.
|
||||
if (header.tables_size > geometry.metadata_max_size) {
|
||||
LERROR << "Invalid partition metadata header table size.";
|
||||
return nullptr;
|
||||
|
|
|
@ -81,8 +81,8 @@ std::string SerializeMetadata(const LpMetadata& input) {
|
|||
return header_blob + tables;
|
||||
}
|
||||
|
||||
// Perform sanity checks so we don't accidentally overwrite valid metadata
|
||||
// with potentially invalid metadata, or random partition data with metadata.
|
||||
// Perform checks so we don't accidentally overwrite valid metadata with
|
||||
// potentially invalid metadata, or random partition data with metadata.
|
||||
static bool ValidateAndSerializeMetadata([[maybe_unused]] const IPartitionOpener& opener,
|
||||
const LpMetadata& metadata, const std::string& slot_suffix,
|
||||
std::string* blob) {
|
||||
|
|
|
@ -553,9 +553,8 @@ class SnapshotManager final : public ISnapshotManager {
|
|||
// This should only be called in recovery.
|
||||
bool UnmapAllPartitions();
|
||||
|
||||
// Sanity check no snapshot overflows. Note that this returns false negatives if the snapshot
|
||||
// overflows, then is remapped and not written afterwards. Hence, the function may only serve
|
||||
// as a sanity check.
|
||||
// Check no snapshot overflows. Note that this returns false negatives if the snapshot
|
||||
// overflows, then is remapped and not written afterwards.
|
||||
bool EnsureNoOverflowSnapshot(LockedFile* lock);
|
||||
|
||||
enum class Slot { Unknown, Source, Target };
|
||||
|
|
|
@ -300,9 +300,9 @@ bool SnapshotManager::CreateSnapshot(LockedFile* lock, SnapshotStatus* status) {
|
|||
LOG(ERROR) << "SnapshotStatus has no name.";
|
||||
return false;
|
||||
}
|
||||
// Sanity check these sizes. Like liblp, we guarantee the partition size
|
||||
// is respected, which means it has to be sector-aligned. (This guarantee
|
||||
// is useful for locating avb footers correctly). The COW file size, however,
|
||||
// Check these sizes. Like liblp, we guarantee the partition size is
|
||||
// respected, which means it has to be sector-aligned. (This guarantee is
|
||||
// useful for locating avb footers correctly). The COW file size, however,
|
||||
// can be arbitrarily larger than specified, so we can safely round it up.
|
||||
if (status->device_size() % kSectorSize != 0) {
|
||||
LOG(ERROR) << "Snapshot " << status->name()
|
||||
|
@ -351,7 +351,6 @@ Return SnapshotManager::CreateCowImage(LockedFile* lock, const std::string& name
|
|||
}
|
||||
|
||||
// The COW file size should have been rounded up to the nearest sector in CreateSnapshot.
|
||||
// Sanity check this.
|
||||
if (status.cow_file_size() % kSectorSize != 0) {
|
||||
LOG(ERROR) << "Snapshot " << name << " COW file size is not a multiple of the sector size: "
|
||||
<< status.cow_file_size();
|
||||
|
|
|
@ -141,7 +141,7 @@ SNAPSHOT_FUZZ_FUNCTION(RecoveryCreateSnapshotDevicesWithMetadata, CreateResult,
|
|||
const RecoveryCreateSnapshotDevicesArgs& args) {
|
||||
std::unique_ptr<AutoDevice> device;
|
||||
if (args.has_metadata_device_object()) {
|
||||
device = std::make_unique<DummyAutoDevice>(args.metadata_mounted());
|
||||
device = std::make_unique<NoOpAutoDevice>(args.metadata_mounted());
|
||||
}
|
||||
return snapshot->RecoveryCreateSnapshotDevices(device);
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ namespace android::snapshot {
|
|||
class AutoMemBasedDir;
|
||||
class SnapshotFuzzDeviceInfo;
|
||||
|
||||
class DummyAutoDevice : public AutoDevice {
|
||||
class NoOpAutoDevice : public AutoDevice {
|
||||
public:
|
||||
DummyAutoDevice(bool mounted) : AutoDevice(mounted ? "dummy" : "") {}
|
||||
NoOpAutoDevice(bool mounted) : AutoDevice(mounted ? "no_op" : "") {}
|
||||
};
|
||||
|
||||
struct SnapshotTestModule {
|
||||
|
|
|
@ -173,9 +173,9 @@ bool SnapshotMetadataUpdater::DeleteGroups() const {
|
|||
if (iter != groups_.end()) {
|
||||
continue;
|
||||
}
|
||||
// Update package metadata doesn't have this group. Before deleting it, sanity check that it
|
||||
// doesn't have any partitions left. Update metadata shouldn't assign any partitions to this
|
||||
// group, so all partitions that originally belong to this group should be moved by
|
||||
// Update package metadata doesn't have this group. Before deleting it, check that it
|
||||
// doesn't have any partitions left. Update metadata shouldn't assign any partitions to
|
||||
// this group, so all partitions that originally belong to this group should be moved by
|
||||
// MovePartitionsToDefault at this point.
|
||||
auto existing_partitions_in_group = builder_->ListPartitionsInGroup(existing_group_name);
|
||||
if (!existing_partitions_in_group.empty()) {
|
||||
|
|
Loading…
Reference in a new issue