From de9ae03d522d9f134d76cc60a7c49b7c38714423 Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Thu, 9 Aug 2018 16:26:59 -0700 Subject: main: replace block writable option with read_only This is more consistent with the way it will be used in the virtio-blk device model. BUG=chromium:872973 TEST=cargo test Change-Id: I28c5d007a7f3864ef6e18e9b343d263123302484 Signed-off-by: Daniel Verkamp Reviewed-on: https://chromium-review.googlesource.com/1170304 Reviewed-by: Dylan Reid Reviewed-by: Zach Reizner --- src/linux.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/linux.rs') diff --git a/src/linux.rs b/src/linux.rs index 98d0c5e..e3784f2 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -405,15 +405,15 @@ fn setup_mmio_bus(cfg: &Config, } else { OpenOptions::new() .read(true) - .write(disk.writable) + .write(!disk.read_only) .open(&disk.path) .map_err(|e| Error::Disk(e))? }; // Lock the disk image to prevent other crosvm instances from using it. - let lock_op = if disk.writable { - FlockOperation::LockExclusive - } else { + let lock_op = if disk.read_only { FlockOperation::LockShared + } else { + FlockOperation::LockExclusive }; flock(&raw_image, lock_op, true).map_err(Error::DiskImageLock)?; -- cgit 1.4.1