1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556(*
* Copyright (C) Citrix Systems Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.md.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)openCtypesmoduleTypes=Bindings_structs_lib.Bindings_structs.Make(Generated_types)moduleMake(F:Cstubs.FOREIGN)=structopenFopenPosixTypestypedlm_lshandle_t=unitptrletdlm_lshandle_t:dlm_lshandle_ttyp=ptrvoidletdlm_lshandle_t_opt:dlm_lshandle_toptiontyp=ptr_optvoid(* always use [ptr_opt ...] to check for NULL return values,
and take [ptr ...] as arguments to ensure non-NULL *)letdlm_create_lockspace=foreign"dlm_create_lockspace"(string@->mode_t@->returningdlm_lshandle_t_opt)(* let dlm_new_lockspace = foreign "dlm_new_lockspace"
(string @-> mode_t @-> uint32_t @-> returning dlm_lshandle_t)*)letdlm_open_lockspace=foreign"dlm_open_lockspace"(string@->returningdlm_lshandle_t_opt)letdlm_ls_pthread_init=foreign"dlm_ls_pthread_init"(dlm_lshandle_t@->returningint)letdlm_release_lockspace=foreign"dlm_release_lockspace"(string@->dlm_lshandle_t@->int@->returningint)letdlm_close_lockspace=foreign"dlm_close_lockspace"(dlm_lshandle_t@->returningint)letmode=uint32_tletflags=uint32_tletdlm_lksb=ptrTypes.Dlm_lksb.tletast_cb=ptr_optvoid(* TODO: callback *)letbast_cb=ptr_optvoid(* TODO: callback *)letdlm_ls_lockx=foreign"dlm_ls_lockx"(dlm_lshandle_t@->mode@->dlm_lksb@->flags@->string@->uint@->uint32_t@->ast_cb@->ptr_optvoid@->bast_cb@->ptr_optuint64_t@->ptr_optuint64_t@->returningint)letdlm_ls_unlock_wait=foreign"dlm_ls_unlock_wait"(dlm_lshandle_t@->uint32_t@->uint32_t@->dlm_lksb@->returningint)end