package ceph

  1. Overview
  2. Docs
Bindings to libcephfs

Install

Dune Dependency

Authors

Maintainers

Sources

ceph-20240106.tbz
sha256=b6ca906022f832c5ca72dbdc5b7ff03b131a2f3c65c6e7e2914d4bb557dbe2d2
sha512=243f58f9156608c50d8e42ec87d2362c38bcc2d80e0bdee44514fc1f7a46defc066e1dab16048555175d8e1ab975841bea5eeeaa4b2e270959f9e97778d033e9

doc/src/ceph.stubs/structs_generated.ml.html

Source file structs_generated.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
[@@@warning "-9-27"]
include Ctypes
let lift x = x
open Ctypes_static

let rec field : type t a. t typ -> string -> a typ -> (a, t) field =
  fun s fname ftype -> match s, fname with
  | Struct ({ tag = "ceph_statx"; _} as s'), "stx_btime" ->
    let f = {ftype; fname; foffset = 112} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "ceph_statx"; _} as s'), "stx_mtime" ->
    let f = {ftype; fname; foffset = 96} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "ceph_statx"; _} as s'), "stx_size" ->
    let f = {ftype; fname; foffset = 32} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "ceph_statx"; _} as s'), "stx_mode" ->
    let f = {ftype; fname; foffset = 20} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "timespec"; _} as s'), "tv_nsec" ->
    let f = {ftype; fname; foffset = 8} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "timespec"; _} as s'), "tv_sec" ->
    let f = {ftype; fname; foffset = 0} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "dirent"; _} as s'), "d_name" ->
    let f = {ftype; fname; foffset = 19} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "dirent"; _} as s'), "d_type" ->
    let f = {ftype; fname; foffset = 18} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "dirent"; _} as s'), "d_reclen" ->
    let f = {ftype; fname; foffset = 16} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "dirent"; _} as s'), "d_off" ->
    let f = {ftype; fname; foffset = 8} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | Struct ({ tag = "dirent"; _} as s'), "d_ino" ->
    let f = {ftype; fname; foffset = 0} in 
    (s'.fields <- BoxedField f :: s'.fields; f)
  | View { ty; _ }, _ ->
    let { ftype; foffset; fname } = field ty fname ftype in
    { ftype; foffset; fname }
  | _ -> failwith ("Unexpected field "^ fname)

let rec seal : type a. a typ -> unit = function
  | Struct ({ tag = "ceph_statx"; spec = Incomplete _; _ } as s') ->
    s'.spec <- Complete { size = 136; align = 8 }
  | Struct ({ tag = "timespec"; spec = Incomplete _; _ } as s') ->
    s'.spec <- Complete { size = 16; align = 8 }
  | Struct ({ tag = "dirent"; spec = Incomplete _; _ } as s') ->
    s'.spec <- Complete { size = 280; align = 8 }
  | Struct { tag; spec = Complete _; _ } ->
    raise (ModifyingSealedType tag)
  | Union { utag; uspec = Some _; _ } ->
    raise (ModifyingSealedType utag)
  | View { ty; _ } -> seal ty
  | _ ->
    raise (Unsupported "Sealing a non-structured type")

type 'a const = 'a
let constant (type t) name (t : t typ) : t = match t, name with
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFIFO" ->
    Unsigned.UInt16.of_string "4096"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFCHR" ->
    Unsigned.UInt16.of_string "8192"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFDIR" ->
    Unsigned.UInt16.of_string "16384"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFBLK" ->
    Unsigned.UInt16.of_string "24576"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFREG" ->
    Unsigned.UInt16.of_string "32768"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFLNK" ->
    Unsigned.UInt16.of_string "40960"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFSOCK" ->
    Unsigned.UInt16.of_string "49152"
  | Ctypes_static.Primitive Cstubs_internals.Uint16_t, "S_IFMT" ->
    Unsigned.UInt16.of_string "61440"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_BTIME" ->
    Unsigned.UInt.of_string "2048"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_MTIME" ->
    Unsigned.UInt.of_string "64"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_SIZE" ->
    Unsigned.UInt.of_string "512"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_MODE" ->
    Unsigned.UInt.of_string "1"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_BASIC_STATS" ->
    Unsigned.UInt.of_string "2047"
  | Ctypes_static.Primitive Cstubs_internals.Uint, "CEPH_STATX_ALL_STATS" ->
    Unsigned.UInt.of_string "8191"
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_NOFOLLOW" ->
    131072
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_DIRECTORY" ->
    65536
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_TRUNC" ->
    512
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_EXCL" ->
    128
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_CREAT" ->
    64
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_RDWR" ->
    2
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_WRONLY" ->
    1
  | Ctypes_static.Primitive Cstubs_internals.Int, "O_RDONLY" ->
    0
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_UNKNOWN" ->
    Char.chr (((0) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_SOCK" ->
    Char.chr (((12) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_REG" ->
    Char.chr (((8) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_LNK" ->
    Char.chr (((10) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_FIFO" ->
    Char.chr (((1) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_DIR" ->
    Char.chr (((4) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_CHR" ->
    Char.chr (((2) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Char, "DT_BLK" ->
    Char.chr (((6) + 256) mod 256)
  | Ctypes_static.Primitive Cstubs_internals.Int, "ENOENT" ->
    2
  | Ctypes_static.Primitive Cstubs_internals.Int, "LIBCEPHFS_VER_EXTRA" ->
    2
  | Ctypes_static.Primitive Cstubs_internals.Int, "LIBCEPHFS_VER_MINOR" ->
    0
  | Ctypes_static.Primitive Cstubs_internals.Int, "LIBCEPHFS_VER_MAJOR" ->
    10
  | _, s -> failwith ("unmatched constant: "^ s)

let enum (type a) name ?typedef ?unexpected (alist : (a * int64) list) =
  match name with
  | s ->
    failwith ("unmatched enum: "^ s)
OCaml

Innovation. Community. Security.