2 use std::os::unix::ffi::OsStrExt;
3 use std::path::PathBuf;
5 use crate::errcode::{bch_errcode, errptr_to_result};
8 pub raw: *mut c::bch_fs,
12 pub fn open(devs: &Vec<PathBuf>, opts: c::bch_opts) -> Result<Fs, bch_errcode> {
13 let devs: Vec<_> = devs.iter()
14 .map(|i| CString::new(i.as_os_str().as_bytes()).unwrap().into_raw())
17 let ret = unsafe { c::bch2_fs_open(devs[..].as_ptr(), devs.len() as u32, opts) };
19 errptr_to_result(ret).map(|fs| Fs { raw: fs})
25 unsafe { c::bch2_fs_stop(self.raw) }