devices: virtio: Update fs code to use sync::Mutex

fs/worker.rs and fs/mod.rs were still using the old std::sync::Mutex
version instead of the crosvm-specific wrapper sync::Mutex

BUG=b:179636297
TEST=build crosvm and run shared-dir with virtio-fs

Change-Id: I773a885fd0ef35e25bc7a090f067d8a6f60636da
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3058837
Auto-Submit: Morg <morg@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Morg <morg@chromium.org>
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
This commit is contained in:
Federico 'Morg' Pareschi 2021-07-29 15:11:35 +09:00 committed by Commit Bot
parent ed4bd118bc
commit 9d1d7d9d48
2 changed files with 5 additions and 6 deletions

View file

@ -5,12 +5,13 @@
use std::fmt;
use std::io;
use std::mem;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use std::thread;
use base::{error, warn, AsRawDescriptor, Error as SysError, Event, RawDescriptor, Tube};
use data_model::{DataInit, Le32};
use resources::Alloc;
use sync::Mutex;
use vm_control::{FsMappingRequest, VmResponse};
use vm_memory::GuestMemory;

View file

@ -6,10 +6,11 @@ use std::convert::{TryFrom, TryInto};
use std::fs::File;
use std::io;
use std::os::unix::io::AsRawFd;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use base::{error, Event, PollToken, SafeDescriptor, Tube, WaitContext};
use fuse::filesystem::{FileSystem, ZeroCopyReader, ZeroCopyWriter};
use sync::Mutex;
use vm_control::{FsMappingRequest, VmResponse};
use vm_memory::GuestMemory;
@ -55,10 +56,7 @@ impl Mapper {
}
fn process_request(&self, request: &FsMappingRequest) -> io::Result<()> {
let tube = self.tube.lock().map_err(|e| {
error!("failed to lock tube: {}", e);
io::Error::from_raw_os_error(libc::EINVAL)
})?;
let tube = self.tube.lock();
tube.send(request).map_err(|e| {
error!("failed to send request {:?}: {}", request, e);