···112112113113let exists handle path (type_ : Types.t) = C.Functions.exists handle path type_
114114115115+let null_string = Ctypes.(coerce (ptr void) (ptr char) null)
116116+115117let is_mounted handle path =
116116- let where = Ctypes.allocate Ctypes.string "" in
117117- let v = C.Functions.is_mounted handle path where in
118118- if not v then None else Some (Ctypes.( !@ ) where)
119119-120120-let null_string = Ctypes.(coerce (ptr void) (ptr char) null)
118118+ let where = Ctypes.(coerce (ptr void) (ptr char) null) in
119119+ let where_ptr = Ctypes.(allocate (ptr char) where) in
120120+ let v = C.Functions.is_mounted handle path where_ptr in
121121+ if not v then None else
122122+ let v = Ctypes.( !@ ) where_ptr in
123123+ let s = Ctypes.string_from_ptr v ~length:256 in
124124+ Some s
121125122126let mount ?mount_opts ?(mount_flags = 0) dataset =
123127 let res = C.Functions.mount dataset mount_opts mount_flags in