From 897f8fa1e39e126a592460804529afa857d9e36f Mon Sep 17 00:00:00 2001 From: Sandeep Dhavale Date: Fri, 19 Apr 2024 13:43:37 -0700 Subject: lpdump: Add info about super partition Currently we do not print info about super partition in lpdump. Let's add it so we can get to know super's size and used size. Available space can be inferred from these two. Bug: 335891825 Test: lpdump --json Test: atest CtsEdiHostTestCases Change-Id: Ic3dea6346492c1f94c6432a96c55bfc6164d1b89 Signed-off-by: Sandeep Dhavale --- partition_tools/dynamic_partitions_device_info.proto | 12 +++++++++++- partition_tools/lpdump.cc | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/partition_tools/dynamic_partitions_device_info.proto b/partition_tools/dynamic_partitions_device_info.proto index 8800dac7..82d20098 100644 --- a/partition_tools/dynamic_partitions_device_info.proto +++ b/partition_tools/dynamic_partitions_device_info.proto @@ -20,7 +20,7 @@ package android; // Keep in sync with proto files on EDI backend. Otherwise, new fields will // go ignored. -// Next: 6 +// Next: 7 message DynamicPartitionsDeviceInfoProto { bool enabled = 1; bool retrofit = 2; @@ -57,4 +57,14 @@ message DynamicPartitionsDeviceInfoProto { uint64 alignment_offset = 5 [json_name = "alignment_offset"]; } repeated BlockDevice block_devices = 5 [json_name = "block_devices"]; + + // Next: 4 + message SuperDevice { + string name = 1; + /** Used space in bytes */ + uint64 used_size = 2 [json_name = "used_size"]; + /** Total size of the super in bytes */ + uint64 total_size = 3 [json_name = "total_size"]; + } + SuperDevice super_device = 6 [json_name = "super_device"]; } diff --git a/partition_tools/lpdump.cc b/partition_tools/lpdump.cc index 97682940..4c1fe954 100644 --- a/partition_tools/lpdump.cc +++ b/partition_tools/lpdump.cc @@ -173,6 +173,12 @@ static bool MergeMetadata(const LpMetadata* metadata, block_device_proto->set_alignment(info.alignment); block_device_proto->set_alignment_offset(info.alignment_offset); } + + auto super_device_proto = proto->mutable_super_device(); + super_device_proto->set_name(GetSuperPartitionName()); + super_device_proto->set_used_size(builder->UsedSpace()); + super_device_proto->set_total_size(GetTotalSuperPartitionSize(*metadata)); + return true; } -- cgit v1.2.3