From 34511ae6b10ac249647c3372644dbe04bf858296 Mon Sep 17 00:00:00 2001 From: Joe Grund Date: Thu, 12 Sep 2019 09:18:05 -0400 Subject: [PATCH] Add support for ZFS 0.8 Signed-off-by: Joe Grund --- .travis.yml | 32 +-- Cargo.lock | 154 +++++++------ libzfs-sys/Cargo.toml | 2 +- libzfs-sys/build.rs | 9 +- libzfs-sys/src/bindings.rs | 456 ++++++++++++++++--------------------- libzfs-sys/src/lib.rs | 3 - libzfs-sys/wrapper.h | 1 + libzfs-types/src/lib.rs | 2 +- libzfs/Cargo.toml | 2 +- libzfs/src/libzfs.rs | 2 - 10 files changed, 310 insertions(+), 353 deletions(-) diff --git a/.travis.yml b/.travis.yml index bceef32..67c3f31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,19 +15,19 @@ jobs: - stage: test name: "copr build test" script: - - cd node-libzfs - - export SPEC=iml-node-libzfs.spec - - docker run -it -e SPEC="$SPEC" -e LOCAL_ONLY="True" -v $(pwd):/build:rw imlteam/copr-zfs - - ((`find _topdir/RPMS -name *.rpm | wc -l` > 0)) + - cd node-libzfs + - export SPEC=iml-node-libzfs.spec + - docker run -it -e SPEC="$SPEC" -e LOCAL_ONLY="True" -v $(pwd):/build:rw imlteam/copr-zfs + - ((`find _topdir/RPMS -name *.rpm | wc -l` > 0)) - stage: cd name: "Continuous Deployment" script: - - cd node-libzfs - - export OWNER=managerforlustre - - export PROJECT=manager-for-lustre-devel - - export PACKAGE=iml-node-libzfs - - export SPEC=iml-node-libzfs.spec - - docker run -it -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr + - cd node-libzfs + - export OWNER=managerforlustre + - export PROJECT=manager-for-lustre-devel + - export PACKAGE=iml-node-libzfs + - export SPEC=iml-node-libzfs.spec + - docker run -it -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr - stage: deploy-libzfs-sys name: "libzfs-sys" script: @@ -65,12 +65,12 @@ jobs: - stage: deploy-copr-r5.0 name: "Copr 5.0 deploy" script: - - cd node-libzfs - - export OWNER=managerforlustre - - export PROJECT=manager-for-lustre-5.0 - - export PACKAGE=iml-node-libzfs - - export SPEC=iml-node-libzfs.spec - - docker run -it -e PROD="true" -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr + - cd node-libzfs + - export OWNER=managerforlustre + - export PROJECT=manager-for-lustre-5.0 + - export PACKAGE=iml-node-libzfs + - export SPEC=iml-node-libzfs.spec + - docker run -it -e PROD="true" -e OWNER="$OWNER" -e PROJECT="$PROJECT" -e PACKAGE="$PACKAGE" -e SPEC="$SPEC" -e KEY="$encrypted_253525cedcf6_key" -e IV="$encrypted_253525cedcf6_iv" -v $(pwd):/build:rw imlteam/copr stages: - test - name: cd diff --git a/Cargo.lock b/Cargo.lock index c002113..d15b9a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,7 +13,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -21,19 +21,19 @@ name = "atty" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "backtrace" -version = "0.3.34" +version = "0.3.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -41,8 +41,8 @@ name = "backtrace-sys" version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -57,12 +57,12 @@ dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -79,7 +79,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cc" -version = "1.0.38" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -101,7 +101,7 @@ version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -115,7 +115,7 @@ dependencies = [ "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -134,9 +134,9 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", - "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -145,7 +145,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -176,7 +176,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "humantime" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -184,12 +184,12 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libc" -version = "0.2.60" +version = "0.2.62" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -197,8 +197,8 @@ name = "libloading" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -207,12 +207,12 @@ version = "0.6.15" dependencies = [ "cstr-argument 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "libzfs-sys 0.5.11", "libzfs-types 0.1.1", "nvpair-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -221,15 +221,15 @@ version = "0.5.11" dependencies = [ "bindgen 0.51.0 (registry+https://github.com/rust-lang/crates.io-index)", "nvpair-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libzfs-types" version = "0.1.1" dependencies = [ - "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -266,7 +266,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "pkg-config" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -277,6 +277,14 @@ dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "quick-error" version = "1.2.2" @@ -290,40 +298,48 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "quote" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" -version = "1.2.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex-syntax" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-demangle" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.98" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde_derive" -version = "1.0.98" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -338,12 +354,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.42" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -351,7 +367,7 @@ name = "termcolor" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -359,7 +375,7 @@ name = "textwrap" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -367,12 +383,12 @@ name = "thread_local" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "unicode-width" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -380,6 +396,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-xid" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "vec_map" version = "0.8.1" @@ -396,12 +417,12 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "winapi" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -418,7 +439,7 @@ name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -428,10 +449,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wincolor" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -439,12 +460,12 @@ dependencies = [ "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "1803c647a3ec87095e7ae7acfca019e98de5ec9a7d01343f611cf3152ed71a90" -"checksum backtrace 0.3.34 (registry+https://github.com/rust-lang/crates.io-index)" = "b5164d292487f037ece34ec0de2fcede2faa162f085dd96d2385ab81b12765ba" +"checksum backtrace 0.3.37 (registry+https://github.com/rust-lang/crates.io-index)" = "5180c5a20655b14a819b652fd2378fa5f1697b6c9ddad3e695c2f9cedf6df4e2" "checksum backtrace-sys 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)" = "82a830b4ef2d1124a711c71d263c5abdc710ef8e907bd508c88be475cebc422b" "checksum bindgen 0.51.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18270cdd7065ec045a6bb4bdcd5144d14a78b3aedb3bc5111e688773ac8b9ad0" "checksum bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d155346769a6855b86399e9bc3814ab343cd3d62c7e985113d46a0ec3c281fd" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" -"checksum cc 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)" = "ce400c638d48ee0e9ab75aef7997609ec57367ccfe1463f21bf53c3eca67bf46" +"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be" "checksum cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fa24eb00d5ffab90eaeaf1092ac85c04c64aaf358ea6f84505b8116d24c6af" "checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853" @@ -456,37 +477,40 @@ dependencies = [ "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" "checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" "checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" -"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" -"checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum libc 0.2.60 (registry+https://github.com/rust-lang/crates.io-index)" = "d44e80633f007889c7eff624b709ab43c92d708caad982295768a7b13ca3b5eb" +"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f" +"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum nvpair-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5fc4cc751960db1094a7a732dd0706927aeae9194bf66c30fa227b70fc62b6c8" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -"checksum pkg-config 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c1d2cfa5a714db3b5f24f0915e74fcdf91d09d496ba61329705dda7774d2af" +"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +"checksum proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e98a83a9f9b331f54b924e68a66acb1bb35cb01fb0a23645139967abefb697e8" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -"checksum regex 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88c3d9193984285d544df4a30c23a4e62ead42edf70a4452ceb76dac1ce05c26" -"checksum regex-syntax 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "b143cceb2ca5e56d5671988ef8b15615733e7ee16cd348e064333b251b89343f" -"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" -"checksum serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5626ac617da2f2d9c48af5515a21d5a480dbd151e01bb1c355e26a3e68113" -"checksum serde_derive 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)" = "01e69e1b8a631f245467ee275b8c757b818653c6d704cdbcaeb56b56767b529c" +"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe" +"checksum regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc220bd33bdce8f093101afe22a037b8eb0e5af33592e6a9caafff0d4cb81cbd" +"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716" +"checksum rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +"checksum serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "f4473e8506b213730ff2061073b48fa51dcc66349219e2e7c5608f0296a1d95a" +"checksum serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "11e410fde43e157d789fc290d26bc940778ad0fdd47836426fbac36573710dbb" "checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum syn 0.15.42 (registry+https://github.com/rust-lang/crates.io-index)" = "eadc09306ca51a40555dd6fc2b415538e9e18bc9f870e47b1a524a79fe2dcf5e" +"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" "checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" "checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" -"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" +"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" diff --git a/libzfs-sys/Cargo.toml b/libzfs-sys/Cargo.toml index 793404c..53764d3 100644 --- a/libzfs-sys/Cargo.toml +++ b/libzfs-sys/Cargo.toml @@ -13,4 +13,4 @@ nvpair-sys = "0.1" [build-dependencies] bindgen = "0.51.0" -pkg-config = "0.3.15" +pkg-config = "0.3.16" diff --git a/libzfs-sys/build.rs b/libzfs-sys/build.rs index b9e976b..2f95d76 100644 --- a/libzfs-sys/build.rs +++ b/libzfs-sys/build.rs @@ -17,7 +17,7 @@ fn main() { env::set_var("LIBCLANG_PATH", "/opt/llvm-5.0.0/lib64/"); pkg_config::Config::new() - .atleast_version("0.7.13") + .atleast_version("0.8.0") .probe("libzfs") .unwrap(); println!("cargo:rustc-link-lib=zpool"); @@ -74,8 +74,6 @@ fn main() { .blacklist_type("nvlist") .whitelist_function("libzfs_init") .whitelist_function("libzfs_fini") - .whitelist_function("thread_init") - .whitelist_function("thread_fini") .whitelist_function("zpool_import") .whitelist_function("zpool_export") .whitelist_function("zpool_search_import") @@ -106,8 +104,9 @@ fn main() { .whitelist_function("zfs_validate_name") .whitelist_function("zprop_free_list") .clang_arg("-I/usr/lib/gcc/x86_64-redhat-linux/4.8.2/include/") - .clang_arg("-I/usr/src/zfs-0.7.13/lib/libspl/include/") - .clang_arg("-I/usr/src/zfs-0.7.13/include/") + .clang_arg("-I/usr/include/libspl/") + .clang_arg("-I/usr/src/debug/zfs-0.8.0/include/") + .clang_arg("-I/usr/include/libzfs/") .generate() .expect("Unable to generate bindings"); diff --git a/libzfs-sys/src/bindings.rs b/libzfs-sys/src/bindings.rs index 03b7df7..e5d16a7 100644 --- a/libzfs-sys/src/bindings.rs +++ b/libzfs-sys/src/bindings.rs @@ -1,86 +1,5 @@ /* automatically generated by rust-bindgen */ -#[repr(C)] -#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -pub struct __BindgenBitfieldUnit { - storage: Storage, - align: [Align; 0], -} -impl __BindgenBitfieldUnit { - #[inline] - pub const fn new(storage: Storage) -> Self { - Self { storage, align: [] } - } -} -impl __BindgenBitfieldUnit -where - Storage: AsRef<[u8]> + AsMut<[u8]>, -{ - #[inline] - pub fn get_bit(&self, index: usize) -> bool { - debug_assert!(index / 8 < self.storage.as_ref().len()); - let byte_index = index / 8; - let byte = self.storage.as_ref()[byte_index]; - let bit_index = if cfg!(target_endian = "big") { - 7 - (index % 8) - } else { - index % 8 - }; - let mask = 1 << bit_index; - byte & mask == mask - } - #[inline] - pub fn set_bit(&mut self, index: usize, val: bool) { - debug_assert!(index / 8 < self.storage.as_ref().len()); - let byte_index = index / 8; - let byte = &mut self.storage.as_mut()[byte_index]; - let bit_index = if cfg!(target_endian = "big") { - 7 - (index % 8) - } else { - index % 8 - }; - let mask = 1 << bit_index; - if val { - *byte |= mask; - } else { - *byte &= !mask; - } - } - #[inline] - pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 { - debug_assert!(bit_width <= 64); - debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); - let mut val = 0; - for i in 0..(bit_width as usize) { - if self.get_bit(i + bit_offset) { - let index = if cfg!(target_endian = "big") { - bit_width as usize - 1 - i - } else { - i - }; - val |= 1 << index; - } - } - val - } - #[inline] - pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) { - debug_assert!(bit_width <= 64); - debug_assert!(bit_offset / 8 < self.storage.as_ref().len()); - debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len()); - for i in 0..(bit_width as usize) { - let mask = 1 << i; - let val_bit_is_set = val & mask == mask; - let index = if cfg!(target_endian = "big") { - bit_width as usize - 1 - i - } else { - i - }; - self.set_bit(index + bit_offset, val_bit_is_set); - } - } -} pub const ZFS_MAX_DATASET_NAME_LEN: u32 = 256; pub const ZPROP_VALUE: &'static [u8; 6usize] = b"value\0"; pub const ZPOOL_CONFIG_POOL_NAME: &'static [u8; 5usize] = b"name\0"; @@ -112,12 +31,9 @@ pub const VDEV_TYPE_LOG: &'static [u8; 4usize] = b"log\0"; pub const VDEV_TYPE_L2CACHE: &'static [u8; 8usize] = b"l2cache\0"; pub const ZFS_MAXPROPLEN: u32 = 4096; pub const ZPOOL_MAXPROPLEN: u32 = 4096; -pub mod boolean { - pub type Type = u32; - pub const B_FALSE: Type = 0; - pub const B_TRUE: Type = 1; -} -pub use self::boolean::Type as boolean_t; +pub const boolean_t_B_FALSE: boolean_t = 0; +pub const boolean_t_B_TRUE: boolean_t = 1; +pub type boolean_t = u32; pub type longlong_t = ::std::os::raw::c_longlong; pub type diskaddr_t = longlong_t; pub type hrtime_t = ::std::os::raw::c_longlong; @@ -174,7 +90,8 @@ pub const dmu_objset_type_DMU_OST_ANY: dmu_objset_type = 5; pub const dmu_objset_type_DMU_OST_NUMTYPES: dmu_objset_type = 6; pub type dmu_objset_type = u32; pub use self::dmu_objset_type as dmu_objset_type_t; -pub const zfs_prop_t_ZFS_PROP_BAD: zfs_prop_t = -1; +pub const zfs_prop_t_ZPROP_CONT: zfs_prop_t = -2; +pub const zfs_prop_t_ZPROP_INVAL: zfs_prop_t = -1; pub const zfs_prop_t_ZFS_PROP_TYPE: zfs_prop_t = 0; pub const zfs_prop_t_ZFS_PROP_CREATION: zfs_prop_t = 1; pub const zfs_prop_t_ZFS_PROP_USED: zfs_prop_t = 2; @@ -257,10 +174,22 @@ pub const zfs_prop_t_ZFS_PROP_REDUNDANT_METADATA: zfs_prop_t = 78; pub const zfs_prop_t_ZFS_PROP_OVERLAY: zfs_prop_t = 79; pub const zfs_prop_t_ZFS_PROP_PREV_SNAP: zfs_prop_t = 80; pub const zfs_prop_t_ZFS_PROP_RECEIVE_RESUME_TOKEN: zfs_prop_t = 81; -pub const zfs_prop_t_ZFS_NUM_PROPS: zfs_prop_t = 82; +pub const zfs_prop_t_ZFS_PROP_ENCRYPTION: zfs_prop_t = 82; +pub const zfs_prop_t_ZFS_PROP_KEYLOCATION: zfs_prop_t = 83; +pub const zfs_prop_t_ZFS_PROP_KEYFORMAT: zfs_prop_t = 84; +pub const zfs_prop_t_ZFS_PROP_PBKDF2_SALT: zfs_prop_t = 85; +pub const zfs_prop_t_ZFS_PROP_PBKDF2_ITERS: zfs_prop_t = 86; +pub const zfs_prop_t_ZFS_PROP_ENCRYPTION_ROOT: zfs_prop_t = 87; +pub const zfs_prop_t_ZFS_PROP_KEY_GUID: zfs_prop_t = 88; +pub const zfs_prop_t_ZFS_PROP_KEYSTATUS: zfs_prop_t = 89; +pub const zfs_prop_t_ZFS_PROP_REMAPTXG: zfs_prop_t = 90; +pub const zfs_prop_t_ZFS_PROP_SPECIAL_SMALL_BLOCKS: zfs_prop_t = 91; +pub const zfs_prop_t_ZFS_PROP_IVSET_GUID: zfs_prop_t = 92; +pub const zfs_prop_t_ZFS_NUM_PROPS: zfs_prop_t = 93; pub type zfs_prop_t = i32; pub mod zpool_prop_t { - pub type Type = u32; + pub type Type = i32; + pub const ZPOOL_PROP_INVAL: Type = -1; pub const ZPOOL_PROP_NAME: Type = 0; pub const ZPOOL_PROP_SIZE: Type = 1; pub const ZPOOL_PROP_CAPACITY: Type = 2; @@ -290,7 +219,10 @@ pub mod zpool_prop_t { pub const ZPOOL_PROP_TNAME: Type = 26; pub const ZPOOL_PROP_MAXDNODESIZE: Type = 27; pub const ZPOOL_PROP_MULTIHOST: Type = 28; - pub const ZPOOL_NUM_PROPS: Type = 29; + pub const ZPOOL_PROP_CHECKPOINT: Type = 29; + pub const ZPOOL_PROP_LOAD_GUID: Type = 30; + pub const ZPOOL_PROP_AUTOTRIM: Type = 31; + pub const ZPOOL_NUM_PROPS: Type = 32; } pub const zprop_source_t_ZPROP_SRC_NONE: zprop_source_t = 1; pub const zprop_source_t_ZPROP_SRC_DEFAULT: zprop_source_t = 2; @@ -331,6 +263,7 @@ pub const vdev_aux_VDEV_AUX_SPLIT_POOL: vdev_aux = 15; pub const vdev_aux_VDEV_AUX_BAD_ASHIFT: vdev_aux = 16; pub const vdev_aux_VDEV_AUX_EXTERNAL_PERSIST: vdev_aux = 17; pub const vdev_aux_VDEV_AUX_ACTIVE: vdev_aux = 18; +pub const vdev_aux_VDEV_AUX_CHILDREN_OFFLINE: vdev_aux = 19; pub type vdev_aux = u32; pub use self::vdev_aux as vdev_aux_t; pub mod pool_state { @@ -345,6 +278,7 @@ pub mod pool_state { pub const POOL_STATE_POTENTIALLY_ACTIVE: Type = 7; } pub use self::pool_state::Type as pool_state_t; + #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct vdev_stat { @@ -361,16 +295,31 @@ pub struct vdev_stat { pub vs_read_errors: u64, pub vs_write_errors: u64, pub vs_checksum_errors: u64, + pub vs_initialize_errors: u64, pub vs_self_healed: u64, pub vs_scan_removing: u64, pub vs_scan_processed: u64, pub vs_fragmentation: u64, + pub vs_initialize_bytes_done: u64, + pub vs_initialize_bytes_est: u64, + pub vs_initialize_state: u64, + pub vs_initialize_action_time: u64, + pub vs_checkpoint_space: u64, + pub vs_resilver_deferred: u64, + pub vs_slow_ios: u64, + pub vs_trim_errors: u64, + pub vs_trim_notsup: u64, + pub vs_trim_bytes_done: u64, + pub vs_trim_bytes_est: u64, + pub vs_trim_state: u64, + pub vs_trim_action_time: u64, } + #[test] fn bindgen_test_layout_vdev_stat() { assert_eq!( ::std::mem::size_of::(), - 216usize, + 328usize, concat!("Size of: ", stringify!(vdev_stat)) ); assert_eq!( @@ -509,8 +458,18 @@ fn bindgen_test_layout_vdev_stat() { ) ); assert_eq!( - unsafe { &(*(::std::ptr::null::())).vs_self_healed as *const _ as usize }, + unsafe { &(*(::std::ptr::null::())).vs_initialize_errors as *const _ as usize }, 184usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_initialize_errors) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_self_healed as *const _ as usize }, + 192usize, concat!( "Offset of field: ", stringify!(vdev_stat), @@ -520,7 +479,7 @@ fn bindgen_test_layout_vdev_stat() { ); assert_eq!( unsafe { &(*(::std::ptr::null::())).vs_scan_removing as *const _ as usize }, - 192usize, + 200usize, concat!( "Offset of field: ", stringify!(vdev_stat), @@ -530,7 +489,7 @@ fn bindgen_test_layout_vdev_stat() { ); assert_eq!( unsafe { &(*(::std::ptr::null::())).vs_scan_processed as *const _ as usize }, - 200usize, + 208usize, concat!( "Offset of field: ", stringify!(vdev_stat), @@ -540,7 +499,7 @@ fn bindgen_test_layout_vdev_stat() { ); assert_eq!( unsafe { &(*(::std::ptr::null::())).vs_fragmentation as *const _ as usize }, - 208usize, + 216usize, concat!( "Offset of field: ", stringify!(vdev_stat), @@ -548,14 +507,144 @@ fn bindgen_test_layout_vdev_stat() { stringify!(vs_fragmentation) ) ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vs_initialize_bytes_done as *const _ as usize + }, + 224usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_initialize_bytes_done) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vs_initialize_bytes_est as *const _ as usize + }, + 232usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_initialize_bytes_est) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_initialize_state as *const _ as usize }, + 240usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_initialize_state) + ) + ); + assert_eq!( + unsafe { + &(*(::std::ptr::null::())).vs_initialize_action_time as *const _ as usize + }, + 248usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_initialize_action_time) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_checkpoint_space as *const _ as usize }, + 256usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_checkpoint_space) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_resilver_deferred as *const _ as usize }, + 264usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_resilver_deferred) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_slow_ios as *const _ as usize }, + 272usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_slow_ios) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_errors as *const _ as usize }, + 280usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_errors) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_notsup as *const _ as usize }, + 288usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_notsup) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_bytes_done as *const _ as usize }, + 296usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_bytes_done) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_bytes_est as *const _ as usize }, + 304usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_bytes_est) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_state as *const _ as usize }, + 312usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_state) + ) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).vs_trim_action_time as *const _ as usize }, + 320usize, + concat!( + "Offset of field: ", + stringify!(vdev_stat), + "::", + stringify!(vs_trim_action_time) + ) + ); } pub type vdev_stat_t = vdev_stat; -extern "C" { - pub fn thread_init(); -} -extern "C" { - pub fn thread_fini(); -} #[repr(C)] #[derive(Copy, Clone)] pub struct dmu_objset_stats { @@ -659,7 +748,7 @@ fn bindgen_test_layout_dmu_objset_stats() { pub type dmu_objset_stats_t = dmu_objset_stats; pub type zfs_handle_t = zfs_handle; pub type zpool_handle_t = zpool_handle; -pub type libzfs_handle_t = [u64; 305usize]; +pub type libzfs_handle_t = [u64; 310usize]; extern "C" { pub fn libzfs_init() -> *mut libzfs_handle_t; } @@ -688,8 +777,10 @@ extern "C" { pub fn zpool_get_state(arg1: *mut zpool_handle_t) -> ::std::os::raw::c_int; } extern "C" { - pub fn zpool_state_to_name(arg1: vdev_state_t, arg2: vdev_aux_t) - -> *mut ::std::os::raw::c_char; + pub fn zpool_state_to_name( + arg1: vdev_state_t, + arg2: vdev_aux_t, + ) -> *const ::std::os::raw::c_char; } extern "C" { pub fn zpool_pool_state_to_name(arg1: pool_state_t) -> *const ::std::os::raw::c_char; @@ -742,160 +833,6 @@ extern "C" { altroot: *mut ::std::os::raw::c_char, ) -> ::std::os::raw::c_int; } -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct importargs { - pub path: *mut *mut ::std::os::raw::c_char, - pub paths: ::std::os::raw::c_int, - pub poolname: *mut ::std::os::raw::c_char, - pub guid: u64, - pub cachefile: *mut ::std::os::raw::c_char, - pub _bitfield_1: __BindgenBitfieldUnit<[u8; 1usize], u8>, - pub __bindgen_padding_0: [u8; 7usize], -} -#[test] -fn bindgen_test_layout_importargs() { - assert_eq!( - ::std::mem::size_of::(), - 48usize, - concat!("Size of: ", stringify!(importargs)) - ); - assert_eq!( - ::std::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(importargs)) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).path as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(importargs), - "::", - stringify!(path) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).paths as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(importargs), - "::", - stringify!(paths) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).poolname as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(importargs), - "::", - stringify!(poolname) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).guid as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(importargs), - "::", - stringify!(guid) - ) - ); - assert_eq!( - unsafe { &(*(::std::ptr::null::())).cachefile as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(importargs), - "::", - stringify!(cachefile) - ) - ); -} -impl importargs { - #[inline] - pub fn can_be_active(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(0usize, 1u8) as u32) } - } - #[inline] - pub fn set_can_be_active(&mut self, val: ::std::os::raw::c_int) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(0usize, 1u8, val as u64) - } - } - #[inline] - pub fn unique(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(1usize, 1u8) as u32) } - } - #[inline] - pub fn set_unique(&mut self, val: ::std::os::raw::c_int) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(1usize, 1u8, val as u64) - } - } - #[inline] - pub fn exists(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(2usize, 1u8) as u32) } - } - #[inline] - pub fn set_exists(&mut self, val: ::std::os::raw::c_int) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(2usize, 1u8, val as u64) - } - } - #[inline] - pub fn scan(&self) -> ::std::os::raw::c_int { - unsafe { ::std::mem::transmute(self._bitfield_1.get(3usize, 1u8) as u32) } - } - #[inline] - pub fn set_scan(&mut self, val: ::std::os::raw::c_int) { - unsafe { - let val: u32 = ::std::mem::transmute(val); - self._bitfield_1.set(3usize, 1u8, val as u64) - } - } - #[inline] - pub fn new_bitfield_1( - can_be_active: ::std::os::raw::c_int, - unique: ::std::os::raw::c_int, - exists: ::std::os::raw::c_int, - scan: ::std::os::raw::c_int, - ) -> __BindgenBitfieldUnit<[u8; 1usize], u8> { - let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 1usize], u8> = - Default::default(); - __bindgen_bitfield_unit.set(0usize, 1u8, { - let can_be_active: u32 = unsafe { ::std::mem::transmute(can_be_active) }; - can_be_active as u64 - }); - __bindgen_bitfield_unit.set(1usize, 1u8, { - let unique: u32 = unsafe { ::std::mem::transmute(unique) }; - unique as u64 - }); - __bindgen_bitfield_unit.set(2usize, 1u8, { - let exists: u32 = unsafe { ::std::mem::transmute(exists) }; - exists as u64 - }); - __bindgen_bitfield_unit.set(3usize, 1u8, { - let scan: u32 = unsafe { ::std::mem::transmute(scan) }; - scan as u64 - }); - __bindgen_bitfield_unit - } -} -pub type importargs_t = importargs; -extern "C" { - pub fn zpool_search_import( - arg1: *mut libzfs_handle_t, - arg2: *mut importargs_t, - ) -> *mut nvlist_t; -} extern "C" { pub fn zfs_open( arg1: *mut libzfs_handle_t, @@ -938,6 +875,7 @@ pub struct zprop_list { pub pl_recvd_width: usize, pub pl_fixed: boolean_t, } + #[test] fn bindgen_test_layout_zprop_list() { assert_eq!( diff --git a/libzfs-sys/src/lib.rs b/libzfs-sys/src/lib.rs index cccf7ce..3c3cca2 100644 --- a/libzfs-sys/src/lib.rs +++ b/libzfs-sys/src/lib.rs @@ -215,12 +215,9 @@ mod tests { } let (nvl, nvp) = unsafe { - thread_init(); - let mut args = import_args(); let nvl = zpool_search_import(h, &mut args as *mut importargs); - thread_fini(); let nvp = nvlist_next_nvpair(nvl, ptr::null_mut()); diff --git a/libzfs-sys/wrapper.h b/libzfs-sys/wrapper.h index afbcb2a..3770e94 100644 --- a/libzfs-sys/wrapper.h +++ b/libzfs-sys/wrapper.h @@ -4,4 +4,5 @@ #define _LARGEFILE64_SOURCE +#include #include diff --git a/libzfs-types/src/lib.rs b/libzfs-types/src/lib.rs index 6dd172a..2b8e9aa 100644 --- a/libzfs-types/src/lib.rs +++ b/libzfs-types/src/lib.rs @@ -42,7 +42,7 @@ impl fmt::Display for LibZfsError { } impl error::Error for LibZfsError { - fn cause(&self) -> Option<&error::Error> { + fn cause(&self) -> Option<&dyn error::Error> { match *self { LibZfsError::Io(ref err) => Some(err), LibZfsError::IntoString(ref err) => Some(err), diff --git a/libzfs/Cargo.toml b/libzfs/Cargo.toml index 4c26f9d..1cc95de 100644 --- a/libzfs/Cargo.toml +++ b/libzfs/Cargo.toml @@ -13,4 +13,4 @@ serde = "1.0" serde_derive = "1.0" foreign-types = "0.3" cstr-argument = "0.1" -lazy_static = "1.3" +lazy_static = "1.4" diff --git a/libzfs/src/libzfs.rs b/libzfs/src/libzfs.rs index fc7421a..d763aec 100644 --- a/libzfs/src/libzfs.rs +++ b/libzfs/src/libzfs.rs @@ -66,11 +66,9 @@ impl Libzfs { pub fn find_importable_pools(&mut self) -> nvpair::NvList { let _l = LOCK.lock().unwrap(); unsafe { - sys::thread_init(); let mut args = sys::import_args(); let x = sys::zpool_search_import(self.raw, &mut args as *mut sys::importargs); - sys::thread_fini(); nvpair::NvList::from_ptr(x) }