glusterfs  8.2
About: GlusterFS is a network/cluster filesystem. The storage server (or each in a cluster) runs glusterfsd and the clients use mount command or glusterfs client to mount the exported filesystem. Release series 8.x (latest version).
  Fossies Dox: glusterfs-8.2.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

dict.h
Go to the documentation of this file.
1 /*
2  Copyright (c) 2008-2012 Red Hat, Inc. <http://www.redhat.com>
3  This file is part of GlusterFS.
4 
5  This file is licensed to you under your choice of the GNU Lesser
6  General Public License, version 3 or any later version (LGPLv3 or
7  later), or the GNU General Public License, version 2 (GPLv2), in all
8  cases as published by the Free Software Foundation.
9 */
10 
11 #ifndef _DICT_H
12 #define _DICT_H
13 
14 #include <inttypes.h>
15 #include <sys/uio.h>
16 #include <pthread.h>
17 
18 #include "glusterfs/common-utils.h"
19 
20 typedef struct _data data_t;
21 typedef struct _dict dict_t;
22 typedef struct _data_pair data_pair_t;
23 
24 #define dict_set_sizen(this, key, value) dict_setn(this, key, SLEN(key), value)
25 
26 #define dict_add_sizen(this, key, value) dict_addn(this, key, SLEN(key), value)
27 
28 #define dict_get_with_ref_sizen(this, key, value) \
29  dict_get_with_refn(this, key, SLEN(key), value)
30 
31 #define dict_get_sizen(this, key) dict_getn(this, key, SLEN(key))
32 
33 #define dict_del_sizen(this, key) dict_deln(this, key, SLEN(key))
34 
35 #define dict_set_str_sizen(this, key, str) \
36  dict_set_strn(this, key, SLEN(key), str)
37 
38 #define dict_set_sizen_str_sizen(this, key, str) \
39  dict_set_nstrn(this, key, SLEN(key), str, SLEN(str))
40 
41 #define dict_set_dynstr_sizen(this, key, str) \
42  dict_set_dynstrn(this, key, SLEN(key), str)
43 
44 #define dict_get_str_sizen(this, key, str) \
45  dict_get_strn(this, key, SLEN(key), str)
46 
47 #define dict_get_int32_sizen(this, key, val) \
48  dict_get_int32n(this, key, SLEN(key), val)
49 
50 #define dict_set_int32_sizen(this, key, val) \
51  dict_set_int32n(this, key, SLEN(key), val)
52 
53 #define GF_PROTOCOL_DICT_SERIALIZE(this, from_dict, to, len, ope, labl) \
54  do { \
55  int _ret = 0; \
56  \
57  if (!from_dict) \
58  break; \
59  \
60  _ret = dict_allocate_and_serialize(from_dict, to, &len); \
61  if (_ret < 0) { \
62  gf_msg(this->name, GF_LOG_WARNING, 0, LG_MSG_DICT_SERIAL_FAILED, \
63  "failed to get serialized dict (%s)", (#from_dict)); \
64  ope = EINVAL; \
65  goto labl; \
66  } \
67  } while (0)
68 
69 #define GF_PROTOCOL_DICT_UNSERIALIZE(xl, to, buff, len, ret, ope, labl) \
70  do { \
71  if (!len) \
72  break; \
73  to = dict_new(); \
74  GF_VALIDATE_OR_GOTO(xl->name, to, labl); \
75  \
76  ret = dict_unserialize(buff, len, &to); \
77  if (ret < 0) { \
78  gf_msg(xl->name, GF_LOG_WARNING, 0, LG_MSG_DICT_UNSERIAL_FAILED, \
79  "failed to unserialize dictionary (%s)", (#to)); \
80  \
81  ope = EINVAL; \
82  goto labl; \
83  } \
84  \
85  } while (0)
86 
87 #define dict_foreach_inline(d, c) for (c = d->members_list; c; c = c->next)
88 
89 #define DICT_KEY_VALUE_MAX_SIZE 1048576
90 #define DICT_MAX_FLAGS 256
91 #define DICT_FLAG_SET 1
92 #define DICT_FLAG_CLEAR 0
93 #define DICT_HDR_LEN 4
94 #define DICT_DATA_HDR_KEY_LEN 4
95 #define DICT_DATA_HDR_VAL_LEN 4
96 
97 struct _data {
98  char *data;
101  int32_t len;
103 };
104 
105 struct _data_pair {
107  struct _data_pair *prev;
108  struct _data_pair *next;
110  char *key;
111  uint32_t key_hash;
112 };
113 
114 struct _dict {
115  uint64_t max_count;
116  int32_t hash_size;
117  int32_t count;
125 };
126 
127 typedef gf_boolean_t (*dict_match_t)(dict_t *d, char *k, data_t *v, void *data);
128 
129 int32_t
130 is_data_equal(data_t *one, data_t *two);
131 void
132 data_destroy(data_t *data);
133 
134 /* function to set a key/value pair (overwrite existing if matches the key */
135 int32_t
136 dict_set(dict_t *this, char *key, data_t *value);
137 int32_t
138 dict_setn(dict_t *this, char *key, const int keylen, data_t *value);
139 /* function to set a new key/value pair (without checking for duplicate) */
140 int32_t
141 dict_add(dict_t *this, char *key, data_t *value);
142 int32_t
143 dict_addn(dict_t *this, char *key, const int keylen, data_t *value);
144 int
145 dict_get_with_ref(dict_t *this, char *key, data_t **data);
146 int
147 dict_get_with_refn(dict_t *this, char *key, const int keylen, data_t **data);
148 data_t *
149 dict_get(dict_t *this, char *key);
150 data_t *
151 dict_getn(dict_t *this, char *key, const int keylen);
152 void
153 dict_del(dict_t *this, char *key);
154 void
155 dict_deln(dict_t *this, char *key, const int keylen);
156 int
157 dict_reset(dict_t *dict);
158 
159 int
160 dict_key_count(dict_t *this);
161 
162 int32_t
164 int32_t
165 dict_serialize(dict_t *dict, char *buf);
166 int32_t
167 dict_unserialize(char *buf, int32_t size, dict_t **fill);
168 
169 int32_t
170 dict_allocate_and_serialize(dict_t *this, char **buf, u_int *length);
171 
172 void
173 dict_unref(dict_t *dict);
174 dict_t *
175 dict_ref(dict_t *dict);
176 data_t *
177 data_ref(data_t *data);
178 void
179 data_unref(data_t *data);
180 
181 int32_t
182 dict_lookup(dict_t *this, char *key, data_t **data);
183 /*
184  TODO: provide converts for different byte sizes, signedness, and void *
185  */
186 data_t *
187 int_to_data(int64_t value);
188 data_t *
189 str_to_data(char *value);
190 data_t *
191 strn_to_data(char *value, const int vallen);
192 data_t *
193 data_from_dynptr(void *value, int32_t len);
194 data_t *
195 bin_to_data(void *value, int32_t len);
196 data_t *
197 static_str_to_data(char *value);
198 data_t *
199 static_bin_to_data(void *value);
200 
201 int64_t
202 data_to_int64(data_t *data);
203 int32_t
204 data_to_int32(data_t *data);
205 int16_t
206 data_to_int16(data_t *data);
207 int8_t
208 data_to_int8(data_t *data);
209 
210 uint64_t
211 data_to_uint64(data_t *data);
212 uint32_t
213 data_to_uint32(data_t *data);
214 uint16_t
215 data_to_uint16(data_t *data);
216 uint8_t
217 data_to_uint8(data_t *data);
218 
219 data_t *
220 data_from_int64(int64_t value);
221 data_t *
222 data_from_int32(int32_t value);
223 data_t *
224 data_from_int16(int16_t value);
225 data_t *
226 data_from_int8(int8_t value);
227 
228 data_t *
229 data_from_uint64(uint64_t value);
230 data_t *
231 data_from_uint32(uint32_t value);
232 data_t *
233 data_from_uint16(uint16_t value);
234 
235 char *
236 data_to_str(data_t *data);
237 void *
238 data_to_bin(data_t *data);
239 void *
240 data_to_ptr(data_t *data);
241 data_t *
242 data_copy(data_t *old);
243 struct iatt *
244 data_to_iatt(data_t *data, char *key);
245 
246 int
247 dict_foreach(dict_t *this,
248  int (*fn)(dict_t *this, char *key, data_t *value, void *data),
249  void *data);
250 
251 int
252 dict_foreach_fnmatch(dict_t *dict, char *pattern,
253  int (*fn)(dict_t *this, char *key, data_t *value,
254  void *data),
255  void *data);
256 
257 int
259  gf_boolean_t (*match)(dict_t *this, char *key, data_t *value,
260  void *mdata),
261  void *match_data,
262  int (*action)(dict_t *this, char *key, data_t *value,
263  void *adata),
264  void *action_data);
265 
266 int
267 dict_null_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp);
268 int
269 dict_remove_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp);
270 dict_t *
271 dict_copy(dict_t *this, dict_t *new);
272 int
273 dict_keys_join(void *value, int size, dict_t *dict,
274  int (*filter_fn)(char *key));
275 
276 /* CLEANED UP FUNCTIONS DECLARATIONS */
278 dict_new(void);
279 dict_t *
280 dict_copy_with_ref(dict_t *this, dict_t *new);
281 
282 GF_MUST_CHECK int
283 dict_reset(dict_t *dict);
284 
285 GF_MUST_CHECK int
286 dict_get_int8(dict_t *this, char *key, int8_t *val);
287 GF_MUST_CHECK int
288 dict_set_int8(dict_t *this, char *key, int8_t val);
289 
290 GF_MUST_CHECK int
291 dict_get_int16(dict_t *this, char *key, int16_t *val);
292 GF_MUST_CHECK int
293 dict_set_int16(dict_t *this, char *key, int16_t val);
294 
295 GF_MUST_CHECK int
296 dict_get_int32(dict_t *this, char *key, int32_t *val);
297 GF_MUST_CHECK int
298 dict_get_int32n(dict_t *this, char *key, const int keylen, int32_t *val);
299 GF_MUST_CHECK int
300 dict_set_int32(dict_t *this, char *key, int32_t val);
301 GF_MUST_CHECK int
302 dict_set_int32n(dict_t *this, char *key, const int keylen, int32_t val);
303 
304 GF_MUST_CHECK int
305 dict_get_int64(dict_t *this, char *key, int64_t *val);
306 GF_MUST_CHECK int
307 dict_set_int64(dict_t *this, char *key, int64_t val);
308 
309 GF_MUST_CHECK int
310 dict_get_uint16(dict_t *this, char *key, uint16_t *val);
311 GF_MUST_CHECK int
312 dict_set_uint16(dict_t *this, char *key, uint16_t val);
313 
314 GF_MUST_CHECK int
315 dict_get_uint32(dict_t *this, char *key, uint32_t *val);
316 GF_MUST_CHECK int
317 dict_set_uint32(dict_t *this, char *key, uint32_t val);
318 
319 GF_MUST_CHECK int
320 dict_get_uint64(dict_t *this, char *key, uint64_t *val);
321 GF_MUST_CHECK int
322 dict_set_uint64(dict_t *this, char *key, uint64_t val);
323 
324 GF_MUST_CHECK int
325 dict_check_flag(dict_t *this, char *key, int flag);
326 GF_MUST_CHECK int
327 dict_set_flag(dict_t *this, char *key, int flag);
328 GF_MUST_CHECK int
329 dict_clear_flag(dict_t *this, char *key, int flag);
330 
331 GF_MUST_CHECK int
332 dict_get_double(dict_t *this, char *key, double *val);
333 GF_MUST_CHECK int
334 dict_set_double(dict_t *this, char *key, double val);
335 
336 GF_MUST_CHECK int
337 dict_set_static_ptr(dict_t *this, char *key, void *ptr);
338 GF_MUST_CHECK int
339 dict_get_ptr(dict_t *this, char *key, void **ptr);
340 GF_MUST_CHECK int
341 dict_get_ptr_and_len(dict_t *this, char *key, void **ptr, int *len);
342 GF_MUST_CHECK int
343 dict_set_dynptr(dict_t *this, char *key, void *ptr, size_t size);
344 
345 GF_MUST_CHECK int
346 dict_get_bin(dict_t *this, char *key, void **ptr);
347 GF_MUST_CHECK int
348 dict_set_bin(dict_t *this, char *key, void *ptr, size_t size);
349 GF_MUST_CHECK int
350 dict_set_static_bin(dict_t *this, char *key, void *ptr, size_t size);
351 
352 GF_MUST_CHECK int
353 dict_set_option(dict_t *this, char *key, char *str);
354 GF_MUST_CHECK int
355 dict_set_str(dict_t *this, char *key, char *str);
356 GF_MUST_CHECK int
357 dict_set_strn(dict_t *this, char *key, const int keylen, char *str);
358 GF_MUST_CHECK int
359 dict_set_nstrn(dict_t *this, char *key, const int keylen, char *str,
360  const int vallen);
361 GF_MUST_CHECK int
362 dict_set_dynstr(dict_t *this, char *key, char *str);
363 GF_MUST_CHECK int
364 dict_set_dynstrn(dict_t *this, char *key, const int keylen, char *str);
365 GF_MUST_CHECK int
366 dict_set_dynstr_with_alloc(dict_t *this, char *key, const char *str);
367 GF_MUST_CHECK int
368 dict_add_dynstr_with_alloc(dict_t *this, char *key, char *str);
369 GF_MUST_CHECK int
370 dict_get_str(dict_t *this, char *key, char **str);
371 GF_MUST_CHECK int
372 dict_get_strn(dict_t *this, char *key, const int keylen, char **str);
373 
374 GF_MUST_CHECK int
375 dict_get_str_boolean(dict_t *this, char *key, int default_val);
376 GF_MUST_CHECK int
377 dict_rename_key(dict_t *this, char *key, char *replace_key);
378 GF_MUST_CHECK int
379 dict_serialize_value_with_delim(dict_t *this, char *buf, int32_t *serz_len,
380  char delimiter);
381 
382 GF_MUST_CHECK int
383 dict_set_gfuuid(dict_t *this, char *key, uuid_t uuid, bool is_static);
384 GF_MUST_CHECK int
385 dict_get_gfuuid(dict_t *this, char *key, uuid_t *uuid);
386 
387 GF_MUST_CHECK int
388 dict_set_iatt(dict_t *this, char *key, struct iatt *iatt, bool is_static);
389 GF_MUST_CHECK int
390 dict_get_iatt(dict_t *this, char *key, struct iatt *iatt);
391 GF_MUST_CHECK int
392 dict_set_mdata(dict_t *this, char *key, struct mdata_iatt *mdata,
393  bool is_static);
394 GF_MUST_CHECK int
395 dict_get_mdata(dict_t *this, char *key, struct mdata_iatt *mdata);
396 
397 void
398 dict_dump_to_statedump(dict_t *dict, char *dict_name, char *domain);
399 
400 void
401 dict_dump_to_log(dict_t *dict);
402 
403 int
404 dict_dump_to_str(dict_t *dict, char *dump, int dumpsize, char *format);
406 dict_match_everything(dict_t *d, char *k, data_t *v, void *data);
407 
408 dict_t *
409 dict_for_key_value(const char *name, const char *value, size_t size,
410  gf_boolean_t is_static);
411 
413 are_dicts_equal(dict_t *one, dict_t *two,
414  gf_boolean_t (*match)(dict_t *d, char *k, data_t *v,
415  void *data),
416  gf_boolean_t (*value_ignore)(char *k));
417 int
418 dict_has_key_from_array(dict_t *dict, char **strings, gf_boolean_t *result);
419 
420 int
422 #endif
dict_get_str_boolean
int dict_get_str_boolean(dict_t *this, char *key, int default_val)
Definition: dict.c:2781
dict_set_double
int dict_set_double(dict_t *this, char *key, double val)
Definition: dict.c:2240
dict_serialized_length
int32_t dict_serialized_length(dict_t *dict)
Definition: dict.c:3012
dict_set_nstrn
int dict_set_nstrn(dict_t *this, char *key, const int keylen, char *str, const int vallen)
Definition: dict.c:2451
dict_clear_flag
int dict_clear_flag(dict_t *this, char *key, int flag)
Definition: dict.c:2208
_dict::max_count
uint64_t max_count
Definition: dict.h:115
dict_for_key_value
dict_t * dict_for_key_value(const char *name, const char *value, size_t size, bool is_static)
Definition: dict.c:3448
int_to_data
data_t * int_to_data(int64_t value)
Definition: dict.c:795
data_to_int8
int8_t data_to_int8(data_t *data)
Definition: dict.c:1142
dict_get_ptr_and_len
int dict_get_ptr_and_len(dict_t *this, char *key, void **ptr, int *len)
Definition: dict.c:2327
dict_foreach
int dict_foreach(dict_t *this, int(*fn)(dict_t *this, char *key, data_t *value, void *data), void *data)
Definition: dict.c:1286
_data::is_static
bool is_static
Definition: dict.h:102
is_data_equal
int32_t is_data_equal(data_t *one, data_t *two)
Definition: dict.c:118
data_to_iatt
struct iatt * data_to_iatt(data_t *data, char *key)
Definition: dict.c:1243
iatt
Definition: iatt.h:46
data_from_int32
data_t * data_from_int32(int32_t value)
Definition: dict.c:836
dict_add_dynstr_with_alloc
int dict_add_dynstr_with_alloc(dict_t *this, char *key, char *str)
Definition: dict.c:2534
data_to_int64
int64_t data_to_int64(data_t *data)
Definition: dict.c:1104
data_from_int64
data_t * data_from_int64(int64_t value)
Definition: dict.c:816
data_copy
data_t * data_copy(data_t *old)
Definition: dict.c:305
dict_set_static_bin
int dict_set_static_bin(dict_t *this, char *key, void *ptr, size_t size)
Definition: dict.c:2647
dict_keys_join
int dict_keys_join(void *value, int size, dict_t *dict, int(*filter_fn)(char *key))
_data_pair::prev
struct _data_pair * prev
Definition: dict.h:107
dict_get_uint64
int dict_get_uint64(dict_t *this, char *key, uint64_t *val)
Definition: dict.c:1991
dict_get_double
int dict_get_double(dict_t *this, char *key, double *val)
Definition: dict.c:2214
dict_get_mdata
int dict_get_mdata(dict_t *this, char *key, struct mdata_iatt *mdata)
Definition: dict.c:2695
data_to_uint16
uint16_t data_to_uint16(data_t *data)
Definition: dict.c:1180
_dict::members_list
data_pair_t * members_list
Definition: dict.h:120
dict_copy
dict_t * dict_copy(dict_t *this, dict_t *new)
Definition: dict.c:1403
dict_remove_foreach_fn
int dict_remove_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp)
Definition: dict.c:1267
data_to_str
char * data_to_str(data_t *data)
Definition: dict.c:1222
data_from_int8
data_t * data_from_int8(int8_t value)
Definition: dict.c:878
_dict::lock
gf_lock_t lock
Definition: dict.h:122
dict_set_strn
int dict_set_strn(dict_t *this, char *key, const int keylen, char *str)
Definition: dict.c:2430
dict_get_int32
int dict_get_int32(dict_t *this, char *key, int32_t *val)
Definition: dict.c:1791
dict_match_t
bool(* dict_match_t)(dict_t *d, char *k, data_t *v, void *data)
Definition: dict.h:127
gf_lock_t
pthread_mutex_t gf_lock_t
Definition: locking.h:74
dict_reset
int dict_reset(dict_t *dict)
Definition: dict.c:1420
static_str_to_data
data_t * static_str_to_data(char *value)
dict_set_uint16
int dict_set_uint16(dict_t *this, char *key, uint16_t val)
Definition: dict.c:1927
data_from_uint64
data_t * data_from_uint64(uint64_t value)
Definition: dict.c:899
_data_pair::next
struct _data_pair * next
Definition: dict.h:108
dict_getn
data_t * dict_getn(dict_t *this, char *key, const int keylen)
Definition: dict.c:556
dict_add
int32_t dict_add(dict_t *this, char *key, data_t *value)
Definition: dict.c:510
dict_set_option
int dict_set_option(dict_t *this, char *key, char *str)
Definition: dict.c:2515
_data::len
int32_t len
Definition: dict.h:101
_dict::members
data_pair_t ** members
Definition: dict.h:119
dict_match_everything
bool dict_match_everything(dict_t *d, char *k, data_t *v, void *data)
Definition: dict.c:1280
dict_addn
int32_t dict_addn(dict_t *this, char *key, const int keylen, data_t *value)
Definition: dict.c:519
data_from_uint16
data_t * data_from_uint16(uint16_t value)
Definition: dict.c:962
dict_has_key_from_array
int dict_has_key_from_array(dict_t *dict, char **strings, bool *result)
Definition: dict.c:3474
mdata_iatt
Definition: iatt.h:95
dict_set_dynstr_with_alloc
int dict_set_dynstr_with_alloc(dict_t *this, char *key, const char *str)
Definition: dict.c:2471
data_to_int16
int16_t data_to_int16(data_t *data)
Definition: dict.c:1120
dict_get_str
int dict_get_str(dict_t *this, char *key, char **str)
Definition: dict.c:2385
dict_get
data_t * dict_get(dict_t *this, char *key)
Definition: dict.c:544
dict_check_flag
int dict_check_flag(dict_t *this, char *key, int flag)
Definition: dict.c:2045
dict_set_int32
int dict_set_int32(dict_t *this, char *key, int32_t val)
Definition: dict.c:1837
data_to_uint32
uint32_t data_to_uint32(data_t *data)
Definition: dict.c:1172
_data
Definition: dict.h:97
bin_to_data
data_t * bin_to_data(void *value, int32_t len)
Definition: dict.c:1070
gf_boolean_t
#define gf_boolean_t
Definition: glusterfs.h:368
dict_set_dynptr
int dict_set_dynptr(dict_t *this, char *key, void *ptr, size_t size)
Definition: dict.c:2278
dict_unserialize
int32_t dict_unserialize(char *buf, int32_t size, dict_t **fill)
Definition: dict.c:3075
dict_set_flag
int dict_set_flag(dict_t *this, char *key, int flag)
Definition: dict.c:2202
dict_null_foreach_fn
int dict_null_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp)
Definition: dict.c:1261
data_from_uint32
data_t * data_from_uint32(uint32_t value)
Definition: dict.c:941
_dict::hash_size
int32_t hash_size
Definition: dict.h:116
dict_lookup
int32_t dict_lookup(dict_t *this, char *key, data_t **data)
Definition: dict.c:359
static_bin_to_data
data_t * static_bin_to_data(void *value)
dict_set_iatt
int dict_set_iatt(dict_t *this, char *key, struct iatt *iatt, bool is_static)
Definition: dict.c:2726
dict_get_strn
int dict_get_strn(dict_t *this, char *key, const int keylen, char **str)
Definition: dict.c:2360
_data::refcount
gf_atomic_int64_t refcount
Definition: dict.h:99
_data_pair::key
char * key
Definition: dict.h:110
dict_foreach_fnmatch
int dict_foreach_fnmatch(dict_t *dict, char *pattern, int(*fn)(dict_t *this, char *key, data_t *value, void *data), void *data)
Definition: dict.c:1349
dict_del
void dict_del(dict_t *this, char *key)
Definition: dict.c:602
dict_set_str
int dict_set_str(dict_t *this, char *key, char *str)
Definition: dict.c:2410
dict_get_int16
int dict_get_int16(dict_t *this, char *key, int16_t *val)
Definition: dict.c:1719
data_destroy
void data_destroy(data_t *data)
Definition: dict.c:293
_data::data
char * data
Definition: dict.h:98
data_ref
data_t * data_ref(data_t *data)
Definition: dict.c:781
dict_get_bin
int dict_get_bin(dict_t *this, char *key, void **ptr)
Definition: dict.c:2559
dict_dump_to_statedump
void dict_dump_to_statedump(dict_t *dict, char *dict_name, char *domain)
Definition: dict.c:3409
data_to_bin
void * data_to_bin(data_t *data)
Definition: dict.c:1236
data_to_ptr
void * data_to_ptr(data_t *data)
Definition: dict.c:1229
dict_copy_with_ref
dict_t * dict_copy_with_ref(dict_t *this, dict_t *new)
Definition: dict.c:1435
dict_key_count
int dict_key_count(dict_t *this)
Definition: dict.c:582
dict_set_gfuuid
int dict_set_gfuuid(dict_t *this, char *key, uuid_t uuid, bool is_static)
Definition: dict.c:2655
data_to_uint64
uint64_t data_to_uint64(data_t *data)
Definition: dict.c:1164
dict_set_dynstrn
int dict_set_dynstrn(dict_t *this, char *key, const int keylen, char *str)
Definition: dict.c:2494
dict_get_uint32
int dict_get_uint32(dict_t *this, char *key, uint32_t *val)
Definition: dict.c:1946
_data_pair::value
data_t * value
Definition: dict.h:109
dict_deln
void dict_deln(dict_t *this, char *key, const int keylen)
Definition: dict.c:614
name
char * name
Definition: xdr-nfs3.h:948
_dict::members_internal
data_pair_t * members_internal
Definition: dict.h:123
dict_set_int32n
int dict_set_int32n(dict_t *this, char *key, const int keylen, int32_t val)
Definition: dict.c:1817
dict_get_gfuuid
int dict_get_gfuuid(dict_t *this, char *key, uuid_t *uuid)
Definition: dict.c:2662
GF_MUST_CHECK
#define GF_MUST_CHECK
Definition: glusterfs.h:766
dict_set_dynstr
int dict_set_dynstr(dict_t *this, char *key, char *str)
Definition: dict.c:2487
dict_serialized_length_lk
int dict_serialized_length_lk(dict_t *this)
Definition: dict.c:2871
dict_set_uint64
int dict_set_uint64(dict_t *this, char *key, uint64_t val)
Definition: dict.c:2017
dict_get_with_refn
int dict_get_with_refn(dict_t *this, char *key, const int keylen, data_t **data)
Definition: dict.c:1476
data_unref
void data_unref(data_t *data)
Definition: dict.c:764
dict_serialize_value_with_delim
int dict_serialize_value_with_delim(dict_t *this, char *buf, int32_t *serz_len, char delimiter)
Definition: dict.c:3332
dict_set
int32_t dict_set(dict_t *this, char *key, data_t *value)
Definition: dict.c:474
str_to_data
data_t * str_to_data(char *value)
Definition: dict.c:1001
_dict::refcount
gf_atomic_int64_t refcount
Definition: dict.h:118
dict_get_uint16
int dict_get_uint16(dict_t *this, char *key, uint16_t *val)
Definition: dict.c:1901
dict_rename_key
int dict_rename_key(dict_t *this, char *key, char *replace_key)
Definition: dict.c:2812
dict_ref
dict_t * dict_ref(dict_t *dict)
Definition: dict.c:751
_data_pair::hash_next
struct _data_pair * hash_next
Definition: dict.h:106
_dict::free_pair
data_pair_t free_pair
Definition: dict.h:124
dict_set_int64
int dict_set_int64(dict_t *this, char *key, int64_t val)
Definition: dict.c:1882
dict_set_mdata
int dict_set_mdata(dict_t *this, char *key, struct mdata_iatt *mdata, bool is_static)
Definition: dict.c:2687
data_from_dynptr
data_t * data_from_dynptr(void *value, int32_t len)
Definition: dict.c:1055
dict_get_int64
int dict_get_int64(dict_t *this, char *key, int64_t *val)
Definition: dict.c:1856
dict_allocate_and_serialize
int32_t dict_allocate_and_serialize(dict_t *this, char **buf, u_int *length)
Definition: dict.c:3218
gf_dict_data_type_t
gf_dict_data_type_t
Definition: glusterfs-fops.h:226
data_from_int16
data_t * data_from_int16(int16_t value)
Definition: dict.c:857
_dict::extra_stdfree
char * extra_stdfree
Definition: dict.h:121
dict_set_bin
int dict_set_bin(dict_t *this, char *key, void *ptr, size_t size)
Definition: dict.c:2633
_dict::count
int32_t count
Definition: dict.h:117
dict_get_iatt
int dict_get_iatt(dict_t *this, char *key, struct iatt *iatt)
Definition: dict.c:2733
dict_get_ptr
int dict_get_ptr(dict_t *this, char *key, void **ptr)
Definition: dict.c:2297
dict_set_int16
int dict_set_int16(dict_t *this, char *key, int16_t val)
Definition: dict.c:1745
strn_to_data
data_t * strn_to_data(char *value, const int vallen)
Definition: dict.c:1013
_data_pair::key_hash
uint32_t key_hash
Definition: dict.h:111
_dict
Definition: dict.h:114
dict_foreach_match
int dict_foreach_match(dict_t *dict, bool(*match)(dict_t *this, char *key, data_t *value, void *mdata), void *match_data, int(*action)(dict_t *this, char *key, data_t *value, void *adata), void *action_data)
Definition: dict.c:1304
_data_pair
Definition: dict.h:105
dict_set_uint32
int dict_set_uint32(dict_t *this, char *key, uint32_t val)
Definition: dict.c:1972
common-utils.h
dict_get_with_ref
int dict_get_with_ref(dict_t *this, char *key, data_t **data)
Definition: dict.c:1464
dict_setn
int32_t dict_setn(dict_t *this, char *key, const int keylen, data_t *value)
Definition: dict.c:483
gf_atomic_t
#define gf_atomic_t
Definition: atomic.h:111
are_dicts_equal
bool are_dicts_equal(dict_t *one, dict_t *two, bool(*match)(dict_t *d, char *k, data_t *v, void *data), bool(*value_ignore)(char *k))
Definition: dict.c:249
data_to_int32
int32_t data_to_int32(data_t *data)
Definition: dict.c:1112
dict_unref
void dict_unref(dict_t *dict)
Definition: dict.c:734
dict_set_static_ptr
int dict_set_static_ptr(dict_t *this, char *key, void *ptr)
Definition: dict.c:2259
data_to_uint8
uint8_t data_to_uint8(data_t *data)
Definition: dict.c:1202
dict_get_int8
int dict_get_int8(dict_t *this, char *key, int8_t *val)
Definition: dict.c:1673
dict_set_int8
int dict_set_int8(dict_t *this, char *key, int8_t val)
Definition: dict.c:1699
dict_dump_to_log
void dict_dump_to_log(dict_t *dict)
Definition: dict.c:3375
dict_dump_to_str
int dict_dump_to_str(dict_t *dict, char *dump, int dumpsize, char *format)
Definition: dict.c:3354
dict_new
dict_t * dict_new(void)
Definition: dict.c:107
dict_serialize
int32_t dict_serialize(dict_t *dict, char *buf)
Definition: dict.c:3044
_data::data_type
gf_dict_data_type_t data_type
Definition: dict.h:100
dict_get_int32n
int dict_get_int32n(dict_t *this, char *key, const int keylen, int32_t *val)
Definition: dict.c:1765