1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00

Added comments and formatted.

This commit is contained in:
Stephen Marz 2020-04-24 19:30:00 -04:00
parent 0d924e6fab
commit 71702acd43
2 changed files with 18 additions and 5 deletions

View File

@ -5,8 +5,8 @@
use crate::{fs::{Descriptor, FileSystem, FsError, Stat}, use crate::{fs::{Descriptor, FileSystem, FsError, Stat},
kmem::{kfree, kmalloc, talloc, tfree}, kmem::{kfree, kmalloc, talloc, tfree},
process::{add_kernel_process_args, set_waiting, set_running}, process::{add_kernel_process_args, set_running, set_waiting},
syscall::{syscall_block_read}}; syscall::syscall_block_read};
use alloc::string::String; use alloc::string::String;
use core::{mem::size_of, ptr::null_mut}; use core::{mem::size_of, ptr::null_mut};
@ -92,6 +92,8 @@ impl Default for BlockBuffer {
} }
} }
// This is why we have the BlockBuffer. Instead of having to unwind
// all other buffers, we drop here when the block buffer goes out of scope.
impl Drop for BlockBuffer { impl Drop for BlockBuffer {
fn drop(&mut self) { fn drop(&mut self) {
if !self.buffer.is_null() { if !self.buffer.is_null() {
@ -135,7 +137,19 @@ impl MinixFileSystem {
// Now, we read the inode itself. // Now, we read the inode itself.
syc_read(desc, buffer.get_mut(), 512, inode_offset as u32); syc_read(desc, buffer.get_mut(), 512, inode_offset as u32);
println!("Inode {} sizex = {} {:o}, DZ {} {} {} {} {} {} {}", inode_num, inode.size, inode.mode, inode.zones[0], inode.zones[1], inode.zones[2], inode.zones[3], inode.zones[4], inode.zones[5], inode.zones[6]); println!(
"Inode {} sizex = {} {:o}, DZ {} {} {} {} {} {} {}",
inode_num,
inode.size,
inode.mode,
inode.zones[0],
inode.zones[1],
inode.zones[2],
inode.zones[3],
inode.zones[4],
inode.zones[5],
inode.zones[6]
);
return Some(*inode); return Some(*inode);
} }
// If we get here, some result wasn't OK. Either the super block // If we get here, some result wasn't OK. Either the super block

View File

@ -5,7 +5,6 @@
use crate::{block::block_op, use crate::{block::block_op,
cpu::TrapFrame, cpu::TrapFrame,
fs::FileSystem,
minixfs, minixfs,
process::{delete_process, set_sleeping}}; process::{delete_process, set_sleeping}};