2 * collectd - src/utils_cache.c
3 * Copyright (C) 2007-2010 Florian octo Forster
4 * Copyright (C) 2016 Sebastian tokkee Harl
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
25 * Florian octo Forster <octo at collectd.org>
26 * Sebastian tokkee Harl <sh at tokkee.org>
33 #include "utils_avltree.h"
34 #include "utils_cache.h"
35 #include "meta_data.h"
39 typedef struct cache_entry_s
41 char name[6 * DATA_MAX_NAME_LEN];
43 gauge_t *values_gauge;
45 /* Time contained in the package
46 * (for calculating rates) */
48 /* Time according to the local clock
49 * (for purging old entries) */
51 /* Interval in which the data is collected
52 * (for purging old entries) */
58 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
59 * ! 0 ! 1 ! 2 ! 3 ! 4 ! 5 ! 6 ! 7 ! 8 ! ...
60 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
61 * ! ds0 ! ds1 ! ds2 ! ds0 ! ds1 ! ds2 ! ds0 ! ds1 ! ds2 ! ...
62 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
63 * ! t = 0 ! t = 1 ! t = 2 ! ...
64 * +-----------------+-----------------+-----------------+----
67 size_t history_index; /* points to the next position to write to. */
68 size_t history_length;
74 c_avl_iterator_t *iter;
80 static c_avl_tree_t *cache_tree = NULL;
81 static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
83 static int cache_compare (const cache_entry_t *a, const cache_entry_t *b)
86 assert ((a != NULL) && (b != NULL));
88 return (strcmp (a->name, b->name));
89 } /* int cache_compare */
91 static cache_entry_t *cache_alloc (size_t values_num)
95 ce = calloc (1, sizeof (*ce));
98 ERROR ("utils_cache: cache_alloc: calloc failed.");
101 ce->values_num = values_num;
103 ce->values_gauge = calloc (values_num, sizeof (*ce->values_gauge));
104 ce->values_raw = calloc (values_num, sizeof (*ce->values_raw));
105 if ((ce->values_gauge == NULL) || (ce->values_raw == NULL))
107 sfree (ce->values_gauge);
108 sfree (ce->values_raw);
110 ERROR ("utils_cache: cache_alloc: calloc failed.");
115 ce->history_length = 0;
119 } /* cache_entry_t *cache_alloc */
121 static void cache_free (cache_entry_t *ce)
126 sfree (ce->values_gauge);
127 sfree (ce->values_raw);
129 if (ce->meta != NULL)
131 meta_data_destroy (ce->meta);
135 } /* void cache_free */
137 static void uc_check_range (const data_set_t *ds, cache_entry_t *ce)
141 for (i = 0; i < ds->ds_num; i++)
143 if (isnan (ce->values_gauge[i]))
145 else if (ce->values_gauge[i] < ds->ds[i].min)
146 ce->values_gauge[i] = NAN;
147 else if (ce->values_gauge[i] > ds->ds[i].max)
148 ce->values_gauge[i] = NAN;
150 } /* void uc_check_range */
152 static int uc_insert (const data_set_t *ds, const value_list_t *vl,
159 /* `cache_lock' has been locked by `uc_update' */
161 key_copy = strdup (key);
162 if (key_copy == NULL)
164 ERROR ("uc_insert: strdup failed.");
168 ce = cache_alloc (ds->ds_num);
172 ERROR ("uc_insert: cache_alloc (%zu) failed.", ds->ds_num);
176 sstrncpy (ce->name, key, sizeof (ce->name));
178 for (i = 0; i < ds->ds_num; i++)
180 switch (ds->ds[i].type)
182 case DS_TYPE_COUNTER:
183 ce->values_gauge[i] = NAN;
184 ce->values_raw[i].counter = vl->values[i].counter;
188 ce->values_gauge[i] = vl->values[i].gauge;
189 ce->values_raw[i].gauge = vl->values[i].gauge;
193 ce->values_gauge[i] = NAN;
194 ce->values_raw[i].derive = vl->values[i].derive;
197 case DS_TYPE_ABSOLUTE:
198 ce->values_gauge[i] = NAN;
199 if (vl->interval > 0)
200 ce->values_gauge[i] = ((double) vl->values[i].absolute)
201 / CDTIME_T_TO_DOUBLE (vl->interval);
202 ce->values_raw[i].absolute = vl->values[i].absolute;
206 /* This shouldn't happen. */
207 ERROR ("uc_insert: Don't know how to handle data source type %i.",
212 } /* switch (ds->ds[i].type) */
215 /* Prune invalid gauge data */
216 uc_check_range (ds, ce);
218 ce->last_time = vl->time;
219 ce->last_update = cdtime ();
220 ce->interval = vl->interval;
221 ce->state = STATE_OKAY;
223 if (c_avl_insert (cache_tree, key_copy, ce) != 0)
226 ERROR ("uc_insert: c_avl_insert failed.");
230 DEBUG ("uc_insert: Added %s to the cache.", key);
232 } /* int uc_insert */
236 if (cache_tree == NULL)
237 cache_tree = c_avl_create ((int (*) (const void *, const void *))
243 int uc_check_timeout (void)
249 cdtime_t *keys_time = NULL;
250 cdtime_t *keys_interval = NULL;
254 c_avl_iterator_t *iter;
259 pthread_mutex_lock (&cache_lock);
263 /* Build a list of entries to be flushed */
264 iter = c_avl_get_iterator (cache_tree);
265 while (c_avl_iterator_next (iter, (void *) &key, (void *) &ce) == 0)
270 /* If the entry is fresh enough, continue. */
271 if ((now - ce->last_update) < (ce->interval * timeout_g))
274 /* If entry has not been updated, add to `keys' array */
275 tmp = realloc ((void *) keys,
276 (keys_len + 1) * sizeof (char *));
279 ERROR ("uc_check_timeout: realloc failed.");
284 tmp_time = realloc (keys_time, (keys_len + 1) * sizeof (*keys_time));
285 if (tmp_time == NULL)
287 ERROR ("uc_check_timeout: realloc failed.");
290 keys_time = tmp_time;
292 tmp_time = realloc (keys_interval, (keys_len + 1) * sizeof (*keys_interval));
293 if (tmp_time == NULL)
295 ERROR ("uc_check_timeout: realloc failed.");
298 keys_interval = tmp_time;
300 keys[keys_len] = strdup (key);
301 if (keys[keys_len] == NULL)
303 ERROR ("uc_check_timeout: strdup failed.");
306 keys_time[keys_len] = ce->last_time;
307 keys_interval[keys_len] = ce->interval;
310 } /* while (c_avl_iterator_next) */
312 c_avl_iterator_destroy (iter);
313 pthread_mutex_unlock (&cache_lock);
317 /* realloc() may have been called for these. */
320 sfree (keys_interval);
324 /* Call the "missing" callback for each value. Do this before removing the
325 * value from the cache, so that callbacks can still access the data stored,
326 * including plugin specific meta data, rates, history, …. This must be done
327 * without holding the lock, otherwise we will run into a deadlock if a
328 * plugin calls the cache interface. */
329 for (i = 0; i < keys_len; i++)
331 value_list_t vl = VALUE_LIST_INIT;
337 status = parse_identifier_vl (keys[i], &vl);
340 ERROR ("uc_check_timeout: parse_identifier_vl (\"%s\") failed.", keys[i]);
344 vl.time = keys_time[i];
345 vl.interval = keys_interval[i];
347 plugin_dispatch_missing (&vl);
348 } /* for (i = 0; i < keys_len; i++) */
350 /* Now actually remove all the values from the cache. We don't re-evaluate
351 * the timestamp again, so in theory it is possible we remove a value after
352 * it is updated here. */
353 pthread_mutex_lock (&cache_lock);
354 for (i = 0; i < keys_len; i++)
359 status = c_avl_remove (cache_tree, keys[i],
360 (void *) &key, (void *) &ce);
363 ERROR ("uc_check_timeout: c_avl_remove (\"%s\") failed.", keys[i]);
371 } /* for (i = 0; i < keys_len; i++) */
372 pthread_mutex_unlock (&cache_lock);
376 sfree (keys_interval);
379 } /* int uc_check_timeout */
381 int uc_update (const data_set_t *ds, const value_list_t *vl)
383 char name[6 * DATA_MAX_NAME_LEN];
384 cache_entry_t *ce = NULL;
388 if (FORMAT_VL (name, sizeof (name), vl) != 0)
390 ERROR ("uc_update: FORMAT_VL failed.");
394 pthread_mutex_lock (&cache_lock);
396 status = c_avl_get (cache_tree, name, (void *) &ce);
397 if (status != 0) /* entry does not yet exist */
399 status = uc_insert (ds, vl, name);
400 pthread_mutex_unlock (&cache_lock);
405 assert (ce->values_num == ds->ds_num);
407 if (ce->last_time >= vl->time)
409 pthread_mutex_unlock (&cache_lock);
410 NOTICE ("uc_update: Value too old: name = %s; value time = %.3f; "
411 "last cache update = %.3f;",
413 CDTIME_T_TO_DOUBLE (vl->time),
414 CDTIME_T_TO_DOUBLE (ce->last_time));
418 for (i = 0; i < ds->ds_num; i++)
420 switch (ds->ds[i].type)
422 case DS_TYPE_COUNTER:
424 counter_t diff = counter_diff (ce->values_raw[i].counter, vl->values[i].counter);
425 ce->values_gauge[i] = ((double) diff)
426 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
427 ce->values_raw[i].counter = vl->values[i].counter;
432 ce->values_raw[i].gauge = vl->values[i].gauge;
433 ce->values_gauge[i] = vl->values[i].gauge;
438 derive_t diff = vl->values[i].derive - ce->values_raw[i].derive;
440 ce->values_gauge[i] = ((double) diff)
441 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
442 ce->values_raw[i].derive = vl->values[i].derive;
446 case DS_TYPE_ABSOLUTE:
447 ce->values_gauge[i] = ((double) vl->values[i].absolute)
448 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
449 ce->values_raw[i].absolute = vl->values[i].absolute;
453 /* This shouldn't happen. */
454 pthread_mutex_unlock (&cache_lock);
455 ERROR ("uc_update: Don't know how to handle data source type %i.",
458 } /* switch (ds->ds[i].type) */
460 DEBUG ("uc_update: %s: ds[%zu] = %lf", name, i, ce->values_gauge[i]);
463 /* Update the history if it exists. */
464 if (ce->history != NULL)
466 assert (ce->history_index < ce->history_length);
467 for (i = 0; i < ce->values_num; i++)
469 size_t hist_idx = (ce->values_num * ce->history_index) + i;
470 ce->history[hist_idx] = ce->values_gauge[i];
473 assert (ce->history_length > 0);
474 ce->history_index = (ce->history_index + 1) % ce->history_length;
477 /* Prune invalid gauge data */
478 uc_check_range (ds, ce);
480 ce->last_time = vl->time;
481 ce->last_update = cdtime ();
482 ce->interval = vl->interval;
484 pthread_mutex_unlock (&cache_lock);
487 } /* int uc_update */
489 int uc_get_rate_by_name (const char *name, gauge_t **ret_values, size_t *ret_values_num)
493 cache_entry_t *ce = NULL;
496 pthread_mutex_lock (&cache_lock);
498 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
502 /* remove missing values from getval */
503 if (ce->state == STATE_MISSING)
509 ret_num = ce->values_num;
510 ret = malloc (ret_num * sizeof (*ret));
513 ERROR ("utils_cache: uc_get_rate_by_name: malloc failed.");
518 memcpy (ret, ce->values_gauge, ret_num * sizeof (gauge_t));
524 DEBUG ("utils_cache: uc_get_rate_by_name: No such value: %s", name);
528 pthread_mutex_unlock (&cache_lock);
533 *ret_values_num = ret_num;
537 } /* gauge_t *uc_get_rate_by_name */
539 gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl)
541 char name[6 * DATA_MAX_NAME_LEN];
546 if (FORMAT_VL (name, sizeof (name), vl) != 0)
548 ERROR ("utils_cache: uc_get_rate: FORMAT_VL failed.");
552 status = uc_get_rate_by_name (name, &ret, &ret_num);
556 /* This is important - the caller has no other way of knowing how many
557 * values are returned. */
558 if (ret_num != (size_t) ds->ds_num)
560 ERROR ("utils_cache: uc_get_rate: ds[%s] has %zu values, "
561 "but uc_get_rate_by_name returned %zu.",
562 ds->type, ds->ds_num, ret_num);
568 } /* gauge_t *uc_get_rate */
570 size_t uc_get_size (void) {
571 size_t size_arrays = 0;
573 pthread_mutex_lock (&cache_lock);
574 size_arrays = (size_t) c_avl_size (cache_tree);
575 pthread_mutex_unlock (&cache_lock);
577 return (size_arrays);
580 int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number)
582 c_avl_iterator_t *iter;
584 cache_entry_t *value;
587 cdtime_t *times = NULL;
589 size_t size_arrays = 0;
593 if ((ret_names == NULL) || (ret_number == NULL))
596 pthread_mutex_lock (&cache_lock);
598 size_arrays = (size_t) c_avl_size (cache_tree);
601 /* Handle the "no values" case here, to avoid the error message when
602 * calloc() returns NULL. */
603 pthread_mutex_unlock (&cache_lock);
607 names = calloc (size_arrays, sizeof (*names));
608 times = calloc (size_arrays, sizeof (*times));
609 if ((names == NULL) || (times == NULL))
611 ERROR ("uc_get_names: calloc failed.");
614 pthread_mutex_unlock (&cache_lock);
618 iter = c_avl_get_iterator (cache_tree);
619 while (c_avl_iterator_next (iter, (void *) &key, (void *) &value) == 0)
621 /* remove missing values when list values */
622 if (value->state == STATE_MISSING)
625 /* c_avl_size does not return a number smaller than the number of elements
626 * returned by c_avl_iterator_next. */
627 assert (number < size_arrays);
629 if (ret_times != NULL)
630 times[number] = value->last_time;
632 names[number] = strdup (key);
633 if (names[number] == NULL)
640 } /* while (c_avl_iterator_next) */
642 c_avl_iterator_destroy (iter);
643 pthread_mutex_unlock (&cache_lock);
649 for (i = 0; i < number; i++)
660 if (ret_times != NULL)
664 *ret_number = number;
667 } /* int uc_get_names */
669 int uc_get_state (const data_set_t *ds, const value_list_t *vl)
671 char name[6 * DATA_MAX_NAME_LEN];
672 cache_entry_t *ce = NULL;
673 int ret = STATE_ERROR;
675 if (FORMAT_VL (name, sizeof (name), vl) != 0)
677 ERROR ("uc_get_state: FORMAT_VL failed.");
678 return (STATE_ERROR);
681 pthread_mutex_lock (&cache_lock);
683 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
689 pthread_mutex_unlock (&cache_lock);
692 } /* int uc_get_state */
694 int uc_set_state (const data_set_t *ds, const value_list_t *vl, int state)
696 char name[6 * DATA_MAX_NAME_LEN];
697 cache_entry_t *ce = NULL;
700 if (FORMAT_VL (name, sizeof (name), vl) != 0)
702 ERROR ("uc_set_state: FORMAT_VL failed.");
703 return (STATE_ERROR);
706 pthread_mutex_lock (&cache_lock);
708 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
715 pthread_mutex_unlock (&cache_lock);
718 } /* int uc_set_state */
720 int uc_get_history_by_name (const char *name,
721 gauge_t *ret_history, size_t num_steps, size_t num_ds)
723 cache_entry_t *ce = NULL;
727 pthread_mutex_lock (&cache_lock);
729 status = c_avl_get (cache_tree, name, (void *) &ce);
732 pthread_mutex_unlock (&cache_lock);
736 if (((size_t) ce->values_num) != num_ds)
738 pthread_mutex_unlock (&cache_lock);
742 /* Check if there are enough values available. If not, increase the buffer
744 if (ce->history_length < num_steps)
748 tmp = realloc (ce->history, sizeof (*ce->history)
749 * num_steps * ce->values_num);
752 pthread_mutex_unlock (&cache_lock);
756 for (i = ce->history_length * ce->values_num;
757 i < (num_steps * ce->values_num);
762 ce->history_length = num_steps;
763 } /* if (ce->history_length < num_steps) */
765 /* Copy the values to the output buffer. */
766 for (i = 0; i < num_steps; i++)
771 if (i < ce->history_index)
772 src_index = ce->history_index - (i + 1);
774 src_index = ce->history_length + ce->history_index - (i + 1);
775 src_index = src_index * num_ds;
777 dst_index = i * num_ds;
779 memcpy (ret_history + dst_index, ce->history + src_index,
780 sizeof (*ret_history) * num_ds);
783 pthread_mutex_unlock (&cache_lock);
786 } /* int uc_get_history_by_name */
788 int uc_get_history (const data_set_t *ds, const value_list_t *vl,
789 gauge_t *ret_history, size_t num_steps, size_t num_ds)
791 char name[6 * DATA_MAX_NAME_LEN];
793 if (FORMAT_VL (name, sizeof (name), vl) != 0)
795 ERROR ("utils_cache: uc_get_history: FORMAT_VL failed.");
799 return (uc_get_history_by_name (name, ret_history, num_steps, num_ds));
800 } /* int uc_get_history */
802 int uc_get_hits (const data_set_t *ds, const value_list_t *vl)
804 char name[6 * DATA_MAX_NAME_LEN];
805 cache_entry_t *ce = NULL;
806 int ret = STATE_ERROR;
808 if (FORMAT_VL (name, sizeof (name), vl) != 0)
810 ERROR ("uc_get_hits: FORMAT_VL failed.");
811 return (STATE_ERROR);
814 pthread_mutex_lock (&cache_lock);
816 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
822 pthread_mutex_unlock (&cache_lock);
825 } /* int uc_get_hits */
827 int uc_set_hits (const data_set_t *ds, const value_list_t *vl, int hits)
829 char name[6 * DATA_MAX_NAME_LEN];
830 cache_entry_t *ce = NULL;
833 if (FORMAT_VL (name, sizeof (name), vl) != 0)
835 ERROR ("uc_set_hits: FORMAT_VL failed.");
836 return (STATE_ERROR);
839 pthread_mutex_lock (&cache_lock);
841 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
848 pthread_mutex_unlock (&cache_lock);
851 } /* int uc_set_hits */
853 int uc_inc_hits (const data_set_t *ds, const value_list_t *vl, int step)
855 char name[6 * DATA_MAX_NAME_LEN];
856 cache_entry_t *ce = NULL;
859 if (FORMAT_VL (name, sizeof (name), vl) != 0)
861 ERROR ("uc_inc_hits: FORMAT_VL failed.");
862 return (STATE_ERROR);
865 pthread_mutex_lock (&cache_lock);
867 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
871 ce->hits = ret + step;
874 pthread_mutex_unlock (&cache_lock);
877 } /* int uc_inc_hits */
882 uc_iter_t *uc_get_iterator (void)
886 iter = (uc_iter_t *) calloc(1, sizeof (*iter));
890 pthread_mutex_lock (&cache_lock);
892 iter->iter = c_avl_get_iterator (cache_tree);
893 if (iter->iter == NULL)
900 } /* uc_iter_t *uc_get_iterator */
902 int uc_iterator_next (uc_iter_t *iter, char **ret_name)
909 while ((status = c_avl_iterator_next (iter->iter,
910 (void *) &iter->name, (void *) &iter->entry)) == 0)
912 if (iter->entry->state == STATE_MISSING)
923 if (ret_name != NULL)
924 *ret_name = iter->name;
927 } /* int uc_iterator_next */
929 void uc_iterator_destroy (uc_iter_t *iter)
934 c_avl_iterator_destroy (iter->iter);
935 pthread_mutex_unlock (&cache_lock);
938 } /* void uc_iterator_destroy */
940 int uc_iterator_get_time (uc_iter_t *iter, cdtime_t *ret_time)
942 if ((iter == NULL) || (iter->entry == NULL) || (ret_time == NULL))
945 *ret_time = iter->entry->last_time;
947 } /* int uc_iterator_get_name */
949 int uc_iterator_get_values (uc_iter_t *iter, value_t **ret_values, size_t *ret_num)
953 if ((iter == NULL) || (iter->entry == NULL)
954 || (ret_values == NULL) || (ret_num == NULL))
957 *ret_values = calloc (iter->entry->values_num, sizeof(*iter->entry->values_raw));
958 if (*ret_values == NULL)
960 for (i = 0; i < iter->entry->values_num; ++i)
961 *ret_values[i] = iter->entry->values_raw[i];
963 *ret_num = iter->entry->values_num;
966 } /* int uc_iterator_get_values */
968 int uc_iterator_get_interval (uc_iter_t *iter, cdtime_t *ret_interval)
970 if ((iter == NULL) || (iter->entry == NULL) || (ret_interval == NULL))
973 *ret_interval = iter->entry->interval;
975 } /* int uc_iterator_get_name */
978 * Meta data interface
980 /* XXX: This function will acquire `cache_lock' but will not free it! */
981 static meta_data_t *uc_get_meta (const value_list_t *vl) /* {{{ */
983 char name[6 * DATA_MAX_NAME_LEN];
984 cache_entry_t *ce = NULL;
987 status = FORMAT_VL (name, sizeof (name), vl);
990 ERROR ("utils_cache: uc_get_meta: FORMAT_VL failed.");
994 pthread_mutex_lock (&cache_lock);
996 status = c_avl_get (cache_tree, name, (void *) &ce);
999 pthread_mutex_unlock (&cache_lock);
1002 assert (ce != NULL);
1004 if (ce->meta == NULL)
1005 ce->meta = meta_data_create ();
1007 if (ce->meta == NULL)
1008 pthread_mutex_unlock (&cache_lock);
1011 } /* }}} meta_data_t *uc_get_meta */
1013 /* Sorry about this preprocessor magic, but it really makes this file much
1015 #define UC_WRAP(wrap_function) { \
1016 meta_data_t *meta; \
1018 meta = uc_get_meta (vl); \
1019 if (meta == NULL) return (-1); \
1020 status = wrap_function (meta, key); \
1021 pthread_mutex_unlock (&cache_lock); \
1024 int uc_meta_data_exists (const value_list_t *vl, const char *key)
1025 UC_WRAP (meta_data_exists)
1027 int uc_meta_data_delete (const value_list_t *vl, const char *key)
1028 UC_WRAP (meta_data_delete)
1031 /* We need a new version of this macro because the following functions take
1033 #define UC_WRAP(wrap_function) { \
1034 meta_data_t *meta; \
1036 meta = uc_get_meta (vl); \
1037 if (meta == NULL) return (-1); \
1038 status = wrap_function (meta, key, value); \
1039 pthread_mutex_unlock (&cache_lock); \
1042 int uc_meta_data_add_string (const value_list_t *vl,
1045 UC_WRAP(meta_data_add_string)
1046 int uc_meta_data_add_signed_int (const value_list_t *vl,
1049 UC_WRAP(meta_data_add_signed_int)
1050 int uc_meta_data_add_unsigned_int (const value_list_t *vl,
1053 UC_WRAP(meta_data_add_unsigned_int)
1054 int uc_meta_data_add_double (const value_list_t *vl,
1057 UC_WRAP(meta_data_add_double)
1058 int uc_meta_data_add_boolean (const value_list_t *vl,
1061 UC_WRAP(meta_data_add_boolean)
1063 int uc_meta_data_get_string (const value_list_t *vl,
1066 UC_WRAP(meta_data_get_string)
1067 int uc_meta_data_get_signed_int (const value_list_t *vl,
1070 UC_WRAP(meta_data_get_signed_int)
1071 int uc_meta_data_get_unsigned_int (const value_list_t *vl,
1074 UC_WRAP(meta_data_get_unsigned_int)
1075 int uc_meta_data_get_double (const value_list_t *vl,
1078 UC_WRAP(meta_data_get_double)
1079 int uc_meta_data_get_boolean (const value_list_t *vl,
1082 UC_WRAP(meta_data_get_boolean)
1085 /* vim: set sw=2 ts=8 sts=2 tw=78 : */