]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/include/spdk/conf.h
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / spdk / include / spdk / conf.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright (C) 2008-2012 Daisuke Aoyama <aoyama@peach.ne.jp>.
5 * Copyright (c) Intel Corporation.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /** \file
36 * Configuration file parser
37 */
38
39 #ifndef SPDK_CONF_H
40 #define SPDK_CONF_H
41
42 #include <stdbool.h>
43
44 struct spdk_conf_value;
45 struct spdk_conf_item;
46 struct spdk_conf_section;
47 struct spdk_conf;
48
49 struct spdk_conf *spdk_conf_allocate(void);
50 void spdk_conf_free(struct spdk_conf *cp);
51 int spdk_conf_read(struct spdk_conf *cp, const char *file);
52 struct spdk_conf_section *spdk_conf_find_section(struct spdk_conf *cp, const char *name);
53
54 /* Configuration file iteration */
55 struct spdk_conf_section *spdk_conf_first_section(struct spdk_conf *cp);
56 struct spdk_conf_section *spdk_conf_next_section(struct spdk_conf_section *sp);
57
58 bool spdk_conf_section_match_prefix(const struct spdk_conf_section *sp, const char *name_prefix);
59 const char *spdk_conf_section_get_name(const struct spdk_conf_section *sp);
60 int spdk_conf_section_get_num(const struct spdk_conf_section *sp);
61 char *spdk_conf_section_get_nmval(struct spdk_conf_section *sp, const char *key,
62 int idx1, int idx2);
63 char *spdk_conf_section_get_nval(struct spdk_conf_section *sp, const char *key, int idx);
64 char *spdk_conf_section_get_val(struct spdk_conf_section *sp, const char *key);
65 int spdk_conf_section_get_intval(struct spdk_conf_section *sp, const char *key);
66 bool spdk_conf_section_get_boolval(struct spdk_conf_section *sp, const char *key, bool default_val);
67
68 void spdk_conf_set_as_default(struct spdk_conf *cp);
69
70 #endif