@@ -27,13 +27,13 @@ fn create_protective_mbr<P>(disk_size: u64, path: P) -> Result<(), Box<dyn std::
2727where
2828 P : AsRef < Path > ,
2929{
30- debug ! ( "🛡️ Creating protective MBR for disk of size {} bytes" , disk_size) ;
30+ info ! ( "Creating protective MBR for disk of size {} bytes" , disk_size) ;
3131 let mut gpt_device = fs:: File :: options ( ) . write ( true ) . open ( & path) ?;
3232 let lb_size = ( disk_size / 512 ) as u32 ;
3333 let lb_size = lb_size. saturating_sub ( 1 ) ; // subtract 1 for the MBR
3434 let mbr = ProtectiveMBR :: with_lb_size ( lb_size) ;
3535 mbr. overwrite_lba0 ( & mut gpt_device) ?;
36- info ! ( "✅ Successfully created protective MBR at {:?}" , path. as_ref( ) ) ;
36+ info ! ( "Successfully created protective MBR at {:?}" , path. as_ref( ) ) ;
3737 Ok ( ( ) )
3838}
3939
@@ -54,7 +54,7 @@ fn create_default_partition_scheme<P>(path: P) -> Result<(), Box<dyn std::error:
5454where
5555 P : AsRef < Path > ,
5656{
57- info ! ( "💽 Creating default GPT partition scheme on {:?}" , path. as_ref( ) ) ;
57+ info ! ( "Creating default GPT partition scheme on {:?}" , path. as_ref( ) ) ;
5858
5959 // Configure and create GPT disk
6060 let gpt_config = GptConfig :: new ( )
@@ -63,24 +63,24 @@ where
6363
6464 let mut gpt_disk = gpt_config. create ( & path) ?;
6565
66- debug ! ( "📝 Creating EFI System Partition (256MB)" ) ;
66+ info ! ( "Creating EFI System Partition (256MB)" ) ;
6767 gpt_disk. add_partition ( "" , 256 * 1024 * 1024 , partition_types:: EFI , 0 , None ) ?;
6868
69- debug ! ( "📝 Creating Boot Partition (2GB)" ) ;
69+ info ! ( "Creating Boot Partition (2GB)" ) ;
7070 gpt_disk. add_partition ( "" , 2 * 1024 * 1024 * 1024 , partition_types:: FREEDESK_BOOT , 0 , None ) ?;
7171
72- debug ! ( "📝 Creating Swap Partition (4GB)" ) ;
72+ info ! ( "Creating Swap Partition (4GB)" ) ;
7373 gpt_disk. add_partition ( "" , 4 * 1024 * 1024 * 1024 , partition_types:: LINUX_SWAP , 0 , None ) ?;
7474
7575 // Use remaining space for root partition
7676 let sectors = gpt_disk. find_free_sectors ( ) ;
77- debug ! ( "📊 Available sectors: {sectors:?}" ) ;
77+ debug ! ( "Available sectors: {sectors:?}" ) ;
7878 let ( _, length) = sectors. iter ( ) . find ( |( _, l) | * l > 0 ) . unwrap ( ) ;
79- debug ! ( "📝 Creating Root Partition ({}MB)" , ( length * 512 ) / ( 1024 * 1024 ) ) ;
79+ info ! ( "Creating Root Partition ({}MB)" , ( length * 512 ) / ( 1024 * 1024 ) ) ;
8080 gpt_disk. add_partition ( "" , * length * 512 , partition_types:: LINUX_FS , 0 , None ) ?;
8181 let _ = gpt_disk. write ( ) ?;
8282
83- info ! ( "✅ Successfully created partition scheme" ) ;
83+ info ! ( "Successfully created partition scheme" ) ;
8484 Ok ( ( ) )
8585}
8686
@@ -90,31 +90,31 @@ where
9090/// - Partitioning with GPT
9191/// - Enumerating block devices
9292fn main ( ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
93- pretty_env_logger:: formatted_builder ( )
94- . filter_level ( log:: LevelFilter :: Trace )
93+ pretty_env_logger:: formatted_timed_builder ( )
94+ . filter_level ( log:: LevelFilter :: Info )
9595 . init ( ) ;
96- info ! ( "🚀 Starting disk partitioning demo" ) ;
96+ info ! ( "Starting disk partitioning demo" ) ;
9797
9898 // Create 35GB sparse image file and attach to loopback device
9999 let image_size = 35 * 1024 * 1024 * 1024 ;
100- info ! ( "📁 Creating {}GB sparse image file" , image_size / ( 1024 * 1024 * 1024 ) ) ;
100+ info ! ( "Creating {}GB sparse image file" , image_size / ( 1024 * 1024 * 1024 ) ) ;
101101 sparsefile:: create ( "hello.world" , image_size) ?;
102102
103- debug ! ( "🔄 Setting up loopback device" ) ;
103+ info ! ( "Setting up loopback device" ) ;
104104 let device = loopback:: LoopDevice :: create ( ) ?;
105105 device. attach ( "hello.world" ) ?;
106- info ! ( "💫 Loop device created at: {}" , & device. path) ;
106+ info ! ( "Loop device created at: {}" , & device. path) ;
107107
108108 // Initialize disk with protective MBR and partition scheme
109109 create_protective_mbr ( image_size, "hello.world" ) ?;
110110 create_default_partition_scheme ( "hello.world" ) ?;
111111
112112 // Notify kernel of partition table changes
113- debug ! ( "🔄 Syncing partition table changes" ) ;
113+ debug ! ( "Syncing partition table changes" ) ;
114114 blkpg:: sync_gpt_partitions ( & device. path ) ?;
115115
116116 // Get list of all loopback devices
117- info ! ( "🔍 Discovering block devices" ) ;
117+ debug ! ( "Discovering block devices" ) ;
118118 let loop_devices = BlockDevice :: discover ( ) ?
119119 . into_iter ( )
120120 . filter_map ( |device| {
@@ -127,12 +127,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
127127 . collect :: < Vec < _ > > ( ) ;
128128
129129 // Display information about discovered devices
130- info ! ( "📋 Device information:" ) ;
130+ info ! ( "Device information:" ) ;
131131 for loop_device in loop_devices {
132132 if let Some ( file) = loop_device. file_path ( ) {
133133 if let Some ( disk) = loop_device. disk ( ) {
134134 info ! (
135- "💾 Loopback device: {} (backing file: {})" ,
135+ "Loopback device: {} (backing file: {})" ,
136136 loop_device. name( ) ,
137137 file. display( )
138138 ) ;
@@ -145,10 +145,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
145145 }
146146
147147 // Clean up resources
148- debug ! ( "🧹 Cleaning up resources" ) ;
148+ info ! ( "Cleaning up resources" ) ;
149149 device. detach ( ) ?;
150150 //fs::remove_file("hello.world")?;
151151
152- info ! ( "✨ Demo completed successfully" ) ;
152+ info ! ( "Demo completed successfully" ) ;
153153 Ok ( ( ) )
154154}
0 commit comments