diff --git a/.gitignore b/.gitignore index 714d47b..e1db110 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ target* test-results/ .direnv .vagrant +libfuckery +build.rs diff --git a/Cargo.toml b/Cargo.toml index 2d3cffb..8df270c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ bitflags = "1.2.1" once_cell = "1.3.1" [dependencies.libnv] -version = "0.2.3" +version = "0.3.0" default-features = false features = ["nvpair"] @@ -51,5 +51,8 @@ slog-term = "2" tempdir = "0.3" tempfile = "3" +[build-dependencies] +cmake = "0.1" + [package.metadata.release] dev-version-ext = "pre" diff --git a/flake.nix b/flake.nix index 5312a83..999d4a0 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,7 @@ vagrant just zlib + cmake ]; PROJECT_ROOT = builtins.toString ./.; RUST_SRC_PATH = "${rust}/lib/rustlib/src/rust/library"; diff --git a/src/lib.rs b/src/lib.rs index 1c267a9..6e9a043 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -61,3 +61,9 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); pub mod log; pub use log::GlobalLogger; + +pub mod fuckery { + extern { + pub(crate) fn fuckery_make_nvlist() -> *mut zfs_core_sys::nvlist_t; + } +} \ No newline at end of file diff --git a/src/zfs/lzc.rs b/src/zfs/lzc.rs index d9b2c32..0224da9 100644 --- a/src/zfs/lzc.rs +++ b/src/zfs/lzc.rs @@ -324,7 +324,7 @@ impl ZfsEngine for ZfsLzc { let mut bookmarks_list = NvList::default(); for bookmark in bookmarks { - bookmarks_list.insert(&bookmark.to_string_lossy(), true)?; + bookmarks_list.insert_boolean(&bookmark.to_string_lossy())?; } let mut errors_list_ptr = null_mut(); diff --git a/tests/test_zfs.rs b/tests/test_zfs.rs index bb796f1..89601b2 100644 --- a/tests/test_zfs.rs +++ b/tests/test_zfs.rs @@ -284,11 +284,9 @@ fn easy_snapshot_and_bookmark() { zfs.destroy_snapshots(&expected_snapshots, DestroyTiming::RightNow).unwrap(); assert_eq!(Ok(false), zfs.exists(expected_snapshots[0].clone())); - // TODO: Fix this method - // Still no clue what is wrong after entire day trying. GH Issue: 159 - //zfs.destroy_bookmarks(&expected_bookmarks).unwrap(); - //let bookmarks = zfs.list_bookmarks(root).expect("failed to list bookmarks"); - //assert!(bookmarks.is_empty()) + zfs.destroy_bookmarks(&expected_bookmarks).unwrap(); + let bookmarks = zfs.list_bookmarks(root).expect("failed to list bookmarks"); + assert!(bookmarks.is_empty()) } #[test]