Loading fastboot/device/commands.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <android-base/unique_fd.h> #include <cutils/android_reboot.h> #include <ext4_utils/wipe.h> #include <fs_mgr.h> #include <liblp/builder.h> #include <liblp/liblp.h> #include <uuid/uuid.h> Loading Loading @@ -310,7 +311,7 @@ class PartitionBuilder { }; PartitionBuilder::PartitionBuilder(FastbootDevice* device) { auto super_device = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!super_device) { return; } Loading fastboot/device/utility.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <fs_mgr.h> #include <fs_mgr_dm_linear.h> #include <liblp/liblp.h> Loading @@ -44,7 +45,7 @@ static bool OpenPhysicalPartition(const std::string& name, PartitionHandle* hand static bool OpenLogicalPartition(const std::string& name, const std::string& slot, PartitionHandle* handle) { std::optional<std::string> path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); std::optional<std::string> path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -100,7 +101,7 @@ static const LpMetadataPartition* FindLogicalPartition(const LpMetadata& metadat bool LogicalPartitionExists(const std::string& name, const std::string& slot_suffix, bool* is_zero_length) { auto path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -149,7 +150,7 @@ std::vector<std::string> ListPartitions(FastbootDevice* device) { } // Next get logical partitions. if (auto path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME)) { if (auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name())) { uint32_t slot_number = SlotNumberForSlotSuffix(device->GetCurrentSlot()); if (auto metadata = ReadMetadata(path->c_str(), slot_number)) { for (const auto& partition : metadata->partitions) { Loading fs_mgr/fs_mgr.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ #include <ext4_utils/wipe.h> #include <fs_mgr_overlayfs.h> #include <libdm/dm.h> #include <liblp/metadata_format.h> #include <linux/fs.h> #include <linux/loop.h> #include <linux/magic.h> Loading Loading @@ -1540,3 +1541,7 @@ bool fs_mgr_update_verity_state(std::function<fs_mgr_verity_state_callback> call return true; } std::string fs_mgr_get_super_partition_name(int /* slot */) { return LP_METADATA_DEFAULT_PARTITION_NAME; } fs_mgr/include/fs_mgr.h +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <linux/dm-ioctl.h> #include <functional> #include <string> #include <fstab/fstab.h> Loading Loading @@ -89,4 +90,9 @@ int fs_mgr_do_format(struct fstab_rec *fstab, bool reserve_footer); #define FS_MGR_SETUP_VERITY_SUCCESS 0 int fs_mgr_setup_verity(struct fstab_rec *fstab, bool wait_for_verity_dev); // Return the name of the super partition if it exists. If a slot number is // specified, the super partition for the corresponding metadata slot will be // returned. Otherwise, it will use the current slot. std::string fs_mgr_get_super_partition_name(int slot = -1); #endif /* __CORE_FS_MGR_H */ fs_mgr/liblp/include/liblp/metadata_format.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ extern "C" { * | Geometry Backup | * +--------------------+ */ #define LP_METADATA_PARTITION_NAME "super" #define LP_METADATA_DEFAULT_PARTITION_NAME "super" /* Size of a sector is always 512 bytes for compatibility with the Linux kernel. */ #define LP_SECTOR_SIZE 512 Loading Loading
fastboot/device/commands.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ #include <android-base/unique_fd.h> #include <cutils/android_reboot.h> #include <ext4_utils/wipe.h> #include <fs_mgr.h> #include <liblp/builder.h> #include <liblp/liblp.h> #include <uuid/uuid.h> Loading Loading @@ -310,7 +311,7 @@ class PartitionBuilder { }; PartitionBuilder::PartitionBuilder(FastbootDevice* device) { auto super_device = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!super_device) { return; } Loading
fastboot/device/utility.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <fs_mgr.h> #include <fs_mgr_dm_linear.h> #include <liblp/liblp.h> Loading @@ -44,7 +45,7 @@ static bool OpenPhysicalPartition(const std::string& name, PartitionHandle* hand static bool OpenLogicalPartition(const std::string& name, const std::string& slot, PartitionHandle* handle) { std::optional<std::string> path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); std::optional<std::string> path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -100,7 +101,7 @@ static const LpMetadataPartition* FindLogicalPartition(const LpMetadata& metadat bool LogicalPartitionExists(const std::string& name, const std::string& slot_suffix, bool* is_zero_length) { auto path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -149,7 +150,7 @@ std::vector<std::string> ListPartitions(FastbootDevice* device) { } // Next get logical partitions. if (auto path = FindPhysicalPartition(LP_METADATA_PARTITION_NAME)) { if (auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name())) { uint32_t slot_number = SlotNumberForSlotSuffix(device->GetCurrentSlot()); if (auto metadata = ReadMetadata(path->c_str(), slot_number)) { for (const auto& partition : metadata->partitions) { Loading
fs_mgr/fs_mgr.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ #include <ext4_utils/wipe.h> #include <fs_mgr_overlayfs.h> #include <libdm/dm.h> #include <liblp/metadata_format.h> #include <linux/fs.h> #include <linux/loop.h> #include <linux/magic.h> Loading Loading @@ -1540,3 +1541,7 @@ bool fs_mgr_update_verity_state(std::function<fs_mgr_verity_state_callback> call return true; } std::string fs_mgr_get_super_partition_name(int /* slot */) { return LP_METADATA_DEFAULT_PARTITION_NAME; }
fs_mgr/include/fs_mgr.h +6 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ #include <linux/dm-ioctl.h> #include <functional> #include <string> #include <fstab/fstab.h> Loading Loading @@ -89,4 +90,9 @@ int fs_mgr_do_format(struct fstab_rec *fstab, bool reserve_footer); #define FS_MGR_SETUP_VERITY_SUCCESS 0 int fs_mgr_setup_verity(struct fstab_rec *fstab, bool wait_for_verity_dev); // Return the name of the super partition if it exists. If a slot number is // specified, the super partition for the corresponding metadata slot will be // returned. Otherwise, it will use the current slot. std::string fs_mgr_get_super_partition_name(int slot = -1); #endif /* __CORE_FS_MGR_H */
fs_mgr/liblp/include/liblp/metadata_format.h +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ extern "C" { * | Geometry Backup | * +--------------------+ */ #define LP_METADATA_PARTITION_NAME "super" #define LP_METADATA_DEFAULT_PARTITION_NAME "super" /* Size of a sector is always 512 bytes for compatibility with the Linux kernel. */ #define LP_SECTOR_SIZE 512 Loading