summaryrefslogtreecommitdiff
path: root/rust-src/bch_bindgen/src/fs.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rust-src/bch_bindgen/src/fs.rs')
-rw-r--r--rust-src/bch_bindgen/src/fs.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/rust-src/bch_bindgen/src/fs.rs b/rust-src/bch_bindgen/src/fs.rs
index 1176846d..b26c51b6 100644
--- a/rust-src/bch_bindgen/src/fs.rs
+++ b/rust-src/bch_bindgen/src/fs.rs
@@ -9,15 +9,12 @@ pub struct Fs {
}
impl Fs {
- pub fn open(devices: &Vec<PathBuf>, opts: c::bch_opts) -> Result<Fs, bch_errcode> {
- let devices: Vec<_> = devices.iter()
- .map(|i| CString::new(i.as_os_str().as_bytes()).unwrap()).collect();
- let dev_c_strs: Vec<_> = devices.iter()
- .map(|i| { let p: *const i8 = i.as_ptr(); p })
+ pub fn open(devs: &Vec<PathBuf>, opts: c::bch_opts) -> Result<Fs, bch_errcode> {
+ let devs: Vec<_> = devs.iter()
+ .map(|i| CString::new(i.as_os_str().as_bytes()).unwrap().into_raw())
.collect();
- let dev_c_strarray: *const *mut i8 = dev_c_strs[..].as_ptr() as *const *mut i8;
- let ret = unsafe { c::bch2_fs_open(dev_c_strarray, dev_c_strs.len() as u32, opts) };
+ let ret = unsafe { c::bch2_fs_open(devs[..].as_ptr(), devs.len() as u32, opts) };
errptr_to_result(ret).map(|fs| Fs { raw: fs})
}