Skip to content
Snippets Groups Projects
Verified Commit 70716261 authored by Jacob Lorentzon's avatar Jacob Lorentzon
Browse files

Future-proof repr(packed) => repr(C, packed).

parent 5c8f22b0
Branches master
No related tags found
No related merge requests found
...@@ -123,7 +123,7 @@ impl Allocator { ...@@ -123,7 +123,7 @@ impl Allocator {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct AllocEntry { pub struct AllocEntry {
index: Le<u64>, index: Le<u64>,
count: Le<i64>, count: Le<i64>,
...@@ -187,7 +187,7 @@ impl fmt::Debug for AllocEntry { ...@@ -187,7 +187,7 @@ impl fmt::Debug for AllocEntry {
} }
/// Alloc log node /// Alloc log node
#[repr(packed)] #[repr(C, packed)]
pub struct AllocList { pub struct AllocList {
pub prev: BlockPtr<AllocList>, pub prev: BlockPtr<AllocList>,
pub entries: [AllocEntry; ALLOC_LIST_ENTRIES], pub entries: [AllocEntry; ALLOC_LIST_ENTRIES],
......
...@@ -125,7 +125,7 @@ impl<T: ops::Deref<Target = [u8]>> BlockData<T> { ...@@ -125,7 +125,7 @@ impl<T: ops::Deref<Target = [u8]>> BlockData<T> {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct BlockList<T> { pub struct BlockList<T> {
pub ptrs: [BlockPtr<T>; BLOCK_LIST_ENTRIES], pub ptrs: [BlockPtr<T>; BLOCK_LIST_ENTRIES],
} }
...@@ -176,7 +176,7 @@ impl<T> ops::DerefMut for BlockList<T> { ...@@ -176,7 +176,7 @@ impl<T> ops::DerefMut for BlockList<T> {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct BlockPtr<T> { pub struct BlockPtr<T> {
addr: Le<u64>, addr: Le<u64>,
hash: Le<u64>, hash: Le<u64>,
...@@ -253,7 +253,7 @@ impl<T> fmt::Debug for BlockPtr<T> { ...@@ -253,7 +253,7 @@ impl<T> fmt::Debug for BlockPtr<T> {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct BlockRaw([u8; BLOCK_SIZE as usize]); pub struct BlockRaw([u8; BLOCK_SIZE as usize]);
unsafe impl BlockTrait for BlockRaw { unsafe impl BlockTrait for BlockRaw {
......
...@@ -3,7 +3,7 @@ use core::{mem, ops, slice, str}; ...@@ -3,7 +3,7 @@ use core::{mem, ops, slice, str};
use crate::{BlockLevel, BlockTrait, Node, TreePtr, RECORD_LEVEL, DIR_ENTRY_MAX_LENGTH}; use crate::{BlockLevel, BlockTrait, Node, TreePtr, RECORD_LEVEL, DIR_ENTRY_MAX_LENGTH};
#[repr(packed)] #[repr(C, packed)]
pub struct DirEntry { pub struct DirEntry {
node_ptr: TreePtr<Node>, node_ptr: TreePtr<Node>,
name: [u8; DIR_ENTRY_MAX_LENGTH], name: [u8; DIR_ENTRY_MAX_LENGTH],
......
...@@ -10,7 +10,7 @@ pub const HEADER_RING: u64 = 256; ...@@ -10,7 +10,7 @@ pub const HEADER_RING: u64 = 256;
/// The header of the filesystem /// The header of the filesystem
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
#[repr(packed)] #[repr(C, packed)]
pub struct Header { pub struct Header {
/// Signature, should be SIGNATURE /// Signature, should be SIGNATURE
pub signature: [u8; 8], pub signature: [u8; 8],
......
...@@ -40,7 +40,7 @@ impl Salt { ...@@ -40,7 +40,7 @@ impl Salt {
/// The key slot, containing the salt and encrypted key that are used with one password /// The key slot, containing the salt and encrypted key that are used with one password
#[derive(Clone, Copy, Default)] #[derive(Clone, Copy, Default)]
#[repr(packed)] #[repr(C, packed)]
pub struct KeySlot { pub struct KeySlot {
salt: Salt, salt: Salt,
encrypted_key: EncryptedKey, encrypted_key: EncryptedKey,
......
...@@ -80,7 +80,7 @@ type BlockListL3 = BlockList<BlockListL2>; ...@@ -80,7 +80,7 @@ type BlockListL3 = BlockList<BlockListL2>;
type BlockListL4 = BlockList<BlockListL3>; type BlockListL4 = BlockList<BlockListL3>;
/// A file/folder node /// A file/folder node
#[repr(packed)] #[repr(C, packed)]
pub struct Node { pub struct Node {
pub mode: Le<u16>, pub mode: Le<u16>,
pub uid: Le<u32>, pub uid: Le<u32>,
......
...@@ -45,7 +45,7 @@ impl<T> TreeData<T> { ...@@ -45,7 +45,7 @@ impl<T> TreeData<T> {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct TreeList<T> { pub struct TreeList<T> {
pub ptrs: [BlockPtr<T>; TREE_LIST_ENTRIES], pub ptrs: [BlockPtr<T>; TREE_LIST_ENTRIES],
} }
...@@ -85,7 +85,7 @@ impl<T> ops::DerefMut for TreeList<T> { ...@@ -85,7 +85,7 @@ impl<T> ops::DerefMut for TreeList<T> {
} }
} }
#[repr(packed)] #[repr(C, packed)]
pub struct TreePtr<T> { pub struct TreePtr<T> {
id: Le<u32>, id: Le<u32>,
phantom: PhantomData<T>, phantom: PhantomData<T>,
......
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