fix some conflict, pass building

master
Tianyu Gao 6 years ago
parent e3e0c4b465
commit ab5ae3a447

@ -11,8 +11,8 @@ use alloc::{
string::String,
sync::{Arc, Weak},
vec,
boxed::Box
vec::Vec,
boxed::Box
};
use core::any::Any;
use core::fmt::{Debug, Error, Formatter};
@ -392,7 +392,8 @@ impl INodeImpl {
id: child.id as u32,
name: Str256::from(name),
};
let old_size = self._size();
let mut disk_inode = self.disk_inode.write();
let old_size = disk_inode.size as usize;
self._resize(old_size + BLKSIZE)?;
self._write_at(old_size, entry.as_buf()).unwrap();
child.nlinks_inc();
@ -457,7 +458,6 @@ impl vfs::INode for INodeImpl {
FileType::BlockDevice => 0,
_ => panic!("Unknown file type"),
},
size: disk_inode.size as usize,
mode: 0o777,
type_: vfs::FileType::from(disk_inode.type_.clone()),
blocks: disk_inode.blocks as usize,
@ -672,29 +672,27 @@ impl vfs::INode for INodeImpl {
Ok(String::from(entry.name.as_ref()))
}
fn io_control(&self, _cmd: u32, _data: usize) -> vfs::Result<()> {
Err(FsError::NotSupported)
}
fn fs(&self) -> Arc<vfs::FileSystem> {
self.fs.clone()
}
fn as_any_ref(&self) -> &Any {
self
}
fn ioctl(&self, request: u32, data: *mut u8) -> Result<(), vfs::IOCTLError> {
if self.metadata().unwrap().type_ != vfs::FileType::CharDevice {
return Err(vfs::IOCTLError::NotCharDevice);
return Err(FsError::IOCTLError);
}
let device_inodes = self.fs.device_inodes.read();
let device_inode = device_inodes.get(&self.device_inode_id);
match device_inode {
Some(x) => { x.ioctl(request, data) }
Some(x) => { x.io_control(_cmd, _data) }
None => {
warn!("cannot find corresponding device inode in call_inoctl");
Err(vfs::IOCTLError::NotCharDevice)
Err(FsError::IOCTLError)
}
}
}
fn fs(&self) -> Arc<vfs::FileSystem> {
self.fs.clone()
}
fn as_any_ref(&self) -> &Any {
self
}
}
impl Drop for INodeImpl {

@ -10,8 +10,5 @@ spin = "0.5"
[dev-dependencies]
tempfile = "3"
[dependencies]
spin = "0.4"
[features]
std = []
std = []

@ -59,7 +59,6 @@ pub trait INode: Any + Sync + Send {
/// This is used to implement dynamics cast.
/// Simply return self in the implement of the function.
fn as_any_ref(&self) -> &Any;
fn ioctl(&self, request: u32, data: *mut u8) -> result::Result<(), IOCTLError>;
}
impl INode {
@ -253,6 +252,7 @@ pub enum FsError {
DirNotEmpty, //E_NOTEMPTY
WrongFs, //E_INVAL, when we find the content on disk is wrong when opening the device
DeviceError,
IOCTLError,
NoDevice
}

Loading…
Cancel
Save