mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-10-24 05:09:47 +00:00
crosvm: minor change in O_DIRECT flag specification.
I could use inline if seems more elegant and in line with https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3328602 BUG=b:190435784 BUG=b:184204645 TEST=build Change-Id: I0d46f6f2520a7c68ae6ed748a3bc217ec83def4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3334326 Reviewed-by: Mattias Nissler <mnissler@chromium.org> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Junichi Uekawa <uekawa@chromium.org>
This commit is contained in:
parent
2c16797f00
commit
a11190428b
1 changed files with 5 additions and 5 deletions
|
@ -608,11 +608,11 @@ pub fn open_file<P: AsRef<Path>>(path: P, read_only: bool, o_direct: bool) -> Re
|
|||
Ok(if let Some(fd) = safe_descriptor_from_path(path)? {
|
||||
fd.into()
|
||||
} else {
|
||||
let mut options = OpenOptions::new();
|
||||
if o_direct {
|
||||
options.custom_flags(O_DIRECT);
|
||||
}
|
||||
options.write(!read_only).read(true).open(path)?
|
||||
OpenOptions::new()
|
||||
.custom_flags(if o_direct { O_DIRECT } else { 0 })
|
||||
.write(!read_only)
|
||||
.read(true)
|
||||
.open(path)?
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue