Verified Commit 733c1298 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Use redoxfs 0.5.0 branch

parent e02f110f
......@@ -2,6 +2,18 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "aes"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8"
dependencies = [
"cfg-if",
"cipher",
"cpufeatures",
"opaque-debug",
]
[[package]]
name = "bit_field"
version = "0.10.1"
......@@ -20,11 +32,39 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cipher"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7"
dependencies = [
"generic-array",
]
[[package]]
name = "cpufeatures"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
dependencies = [
"libc",
]
[[package]]
name = "generic-array"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "libc"
version = "0.2.118"
version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06e509672465a0504304aa87f9f176f2b2b716ed8fb105ebe5c02dc6dce96a94"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]]
name = "linked_list_allocator"
......@@ -53,6 +93,12 @@ dependencies = [
"cfg-if",
]
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "raw-cpuid"
version = "10.2.0"
......@@ -112,12 +158,16 @@ dependencies = [
[[package]]
name = "redoxfs"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7fcc31de09215010802574e370fce8534be7f3453ca76c4369e527b6924dafaa"
version = "0.5.0"
source = "git+https://gitlab.redox-os.org/redox-os/redoxfs.git?branch=0.5.0#1ca00b6dd684bd21880dbaac7ede4e5c133ba5e3"
dependencies = [
"aes",
"generic-array",
"libc",
"log",
"redox_syscall",
"seahash",
"simple_endian",
"uuid",
]
......@@ -127,6 +177,17 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "seahash"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]]
name = "simple_endian"
version = "0.2.1"
source = "git+https://github.com/michalfita/simple-endian-rs.git?rev=7210f40881d16f7f2e3d8d40f6381fa222843caa#7210f40881d16f7f2e3d8d40f6381fa222843caa"
[[package]]
name = "spin"
version = "0.9.2"
......@@ -145,12 +206,24 @@ dependencies = [
"lock_api",
]
[[package]]
name = "typenum"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987"
[[package]]
name = "uuid"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc7e3b898aa6f6c08e5295b6c89258d1331e9ac578cc992fb818759951bdc22"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "x86"
version = "0.43.0"
......
......@@ -18,7 +18,7 @@ crate-type = ["staticlib"]
linked_list_allocator = "0.9.1"
log = "0.4.14"
redox_syscall = "0.2.10"
redoxfs = { version = "0.4.4", default-features = false }
redoxfs = { git = "https://gitlab.redox-os.org/redox-os/redoxfs.git", branch = "0.5.0", default-features = false }
spin = "0.9.2"
[target.'cfg(target_os = "uefi")'.dependencies]
......
......@@ -17,5 +17,5 @@ stage3:
align 512, db 0
.end:
; the maximum size of the boot loader portion is 128 KiB
times 131072-($-$$) db 0
; the maximum size of the boot loader portion is 256 KiB
times 262144-($-$$) db 0
......@@ -239,14 +239,14 @@ fn main<
let mut fs = os.filesystem();
print!("RedoxFS ");
for i in 0..fs.header.1.uuid.len() {
for i in 0..fs.header.uuid().len() {
if i == 4 || i == 6 || i == 8 || i == 10 {
print!("-");
}
print!("{:>02x}", fs.header.1.uuid[i]);
print!("{:>02x}", fs.header.uuid()[i]);
}
println!(": {} MiB", fs.header.1.size / MIBI as u64);
println!(": {} MiB", fs.header.size() / MIBI as u64);
let mode_opt = select_mode(os);
......@@ -256,12 +256,11 @@ fn main<
panic!("Failed to allocate memory for stack");
}
let kernel = {
let node = fs.find_node("kernel", fs.header.1.root)
let kernel = fs.tx(|tx| {
let node = tx.find_node(redoxfs::TreePtr::root(), "kernel")
.expect("Failed to find kernel file");
let size = fs.node_len(node.0)
.expect("Failed to read kernel size");
let size = node.data().size();
print!("Kernel: 0/{} MiB", size / MIBI as u64);
......@@ -277,7 +276,7 @@ fn main<
let mut i = 0;
for chunk in kernel.chunks_mut(MIBI) {
print!("\rKernel: {}/{} MiB", i / MIBI as u64, size / MIBI as u64);
i += fs.read_node(node.0, i, chunk, 0, 0)
i += tx.read_node_inner(&node, i, chunk)
.expect("Failed to read kernel file") as u64;
}
println!("\rKernel: {}/{} MiB", i / MIBI as u64, size / MIBI as u64);
......@@ -287,15 +286,15 @@ fn main<
panic!("Kernel has invalid magic number {:#X?}", magic);
}
kernel
};
Ok(kernel)
}).expect("RedoxFS transaction failed");
let page_phys = unsafe { paging_create(os, kernel.as_ptr() as usize, kernel.len()) }
.expect("Failed to set up paging");
//TODO: properly reserve page table allocations so kernel does not re-use them
let live_opt = if cfg!(feature = "live") {
let size = fs.header.1.size;
let size = fs.header.size();
print!("Live: 0/{} MiB", size / MIBI as u64);
......@@ -311,8 +310,10 @@ fn main<
let mut i = 0;
for chunk in live.chunks_mut(MIBI) {
print!("\rLive: {}/{} MiB", i / MIBI as u64, size / MIBI as u64);
i += fs.disk.read_at(fs.block + i / redoxfs::BLOCK_SIZE, chunk)
.expect("Failed to read live disk") as u64;
i += unsafe {
fs.disk.read_at(fs.block + i / redoxfs::BLOCK_SIZE, chunk)
.expect("Failed to read live disk") as u64
};
}
println!("\rLive: {}/{} MiB", i / MIBI as u64, size / MIBI as u64);
......@@ -344,12 +345,12 @@ fn main<
writeln!(w, "REDOXFS_BLOCK={:016x}", fs.block).unwrap();
}
write!(w, "REDOXFS_UUID=").unwrap();
for i in 0..fs.header.1.uuid.len() {
for i in 0..fs.header.uuid().len() {
if i == 4 || i == 6 || i == 8 || i == 10 {
write!(w, "-").unwrap();
}
write!(w, "{:>02x}", fs.header.1.uuid[i]).unwrap();
write!(w, "{:>02x}", fs.header.uuid()[i]).unwrap();
}
writeln!(w).unwrap();
......
......@@ -42,7 +42,7 @@ impl DiskBios {
}
impl Disk for DiskBios {
fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
unsafe fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
for (i, chunk) in buffer.chunks_mut(BLOCK_SIZE as usize).enumerate() {
unsafe {
let mut dap = DiskAddressPacket::from_block(block + i as u64);
......@@ -68,7 +68,7 @@ impl Disk for DiskBios {
Ok(buffer.len())
}
fn write_at(&mut self, block: u64, buffer: &[u8]) -> Result<usize> {
unsafe fn write_at(&mut self, block: u64, buffer: &[u8]) -> Result<usize> {
log::error!(
"DiskBios::write_at(0x{:X}, 0x{:X}:0x{:X}) not allowed",
block,
......
......@@ -90,7 +90,7 @@ impl Os<
//TODO: get block from partition table
let block = crate::MIBI as u64 / redoxfs::BLOCK_SIZE;
redoxfs::FileSystem::open(disk, Some(block))
redoxfs::FileSystem::open(disk, Some(block), false)
.expect("Failed to open RedoxFS")
}
......
......@@ -18,7 +18,7 @@ impl Protocol<UefiBlockIo> for DiskEfi {
}
impl Disk for DiskEfi {
fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
unsafe fn read_at(&mut self, block: u64, buffer: &mut [u8]) -> Result<usize> {
let block_size = self.0.Media.BlockSize as u64;
let lba = block * BLOCK_SIZE / block_size;
......@@ -32,7 +32,7 @@ impl Disk for DiskEfi {
}
}
fn write_at(&mut self, block: u64, _buffer: &[u8]) -> Result<usize> {
unsafe fn write_at(&mut self, block: u64, _buffer: &[u8]) -> Result<usize> {
println!("DiskEfi::write_at 0x{:X} not implemented", block);
Err(Error::new(EIO))
}
......
......@@ -88,7 +88,7 @@ impl Os<
continue;
}
match redoxfs::FileSystem::open(block_io, Some(0)) {
match redoxfs::FileSystem::open(block_io, Some(0), false) {
Ok(ok) => return ok,
Err(err) => match err.errno {
// Ignore header not found error
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment