this repo has no description

Fix zfs bindings

-2
shelter.opam
···
]
dev-repo: "git+https://github.com/username/reponame.git"
pin-depends:[
-
[ "zfs.dev" "git+https://github.com/patricoferris/ocaml-zfs" ]
-
[ "void.dev" "git+https://github.com/quantifyearth/void" ]
[ "irmin.dev" "git+https://github.com/mirage/irmin#eio" ]
[ "ppx_irmin.dev" "git+https://github.com/mirage/irmin#eio" ]
[ "irmin-git.dev" "git+https://github.com/mirage/irmin#eio" ]
-2
shelter.opam.template
···
pin-depends:[
-
[ "zfs.dev" "git+https://github.com/patricoferris/ocaml-zfs" ]
-
[ "void.dev" "git+https://github.com/quantifyearth/void" ]
[ "irmin.dev" "git+https://github.com/mirage/irmin#eio" ]
[ "ppx_irmin.dev" "git+https://github.com/mirage/irmin#eio" ]
[ "irmin-git.dev" "git+https://github.com/mirage/irmin#eio" ]
+1 -1
vendor/zfs/src/function_description.ml
···
let is_mounted =
foreign "is_mounted"
-
(Types.libzfs_handle_t @-> string @-> ptr string @-> returning bool)
+
(Types.libzfs_handle_t @-> string @-> ptr (ptr char) @-> returning bool)
let diff =
foreign "zfs_show_diffs"
+9 -5
vendor/zfs/src/zfs.ml
···
let exists handle path (type_ : Types.t) = C.Functions.exists handle path type_
+
let null_string = Ctypes.(coerce (ptr void) (ptr char) null)
+
let is_mounted handle path =
-
let where = Ctypes.allocate Ctypes.string "" in
-
let v = C.Functions.is_mounted handle path where in
-
if not v then None else Some (Ctypes.( !@ ) where)
-
-
let null_string = Ctypes.(coerce (ptr void) (ptr char) null)
+
let where = Ctypes.(coerce (ptr void) (ptr char) null) in
+
let where_ptr = Ctypes.(allocate (ptr char) where) in
+
let v = C.Functions.is_mounted handle path where_ptr in
+
if not v then None else
+
let v = Ctypes.( !@ ) where_ptr in
+
let s = Ctypes.string_from_ptr v ~length:256 in
+
Some s
let mount ?mount_opts ?(mount_flags = 0) dataset =
let res = C.Functions.mount dataset mount_opts mount_flags in