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>
32 #include "utils_avltree.h"
33 #include "utils_cache.h"
34 #include "meta_data.h"
38 typedef struct cache_entry_s
40 char name[6 * DATA_MAX_NAME_LEN];
42 gauge_t *values_gauge;
44 /* Time contained in the package
45 * (for calculating rates) */
47 /* Time according to the local clock
48 * (for purging old entries) */
50 /* Interval in which the data is collected
51 * (for purging old entries) */
57 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
58 * ! 0 ! 1 ! 2 ! 3 ! 4 ! 5 ! 6 ! 7 ! 8 ! ...
59 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
60 * ! ds0 ! ds1 ! ds2 ! ds0 ! ds1 ! ds2 ! ds0 ! ds1 ! ds2 ! ...
61 * +-----+-----+-----+-----+-----+-----+-----+-----+-----+----
62 * ! t = 0 ! t = 1 ! t = 2 ! ...
63 * +-----------------+-----------------+-----------------+----
66 size_t history_index; /* points to the next position to write to. */
67 size_t history_length;
73 c_avl_iterator_t *iter;
79 static c_avl_tree_t *cache_tree = NULL;
80 static pthread_mutex_t cache_lock = PTHREAD_MUTEX_INITIALIZER;
82 static int cache_compare (const cache_entry_t *a, const cache_entry_t *b)
85 assert ((a != NULL) && (b != NULL));
87 return (strcmp (a->name, b->name));
88 } /* int cache_compare */
90 static cache_entry_t *cache_alloc (size_t values_num)
94 ce = calloc (1, sizeof (*ce));
97 ERROR ("utils_cache: cache_alloc: calloc failed.");
100 ce->values_num = values_num;
102 ce->values_gauge = calloc (values_num, sizeof (*ce->values_gauge));
103 ce->values_raw = calloc (values_num, sizeof (*ce->values_raw));
104 if ((ce->values_gauge == NULL) || (ce->values_raw == NULL))
106 sfree (ce->values_gauge);
107 sfree (ce->values_raw);
109 ERROR ("utils_cache: cache_alloc: calloc failed.");
114 ce->history_length = 0;
118 } /* cache_entry_t *cache_alloc */
120 static void cache_free (cache_entry_t *ce)
125 sfree (ce->values_gauge);
126 sfree (ce->values_raw);
128 if (ce->meta != NULL)
130 meta_data_destroy (ce->meta);
134 } /* void cache_free */
136 static void uc_check_range (const data_set_t *ds, cache_entry_t *ce)
140 for (i = 0; i < ds->ds_num; i++)
142 if (isnan (ce->values_gauge[i]))
144 else if (ce->values_gauge[i] < ds->ds[i].min)
145 ce->values_gauge[i] = NAN;
146 else if (ce->values_gauge[i] > ds->ds[i].max)
147 ce->values_gauge[i] = NAN;
149 } /* void uc_check_range */
151 static int uc_insert (const data_set_t *ds, const value_list_t *vl,
158 /* `cache_lock' has been locked by `uc_update' */
160 key_copy = strdup (key);
161 if (key_copy == NULL)
163 ERROR ("uc_insert: strdup failed.");
167 ce = cache_alloc (ds->ds_num);
171 ERROR ("uc_insert: cache_alloc (%zu) failed.", ds->ds_num);
175 sstrncpy (ce->name, key, sizeof (ce->name));
177 for (i = 0; i < ds->ds_num; i++)
179 switch (ds->ds[i].type)
181 case DS_TYPE_COUNTER:
182 ce->values_gauge[i] = NAN;
183 ce->values_raw[i].counter = vl->values[i].counter;
187 ce->values_gauge[i] = vl->values[i].gauge;
188 ce->values_raw[i].gauge = vl->values[i].gauge;
192 ce->values_gauge[i] = NAN;
193 ce->values_raw[i].derive = vl->values[i].derive;
196 case DS_TYPE_ABSOLUTE:
197 ce->values_gauge[i] = NAN;
198 if (vl->interval > 0)
199 ce->values_gauge[i] = ((double) vl->values[i].absolute)
200 / CDTIME_T_TO_DOUBLE (vl->interval);
201 ce->values_raw[i].absolute = vl->values[i].absolute;
205 /* This shouldn't happen. */
206 ERROR ("uc_insert: Don't know how to handle data source type %i.",
211 } /* switch (ds->ds[i].type) */
214 /* Prune invalid gauge data */
215 uc_check_range (ds, ce);
217 ce->last_time = vl->time;
218 ce->last_update = cdtime ();
219 ce->interval = vl->interval;
220 ce->state = STATE_OKAY;
222 if (c_avl_insert (cache_tree, key_copy, ce) != 0)
225 ERROR ("uc_insert: c_avl_insert failed.");
229 DEBUG ("uc_insert: Added %s to the cache.", key);
231 } /* int uc_insert */
235 if (cache_tree == NULL)
236 cache_tree = c_avl_create ((int (*) (const void *, const void *))
242 int uc_check_timeout (void)
248 cdtime_t *keys_time = NULL;
249 cdtime_t *keys_interval = NULL;
253 c_avl_iterator_t *iter;
258 pthread_mutex_lock (&cache_lock);
262 /* Build a list of entries to be flushed */
263 iter = c_avl_get_iterator (cache_tree);
264 while (c_avl_iterator_next (iter, (void *) &key, (void *) &ce) == 0)
269 /* If the entry is fresh enough, continue. */
270 if ((now - ce->last_update) < (ce->interval * timeout_g))
273 /* If entry has not been updated, add to `keys' array */
274 tmp = realloc ((void *) keys,
275 (keys_len + 1) * sizeof (char *));
278 ERROR ("uc_check_timeout: realloc failed.");
283 tmp_time = realloc (keys_time, (keys_len + 1) * sizeof (*keys_time));
284 if (tmp_time == NULL)
286 ERROR ("uc_check_timeout: realloc failed.");
289 keys_time = tmp_time;
291 tmp_time = realloc (keys_interval, (keys_len + 1) * sizeof (*keys_interval));
292 if (tmp_time == NULL)
294 ERROR ("uc_check_timeout: realloc failed.");
297 keys_interval = tmp_time;
299 keys[keys_len] = strdup (key);
300 if (keys[keys_len] == NULL)
302 ERROR ("uc_check_timeout: strdup failed.");
305 keys_time[keys_len] = ce->last_time;
306 keys_interval[keys_len] = ce->interval;
309 } /* while (c_avl_iterator_next) */
311 c_avl_iterator_destroy (iter);
312 pthread_mutex_unlock (&cache_lock);
316 /* realloc() may have been called for these. */
319 sfree (keys_interval);
323 /* Call the "missing" callback for each value. Do this before removing the
324 * value from the cache, so that callbacks can still access the data stored,
325 * including plugin specific meta data, rates, history, …. This must be done
326 * without holding the lock, otherwise we will run into a deadlock if a
327 * plugin calls the cache interface. */
328 for (i = 0; i < keys_len; i++)
330 value_list_t vl = VALUE_LIST_INIT;
336 status = parse_identifier_vl (keys[i], &vl);
339 ERROR ("uc_check_timeout: parse_identifier_vl (\"%s\") failed.", keys[i]);
343 vl.time = keys_time[i];
344 vl.interval = keys_interval[i];
346 plugin_dispatch_missing (&vl);
347 } /* for (i = 0; i < keys_len; i++) */
349 /* Now actually remove all the values from the cache. We don't re-evaluate
350 * the timestamp again, so in theory it is possible we remove a value after
351 * it is updated here. */
352 pthread_mutex_lock (&cache_lock);
353 for (i = 0; i < keys_len; i++)
358 status = c_avl_remove (cache_tree, keys[i],
359 (void *) &key, (void *) &ce);
362 ERROR ("uc_check_timeout: c_avl_remove (\"%s\") failed.", keys[i]);
370 } /* for (i = 0; i < keys_len; i++) */
371 pthread_mutex_unlock (&cache_lock);
375 sfree (keys_interval);
378 } /* int uc_check_timeout */
380 int uc_update (const data_set_t *ds, const value_list_t *vl)
382 char name[6 * DATA_MAX_NAME_LEN];
383 cache_entry_t *ce = NULL;
387 if (FORMAT_VL (name, sizeof (name), vl) != 0)
389 ERROR ("uc_update: FORMAT_VL failed.");
393 pthread_mutex_lock (&cache_lock);
395 status = c_avl_get (cache_tree, name, (void *) &ce);
396 if (status != 0) /* entry does not yet exist */
398 status = uc_insert (ds, vl, name);
399 pthread_mutex_unlock (&cache_lock);
404 assert (ce->values_num == ds->ds_num);
406 if (ce->last_time >= vl->time)
408 pthread_mutex_unlock (&cache_lock);
409 NOTICE ("uc_update: Value too old: name = %s; value time = %.3f; "
410 "last cache update = %.3f;",
412 CDTIME_T_TO_DOUBLE (vl->time),
413 CDTIME_T_TO_DOUBLE (ce->last_time));
417 for (i = 0; i < ds->ds_num; i++)
419 switch (ds->ds[i].type)
421 case DS_TYPE_COUNTER:
423 counter_t diff = counter_diff (ce->values_raw[i].counter, vl->values[i].counter);
424 ce->values_gauge[i] = ((double) diff)
425 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
426 ce->values_raw[i].counter = vl->values[i].counter;
431 ce->values_raw[i].gauge = vl->values[i].gauge;
432 ce->values_gauge[i] = vl->values[i].gauge;
437 derive_t diff = vl->values[i].derive - ce->values_raw[i].derive;
439 ce->values_gauge[i] = ((double) diff)
440 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
441 ce->values_raw[i].derive = vl->values[i].derive;
445 case DS_TYPE_ABSOLUTE:
446 ce->values_gauge[i] = ((double) vl->values[i].absolute)
447 / (CDTIME_T_TO_DOUBLE (vl->time - ce->last_time));
448 ce->values_raw[i].absolute = vl->values[i].absolute;
452 /* This shouldn't happen. */
453 pthread_mutex_unlock (&cache_lock);
454 ERROR ("uc_update: Don't know how to handle data source type %i.",
457 } /* switch (ds->ds[i].type) */
459 DEBUG ("uc_update: %s: ds[%zu] = %lf", name, i, ce->values_gauge[i]);
462 /* Update the history if it exists. */
463 if (ce->history != NULL)
465 assert (ce->history_index < ce->history_length);
466 for (i = 0; i < ce->values_num; i++)
468 size_t hist_idx = (ce->values_num * ce->history_index) + i;
469 ce->history[hist_idx] = ce->values_gauge[i];
472 assert (ce->history_length > 0);
473 ce->history_index = (ce->history_index + 1) % ce->history_length;
476 /* Prune invalid gauge data */
477 uc_check_range (ds, ce);
479 ce->last_time = vl->time;
480 ce->last_update = cdtime ();
481 ce->interval = vl->interval;
483 pthread_mutex_unlock (&cache_lock);
486 } /* int uc_update */
488 int uc_get_rate_by_name (const char *name, gauge_t **ret_values, size_t *ret_values_num)
492 cache_entry_t *ce = NULL;
495 pthread_mutex_lock (&cache_lock);
497 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
501 /* remove missing values from getval */
502 if (ce->state == STATE_MISSING)
508 ret_num = ce->values_num;
509 ret = malloc (ret_num * sizeof (*ret));
512 ERROR ("utils_cache: uc_get_rate_by_name: malloc failed.");
517 memcpy (ret, ce->values_gauge, ret_num * sizeof (gauge_t));
523 DEBUG ("utils_cache: uc_get_rate_by_name: No such value: %s", name);
527 pthread_mutex_unlock (&cache_lock);
532 *ret_values_num = ret_num;
536 } /* gauge_t *uc_get_rate_by_name */
538 gauge_t *uc_get_rate (const data_set_t *ds, const value_list_t *vl)
540 char name[6 * DATA_MAX_NAME_LEN];
545 if (FORMAT_VL (name, sizeof (name), vl) != 0)
547 ERROR ("utils_cache: uc_get_rate: FORMAT_VL failed.");
551 status = uc_get_rate_by_name (name, &ret, &ret_num);
555 /* This is important - the caller has no other way of knowing how many
556 * values are returned. */
557 if (ret_num != (size_t) ds->ds_num)
559 ERROR ("utils_cache: uc_get_rate: ds[%s] has %zu values, "
560 "but uc_get_rate_by_name returned %zu.",
561 ds->type, ds->ds_num, ret_num);
567 } /* gauge_t *uc_get_rate */
569 size_t uc_get_size (void) {
570 size_t size_arrays = 0;
572 pthread_mutex_lock (&cache_lock);
573 size_arrays = (size_t) c_avl_size (cache_tree);
574 pthread_mutex_unlock (&cache_lock);
576 return (size_arrays);
579 int uc_get_names (char ***ret_names, cdtime_t **ret_times, size_t *ret_number)
581 c_avl_iterator_t *iter;
583 cache_entry_t *value;
586 cdtime_t *times = NULL;
588 size_t size_arrays = 0;
592 if ((ret_names == NULL) || (ret_number == NULL))
595 pthread_mutex_lock (&cache_lock);
597 size_arrays = (size_t) c_avl_size (cache_tree);
600 /* Handle the "no values" case here, to avoid the error message when
601 * calloc() returns NULL. */
602 pthread_mutex_unlock (&cache_lock);
606 names = calloc (size_arrays, sizeof (*names));
607 times = calloc (size_arrays, sizeof (*times));
608 if ((names == NULL) || (times == NULL))
610 ERROR ("uc_get_names: calloc failed.");
613 pthread_mutex_unlock (&cache_lock);
617 iter = c_avl_get_iterator (cache_tree);
618 while (c_avl_iterator_next (iter, (void *) &key, (void *) &value) == 0)
620 /* remove missing values when list values */
621 if (value->state == STATE_MISSING)
624 /* c_avl_size does not return a number smaller than the number of elements
625 * returned by c_avl_iterator_next. */
626 assert (number < size_arrays);
628 if (ret_times != NULL)
629 times[number] = value->last_time;
631 names[number] = strdup (key);
632 if (names[number] == NULL)
639 } /* while (c_avl_iterator_next) */
641 c_avl_iterator_destroy (iter);
642 pthread_mutex_unlock (&cache_lock);
648 for (i = 0; i < number; i++)
659 if (ret_times != NULL)
663 *ret_number = number;
666 } /* int uc_get_names */
668 int uc_get_state (const data_set_t *ds, const value_list_t *vl)
670 char name[6 * DATA_MAX_NAME_LEN];
671 cache_entry_t *ce = NULL;
672 int ret = STATE_ERROR;
674 if (FORMAT_VL (name, sizeof (name), vl) != 0)
676 ERROR ("uc_get_state: FORMAT_VL failed.");
677 return (STATE_ERROR);
680 pthread_mutex_lock (&cache_lock);
682 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
688 pthread_mutex_unlock (&cache_lock);
691 } /* int uc_get_state */
693 int uc_set_state (const data_set_t *ds, const value_list_t *vl, int state)
695 char name[6 * DATA_MAX_NAME_LEN];
696 cache_entry_t *ce = NULL;
699 if (FORMAT_VL (name, sizeof (name), vl) != 0)
701 ERROR ("uc_set_state: FORMAT_VL failed.");
702 return (STATE_ERROR);
705 pthread_mutex_lock (&cache_lock);
707 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
714 pthread_mutex_unlock (&cache_lock);
717 } /* int uc_set_state */
719 int uc_get_history_by_name (const char *name,
720 gauge_t *ret_history, size_t num_steps, size_t num_ds)
722 cache_entry_t *ce = NULL;
726 pthread_mutex_lock (&cache_lock);
728 status = c_avl_get (cache_tree, name, (void *) &ce);
731 pthread_mutex_unlock (&cache_lock);
735 if (((size_t) ce->values_num) != num_ds)
737 pthread_mutex_unlock (&cache_lock);
741 /* Check if there are enough values available. If not, increase the buffer
743 if (ce->history_length < num_steps)
747 tmp = realloc (ce->history, sizeof (*ce->history)
748 * num_steps * ce->values_num);
751 pthread_mutex_unlock (&cache_lock);
755 for (i = ce->history_length * ce->values_num;
756 i < (num_steps * ce->values_num);
761 ce->history_length = num_steps;
762 } /* if (ce->history_length < num_steps) */
764 /* Copy the values to the output buffer. */
765 for (i = 0; i < num_steps; i++)
770 if (i < ce->history_index)
771 src_index = ce->history_index - (i + 1);
773 src_index = ce->history_length + ce->history_index - (i + 1);
774 src_index = src_index * num_ds;
776 dst_index = i * num_ds;
778 memcpy (ret_history + dst_index, ce->history + src_index,
779 sizeof (*ret_history) * num_ds);
782 pthread_mutex_unlock (&cache_lock);
785 } /* int uc_get_history_by_name */
787 int uc_get_history (const data_set_t *ds, const value_list_t *vl,
788 gauge_t *ret_history, size_t num_steps, size_t num_ds)
790 char name[6 * DATA_MAX_NAME_LEN];
792 if (FORMAT_VL (name, sizeof (name), vl) != 0)
794 ERROR ("utils_cache: uc_get_history: FORMAT_VL failed.");
798 return (uc_get_history_by_name (name, ret_history, num_steps, num_ds));
799 } /* int uc_get_history */
801 int uc_get_hits (const data_set_t *ds, const value_list_t *vl)
803 char name[6 * DATA_MAX_NAME_LEN];
804 cache_entry_t *ce = NULL;
805 int ret = STATE_ERROR;
807 if (FORMAT_VL (name, sizeof (name), vl) != 0)
809 ERROR ("uc_get_hits: FORMAT_VL failed.");
810 return (STATE_ERROR);
813 pthread_mutex_lock (&cache_lock);
815 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
821 pthread_mutex_unlock (&cache_lock);
824 } /* int uc_get_hits */
826 int uc_set_hits (const data_set_t *ds, const value_list_t *vl, int hits)
828 char name[6 * DATA_MAX_NAME_LEN];
829 cache_entry_t *ce = NULL;
832 if (FORMAT_VL (name, sizeof (name), vl) != 0)
834 ERROR ("uc_set_hits: FORMAT_VL failed.");
835 return (STATE_ERROR);
838 pthread_mutex_lock (&cache_lock);
840 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
847 pthread_mutex_unlock (&cache_lock);
850 } /* int uc_set_hits */
852 int uc_inc_hits (const data_set_t *ds, const value_list_t *vl, int step)
854 char name[6 * DATA_MAX_NAME_LEN];
855 cache_entry_t *ce = NULL;
858 if (FORMAT_VL (name, sizeof (name), vl) != 0)
860 ERROR ("uc_inc_hits: FORMAT_VL failed.");
861 return (STATE_ERROR);
864 pthread_mutex_lock (&cache_lock);
866 if (c_avl_get (cache_tree, name, (void *) &ce) == 0)
870 ce->hits = ret + step;
873 pthread_mutex_unlock (&cache_lock);
876 } /* int uc_inc_hits */
881 uc_iter_t *uc_get_iterator (void)
885 iter = (uc_iter_t *) calloc(1, sizeof (*iter));
889 pthread_mutex_lock (&cache_lock);
891 iter->iter = c_avl_get_iterator (cache_tree);
892 if (iter->iter == NULL)
899 } /* uc_iter_t *uc_get_iterator */
901 int uc_iterator_next (uc_iter_t *iter, char **ret_name)
908 while ((status = c_avl_iterator_next (iter->iter,
909 (void *) &iter->name, (void *) &iter->entry)) == 0)
911 if (iter->entry->state == STATE_MISSING)
922 if (ret_name != NULL)
923 *ret_name = iter->name;
926 } /* int uc_iterator_next */
928 void uc_iterator_destroy (uc_iter_t *iter)
933 c_avl_iterator_destroy (iter->iter);
934 pthread_mutex_unlock (&cache_lock);
937 } /* void uc_iterator_destroy */
939 int uc_iterator_get_time (uc_iter_t *iter, cdtime_t *ret_time)
941 if ((iter == NULL) || (iter->entry == NULL) || (ret_time == NULL))
944 *ret_time = iter->entry->last_time;
946 } /* int uc_iterator_get_name */
948 int uc_iterator_get_values (uc_iter_t *iter, value_t **ret_values, size_t *ret_num)
952 if ((iter == NULL) || (iter->entry == NULL)
953 || (ret_values == NULL) || (ret_num == NULL))
956 *ret_values = calloc (iter->entry->values_num, sizeof(*iter->entry->values_raw));
957 if (*ret_values == NULL)
959 for (i = 0; i < iter->entry->values_num; ++i)
960 *ret_values[i] = iter->entry->values_raw[i];
962 *ret_num = iter->entry->values_num;
965 } /* int uc_iterator_get_values */
967 int uc_iterator_get_interval (uc_iter_t *iter, cdtime_t *ret_interval)
969 if ((iter == NULL) || (iter->entry == NULL) || (ret_interval == NULL))
972 *ret_interval = iter->entry->interval;
974 } /* int uc_iterator_get_name */
977 * Meta data interface
979 /* XXX: This function will acquire `cache_lock' but will not free it! */
980 static meta_data_t *uc_get_meta (const value_list_t *vl) /* {{{ */
982 char name[6 * DATA_MAX_NAME_LEN];
983 cache_entry_t *ce = NULL;
986 status = FORMAT_VL (name, sizeof (name), vl);
989 ERROR ("utils_cache: uc_get_meta: FORMAT_VL failed.");
993 pthread_mutex_lock (&cache_lock);
995 status = c_avl_get (cache_tree, name, (void *) &ce);
998 pthread_mutex_unlock (&cache_lock);
1001 assert (ce != NULL);
1003 if (ce->meta == NULL)
1004 ce->meta = meta_data_create ();
1006 if (ce->meta == NULL)
1007 pthread_mutex_unlock (&cache_lock);
1010 } /* }}} meta_data_t *uc_get_meta */
1012 /* Sorry about this preprocessor magic, but it really makes this file much
1014 #define UC_WRAP(wrap_function) { \
1015 meta_data_t *meta; \
1017 meta = uc_get_meta (vl); \
1018 if (meta == NULL) return (-1); \
1019 status = wrap_function (meta, key); \
1020 pthread_mutex_unlock (&cache_lock); \
1023 int uc_meta_data_exists (const value_list_t *vl, const char *key)
1024 UC_WRAP (meta_data_exists)
1026 int uc_meta_data_delete (const value_list_t *vl, const char *key)
1027 UC_WRAP (meta_data_delete)
1030 /* We need a new version of this macro because the following functions take
1032 #define UC_WRAP(wrap_function) { \
1033 meta_data_t *meta; \
1035 meta = uc_get_meta (vl); \
1036 if (meta == NULL) return (-1); \
1037 status = wrap_function (meta, key, value); \
1038 pthread_mutex_unlock (&cache_lock); \
1041 int uc_meta_data_add_string (const value_list_t *vl,
1044 UC_WRAP(meta_data_add_string)
1045 int uc_meta_data_add_signed_int (const value_list_t *vl,
1048 UC_WRAP(meta_data_add_signed_int)
1049 int uc_meta_data_add_unsigned_int (const value_list_t *vl,
1052 UC_WRAP(meta_data_add_unsigned_int)
1053 int uc_meta_data_add_double (const value_list_t *vl,
1056 UC_WRAP(meta_data_add_double)
1057 int uc_meta_data_add_boolean (const value_list_t *vl,
1060 UC_WRAP(meta_data_add_boolean)
1062 int uc_meta_data_get_string (const value_list_t *vl,
1065 UC_WRAP(meta_data_get_string)
1066 int uc_meta_data_get_signed_int (const value_list_t *vl,
1069 UC_WRAP(meta_data_get_signed_int)
1070 int uc_meta_data_get_unsigned_int (const value_list_t *vl,
1073 UC_WRAP(meta_data_get_unsigned_int)
1074 int uc_meta_data_get_double (const value_list_t *vl,
1077 UC_WRAP(meta_data_get_double)
1078 int uc_meta_data_get_boolean (const value_list_t *vl,
1081 UC_WRAP(meta_data_get_boolean)
1084 /* vim: set sw=2 ts=8 sts=2 tw=78 : */