3232//! $ cargo run --example list_dir -- ./disk.img
3333//! ```
3434
35- extern crate embedded_sdmmc;
36-
3735mod linux;
3836use linux:: * ;
3937
40- use embedded_sdmmc:: { Directory , VolumeIdx , VolumeManager } ;
38+ use embedded_sdmmc:: { ShortFileName , VolumeIdx } ;
4139
4240type Error = embedded_sdmmc:: Error < std:: io:: Error > ;
4341
42+ type Directory < ' a > = embedded_sdmmc:: Directory < ' a , LinuxBlockDevice , Clock , 8 , 4 , 4 > ;
43+ type VolumeManager = embedded_sdmmc:: VolumeManager < LinuxBlockDevice , Clock , 8 , 4 , 4 > ;
44+
4445fn main ( ) -> Result < ( ) , Error > {
4546 env_logger:: init ( ) ;
4647 let mut args = std:: env:: args ( ) . skip ( 1 ) ;
4748 let filename = args. next ( ) . unwrap_or_else ( || "/dev/mmcblk0" . into ( ) ) ;
4849 let print_blocks = args. find ( |x| x == "-v" ) . map ( |_| true ) . unwrap_or ( false ) ;
50+
4951 let lbd = LinuxBlockDevice :: new ( filename, print_blocks) . map_err ( Error :: DeviceError ) ?;
50- let volume_mgr: VolumeManager < LinuxBlockDevice , Clock , 8 , 8 , 4 > =
51- VolumeManager :: new_with_limits ( lbd, Clock , 0xAA00_0000 ) ;
52+ let volume_mgr: VolumeManager = VolumeManager :: new_with_limits ( lbd, Clock , 0xAA00_0000 ) ;
5253 let volume = volume_mgr. open_volume ( VolumeIdx ( 0 ) ) ?;
5354 let root_dir = volume. open_root_dir ( ) ?;
5455 list_dir ( root_dir, "/" ) ?;
@@ -58,10 +59,7 @@ fn main() -> Result<(), Error> {
5859/// Recursively print a directory listing for the open directory given.
5960///
6061/// The path is for display purposes only.
61- fn list_dir (
62- directory : Directory < LinuxBlockDevice , Clock , 8 , 8 , 4 > ,
63- path : & str ,
64- ) -> Result < ( ) , Error > {
62+ fn list_dir ( directory : Directory < ' _ > , path : & str ) -> Result < ( ) , Error > {
6563 println ! ( "Listing {}" , path) ;
6664 let mut children = Vec :: new ( ) ;
6765 directory. iterate_dir ( |entry| {
@@ -77,8 +75,8 @@ fn list_dir(
7775 }
7876 ) ;
7977 if entry. attributes . is_directory ( )
80- && entry. name != embedded_sdmmc :: ShortFileName :: parent_dir ( )
81- && entry. name != embedded_sdmmc :: ShortFileName :: this_dir ( )
78+ && entry. name != ShortFileName :: parent_dir ( )
79+ && entry. name != ShortFileName :: this_dir ( )
8280 {
8381 children. push ( entry. name . clone ( ) ) ;
8482 }
0 commit comments