2 # Copyright 2015 ClusterHQ
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 Python bindings for ``libnvpair``.
20 from __future__
import absolute_import
, division
, print_function
28 DATA_TYPE_UNKNOWN = 0,
39 DATA_TYPE_INT16_ARRAY,
40 DATA_TYPE_UINT16_ARRAY,
41 DATA_TYPE_INT32_ARRAY,
42 DATA_TYPE_UINT32_ARRAY,
43 DATA_TYPE_INT64_ARRAY,
44 DATA_TYPE_UINT64_ARRAY,
45 DATA_TYPE_STRING_ARRAY,
48 DATA_TYPE_NVLIST_ARRAY,
49 DATA_TYPE_BOOLEAN_VALUE,
52 DATA_TYPE_BOOLEAN_ARRAY,
56 typedef enum { B_FALSE, B_TRUE } boolean_t;
58 typedef unsigned char uchar_t;
59 typedef unsigned int uint_t;
61 int nvlist_alloc(nvlist_t **, uint_t, int);
62 void nvlist_free(nvlist_t *);
64 int nvlist_unpack(char *, size_t, nvlist_t **, int);
66 void dump_nvlist(nvlist_t *, int);
67 int nvlist_dup(nvlist_t *, nvlist_t **, int);
69 int nvlist_add_boolean(nvlist_t *, const char *);
70 int nvlist_add_boolean_value(nvlist_t *, const char *, boolean_t);
71 int nvlist_add_byte(nvlist_t *, const char *, uchar_t);
72 int nvlist_add_int8(nvlist_t *, const char *, int8_t);
73 int nvlist_add_uint8(nvlist_t *, const char *, uint8_t);
74 int nvlist_add_int16(nvlist_t *, const char *, int16_t);
75 int nvlist_add_uint16(nvlist_t *, const char *, uint16_t);
76 int nvlist_add_int32(nvlist_t *, const char *, int32_t);
77 int nvlist_add_uint32(nvlist_t *, const char *, uint32_t);
78 int nvlist_add_int64(nvlist_t *, const char *, int64_t);
79 int nvlist_add_uint64(nvlist_t *, const char *, uint64_t);
80 int nvlist_add_string(nvlist_t *, const char *, const char *);
81 int nvlist_add_nvlist(nvlist_t *, const char *, nvlist_t *);
82 int nvlist_add_boolean_array(nvlist_t *, const char *,
83 const boolean_t *, uint_t);
84 int nvlist_add_byte_array(nvlist_t *, const char *,
85 const uchar_t *, uint_t);
86 int nvlist_add_int8_array(nvlist_t *, const char *,
87 const int8_t *, uint_t);
88 int nvlist_add_uint8_array(nvlist_t *, const char *,
89 const uint8_t *, uint_t);
90 int nvlist_add_int16_array(nvlist_t *, const char *,
91 const int16_t *, uint_t);
92 int nvlist_add_uint16_array(nvlist_t *, const char *,
93 const uint16_t *, uint_t);
94 int nvlist_add_int32_array(nvlist_t *, const char *,
95 const int32_t *, uint_t);
96 int nvlist_add_uint32_array(nvlist_t *, const char *,
97 const uint32_t *, uint_t);
98 int nvlist_add_int64_array(nvlist_t *, const char *,
99 const int64_t *, uint_t);
100 int nvlist_add_uint64_array(nvlist_t *, const char *,
101 const uint64_t *, uint_t);
102 int nvlist_add_string_array(nvlist_t *, const char *,
103 const char * const *, uint_t);
104 int nvlist_add_nvlist_array(nvlist_t *, const char *,
105 const nvlist_t * const *, uint_t);
107 nvpair_t *nvlist_next_nvpair(nvlist_t *, nvpair_t *);
108 nvpair_t *nvlist_prev_nvpair(nvlist_t *, nvpair_t *);
109 char *nvpair_name(nvpair_t *);
110 data_type_t nvpair_type(nvpair_t *);
111 int nvpair_type_is_array(nvpair_t *);
112 int nvpair_value_boolean_value(nvpair_t *, boolean_t *);
113 int nvpair_value_byte(nvpair_t *, uchar_t *);
114 int nvpair_value_int8(nvpair_t *, int8_t *);
115 int nvpair_value_uint8(nvpair_t *, uint8_t *);
116 int nvpair_value_int16(nvpair_t *, int16_t *);
117 int nvpair_value_uint16(nvpair_t *, uint16_t *);
118 int nvpair_value_int32(nvpair_t *, int32_t *);
119 int nvpair_value_uint32(nvpair_t *, uint32_t *);
120 int nvpair_value_int64(nvpair_t *, int64_t *);
121 int nvpair_value_uint64(nvpair_t *, uint64_t *);
122 int nvpair_value_string(nvpair_t *, char **);
123 int nvpair_value_nvlist(nvpair_t *, nvlist_t **);
124 int nvpair_value_boolean_array(nvpair_t *, boolean_t **, uint_t *);
125 int nvpair_value_byte_array(nvpair_t *, uchar_t **, uint_t *);
126 int nvpair_value_int8_array(nvpair_t *, int8_t **, uint_t *);
127 int nvpair_value_uint8_array(nvpair_t *, uint8_t **, uint_t *);
128 int nvpair_value_int16_array(nvpair_t *, int16_t **, uint_t *);
129 int nvpair_value_uint16_array(nvpair_t *, uint16_t **, uint_t *);
130 int nvpair_value_int32_array(nvpair_t *, int32_t **, uint_t *);
131 int nvpair_value_uint32_array(nvpair_t *, uint32_t **, uint_t *);
132 int nvpair_value_int64_array(nvpair_t *, int64_t **, uint_t *);
133 int nvpair_value_uint64_array(nvpair_t *, uint64_t **, uint_t *);
134 int nvpair_value_string_array(nvpair_t *, char ***, uint_t *);
135 int nvpair_value_nvlist_array(nvpair_t *, nvlist_t ***, uint_t *);
139 #include <libzfs/sys/nvpair.h>
144 # vim: softtabstop=4 tabstop=4 expandtab shiftwidth=4