@@ -9,7 +9,7 @@ use uucore::translate;
99
1010use clap:: builder:: ValueParser ;
1111use uucore:: display:: Quotable ;
12- use uucore:: fs:: display_permissions;
12+ use uucore:: fs:: { display_permissions, major , minor } ;
1313use uucore:: fsext:: {
1414 FsMeta , MetadataTimeField , StatFs , metadata_get_time, pretty_filetype, pretty_fstype,
1515 read_fs_list, statfs,
@@ -301,16 +301,6 @@ fn group_num(s: &str) -> Cow<'_, str> {
301301 res. into ( )
302302}
303303
304- /// Keeps major part of an integer
305- fn major ( n : u64 ) -> u64 {
306- ( n >> 8 ) & 0xFF
307- }
308-
309- // Keeps minor part of an integer
310- fn minor ( n : u64 ) -> u64 {
311- n & 0xFF
312- }
313-
314304struct Stater {
315305 follow : bool ,
316306 show_fs : bool ,
@@ -1075,8 +1065,8 @@ impl Stater {
10751065 }
10761066 }
10771067 // device number in decimal
1078- 'd' if flag. major => OutputType :: Unsigned ( major ( meta. dev ( ) ) ) ,
1079- 'd' if flag. minor => OutputType :: Unsigned ( minor ( meta. dev ( ) ) ) ,
1068+ 'd' if flag. major => OutputType :: Unsigned ( major ( meta. dev ( ) as _ ) as u64 ) ,
1069+ 'd' if flag. minor => OutputType :: Unsigned ( minor ( meta. dev ( ) as _ ) as u64 ) ,
10801070 'd' => OutputType :: Unsigned ( meta. dev ( ) ) ,
10811071 // device number in hex
10821072 'D' => OutputType :: UnsignedHex ( meta. dev ( ) ) ,
@@ -1115,10 +1105,10 @@ impl Stater {
11151105 's' => OutputType :: Integer ( meta. len ( ) as i64 ) ,
11161106 // major device type in hex, for character/block device special
11171107 // files
1118- 't' => OutputType :: UnsignedHex ( major ( meta. rdev ( ) ) ) ,
1108+ 't' => OutputType :: UnsignedHex ( major ( meta. rdev ( ) as _ ) as u64 ) ,
11191109 // minor device type in hex, for character/block device special
11201110 // files
1121- 'T' => OutputType :: UnsignedHex ( minor ( meta. rdev ( ) ) ) ,
1111+ 'T' => OutputType :: UnsignedHex ( minor ( meta. rdev ( ) as _ ) as u64 ) ,
11221112 // user ID of owner
11231113 'u' => OutputType :: Unsigned ( meta. uid ( ) as u64 ) ,
11241114 // user name of owner
@@ -1162,8 +1152,8 @@ impl Stater {
11621152 OutputType :: Float ( sec as f64 + nsec as f64 / 1_000_000_000.0 )
11631153 }
11641154 'R' => OutputType :: UnsignedHex ( meta. rdev ( ) ) ,
1165- 'r' if flag. major => OutputType :: Unsigned ( major ( meta. rdev ( ) ) ) ,
1166- 'r' if flag. minor => OutputType :: Unsigned ( minor ( meta. rdev ( ) ) ) ,
1155+ 'r' if flag. major => OutputType :: Unsigned ( major ( meta. rdev ( ) as _ ) as u64 ) ,
1156+ 'r' if flag. minor => OutputType :: Unsigned ( minor ( meta. rdev ( ) as _ ) as u64 ) ,
11671157 'r' => OutputType :: Unsigned ( meta. rdev ( ) ) ,
11681158 _ => OutputType :: Unknown ,
11691159 } ;
0 commit comments