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
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
// Copyright 2017 LambdaStack All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Portions from Chris Holcombe
// The MIT License (MIT)
//
// Copyright (c) 2015 Chris Holcombe
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#![allow(non_camel_case_types)]
#![allow(unused_imports)]

extern crate libc;

use self::libc::{size_t, ssize_t, time_t, timeval};

bitflags! {
    pub struct AllocFlags: u32 {
        const LIBRADOS_OP_FLAG_EXCL = 1;
        const LIBRADOS_OP_FLAG_FAILOK = 2;
        const LIBRADOS_OP_FLAG_FADVISE_RANDOM = 4;
        const LIBRADOS_OP_FLAG_FADVISE_SEQUENTIAL = 8;
        const LIBRADOS_OP_FLAG_FADVISE_WILLNEED = 16;
        const LIBRADOS_OP_FLAG_FADVISE_DONTNEED = 32;
        const LIBRADOS_OP_FLAG_FADVISE_NOCACHE = 64;
    }
}
impl AllocFlags {
    pub fn clear(&mut self) {
        self.bits = 0; // The `bits` field can be accessed from within the
                       // same module where the `bitflags!` macro was invoked.
    }
}

bitflags! {
    pub struct XattrFlags: u32 {
        const LIBRADOS_CMPXATTR_OP_EQ = 1;
        const LIBRADOS_CMPXATTR_OP_NE = 2;
        const LIBRADOS_CMPXATTR_OP_GT = 3;
        const LIBRADOS_CMPXATTR_OP_GTE = 4;
        const LIBRADOS_CMPXATTR_OP_LT = 5;
        const LIBRADOS_CMPXATTR_OP_LTE = 6;
    }
}
impl XattrFlags {
    pub fn clear(&mut self) {
        self.bits = 0; // The `bits` field can be accessed from within the
                       // same module where the `bitflags!` macro was invoked.
    }
}

// Flags for rados_read_op_operate(), rados_write_op_operate(),
// rados_aio_read_op_operate(), and rados_aio_write_op_operate()
bitflags! {
    pub struct OperationFlags: u32 {
        const LIBRADOS_OPERATION_NOFLAG= 0;
        const LIBRADOS_OPERATION_BALANCE_READS= 1;
        const LIBRADOS_OPERATION_LOCALIZE_READS= 2;
        const LIBRADOS_OPERATION_ORDER_READS_WRITES= 4;
        const LIBRADOS_OPERATION_IGNORE_CACHE= 8;
        const LIBRADOS_OPERATION_SKIPRWLOCKS= 16;
        const LIBRADOS_OPERATION_IGNORE_OVERLAY= 32;
    }
}

impl OperationFlags {
    pub fn clear(&mut self) {
        self.bits = 0; // The `bits` field can be accessed from within the
                       // same module where the `bitflags!` macro was invoked.
    }
}

pub type rados_t = *mut ::std::os::raw::c_void;
pub type rados_config_t = *mut ::std::os::raw::c_void;
pub type rados_ioctx_t = *mut ::std::os::raw::c_void;
pub type rados_list_ctx_t = *mut ::std::os::raw::c_void;
pub type rados_snap_t = u64;
pub type rados_xattrs_iter_t = *mut ::std::os::raw::c_void;
pub type rados_omap_iter_t = *mut ::std::os::raw::c_void;

#[repr(C)]
#[derive(Copy, Debug)]
pub struct Struct_rados_pool_stat_t {
    pub num_bytes: u64,
    pub num_kb: u64,
    pub num_objects: u64,
    pub num_object_clones: u64,
    pub num_object_copies: u64,
    pub num_objects_missing_on_primary: u64,
    pub num_objects_unfound: u64,
    pub num_objects_degraded: u64,
    pub num_rd: u64,
    pub num_rd_kb: u64,
    pub num_wr: u64,
    pub num_wr_kb: u64,
}

impl ::std::clone::Clone for Struct_rados_pool_stat_t {
    fn clone(&self) -> Self {
        *self
    }
}

impl ::std::default::Default for Struct_rados_pool_stat_t {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}

#[repr(C)]
#[derive(Copy, Debug)]
pub struct Struct_rados_cluster_stat_t {
    pub kb: u64,
    pub kb_used: u64,
    pub kb_avail: u64,
    pub num_objects: u64,
}

impl ::std::clone::Clone for Struct_rados_cluster_stat_t {
    fn clone(&self) -> Self {
        *self
    }
}

impl ::std::default::Default for Struct_rados_cluster_stat_t {
    fn default() -> Self {
        unsafe { ::std::mem::zeroed() }
    }
}

pub type rados_write_op_t = *mut ::std::os::raw::c_void;

pub type rados_read_op_t = *mut ::std::os::raw::c_void;

pub type rados_completion_t = *mut ::std::os::raw::c_void;

pub type rados_callback_t = ::std::option::Option<
    extern "C" fn(cb: rados_completion_t, arg: *mut ::std::os::raw::c_void) -> (),
>;

pub type rados_watchcb_t = ::std::option::Option<
    extern "C" fn(opcode: u8, ver: u64, arg: *mut ::std::os::raw::c_void) -> (),
>;

pub type rados_watchcb2_t = ::std::option::Option<
    extern "C" fn(
        arg: *mut ::std::os::raw::c_void,
        notify_id: u64,
        handle: u64,
        notifier_id: u64,
        data: *mut ::std::os::raw::c_void,
        data_len: size_t,
    ) -> (),
>;

pub type rados_watcherrcb_t = ::std::option::Option<
    extern "C" fn(pre: *mut ::std::os::raw::c_void, cookie: u64, err: ::libc::c_int) -> (),
>;

pub type rados_log_callback_t = ::std::option::Option<
    extern "C" fn(
        arg: *mut ::std::os::raw::c_void,
        line: *const ::libc::c_char,
        who: *const ::libc::c_char,
        sec: u64,
        nsec: u64,
        seq: u64,
        level: *const ::libc::c_char,
        msg: *const ::libc::c_char,
    ) -> (),
>;

#[cfg(unix)]
#[link(name = "rados", kind = "dylib")]
extern "C" {
    pub fn rados_version(
        major: *mut ::libc::c_int,
        minor: *mut ::libc::c_int,
        extra: *mut ::libc::c_int,
    ) -> ();

    pub fn rados_create(cluster: *mut rados_t, id: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_create2(
        pcluster: *mut rados_t,
        clustername: *const ::libc::c_char,
        name: *const ::libc::c_char,
        flags: u64,
    ) -> ::libc::c_int;

    pub fn rados_create_with_context(cluster: *mut rados_t, cct: rados_config_t) -> ::libc::c_int;

    pub fn rados_ping_monitor(
        cluster: rados_t,
        mon_id: *const ::libc::c_char,
        outstr: *mut *mut ::libc::c_char,
        outstrlen: *mut size_t,
    ) -> ::libc::c_int;

    pub fn rados_connect(cluster: rados_t) -> ::libc::c_int;

    pub fn rados_shutdown(cluster: rados_t) -> ();

    pub fn rados_conf_read_file(cluster: rados_t, path: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_conf_parse_argv(
        cluster: rados_t,
        argc: ::libc::c_int,
        argv: *mut *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_conf_parse_argv_remainder(
        cluster: rados_t,
        argc: ::libc::c_int,
        argv: *mut *const ::libc::c_char,
        remargv: *mut *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_conf_parse_env(cluster: rados_t, var: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_conf_set(
        cluster: rados_t,
        option: *const ::libc::c_char,
        value: *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_conf_get(
        cluster: rados_t,
        option: *const ::libc::c_char,
        buf: *mut ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_cluster_stat(
        cluster: rados_t,
        result: *mut Struct_rados_cluster_stat_t,
    ) -> ::libc::c_int;

    /// The Ceph documentation states that the return value of 0 means success
    /// but actually a value < 0 is an error and a value > 0 is the length
    /// which should be 36.
    ///
    pub fn rados_cluster_fsid(
        cluster: rados_t,
        buf: *mut ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_wait_for_latest_osdmap(cluster: rados_t) -> ::libc::c_int;

    pub fn rados_pool_list(
        cluster: rados_t,
        buf: *mut ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_cct(cluster: rados_t) -> rados_config_t;

    pub fn rados_get_instance_id(cluster: rados_t) -> u64;

    pub fn rados_ioctx_create(
        cluster: rados_t,
        pool_name: *const ::libc::c_char,
        ioctx: *mut rados_ioctx_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_create2(
        cluster: rados_t,
        pool_id: i64,
        ioctx: *mut rados_ioctx_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_destroy(io: rados_ioctx_t) -> ();

    pub fn rados_ioctx_cct(io: rados_ioctx_t) -> rados_config_t;

    pub fn rados_ioctx_get_cluster(io: rados_ioctx_t) -> rados_t;

    pub fn rados_ioctx_pool_stat(
        io: rados_ioctx_t,
        stats: *mut Struct_rados_pool_stat_t,
    ) -> ::libc::c_int;

    pub fn rados_pool_lookup(cluster: rados_t, pool_name: *const ::libc::c_char) -> i64;

    pub fn rados_pool_reverse_lookup(
        cluster: rados_t,
        id: i64,
        buf: *mut ::libc::c_char,
        maxlen: size_t,
    ) -> ::libc::c_int;

    /// Returns -17 if pool already exists.
    pub fn rados_pool_create(cluster: rados_t, pool_name: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_pool_create_with_auid(
        cluster: rados_t,
        pool_name: *const ::libc::c_char,
        auid: u64,
    ) -> ::libc::c_int;

    pub fn rados_pool_create_with_crush_rule(
        cluster: rados_t,
        pool_name: *const ::libc::c_char,
        crush_rule_num: u8,
    ) -> ::libc::c_int;

    pub fn rados_pool_create_with_all(
        cluster: rados_t,
        pool_name: *const ::libc::c_char,
        auid: u64,
        crush_rule_num: u8,
    ) -> ::libc::c_int;

    pub fn rados_pool_get_base_tier(
        cluster: rados_t,
        pool: i64,
        base_tier: *mut i64,
    ) -> ::libc::c_int;

    pub fn rados_pool_delete(cluster: rados_t, pool_name: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_ioctx_pool_set_auid(io: rados_ioctx_t, auid: u64) -> ::libc::c_int;

    pub fn rados_ioctx_pool_get_auid(io: rados_ioctx_t, auid: *mut u64) -> ::libc::c_int;

    pub fn rados_ioctx_pool_requires_alignment(io: rados_ioctx_t) -> ::libc::c_int;

    pub fn rados_ioctx_pool_required_alignment(io: rados_ioctx_t) -> u64;

    pub fn rados_ioctx_get_id(io: rados_ioctx_t) -> i64;

    pub fn rados_ioctx_get_pool_name(
        io: rados_ioctx_t,
        buf: *mut ::libc::c_char,
        maxlen: ::libc::c_uint,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_locator_set_key(io: rados_ioctx_t, key: *const ::libc::c_char) -> ();

    pub fn rados_ioctx_set_namespace(io: rados_ioctx_t, nspace: *const ::libc::c_char) -> ();

    pub fn rados_nobjects_list_open(io: rados_ioctx_t, ctx: *mut rados_list_ctx_t)
        -> ::libc::c_int;

    pub fn rados_nobjects_list_get_pg_hash_position(ctx: rados_list_ctx_t) -> u32;

    pub fn rados_nobjects_list_seek(ctx: rados_list_ctx_t, pos: u32) -> u32;

    pub fn rados_nobjects_list_next(
        ctx: rados_list_ctx_t,
        entry: *mut *mut *const ::libc::c_char,
        key: *mut *mut *const ::libc::c_char,
        nspace: *mut *mut *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_nobjects_list_close(ctx: rados_list_ctx_t) -> ();

    pub fn rados_objects_list_open(io: rados_ioctx_t, ctx: *mut rados_list_ctx_t) -> ::libc::c_int;

    pub fn rados_objects_list_get_pg_hash_position(ctx: rados_list_ctx_t) -> u32;

    pub fn rados_objects_list_seek(ctx: rados_list_ctx_t, pos: u32) -> u32;

    pub fn rados_objects_list_next(
        ctx: rados_list_ctx_t,
        entry: *mut *const ::libc::c_char,
        key: *mut *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_objects_list_close(ctx: rados_list_ctx_t) -> ();

    pub fn rados_ioctx_snap_create(
        io: rados_ioctx_t,
        snapname: *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_remove(
        io: rados_ioctx_t,
        snapname: *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_rollback(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        snapname: *const ::libc::c_char,
    ) -> ::libc::c_int;
    // Deprecated: Use rados_ioctx_snap_rollback() instead
    pub fn rados_rollback(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        snapname: *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_set_read(io: rados_ioctx_t, snap: rados_snap_t) -> ();

    pub fn rados_ioctx_selfmanaged_snap_create(
        io: rados_ioctx_t,
        snapid: *mut rados_snap_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_selfmanaged_snap_remove(
        io: rados_ioctx_t,
        snapid: rados_snap_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_selfmanaged_snap_rollback(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        snapid: rados_snap_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_selfmanaged_snap_set_write_ctx(
        io: rados_ioctx_t,
        seq: rados_snap_t,
        snaps: *mut rados_snap_t,
        num_snaps: ::libc::c_int,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_list(
        io: rados_ioctx_t,
        snaps: *mut rados_snap_t,
        maxlen: ::libc::c_int,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_lookup(
        io: rados_ioctx_t,
        name: *const ::libc::c_char,
        id: *mut rados_snap_t,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_get_name(
        io: rados_ioctx_t,
        id: rados_snap_t,
        name: *mut ::libc::c_char,
        maxlen: ::libc::c_int,
    ) -> ::libc::c_int;

    pub fn rados_ioctx_snap_get_stamp(
        io: rados_ioctx_t,
        id: rados_snap_t,
        t: *mut time_t,
    ) -> ::libc::c_int;

    pub fn rados_get_last_version(io: rados_ioctx_t) -> u64;

    pub fn rados_write(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        len: size_t,
        off: u64,
    ) -> ::libc::c_int;

    pub fn rados_write_full(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_clone_range(
        io: rados_ioctx_t,
        dst: *const ::libc::c_char,
        dst_off: u64,
        src: *const ::libc::c_char,
        src_off: u64,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_append(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_read(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        buf: *mut ::libc::c_char,
        len: size_t,
        off: u64,
    ) -> ::libc::c_int;

    pub fn rados_remove(io: rados_ioctx_t, oid: *const ::libc::c_char) -> ::libc::c_int;

    pub fn rados_trunc(io: rados_ioctx_t, oid: *const ::libc::c_char, size: u64) -> ::libc::c_int;

    pub fn rados_getxattr(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        buf: *mut ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_setxattr(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_rmxattr(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
    ) -> ::libc::c_int;

    pub fn rados_getxattrs(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        iter: *mut rados_xattrs_iter_t,
    ) -> ::libc::c_int;

    pub fn rados_getxattrs_next(
        iter: rados_xattrs_iter_t,
        name: *mut *const ::libc::c_char,
        val: *mut *const ::libc::c_char,
        len: *mut size_t,
    ) -> ::libc::c_int;

    pub fn rados_getxattrs_end(iter: rados_xattrs_iter_t) -> ();

    pub fn rados_omap_get_next(
        iter: rados_omap_iter_t,
        key: *mut *mut ::libc::c_char,
        val: *mut *mut ::libc::c_char,
        len: *mut size_t,
    ) -> ::libc::c_int;

    pub fn rados_omap_get_end(iter: rados_omap_iter_t) -> ();

    pub fn rados_stat(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        psize: *mut u64,
        pmtime: *mut time_t,
    ) -> ::libc::c_int;

    pub fn rados_tmap_update(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        cmdbuf: *const ::libc::c_char,
        cmdbuflen: size_t,
    ) -> ::libc::c_int;

    pub fn rados_tmap_put(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        buflen: size_t,
    ) -> ::libc::c_int;

    pub fn rados_tmap_get(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        buf: *mut ::libc::c_char,
        buflen: size_t,
    ) -> ::libc::c_int;

    pub fn rados_exec(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        cls: *const ::libc::c_char,
        method: *const ::libc::c_char,
        in_buf: *const ::libc::c_char,
        in_len: size_t,
        buf: *mut ::libc::c_char,
        out_len: size_t,
    ) -> ::libc::c_int;

    pub fn rados_aio_create_completion(
        cb_arg: *mut ::std::os::raw::c_void,
        cb_complete: rados_callback_t,
        cb_safe: rados_callback_t,
        pc: *mut rados_completion_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_wait_for_complete(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_wait_for_safe(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_is_complete(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_is_safe(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_wait_for_complete_and_cb(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_wait_for_safe_and_cb(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_is_complete_and_cb(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_is_safe_and_cb(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_get_return_value(c: rados_completion_t) -> ::libc::c_int;
    pub fn rados_aio_release(c: rados_completion_t) -> ();
    pub fn rados_aio_write(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        completion: rados_completion_t,
        buf: *const ::libc::c_char,
        len: size_t,
        off: u64,
    ) -> ::libc::c_int;
    pub fn rados_aio_append(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        completion: rados_completion_t,
        buf: *const ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_write_full(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        completion: rados_completion_t,
        buf: *const ::libc::c_char,
        len: size_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_remove(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        completion: rados_completion_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_read(
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        completion: rados_completion_t,
        buf: *mut ::libc::c_char,
        len: size_t,
        off: u64,
    ) -> ::libc::c_int;
    pub fn rados_aio_flush(io: rados_ioctx_t) -> ::libc::c_int;
    pub fn rados_aio_flush_async(
        io: rados_ioctx_t,
        completion: rados_completion_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_stat(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        completion: rados_completion_t,
        psize: *mut u64,
        pmtime: *mut time_t,
    ) -> ::libc::c_int;
    pub fn rados_aio_cancel(io: rados_ioctx_t, completion: rados_completion_t) -> ::libc::c_int;
    pub fn rados_watch(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        ver: u64,
        cookie: *mut u64,
        watchcb: rados_watchcb_t,
        arg: *mut ::std::os::raw::c_void,
    ) -> ::libc::c_int;
    pub fn rados_watch2(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        cookie: *mut u64,
        watchcb: rados_watchcb2_t,
        watcherrcb: rados_watcherrcb_t,
        arg: *mut ::std::os::raw::c_void,
    ) -> ::libc::c_int;
    pub fn rados_watch_check(io: rados_ioctx_t, cookie: u64) -> ::libc::c_int;
    pub fn rados_unwatch(io: rados_ioctx_t, o: *const ::libc::c_char, cookie: u64)
        -> ::libc::c_int;
    pub fn rados_unwatch2(io: rados_ioctx_t, cookie: u64) -> ::libc::c_int;
    pub fn rados_notify(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        ver: u64,
        buf: *const ::libc::c_char,
        buf_len: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_notify2(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        buf: *const ::libc::c_char,
        buf_len: ::libc::c_int,
        timeout_ms: u64,
        reply_buffer: *mut *mut ::libc::c_char,
        reply_buffer_len: *mut size_t,
    ) -> ::libc::c_int;
    pub fn rados_notify_ack(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        notify_id: u64,
        cookie: u64,
        buf: *const ::libc::c_char,
        buf_len: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_watch_flush(cluster: rados_t) -> ::libc::c_int;
    pub fn rados_set_alloc_hint(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        expected_object_size: u64,
        expected_write_size: u64,
    ) -> ::libc::c_int;
    pub fn rados_create_write_op() -> rados_write_op_t;
    pub fn rados_release_write_op(write_op: rados_write_op_t) -> ();
    pub fn rados_write_op_set_flags(write_op: rados_write_op_t, flags: ::libc::c_int) -> ();
    pub fn rados_write_op_assert_exists(write_op: rados_write_op_t) -> ();
    pub fn rados_write_op_assert_version(write_op: rados_write_op_t, ver: u64) -> ();
    pub fn rados_write_op_cmpxattr(
        write_op: rados_write_op_t,
        name: *const ::libc::c_char,
        comparison_operator: u8,
        value: *const ::libc::c_char,
        value_len: size_t,
    ) -> ();
    pub fn rados_write_op_omap_cmp(
        write_op: rados_write_op_t,
        key: *const ::libc::c_char,
        comparison_operator: u8,
        val: *const ::libc::c_char,
        val_len: size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_write_op_setxattr(
        write_op: rados_write_op_t,
        name: *const ::libc::c_char,
        value: *const ::libc::c_char,
        value_len: size_t,
    ) -> ();
    pub fn rados_write_op_rmxattr(write_op: rados_write_op_t, name: *const ::libc::c_char) -> ();
    pub fn rados_write_op_create(
        write_op: rados_write_op_t,
        exclusive: ::libc::c_int,
        category: *const ::libc::c_char,
    ) -> ();
    pub fn rados_write_op_write(
        write_op: rados_write_op_t,
        buffer: *const ::libc::c_char,
        len: size_t,
        offset: u64,
    ) -> ();
    pub fn rados_write_op_write_full(
        write_op: rados_write_op_t,
        buffer: *const ::libc::c_char,
        len: size_t,
    ) -> ();
    pub fn rados_write_op_append(
        write_op: rados_write_op_t,
        buffer: *const ::libc::c_char,
        len: size_t,
    ) -> ();
    pub fn rados_write_op_remove(write_op: rados_write_op_t) -> ();
    pub fn rados_write_op_truncate(write_op: rados_write_op_t, offset: u64) -> ();
    pub fn rados_write_op_zero(write_op: rados_write_op_t, offset: u64, len: u64) -> ();
    pub fn rados_write_op_exec(
        write_op: rados_write_op_t,
        cls: *const ::libc::c_char,
        method: *const ::libc::c_char,
        in_buf: *const ::libc::c_char,
        in_len: size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_write_op_omap_set(
        write_op: rados_write_op_t,
        keys: *const *const ::libc::c_char,
        vals: *const *const ::libc::c_char,
        lens: *const size_t,
        num: size_t,
    ) -> ();
    pub fn rados_write_op_omap_rm_keys(
        write_op: rados_write_op_t,
        keys: *const *const ::libc::c_char,
        keys_len: size_t,
    ) -> ();
    pub fn rados_write_op_omap_clear(write_op: rados_write_op_t) -> ();
    pub fn rados_write_op_set_alloc_hint(
        write_op: rados_write_op_t,
        expected_object_size: u64,
        expected_write_size: u64,
    ) -> ();
    pub fn rados_write_op_operate(
        write_op: rados_write_op_t,
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        mtime: *mut time_t,
        flags: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_aio_write_op_operate(
        write_op: rados_write_op_t,
        io: rados_ioctx_t,
        completion: rados_completion_t,
        oid: *const ::libc::c_char,
        mtime: *mut time_t,
        flags: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_create_read_op() -> rados_read_op_t;
    pub fn rados_release_read_op(read_op: rados_read_op_t) -> ();
    pub fn rados_read_op_set_flags(read_op: rados_read_op_t, flags: ::libc::c_int) -> ();
    pub fn rados_read_op_assert_exists(read_op: rados_read_op_t) -> ();
    pub fn rados_read_op_assert_version(write_op: rados_read_op_t, ver: u64) -> ();
    pub fn rados_read_op_cmpxattr(
        read_op: rados_read_op_t,
        name: *const ::libc::c_char,
        comparison_operator: u8,
        value: *const ::libc::c_char,
        value_len: size_t,
    ) -> ();
    pub fn rados_read_op_getxattrs(
        read_op: rados_read_op_t,
        iter: *mut rados_xattrs_iter_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_omap_cmp(
        read_op: rados_read_op_t,
        key: *const ::libc::c_char,
        comparison_operator: u8,
        val: *const ::libc::c_char,
        val_len: size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_stat(
        read_op: rados_read_op_t,
        psize: *mut u64,
        pmtime: *mut time_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_read(
        read_op: rados_read_op_t,
        offset: u64,
        len: size_t,
        buf: *mut ::libc::c_char,
        bytes_read: *mut size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_exec(
        read_op: rados_read_op_t,
        cls: *const ::libc::c_char,
        method: *const ::libc::c_char,
        in_buf: *const ::libc::c_char,
        in_len: size_t,
        out_buf: *mut *mut ::libc::c_char,
        out_len: *mut size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_exec_user_buf(
        read_op: rados_read_op_t,
        cls: *const ::libc::c_char,
        method: *const ::libc::c_char,
        in_buf: *const ::libc::c_char,
        in_len: size_t,
        out_buf: *mut ::libc::c_char,
        out_len: size_t,
        used_len: *mut size_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_omap_get_vals(
        read_op: rados_read_op_t,
        start_after: *const ::libc::c_char,
        filter_prefix: *const ::libc::c_char,
        max_return: u64,
        iter: *mut rados_omap_iter_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_omap_get_keys(
        read_op: rados_read_op_t,
        start_after: *const ::libc::c_char,
        max_return: u64,
        iter: *mut rados_omap_iter_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_omap_get_vals_by_keys(
        read_op: rados_read_op_t,
        keys: *const *const ::libc::c_char,
        keys_len: size_t,
        iter: *mut rados_omap_iter_t,
        prval: *mut ::libc::c_int,
    ) -> ();
    pub fn rados_read_op_operate(
        read_op: rados_read_op_t,
        io: rados_ioctx_t,
        oid: *const ::libc::c_char,
        flags: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_aio_read_op_operate(
        read_op: rados_read_op_t,
        io: rados_ioctx_t,
        completion: rados_completion_t,
        oid: *const ::libc::c_char,
        flags: ::libc::c_int,
    ) -> ::libc::c_int;
    pub fn rados_lock_exclusive(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        cookie: *const ::libc::c_char,
        desc: *const ::libc::c_char,
        duration: *mut timeval,
        flags: u8,
    ) -> ::libc::c_int;
    pub fn rados_lock_shared(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        cookie: *const ::libc::c_char,
        tag: *const ::libc::c_char,
        desc: *const ::libc::c_char,
        duration: *mut timeval,
        flags: u8,
    ) -> ::libc::c_int;
    pub fn rados_unlock(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        cookie: *const ::libc::c_char,
    ) -> ::libc::c_int;
    pub fn rados_list_lockers(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        exclusive: *mut ::libc::c_int,
        tag: *mut ::libc::c_char,
        tag_len: *mut size_t,
        clients: *mut ::libc::c_char,
        clients_len: *mut size_t,
        cookies: *mut ::libc::c_char,
        cookies_len: *mut size_t,
        addrs: *mut ::libc::c_char,
        addrs_len: *mut size_t,
    ) -> ssize_t;
    pub fn rados_break_lock(
        io: rados_ioctx_t,
        o: *const ::libc::c_char,
        name: *const ::libc::c_char,
        client: *const ::libc::c_char,
        cookie: *const ::libc::c_char,
    ) -> ::libc::c_int;
    pub fn rados_blacklist_add(
        cluster: rados_t,
        client_address: *mut ::libc::c_char,
        expire_seconds: u32,
    ) -> ::libc::c_int;
    pub fn rados_mon_command(
        cluster: rados_t,
        cmd: *mut *const ::libc::c_char,
        cmdlen: size_t,
        inbuf: *const ::libc::c_char,
        inbuflen: size_t,
        outbuf: *mut *mut ::libc::c_char,
        outbuflen: *mut size_t,
        outs: *mut *mut ::libc::c_char,
        outslen: *mut size_t,
    ) -> ::libc::c_int;
    pub fn rados_mon_command_target(
        cluster: rados_t,
        name: *const ::libc::c_char,
        cmd: *mut *const ::libc::c_char,
        cmdlen: size_t,
        inbuf: *const ::libc::c_char,
        inbuflen: size_t,
        outbuf: *mut *mut ::libc::c_char,
        outbuflen: *mut size_t,
        outs: *mut *mut ::libc::c_char,
        outslen: *mut size_t,
    ) -> ::libc::c_int;
    pub fn rados_buffer_free(buf: *mut ::libc::c_char) -> ();
    pub fn rados_osd_command(
        cluster: rados_t,
        osdid: ::libc::c_int,
        cmd: *mut *const ::libc::c_char,
        cmdlen: size_t,
        inbuf: *const ::libc::c_char,
        inbuflen: size_t,
        outbuf: *mut *mut ::libc::c_char,
        outbuflen: *mut size_t,
        outs: *mut *mut ::libc::c_char,
        outslen: *mut size_t,
    ) -> ::libc::c_int;
    pub fn rados_pg_command(
        cluster: rados_t,
        pgstr: *const ::libc::c_char,
        cmd: *mut *const ::libc::c_char,
        cmdlen: size_t,
        inbuf: *const ::libc::c_char,
        inbuflen: size_t,
        outbuf: *mut *mut ::libc::c_char,
        outbuflen: *mut size_t,
        outs: *mut *mut ::libc::c_char,
        outslen: *mut size_t,
    ) -> ::libc::c_int;
    pub fn rados_monitor_log(
        cluster: rados_t,
        level: *const ::libc::c_char,
        cb: rados_log_callback_t,
        arg: *mut ::std::os::raw::c_void,
    ) -> ::libc::c_int;
}