Skip to content
Snippets Groups Projects
Commit 47c9acc4 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Version 3 - bump block size to 4096

parent 513bfaf8
No related branches found
No related tags found
No related merge requests found
...@@ -3,14 +3,14 @@ use std::ops::{Deref, DerefMut}; ...@@ -3,14 +3,14 @@ use std::ops::{Deref, DerefMut};
use uuid::Uuid; use uuid::Uuid;
use BLOCK_SIZE; use {BLOCK_SIZE, SIGNATURE, VERSION};
/// The header of the filesystem /// The header of the filesystem
#[repr(packed)] #[repr(packed)]
pub struct Header { pub struct Header {
/// Signature, should be b"RedoxFS\0" /// Signature, should be SIGNATURE
pub signature: [u8; 8], pub signature: [u8; 8],
/// Version, should be 1 /// Version, should be VERSION
pub version: u64, pub version: u64,
/// Disk ID, a 128-bit unique identifier /// Disk ID, a 128-bit unique identifier
pub uuid: [u8; 16], pub uuid: [u8; 16],
...@@ -25,9 +25,6 @@ pub struct Header { ...@@ -25,9 +25,6 @@ pub struct Header {
} }
impl Header { impl Header {
pub const SIGNATURE: &'static [u8; 8] = b"RedoxFS\0";
pub const VERSION: u64 = 2;
pub fn default() -> Header { pub fn default() -> Header {
Header { Header {
signature: [0; 8], signature: [0; 8],
...@@ -43,8 +40,8 @@ impl Header { ...@@ -43,8 +40,8 @@ impl Header {
pub fn new(size: u64, root: u64, free: u64) -> Header { pub fn new(size: u64, root: u64, free: u64) -> Header {
let uuid = Uuid::new_v4(); let uuid = Uuid::new_v4();
Header { Header {
signature: *Header::SIGNATURE, signature: *SIGNATURE,
version: Header::VERSION, version: VERSION,
uuid: *uuid.as_bytes(), uuid: *uuid.as_bytes(),
size: size, size: size,
root: root, root: root,
...@@ -54,7 +51,7 @@ impl Header { ...@@ -54,7 +51,7 @@ impl Header {
} }
pub fn valid(&self) -> bool { pub fn valid(&self) -> bool {
&self.signature == Header::SIGNATURE && self.version == Header::VERSION &self.signature == SIGNATURE && self.version == VERSION
} }
} }
......
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
extern crate syscall; extern crate syscall;
extern crate uuid; extern crate uuid;
pub const BLOCK_SIZE: u64 = 512; pub const BLOCK_SIZE: u64 = 4096;
pub const SIGNATURE: &'static [u8; 8] = b"RedoxFS\0";
pub const VERSION: u64 = 3;
pub use self::disk::{Disk, DiskCache, DiskFile}; pub use self::disk::{Disk, DiskCache, DiskFile};
pub use self::ex_node::ExNode; pub use self::ex_node::ExNode;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment