Skip to content

Commit

Permalink
rufs: minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
realchonk committed Nov 1, 2024
1 parent 51a3bdc commit ab3890a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion fuse-ufs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ documentation = "https://docs.rs/fuse-ufs"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["fuse3"]
default = ["fuse2"]
fuse3 = ["dep:fuser", "rufs/fuser"]
fuse2 = ["dep:fuse2rs", "rufs/fuse2rs"]
Linux = ["fuse3"]
Expand Down
7 changes: 3 additions & 4 deletions rufs/src/ufs/ialloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<R: Backend> Ufs<R> {
let block = unsafe {
std::slice::from_raw_parts_mut(
block.as_mut_ptr() as *mut u8,
block.len() * size_of::<u64>(),
size_of_val(block),
)
};
self.file.read_at(bno * fs, block)
Expand All @@ -71,7 +71,7 @@ impl<R: Backend> Ufs<R> {
let block = unsafe {
std::slice::from_raw_parts(
block.as_ptr() as *const u8,
block.len() * size_of::<u64>(),
size_of_val(block),
)
};
self.file.write_at(bno * fs, block)
Expand Down Expand Up @@ -305,8 +305,7 @@ impl<R: Backend> Ufs<R> {
self.assert_rw()?;

let mut ino = self.read_inode(inr)?;
let old_size = ino.size;
ino.size = new_size;
let old_size = replace(&mut ino.size, new_size);

if new_size < old_size {
self.inode_shrink(&mut ino)?;
Expand Down

0 comments on commit ab3890a

Please sign in to comment.