Reduce diff - remove dirty flag as it could be added in a separate change
This commit is contained in:
+1
-5
@@ -4,7 +4,6 @@ extern crate time;
|
||||
use std::cmp;
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::{ErrorKind, Error};
|
||||
use std::os::unix::ffi::OsStrExt;
|
||||
use std::path::Path;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
@@ -28,10 +27,7 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: filesystem::FileSy
|
||||
|
||||
callback();
|
||||
|
||||
session.run()?;
|
||||
|
||||
session.filesystem.fs.close().map_err(|e| Error::new(ErrorKind::Interrupted,format!("{}",e)))
|
||||
|
||||
session.run()
|
||||
}
|
||||
|
||||
pub struct Fuse<D: Disk> {
|
||||
|
||||
+4
-11
@@ -3,7 +3,7 @@ extern crate spin;
|
||||
use syscall;
|
||||
use syscall::{Packet, Scheme};
|
||||
use std::fs::File;
|
||||
use std::io::{Error, ErrorKind, Read, Result, Write};
|
||||
use std::io::{self, Read, Write};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
@@ -16,7 +16,7 @@ use self::scheme::FileScheme;
|
||||
pub mod resource;
|
||||
pub mod scheme;
|
||||
|
||||
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, mut callback: F) -> Result<()> {
|
||||
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, mut callback: F) -> io::Result<()> {
|
||||
let mountpoint = mountpoint.as_ref();
|
||||
let mut socket = File::create(format!(":{}", mountpoint.display()))?;
|
||||
|
||||
@@ -25,7 +25,7 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou
|
||||
syscall::setrens(0, 0).expect("redoxfs: failed to enter null namespace");
|
||||
|
||||
let scheme = FileScheme::new(format!("{}", mountpoint.display()), filesystem);
|
||||
let res = loop {
|
||||
loop {
|
||||
if IS_UMT.load(Ordering::SeqCst) > 0 {
|
||||
break Ok(());
|
||||
}
|
||||
@@ -33,7 +33,7 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou
|
||||
let mut packet = Packet::default();
|
||||
match socket.read(&mut packet) {
|
||||
Ok(_ok) => (),
|
||||
Err(err) => if err.kind() == ErrorKind::Interrupted {
|
||||
Err(err) => if err.kind() == io::ErrorKind::Interrupted {
|
||||
continue;
|
||||
} else {
|
||||
break Err(err);
|
||||
@@ -48,12 +48,5 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou
|
||||
break Err(err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
let mut fs = scheme.fs.borrow_mut();
|
||||
fs.close().map_err(|e| Error::new(ErrorKind::Interrupted,format!("{}",e)))?;
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ impl Fmaps {
|
||||
|
||||
pub struct FileScheme<D: Disk> {
|
||||
name: String,
|
||||
pub(crate) fs: RefCell<FileSystem<D>>,
|
||||
fs: RefCell<FileSystem<D>>,
|
||||
next_id: AtomicUsize,
|
||||
files: Mutex<BTreeMap<usize, Box<Resource<D>>>>,
|
||||
fmaps: Mutex<Fmaps>
|
||||
|
||||
Reference in New Issue
Block a user