MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / formatted_size

Method formatted_size

src/fs/ata.rs:494–508  ·  view source on GitHub ↗

Formatted size

(&self)

Source from the content-addressed store, hash-verified

492
493 // Formatted size
494 fn formatted_size(&self) -> (usize, String)
495 {
496 let count = self.blkcount() as usize;
497 let size = self.blksize() as usize;
498 let bytes = size * count;
499
500 if bytes >> 20 < 1000
501 {
502 (bytes >> 20, String::from("MB"))
503 }
504 else
505 {
506 (bytes >> 30, String::from("GB"))
507 }
508 }
509}
510
511

Callers 1

fmtMethod · 0.80

Calls 2

blkcountMethod · 0.45
blksizeMethod · 0.45

Tested by

no test coverage detected