From f248cc5a98d8da0d7667fd4e6bc951e0c279e802 Mon Sep 17 00:00:00 2001 From: Hongguang Chen Date: Wed, 22 Jul 2020 16:35:09 -0700 Subject: [PATCH] Use more inclusive language for #inclusivefixit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating language to comply with Android’s inclusive language guidance. See https://source.android.com/setup/contribute/respectful-code for reference. Bug: 161896447 Test: make Change-Id: I3e43a9a0f09b0587ec95de886705f03c1a430ef6 --- fs_mgr/libfiemap/fiemap_writer.cpp | 2 +- fs_mgr/libfiemap/split_fiemap_writer.cpp | 2 +- fs_mgr/libfiemap/utility.cpp | 3 +- fs_mgr/libfs_avb/avb_ops.cpp | 36 +++++++++---------- fs_mgr/libfs_avb/fs_avb.cpp | 6 ++-- fs_mgr/libfs_avb/tests/util_test.cpp | 6 ++-- fs_mgr/liblp/builder_test.cpp | 2 +- fs_mgr/liblp/device_test.cpp | 2 +- fs_mgr/liblp/partition_opener.cpp | 2 +- fs_mgr/liblp/reader.cpp | 4 +-- fs_mgr/liblp/writer.cpp | 4 +-- .../include/libsnapshot/snapshot.h | 5 ++- fs_mgr/libsnapshot/snapshot.cpp | 7 ++-- fs_mgr/libsnapshot/snapshot_fuzz.cpp | 2 +- fs_mgr/libsnapshot/snapshot_fuzz_utils.h | 4 +-- .../libsnapshot/snapshot_metadata_updater.cpp | 6 ++-- 16 files changed, 45 insertions(+), 48 deletions(-) diff --git a/fs_mgr/libfiemap/fiemap_writer.cpp b/fs_mgr/libfiemap/fiemap_writer.cpp index 4dd4bcc14..621031ada 100644 --- a/fs_mgr/libfiemap/fiemap_writer.cpp +++ b/fs_mgr/libfiemap/fiemap_writer.cpp @@ -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. diff --git a/fs_mgr/libfiemap/split_fiemap_writer.cpp b/fs_mgr/libfiemap/split_fiemap_writer.cpp index 12c73979d..36bb3dfee 100644 --- a/fs_mgr/libfiemap/split_fiemap_writer.cpp +++ b/fs_mgr/libfiemap/split_fiemap_writer.cpp @@ -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_ = {}; } diff --git a/fs_mgr/libfiemap/utility.cpp b/fs_mgr/libfiemap/utility.cpp index bbb0510fa..c1898556e 100644 --- a/fs_mgr/libfiemap/utility.cpp +++ b/fs_mgr/libfiemap/utility.cpp @@ -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; diff --git a/fs_mgr/libfs_avb/avb_ops.cpp b/fs_mgr/libfs_avb/avb_ops.cpp index c192bf572..46072bb70 100644 --- a/fs_mgr/libfs_avb/avb_ops.cpp +++ b/fs_mgr/libfs_avb/avb_ops.cpp @@ -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; diff --git a/fs_mgr/libfs_avb/fs_avb.cpp b/fs_mgr/libfs_avb/fs_avb.cpp index 5d504ab0d..49333a13b 100644 --- a/fs_mgr/libfs_avb/fs_avb.cpp +++ b/fs_mgr/libfs_avb/fs_avb.cpp @@ -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 diff --git a/fs_mgr/libfs_avb/tests/util_test.cpp b/fs_mgr/libfs_avb/tests/util_test.cpp index 5c388aaeb..a52a00d27 100644 --- a/fs_mgr/libfs_avb/tests/util_test.cpp +++ b/fs_mgr/libfs_avb/tests/util_test.cpp @@ -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()); diff --git a/fs_mgr/liblp/builder_test.cpp b/fs_mgr/liblp/builder_test.cpp index a21e09e4f..e4b617a51 100644 --- a/fs_mgr/liblp/builder_test.cpp +++ b/fs_mgr/liblp/builder_test.cpp @@ -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); } diff --git a/fs_mgr/liblp/device_test.cpp b/fs_mgr/liblp/device_test.cpp index 6af9d94db..236fd8dd3 100644 --- a/fs_mgr/liblp/device_test.cpp +++ b/fs_mgr/liblp/device_test.cpp @@ -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); diff --git a/fs_mgr/liblp/partition_opener.cpp b/fs_mgr/liblp/partition_opener.cpp index 1d4db8525..3d3dde6f2 100644 --- a/fs_mgr/liblp/partition_opener.cpp +++ b/fs_mgr/liblp/partition_opener.cpp @@ -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; diff --git a/fs_mgr/liblp/reader.cpp b/fs_mgr/liblp/reader.cpp index e6fd9f72a..24ccc0f9d 100644 --- a/fs_mgr/liblp/reader.cpp +++ b/fs_mgr/liblp/reader.cpp @@ -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 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; diff --git a/fs_mgr/liblp/writer.cpp b/fs_mgr/liblp/writer.cpp index 8bf1ee923..2708efa15 100644 --- a/fs_mgr/liblp/writer.cpp +++ b/fs_mgr/liblp/writer.cpp @@ -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) { diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h index 3c2c77683..a4a31507e 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h @@ -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 }; diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp index 7488bdaca..b49f99ea4 100644 --- a/fs_mgr/libsnapshot/snapshot.cpp +++ b/fs_mgr/libsnapshot/snapshot.cpp @@ -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(); diff --git a/fs_mgr/libsnapshot/snapshot_fuzz.cpp b/fs_mgr/libsnapshot/snapshot_fuzz.cpp index 5b145c31f..aced3edf5 100644 --- a/fs_mgr/libsnapshot/snapshot_fuzz.cpp +++ b/fs_mgr/libsnapshot/snapshot_fuzz.cpp @@ -141,7 +141,7 @@ SNAPSHOT_FUZZ_FUNCTION(RecoveryCreateSnapshotDevicesWithMetadata, CreateResult, const RecoveryCreateSnapshotDevicesArgs& args) { std::unique_ptr device; if (args.has_metadata_device_object()) { - device = std::make_unique(args.metadata_mounted()); + device = std::make_unique(args.metadata_mounted()); } return snapshot->RecoveryCreateSnapshotDevices(device); } diff --git a/fs_mgr/libsnapshot/snapshot_fuzz_utils.h b/fs_mgr/libsnapshot/snapshot_fuzz_utils.h index fa327b8a7..5319e69de 100644 --- a/fs_mgr/libsnapshot/snapshot_fuzz_utils.h +++ b/fs_mgr/libsnapshot/snapshot_fuzz_utils.h @@ -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 { diff --git a/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp b/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp index 051584c34..12101a232 100644 --- a/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp +++ b/fs_mgr/libsnapshot/snapshot_metadata_updater.cpp @@ -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()) {