Yet more stuff. Direct IO is not working at all.
This commit is contained in:
19
src/io.rs
19
src/io.rs
@@ -1,5 +1,6 @@
|
||||
use std::fs::{File, OpenOptions};
|
||||
use std::io::{self, Seek, SeekFrom};
|
||||
use std::os::unix::fs::{FileExt, OpenOptionsExt};
|
||||
|
||||
use crate::cli::CONFIG;
|
||||
|
||||
@@ -22,8 +23,18 @@ pub fn get_stream_length<S: Seek>(stream: &mut S) -> io::Result<u64> {
|
||||
pub fn load_input() -> anyhow::Result<File> {
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
//.custom_flags(libc::O_DIRECT)
|
||||
.open(&CONFIG.input)
|
||||
.with_context(|| format!("Failed to open input file: {}", &CONFIG.input.display()))
|
||||
|
||||
/*
|
||||
use std::ffi::CString;
|
||||
use std::os::fd::FromRawFd;
|
||||
|
||||
let path = CString::new(CONFIG.input.to_str().unwrap().to_owned()).unwrap();
|
||||
let flags = libc::O_DIRECT | libc::O_RDONLY;
|
||||
let f = unsafe { File::from_raw_fd(libc::open(path.as_ptr(), flags)) };
|
||||
*/
|
||||
}
|
||||
|
||||
pub fn load_output() -> anyhow::Result<File> {
|
||||
@@ -40,16 +51,10 @@ pub fn load_output() -> anyhow::Result<File> {
|
||||
})
|
||||
}
|
||||
|
||||
pub fn load_map_read() -> anyhow::Result<File> {
|
||||
pub fn load_map_read() -> std::io::Result<File> {
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
.open(crate::path::MAP_PATH.clone())
|
||||
.with_context(|| {
|
||||
format!(
|
||||
"Failed to open/create mapping file at: {}",
|
||||
crate::path::MAP_PATH.display()
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
pub fn load_map_write() -> anyhow::Result<File> {
|
||||
|
||||
Reference in New Issue
Block a user