summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSandeep Dhavale <dhavale@google.com>2024-04-19 13:43:37 -0700
committerSandeep Dhavale <dhavale@google.com>2024-04-22 15:22:26 -0700
commit897f8fa1e39e126a592460804529afa857d9e36f (patch)
treefc02a4135bcd5bffc55ab550fac05bda395f7fa3
parent68d41126d5bb7931a5753da7effbf1d6f7482863 (diff)
downloadextras-897f8fa1e39e126a592460804529afa857d9e36f.tar.gz
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 <dhavale@google.com>
-rw-r--r--partition_tools/dynamic_partitions_device_info.proto12
-rw-r--r--partition_tools/lpdump.cc6
2 files changed, 17 insertions, 1 deletions
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;
}