Set or clear the dirty bit for QCOW2 v3 images. When `dirty` is true, sets the bit to indicate the image is in use. When `dirty` is false, clears the bit to indicate a clean shutdown.
(
&mut self,
file: &mut F,
dirty: bool,
)
| 528 | /// When `dirty` is true, sets the bit to indicate the image is in use. |
| 529 | /// When `dirty` is false, clears the bit to indicate a clean shutdown. |
| 530 | pub fn set_dirty_bit<F: Seek + Write + FileSync>( |
| 531 | &mut self, |
| 532 | file: &mut F, |
| 533 | dirty: bool, |
| 534 | ) -> BlockResult<()> { |
| 535 | if self.version == 3 { |
| 536 | if dirty { |
| 537 | self.incompatible_features |= IncompatFeatures::DIRTY.bits(); |
| 538 | } else { |
| 539 | self.incompatible_features &= !IncompatFeatures::DIRTY.bits(); |
| 540 | } |
| 541 | self.write_incompatible_features(file)?; |
| 542 | file.fsync() |
| 543 | .map_err(|e| BlockError::new(BlockErrorKind::Io, Error::SyncingHeader(e)))?; |
| 544 | } |
| 545 | Ok(()) |
| 546 | } |
| 547 | |
| 548 | /// Set the corrupt bit for QCOW2 v3 images. |
| 549 | /// |
no test coverage detected