mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-01-30 04:19:20 +00:00
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 <dverkamp@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1170304 Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
5f871eb8f4
commit
de9ae03d52
2 changed files with 6 additions and 6 deletions
|
@ -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)?;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ enum DiskType {
|
|||
|
||||
struct DiskOption {
|
||||
path: PathBuf,
|
||||
writable: bool,
|
||||
read_only: bool,
|
||||
disk_type: DiskType,
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument::
|
|||
cfg.disks
|
||||
.push(DiskOption {
|
||||
path: disk_path,
|
||||
writable: name.starts_with("rw"),
|
||||
read_only: !name.starts_with("rw"),
|
||||
disk_type: if name.ends_with("qcow") {
|
||||
DiskType::Qcow
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue