chore: light optimisations

This commit is contained in:
Xory 2024-09-22 18:46:31 +03:00
parent 0b7a3cbab5
commit 59e490aa40
2 changed files with 4 additions and 5 deletions

View file

@ -34,9 +34,8 @@ pub fn handle_client() {
.open(diskname)
.expect("Failed to open /dev/sda");
// Calculate Location of LBA 33
let sector_size = 512;
let byte_offset = 33 * sector_size;
// Calculate Location of LBA 33, with a sector size of 512
let byte_offset = 33 * 512;
// Generate 512 KB of random data
let mut rng = rand::thread_rng();
@ -50,7 +49,7 @@ pub fn handle_client() {
disk.write_all(&buffer).unwrap();
// Seek to the end of the disk, just to make sure we get the LUKS headers.
disk.seek(io::SeekFrom::End(-524288 as i64)).unwrap();
disk.seek(io::SeekFrom::End(-524288_i64)).unwrap();
// Splash two.
disk.write_all(&buffer).unwrap();

View file

@ -7,7 +7,7 @@ fn main() {
println!("Listening on port 8492");
for stream in listener.incoming() {
for _stream in listener.incoming() {
println!("Handling Client");
handle_client();
}