@@ -2,10 +2,12 @@ use crate::{
22 os:: {
33 disk:: Disk ,
44 error:: { Error , Result } ,
5+ BytesFmt ,
56 } ,
67 store:: ChunkInfo ,
78} ;
89use alloc:: vec:: Vec ;
10+ use log:: info;
911
1012fn le16 ( buf : & [ u8 ] , lo : usize ) -> u16 {
1113 ( 0 ..2 ) . map ( |i| ( buf[ lo + i] as u16 ) << ( 8 * i) ) . sum ( )
@@ -244,12 +246,28 @@ async fn get_swap_chunks(disk: &Disk, start: u64, end: u64) -> Result<Option<Vec
244246/// Returns chunks *relative to the start of the partition*.
245247async fn parse_partition ( disk : & Disk , start : u64 , end : u64 ) -> Result < Vec < ChunkInfo > > {
246248 if let Some ( chunks) = get_ext4_chunks ( disk, start, end) . await ? {
249+ info ! (
250+ "Ext4 partition with {} chunks of size {}" ,
251+ chunks. len( ) ,
252+ BytesFmt ( chunks. iter( ) . map( |x| x. size as u64 ) . sum:: <u64 >( ) )
253+ ) ;
247254 Ok ( chunks)
248255 } else if let Some ( chunks) = get_ntfs_chunks ( disk, start, end) . await ? {
256+ info ! (
257+ "NTFS partition with {} chunks of size {}" ,
258+ chunks. len( ) ,
259+ BytesFmt ( chunks. iter( ) . map( |x| x. size as u64 ) . sum:: <u64 >( ) )
260+ ) ;
249261 Ok ( chunks)
250262 } else if let Some ( chunks) = get_swap_chunks ( disk, start, end) . await ? {
263+ info ! (
264+ "Swap partition with {} chunks of size {}" ,
265+ chunks. len( ) ,
266+ BytesFmt ( chunks. iter( ) . map( |x| x. size as u64 ) . sum:: <u64 >( ) )
267+ ) ;
251268 Ok ( chunks)
252269 } else {
270+ info ! ( "Unknown partition type" ) ;
253271 Ok ( vec ! [ ChunkInfo {
254272 start: 0 ,
255273 size: ( end - start) as usize ,
@@ -268,6 +286,10 @@ async fn parse_gpt(disk: &mut Disk) -> Result<Option<Vec<ChunkInfo>>> {
268286 for partition in partitions {
269287 let begin = partition. byte_start as usize ;
270288 let end = partition. byte_end as usize ;
289+ info ! (
290+ "Partition starting at {begin}, size {}" ,
291+ BytesFmt ( ( end - begin) as u64 )
292+ ) ;
271293
272294 if pos < begin {
273295 chunks. push ( ChunkInfo {
0 commit comments