(file: File, direct_io: bool)
| 48 | |
| 49 | impl RawFile { |
| 50 | pub fn new(file: File, direct_io: bool) -> Self { |
| 51 | // Assume no alignment restrictions if we aren't using O_DIRECT. |
| 52 | let mut alignment = 0; |
| 53 | if direct_io { |
| 54 | for align in &BLK_ALIGNMENTS { |
| 55 | if is_valid_alignment(file.as_raw_fd(), *align) { |
| 56 | alignment = *align; |
| 57 | break; |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | RawFile { |
| 62 | file, |
| 63 | alignment, |
| 64 | position: 0, |
| 65 | direct_io, |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | fn round_up(&self, offset: u64) -> u64 { |
| 70 | let align: u64 = self.alignment.try_into().unwrap(); |
nothing calls this directly
no test coverage detected