text
stringlengths
12
786k
let partition_offset proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_PartitionOffset proxy
let partition_size proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_PartitionSize proxy
let partition_alignment_offset proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_PartitionAlignmentOffset proxy
let partition_table_scheme proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_PartitionTableScheme proxy
let partition_table_count proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_PartitionTableCount proxy )
let drive_vendor proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveVendor proxy
let drive_model proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveModel proxy
let drive_revision proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveRevision proxy
let drive_serial proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveSerial proxy
let drive_wwn proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveWwn proxy
let drive_rotation_rate proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveRotationRate proxy )
let drive_write_cache proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveWriteCache proxy
let drive_connection_interface proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveConnectionInterface proxy
let drive_connection_speed proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveConnectionSpeed proxy
let drive_media_compatibility proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveMediaCompatibility proxy
let drive_media proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveMedia proxy
let drive_is_media_ejectable proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveIsMediaEjectable proxy
let drive_can_detach proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveCanDetach proxy
let drive_can_spindown proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveCanSpindown proxy
let drive_is_rotational proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveIsRotational proxy
let drive_adapter proxy = OBus_property . map_r_with_context ( fun context x -> UDisks_adapter . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) x ) ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveAdapter proxy )
let drive_ports proxy = OBus_property . map_r_with_context ( fun context x -> List . map ( fun path -> UDisks_port . of_proxy ( OBus_proxy . make ( OBus_context . sender context ) path ) ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_DrivePorts proxy )
let drive_similar_devices proxy = OBus_property . map_r_with_context ( fun context x -> List . map ( fun path -> OBus_proxy . make ( OBus_context . sender context ) path ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveSimilarDevices proxy )
let optical_disc_is_blank proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscIsBlank proxy
let optical_disc_is_appendable proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscIsAppendable proxy
let optical_disc_is_closed proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscIsClosed proxy
let optical_disc_num_tracks proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscNumTracks proxy )
let optical_disc_num_audio_tracks proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscNumAudioTracks proxy )
let optical_disc_num_sessions proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_OpticalDiscNumSessions proxy )
let drive_ata_smart_is_available proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveAtaSmartIsAvailable proxy
let drive_ata_smart_time_collected proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveAtaSmartTimeCollected proxy
let drive_ata_smart_status proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveAtaSmartStatus proxy
let drive_ata_smart_blob proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_DriveAtaSmartBlob proxy
let linux_md_component_level proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentLevel proxy
let linux_md_component_position proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentPosition proxy )
let linux_md_component_num_raid_devices proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentNumRaidDevices proxy )
let linux_md_component_uuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentUuid proxy
let linux_md_component_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentName proxy
let linux_md_component_home_host proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentHomeHost proxy
let linux_md_component_version proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentVersion proxy
let linux_md_component_holder proxy = OBus_property . map_r_with_context ( fun context x -> OBus_proxy . make ( OBus_context . sender context ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentHolder proxy )
let linux_md_component_state proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdComponentState proxy
let linux_md_state proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdState proxy
let linux_md_level proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdLevel proxy
let linux_md_uuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdUuid proxy
let linux_md_home_host proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdHomeHost proxy
let linux_md_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdName proxy
let linux_md_num_raid_devices proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdNumRaidDevices proxy )
let linux_md_version proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdVersion proxy
let linux_md_slaves proxy = OBus_property . map_r_with_context ( fun context x -> List . map ( fun path -> OBus_proxy . make ( OBus_context . sender context ) path ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdSlaves proxy )
let linux_md_is_degraded proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdIsDegraded proxy
let linux_md_sync_action proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdSyncAction proxy
let linux_md_sync_percentage proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdSyncPercentage proxy
let linux_md_sync_speed proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxMdSyncSpeed proxy
let linux_lvm2_pvuuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVUuid proxy
let linux_lvm2_pvnum_metadata_areas proxy = OBus_property . map_r ( fun x -> Int32 . to_int x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVNumMetadataAreas proxy )
let linux_lvm2_pvgroup_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupName proxy
let linux_lvm2_pvgroup_uuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupUuid proxy
let linux_lvm2_pvgroup_size proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupSize proxy
let linux_lvm2_pvgroup_unallocated_size proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupUnallocatedSize proxy
let linux_lvm2_pvgroup_sequence_number proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupSequenceNumber proxy
let linux_lvm2_pvgroup_extent_size proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupExtentSize proxy
let linux_lvm2_pvgroup_physical_volumes proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupPhysicalVolumes proxy
let linux_lvm2_pvgroup_logical_volumes proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2PVGroupLogicalVolumes proxy
let linux_lvm2_lvname proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVName proxy
let linux_lvm2_lvuuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVUuid proxy
let linux_lvm2_lvgroup_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVGroupName proxy
let linux_lvm2_lvgroup_uuid proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLvm2LVGroupUuid proxy
let linux_dmmp_component_holder proxy = OBus_property . map_r_with_context ( fun context x -> OBus_proxy . make ( OBus_context . sender context ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpComponentHolder proxy )
let linux_dmmp_name proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpName proxy
let linux_dmmp_slaves proxy = OBus_property . map_r_with_context ( fun context x -> List . map ( fun path -> OBus_proxy . make ( OBus_context . sender context ) path ) x ) ( OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpSlaves proxy )
let linux_dmmp_parameters proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxDmmpParameters proxy
let linux_loop_filename proxy = OBus_property . make ~ monitor : UDisks_monitor . monitor p_LinuxLoopFilename proxy
let properties proxy = OBus_property . group ~ monitor : UDisks_monitor . monitor proxy interface
module type S = sig module M : Monads . State_sig type key = int val add : key -> unit M . t val find : key -> key M . t val union : key -> key -> key M . t val show : string M . t end
module UF : S = struct type node = T of { rank : int } | Ptr of key and key = int module S = Stores . Map ( Int_map ) ( struct type key = int type value = node let key_to_string = string_of_int let value_to_string ( x : value ) = match x with | T { rank } -> Printf . sprintf " [ % d ] " rank | Ptr k -> Printf . sprintf " ptr ( % d ) " k end ) module M = Monads . Make_state_monad ( S ) let add ( k : key ) = let open M in set k ( T { rank = 1 } ) let rec get_root ( k : key ) ( acc : key list ) = let open M in get k >>= function | None -> let msg = Printf . sprintf " UF . get_root : invalid key % d " k in Stdlib . failwith msg | Some ( T { rank } ) -> let ptr_to_root = Ptr k in iter_list ( fun key -> set key ptr_to_root ) acc >>= fun ( ) -> return ( k , rank ) | Some ( Ptr k ' ) -> get_root k ' ( k :: acc ) let find ( k : key ) = let open M in get_root k [ ] >>= fun ( res , _ ) -> return res let union k1 k2 = let open M in get_root k1 [ ] >>= fun ( k1 , rank1 ) -> get_root k2 [ ] >>= fun ( k2 , rank2 ) -> if k1 = k2 then return k1 else if rank1 < rank2 then set k1 ( Ptr k2 ) >>= fun ( ) -> return k2 else if rank1 > rank2 then set k2 ( Ptr k1 ) >>= fun ( ) -> return k1 else let new_root = T { rank = rank1 + 1 } in set k2 ( Ptr k1 ) >>= fun ( ) -> set k1 new_root >>= fun ( ) -> return k1 let show s = ( S . to_string s , s ) end
module type Str_conv_sig = sig module type UintSig = sig type t val name : string val fmt : string val zero : t val max_int : t val bits : int val of_int : int -> t val to_int : t -> int val add : t -> t -> t val mul : t -> t -> t val divmod : t -> t -> t * t end module type S = sig type t val of_string : string -> t val to_string : t -> string val to_string_bin : t -> string val to_string_oct : t -> string val to_string_hex : t -> string val printer : Format . formatter -> t -> unit val printer_bin : Format . formatter -> t -> unit val printer_oct : Format . formatter -> t -> unit val printer_hex : Format . formatter -> t -> unit end module Make ( U : UintSig ) : S with type t = U . t end
module Str_conv : Str_conv_sig = struct module type UintSig = sig type t val name : string val fmt : string val zero : t val max_int : t val bits : int val of_int : int -> t val to_int : t -> int val add : t -> t -> t val mul : t -> t -> t val divmod : t -> t -> t * t end module type S = sig type t val of_string : string -> t val to_string : t -> string val to_string_bin : t -> string val to_string_oct : t -> string val to_string_hex : t -> string val printer : Format . formatter -> t -> unit val printer_bin : Format . formatter -> t -> unit val printer_oct : Format . formatter -> t -> unit val printer_hex : Format . formatter -> t -> unit end module Make ( U : UintSig ) : S with type t = U . t = struct type t = U . t let digit_of_char c = let disp = if c >= ' 0 ' && c <= ' 9 ' then 48 else if c >= ' A ' && c <= ' F ' then 55 else if c >= ' a ' && c <= ' f ' then 87 else failwith ( U . name ^ " . of_string " ) in int_of_char c - disp let of_string ' s base = let base = U . of_int base in let res = ref U . zero in let thresh = fst ( U . divmod U . max_int base ) in for i = 0 to String . length s - 1 do let c = s . [ i ] in if ! res > thresh then failwith ( U . name ^ " . of_string " ) ; if c <> ' _ ' then begin let d = U . of_int ( digit_of_char c ) in res := U . add ( U . mul ! res base ) d ; if ! res < d then failwith ( U . name ^ " . of_string " ) ; end done ; ! res let of_string s = let fail = U . name ^ " . of_string " in let len = String . length s in match len with | 0 -> invalid_arg fail | 1 | 2 -> of_string ' s 10 | _ -> if s . [ 0 ] = ' 0 ' && ( s . [ 1 ] < ' 0 ' || s . [ 1 ] > ' 9 ' ) then let base = match s . [ 1 ] with | ' b ' | ' B ' -> 2 | ' o ' | ' O ' -> 8 | ' x ' | ' X ' -> 16 | _ -> invalid_arg fail in of_string ' ( String . sub s 2 ( len - 2 ) ) base else of_string ' s 10 let to_string_base base prefix x = let y = ref x in if ! y = U . zero then " 0 " else begin let buffer = Bytes . create U . bits in let conv = " 0123456789abcdef " in let base = U . of_int base in let i = ref ( Bytes . length buffer ) in while ! y <> U . zero do let x ' , digit = U . divmod ! y base in y := x ' ; decr i ; Bytes . set buffer ! i conv . [ U . to_int digit ] done ; prefix ^ Bytes . sub_string buffer ! i ( Bytes . length buffer - ! i ) end let to_string = to_string_base 10 " " let to_string_bin = to_string_base 2 " 0b " let to_string_oct = to_string_base 8 " 0o " let to_string_hex = to_string_base 16 " 0x " let print_with f fmt x = Format . fprintf fmt " [ @% s ] " @ ( f x ^ U . fmt ) let printer = print_with to_string let printer_bin = print_with to_string_bin let printer_oct = print_with to_string_oct let printer_hex = print_with to_string_hex end end
module Conv = Uint . Str_conv . Make ( struct type t = uint16 let fmt = " Ul " let name = " Uint16 " let zero = zero let max_int = max_int let bits = 16 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
module Conv = Uint . Str_conv . Make ( struct type t = uint32 let fmt = " Ul " let name = " Uint32 " let zero = zero let max_int = max_int let bits = 32 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
module Conv = Uint . Str_conv . Make ( struct type t = uint64 let name = " Uint64 " let fmt = " UL " let zero = zero let max_int = max_int let bits = 64 let of_int = of_int let to_int = to_int let add = add let mul = mul let divmod = ( fun x y -> div x y , rem x y ) end )
let to_signed c = let c = Char . code c in if ( c > 127 ) then ( ( - lnot c + 1 ) land 255 ) else c
let zero = Char . unsafe_chr 0
let one = Char . unsafe_chr 1
let add x y = ( code x + code y ) land max_int |> chr
let sub x y = ( code x - code y ) land max_int |> chr
let mul x y = ( code x * code y ) land max_int |> chr
let div x y = code x / code y |> chr
let rem x y = code x mod code y |> chr
let pred x = sub x one
let succ x = add x one
module Infix = struct let ( * ) = mul let ( + ) = add let ( - ) = sub let ( / ) = div let ( mod ) = rem end
let ( lsl ) x y = ( code x lsl code y ) land max_int |> chr
let ( lsr ) x y = code x lsr code y |> chr
let ( land ) x y = code x land code y |> chr
let ( lor ) x y = code x lor code y |> chr
let ( lxor ) x y = code x lxor code y |> chr
let lnot x = x lxor ( Char . chr max_int )
let swap_nibbles x = ( ( x land ( chr 0x0f ) ) lsl chr 4 ) lor ( ( x land ( Char . chr 0xF0 ) ) lsr ( chr 4 ) )
let is_bit_set x bit = x land ( one lsl ( Char . unsafe_chr bit ) ) != zero