2020-04-22 04:30:09 +04:00
|
|
|
// test.rs
|
|
|
|
|
2020-04-26 00:06:29 +04:00
|
|
|
use crate::{kmem::{kfree, kmalloc},
|
|
|
|
syscall::syscall_fs_read};
|
2020-04-24 22:39:56 +04:00
|
|
|
|
|
|
|
pub fn test_block() {
|
2020-04-26 00:06:29 +04:00
|
|
|
// Let's test the block driver!
|
|
|
|
let bytes_to_read = 1024 * 50;
|
|
|
|
let buffer = kmalloc(bytes_to_read);
|
|
|
|
unsafe {
|
2020-04-26 03:51:27 +04:00
|
|
|
let bytes_read =
|
|
|
|
syscall_fs_read(8, 5, buffer, bytes_to_read as u32, 0);
|
2020-04-26 00:06:29 +04:00
|
|
|
println!("FS Read returned {} bytes", bytes_read);
|
|
|
|
for i in 0..16 * 4 {
|
|
|
|
print!("{:02x} ", buffer.add(i).read());
|
|
|
|
if (i + 1) % 16 == 0 {
|
|
|
|
println!();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
println!();
|
|
|
|
kfree(buffer);
|
2020-04-24 22:39:56 +04:00
|
|
|
}
|