continue;
}
+ let mut num_data_sectors = 0;
+
+ for d in 1..NUM_SECTORS {
+ let wrapped_index = ((index + d) & (NUM_SECTORS - 1)) as usize;
+ let other_sector_header = &self.sector_header[wrapped_index];
+
+ if other_sector_header.belongs_to(sector_header.recording_id) {
+ num_data_sectors += 1;
+ }
+ }
+
let mut date_time_s = [b' '; 19];
if let Some(tm) = Time::from_unix_time(sector_header.start_time) {
tm.fmt_time(&mut date_time_s[11..]);
}
+ let recording_size = (num_data_sectors + 1) * (SECTOR_SIZE >> 10);
+
+ let mut recording_size_s = [b'0'; 9];
+ let recording_size_s_len = fmt_u32_pad(&mut recording_size_s,
+ recording_size as u32,
+ 8, b' ');
+
let mut recording_id_s = [b'0'; 9];
let recording_id_s_len =
fmt_u32_pad(&mut recording_id_s,
8, b' ');
tx_buf.write(&date_time_s);
- tx_buf.write(b" ");
+ tx_buf.write(&recording_size_s[0..recording_size_s_len]);
+ tx_buf.write(b"K");
tx_buf.write(&recording_id_s[0..recording_id_s_len]);
tx_buf.write(b"\n");
let num_bytes_read = file.read(&mut listing_raw).unwrap();
let expected_bytes = b"\
-2020-01-07 19:27:30 1\n";
+2020-01-07 19:27:30 4K 1\n";
assert_eq!(String::from_utf8(expected_bytes.to_vec()).unwrap(),
String::from_utf8(listing_raw[0..num_bytes_read].to_vec()).unwrap());
let num_bytes_read = file.read(&mut listing_raw).unwrap();
let expected_bytes = b"\
-2020-01-09 12:11:33 1\n";
+2020-01-09 12:11:33 8K 1\n";
assert_eq!(String::from_utf8(expected_bytes.to_vec()).unwrap(),
String::from_utf8(listing_raw[0..num_bytes_read].to_vec()).unwrap());