0.4.3 - update redox_syscall
This commit is contained in:
Generated
+41
-25
@@ -1,5 +1,10 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "0.1.10"
|
||||
@@ -15,16 +20,16 @@ name = "fuse"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.70"
|
||||
version = "0.2.81"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -32,12 +37,12 @@ name = "log"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.8"
|
||||
version = "0.4.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -45,7 +50,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.17"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@@ -53,7 +58,7 @@ name = "rand"
|
||||
version = "0.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -63,10 +68,10 @@ version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -92,17 +97,20 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "redox_syscall"
|
||||
version = "0.1.57"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "redoxfs"
|
||||
version = "0.4.1"
|
||||
version = "0.4.3"
|
||||
dependencies = [
|
||||
"fuse 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"redox_syscall 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
@@ -113,11 +121,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.43"
|
||||
version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -128,9 +137,14 @@ dependencies = [
|
||||
"rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.10.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@@ -148,22 +162,24 @@ version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[metadata]
|
||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
||||
"checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
|
||||
"checksum fuse 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e57070510966bfef93662a81cb8aa2b1c7db0964354fa9921434f04b9e8660"
|
||||
"checksum libc 0.2.70 (registry+https://github.com/rust-lang/crates.io-index)" = "3baa92041a6fec78c687fa0cc2b3fae8884f743d672cf551bed1d6dac6988d0f"
|
||||
"checksum libc 0.2.81 (registry+https://github.com/rust-lang/crates.io-index)" = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
||||
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
|
||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
||||
"checksum log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b"
|
||||
"checksum pkg-config 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)" = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
"checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c"
|
||||
"checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
|
||||
"checksum rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
|
||||
"checksum rand_core 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"
|
||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.57 (registry+https://github.com/rust-lang/crates.io-index)" = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
|
||||
"checksum redox_syscall 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "48b82c2a1e8eb6e1bfde608de2bcbebd4072aa32d056ea48a986990cd5ca0f5a"
|
||||
"checksum thread-scoped 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bcbb6aa301e5d3b0b5ef639c9a9c7e2f1c944f177b460c04dc24c69b1fa2bd99"
|
||||
"checksum time 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438"
|
||||
"checksum time 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)" = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255"
|
||||
"checksum uuid 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum wasi 0.10.0+wasi-snapshot-preview1 (registry+https://github.com/rust-lang/crates.io-index)" = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f"
|
||||
"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
name = "redoxfs"
|
||||
description = "The Redox Filesystem"
|
||||
repository = "https://gitlab.redox-os.org/redox-os/redoxfs"
|
||||
version = "0.4.1"
|
||||
version = "0.4.3"
|
||||
license-file = "LICENSE"
|
||||
readme = "README.md"
|
||||
authors = ["Jeremy Soller <jackpot51@gmail.com>"]
|
||||
@@ -27,7 +27,7 @@ path = "src/bin/mkfs.rs"
|
||||
doc = false
|
||||
|
||||
[dependencies]
|
||||
redox_syscall = "0.1"
|
||||
redox_syscall = "0.2"
|
||||
uuid = { version = "0.5", features = ["v4"] }
|
||||
|
||||
[target.'cfg(not(target_os = "redox"))'.dependencies]
|
||||
|
||||
+4
-4
@@ -29,12 +29,12 @@ extern "C" fn unmount_handler(_s: usize) {
|
||||
//for, so I put 2. I don't think 0,0 is a valid sa_mask. I don't know what i'm doing here. When u
|
||||
//send it a sigkill, it shuts off the filesystem
|
||||
fn setsig() {
|
||||
use syscall::{sigaction, SigAction, SIGTERM};
|
||||
use syscall::{sigaction, SigAction, SigActionFlags, SIGTERM};
|
||||
|
||||
let sig_action = SigAction {
|
||||
sa_handler: unmount_handler,
|
||||
sa_handler: Some(unmount_handler),
|
||||
sa_mask: [0, 0],
|
||||
sa_flags: 0,
|
||||
sa_flags: SigActionFlags::empty(),
|
||||
};
|
||||
|
||||
sigaction(SIGTERM, Some(&sig_action), None).unwrap();
|
||||
@@ -63,7 +63,7 @@ fn capability_mode() {
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
fn fork() -> isize {
|
||||
unsafe { syscall::Error::mux(syscall::clone(0)) as isize }
|
||||
unsafe { syscall::Error::mux(syscall::clone(syscall::CloneFlags::empty())) as isize }
|
||||
}
|
||||
|
||||
#[cfg(target_os = "redox")]
|
||||
|
||||
+26
-33
@@ -7,7 +7,7 @@ use syscall::data::{Map, Stat, TimeSpec};
|
||||
use syscall::error::{Error, Result, EBADF, EINVAL, EISDIR, ENOMEM, EPERM};
|
||||
use syscall::flag::{
|
||||
F_GETFL, F_SETFL, MODE_PERM, O_ACCMODE, O_APPEND, O_RDONLY, O_RDWR, O_WRONLY, PROT_READ,
|
||||
PROT_WRITE, SEEK_CUR, SEEK_END, SEEK_SET,
|
||||
PROT_WRITE, SEEK_CUR, SEEK_END, SEEK_SET, MapFlags,
|
||||
};
|
||||
|
||||
use disk::Disk;
|
||||
@@ -19,7 +19,7 @@ pub trait Resource<D: Disk> {
|
||||
fn set_path(&mut self, path: &str);
|
||||
fn read(&mut self, buf: &mut [u8], fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
fn write(&mut self, buf: &[u8], fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
fn seek(&mut self, offset: usize, whence: usize, fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
fn seek(&mut self, offset: isize, whence: usize, fs: &mut FileSystem<D>) -> Result<isize>;
|
||||
fn fmap(&mut self, map: &Map, fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
fn funmap(&mut self, address: usize, fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
fn fchmod(&mut self, mode: u16, fs: &mut FileSystem<D>) -> Result<usize>;
|
||||
@@ -36,7 +36,7 @@ pub struct DirResource {
|
||||
path: String,
|
||||
block: u64,
|
||||
data: Option<Vec<u8>>,
|
||||
seek: usize,
|
||||
seek: isize,
|
||||
uid: u32,
|
||||
}
|
||||
|
||||
@@ -73,9 +73,10 @@ impl<D: Disk> Resource<D> for DirResource {
|
||||
|
||||
fn read(&mut self, buf: &mut [u8], _fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
let data = self.data.as_ref().ok_or(Error::new(EISDIR))?;
|
||||
let size = data.len() as isize;
|
||||
let mut i = 0;
|
||||
while i < buf.len() && self.seek < data.len() {
|
||||
buf[i] = data[self.seek];
|
||||
while i < buf.len() && self.seek < size {
|
||||
buf[i] = data[self.seek as usize];
|
||||
i += 1;
|
||||
self.seek += 1;
|
||||
}
|
||||
@@ -86,21 +87,15 @@ impl<D: Disk> Resource<D> for DirResource {
|
||||
Err(Error::new(EBADF))
|
||||
}
|
||||
|
||||
fn seek(&mut self, offset: usize, whence: usize, _fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
fn seek(&mut self, offset: isize, whence: usize, _fs: &mut FileSystem<D>) -> Result<isize> {
|
||||
let data = self.data.as_ref().ok_or(Error::new(EBADF))?;
|
||||
let size = data.len() as isize;
|
||||
self.seek = match whence {
|
||||
SEEK_SET => max(0, min(data.len() as isize, offset as isize)) as usize,
|
||||
SEEK_CUR => max(
|
||||
0,
|
||||
min(data.len() as isize, self.seek as isize + offset as isize),
|
||||
) as usize,
|
||||
SEEK_END => max(
|
||||
0,
|
||||
min(data.len() as isize, data.len() as isize + offset as isize),
|
||||
) as usize,
|
||||
SEEK_SET => max(0, min(size, offset)),
|
||||
SEEK_CUR => max(0, min(size, self.seek + offset)),
|
||||
SEEK_END => max(0, min(size, size + offset)),
|
||||
_ => return Err(Error::new(EINVAL)),
|
||||
};
|
||||
|
||||
Ok(self.seek)
|
||||
}
|
||||
|
||||
@@ -200,7 +195,7 @@ impl<D: Disk> Resource<D> for DirResource {
|
||||
pub struct Fmap {
|
||||
block: u64,
|
||||
offset: usize,
|
||||
flags: usize,
|
||||
flags: MapFlags,
|
||||
data: &'static mut [u8],
|
||||
}
|
||||
|
||||
@@ -272,7 +267,7 @@ pub struct FileResource {
|
||||
path: String,
|
||||
block: u64,
|
||||
flags: usize,
|
||||
seek: u64,
|
||||
seek: isize,
|
||||
uid: u32,
|
||||
fmaps: BTreeMap<usize, Fmap>,
|
||||
}
|
||||
@@ -312,8 +307,8 @@ impl<D: Disk> Resource<D> for FileResource {
|
||||
|
||||
fn read(&mut self, buf: &mut [u8], fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
if self.flags & O_ACCMODE == O_RDWR || self.flags & O_ACCMODE == O_RDONLY {
|
||||
let count = fs.read_node(self.block, self.seek, buf)?;
|
||||
self.seek += count as u64;
|
||||
let count = fs.read_node(self.block, self.seek as u64, buf)?;
|
||||
self.seek += count as isize;
|
||||
Ok(count)
|
||||
} else {
|
||||
Err(Error::new(EBADF))
|
||||
@@ -323,42 +318,40 @@ impl<D: Disk> Resource<D> for FileResource {
|
||||
fn write(&mut self, buf: &[u8], fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
if self.flags & O_ACCMODE == O_RDWR || self.flags & O_ACCMODE == O_WRONLY {
|
||||
if self.flags & O_APPEND == O_APPEND {
|
||||
self.seek = fs.node_len(self.block)?;
|
||||
self.seek = fs.node_len(self.block)? as isize;
|
||||
}
|
||||
let mtime = SystemTime::now().duration_since(UNIX_EPOCH).unwrap();
|
||||
let count = fs.write_node(
|
||||
self.block,
|
||||
self.seek,
|
||||
self.seek as u64,
|
||||
buf,
|
||||
mtime.as_secs(),
|
||||
mtime.subsec_nanos(),
|
||||
)?;
|
||||
self.seek += count as u64;
|
||||
self.seek += count as isize;
|
||||
Ok(count)
|
||||
} else {
|
||||
Err(Error::new(EBADF))
|
||||
}
|
||||
}
|
||||
|
||||
fn seek(&mut self, offset: usize, whence: usize, fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
let size = fs.node_len(self.block)?;
|
||||
|
||||
fn seek(&mut self, offset: isize, whence: usize, fs: &mut FileSystem<D>) -> Result<isize> {
|
||||
let size = fs.node_len(self.block)? as isize;
|
||||
self.seek = match whence {
|
||||
SEEK_SET => max(0, offset as i64) as u64,
|
||||
SEEK_CUR => max(0, self.seek as i64 + offset as i64) as u64,
|
||||
SEEK_END => max(0, size as i64 + offset as i64) as u64,
|
||||
SEEK_SET => max(0, offset),
|
||||
SEEK_CUR => max(0, self.seek + offset),
|
||||
SEEK_END => max(0, size + offset),
|
||||
_ => return Err(Error::new(EINVAL)),
|
||||
};
|
||||
|
||||
Ok(self.seek as usize)
|
||||
Ok(self.seek)
|
||||
}
|
||||
|
||||
fn fmap(&mut self, map: &Map, fs: &mut FileSystem<D>) -> Result<usize> {
|
||||
let accmode = self.flags & O_ACCMODE;
|
||||
if map.flags & PROT_READ > 0 && !(accmode == O_RDWR || accmode == O_RDONLY) {
|
||||
if map.flags.contains(PROT_READ) && !(accmode == O_RDWR || accmode == O_RDONLY) {
|
||||
return Err(Error::new(EBADF));
|
||||
}
|
||||
if map.flags & PROT_WRITE > 0 && !(accmode == O_RDWR || accmode == O_WRONLY) {
|
||||
if map.flags.contains(PROT_WRITE) && !(accmode == O_RDWR || accmode == O_WRONLY) {
|
||||
return Err(Error::new(EBADF));
|
||||
}
|
||||
//TODO: PROT_EXEC?
|
||||
|
||||
@@ -6,12 +6,12 @@ use std::time::{SystemTime, UNIX_EPOCH};
|
||||
|
||||
use syscall::data::{Map, Stat, StatVfs, TimeSpec};
|
||||
use syscall::error::{
|
||||
Error, Result, EACCES, EBADF, EEXIST, EINVAL, EISDIR, ELOOP, ENOENT, ENOTDIR, ENOTEMPTY, EPERM,
|
||||
EXDEV,
|
||||
Error, Result, EACCES, EBADF, EEXIST, EINVAL, EISDIR, ELOOP, ENOENT, ENOTDIR, ENOTEMPTY,
|
||||
ENOSYS, EPERM, EXDEV,
|
||||
};
|
||||
use syscall::flag::{
|
||||
MODE_PERM, O_ACCMODE, O_CREAT, O_DIRECTORY, O_EXCL, O_NOFOLLOW, O_RDONLY, O_RDWR, O_STAT,
|
||||
O_SYMLINK, O_TRUNC, O_WRONLY,
|
||||
O_SYMLINK, O_TRUNC, O_WRONLY, EventFlags,
|
||||
};
|
||||
use syscall::scheme::Scheme;
|
||||
|
||||
@@ -491,7 +491,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
|
||||
}
|
||||
}
|
||||
|
||||
fn seek(&self, id: usize, pos: usize, whence: usize) -> Result<usize> {
|
||||
fn seek(&self, id: usize, pos: isize, whence: usize) -> Result<isize> {
|
||||
// println!("Seek {}, {} {}", id, pos, whence);
|
||||
let mut files = self.files.borrow_mut();
|
||||
if let Some(file) = files.get_mut(&id) {
|
||||
@@ -528,7 +528,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
|
||||
}
|
||||
}
|
||||
|
||||
fn fevent(&self, id: usize, flags: usize) -> Result<usize> {
|
||||
fn fevent(&self, id: usize, _flags: EventFlags) -> Result<EventFlags> {
|
||||
let files = self.files.borrow_mut();
|
||||
if let Some(file) = files.get(&id) {
|
||||
// EPERM is returned for files that are always readable or writable
|
||||
@@ -734,7 +734,7 @@ impl<D: Disk> Scheme for FileScheme<D> {
|
||||
}
|
||||
}
|
||||
|
||||
fn funmap(&self, address: usize) -> Result<usize> {
|
||||
fn funmap_old(&self, address: usize) -> Result<usize> {
|
||||
if let Some(id) = self.fmap.borrow_mut().remove(&address) {
|
||||
let mut files = self.files.borrow_mut();
|
||||
if let Some(file) = files.get_mut(&id) {
|
||||
@@ -747,6 +747,12 @@ impl<D: Disk> Scheme for FileScheme<D> {
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: implement
|
||||
fn funmap(&self, address: usize, length: usize) -> Result<usize> {
|
||||
println!("redoxfs: funmap 0x{:X}, {}", address, length);
|
||||
Err(Error::new(ENOSYS))
|
||||
}
|
||||
|
||||
fn close(&self, id: usize) -> Result<usize> {
|
||||
// println!("Close {}", id);
|
||||
let mut files = self.files.borrow_mut();
|
||||
|
||||
Reference in New Issue
Block a user