summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1aa4295)
raw | patch | inline | side by side (parent: 1aa4295)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 5 Jun 2016 14:44:39 +0000 (16:44 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 25 Sep 2016 10:42:45 +0000 (12:42 +0200) |
This serves two purposes:
- Allow field values of arbitrary length.
- Reuse the identifier in other places.
Renamed identifier_t from utils_vl_lookup to lookup_identifier_t.
- Allow field values of arbitrary length.
- Reuse the identifier in other places.
Renamed identifier_t from utils_vl_lookup to lookup_identifier_t.
diff --git a/src/aggregation.c b/src/aggregation.c
index 2744c89ecb8a9caff99bc543555dd72660a2719d..bb37b858fd846737bd48c204434b5257287d2f48 100644 (file)
--- a/src/aggregation.c
+++ b/src/aggregation.c
struct aggregation_s /* {{{ */
{
- identifier_t ident;
+ lookup_identifier_t ident;
unsigned int group_by;
unsigned int regex_fields;
struct agg_instance_s /* {{{ */
{
pthread_mutex_t lock;
- identifier_t ident;
+ lookup_identifier_t ident;
int ds_type;
diff --git a/src/daemon/plugin.h b/src/daemon/plugin.h
index de42c068f536bf462d86659b30d677b9efaaeb1f..c4cf566dba109e279b5e499d197d9b50eb657802 100644 (file)
--- a/src/daemon/plugin.h
+++ b/src/daemon/plugin.h
/*
* Public data types
*/
+struct identifier_s
+{
+ char *host;
+ char *plugin;
+ char *plugin_instance;
+ char *type;
+ char *type_instance;
+};
+typedef struct identifier_s identifier_t;
+
typedef unsigned long long counter_t;
typedef double gauge_t;
typedef int64_t derive_t;
diff --git a/src/utils_vl_lookup.c b/src/utils_vl_lookup.c
index 2ca9ddf8e551bd43691dd9b3f4b5d0f3c54188b9..226ba0ba39f44d79af6bd279fef778fddb8c41ab 100644 (file)
--- a/src/utils_vl_lookup.c
+++ b/src/utils_vl_lookup.c
struct user_obj_s
{
void *user_obj;
- identifier_t ident;
+ lookup_identifier_t ident;
user_obj_t *next;
};
} /* }}} int lu_copy_ident_to_match_part */
static int lu_copy_ident_to_match (identifier_match_t *match, /* {{{ */
- identifier_t const *ident, unsigned int group_by)
+ lookup_identifier_t const *ident, unsigned int group_by)
{
memset (match, 0, sizeof (*match));
} /* }}} void lookup_destroy */
int lookup_add (lookup_t *obj, /* {{{ */
- identifier_t const *ident, unsigned int group_by, void *user_class)
+ lookup_identifier_t const *ident, unsigned int group_by, void *user_class)
{
by_type_entry_t *by_type = NULL;
user_class_list_t *user_class_obj;
diff --git a/src/utils_vl_lookup.h b/src/utils_vl_lookup.h
index 1d01ebdf2978a32b924e21fe844c6cc87793c37e..e46e7637780ad72f75c59bb8b82bc9c045517066 100644 (file)
--- a/src/utils_vl_lookup.h
+++ b/src/utils_vl_lookup.h
* freed. */
typedef void (*lookup_free_obj_callback_t) (void *user_obj);
-struct identifier_s
+struct lookup_identifier_s
{
char host[DATA_MAX_NAME_LEN];
char plugin[DATA_MAX_NAME_LEN];
char type[DATA_MAX_NAME_LEN];
char type_instance[DATA_MAX_NAME_LEN];
};
-typedef struct identifier_s identifier_t;
+typedef struct lookup_identifier_s lookup_identifier_t;
#define LU_GROUP_BY_HOST 0x01
#define LU_GROUP_BY_PLUGIN 0x02
void lookup_destroy (lookup_t *obj);
int lookup_add (lookup_t *obj,
- identifier_t const *ident, unsigned int group_by, void *user_class);
+ lookup_identifier_t const *ident, unsigned int group_by, void *user_class);
/* TODO(octo): Pass lookup_obj_callback_t to lookup_search()? */
int lookup_search (lookup_t *obj,
index 44660638c4234b79a85e77566f338b7383f33bcd..b3765e9f41d74b1067b2085d52995bdd940e865a 100644 (file)
static _Bool expect_new_obj = 0;
static _Bool have_new_obj = 0;
-static identifier_t last_class_ident;
-static identifier_t last_obj_ident;
+static lookup_identifier_t last_class_ident;
+static lookup_identifier_t last_obj_ident;
static data_source_t dsrc_test = { "value", DS_TYPE_DERIVE, 0.0, NAN };
static data_set_t const ds_test = { "test", 1, &dsrc_test };
value_list_t const *vl,
void *user_class, void *user_obj)
{
- identifier_t *class = user_class;
- identifier_t *obj = user_obj;
+ lookup_identifier_t *class = user_class;
+ lookup_identifier_t *obj = user_obj;
OK1(expect_new_obj == have_new_obj,
(expect_new_obj ? "New obj is created." : "Updating existing obj."));
static void *lookup_class_callback (data_set_t const *ds,
value_list_t const *vl, void *user_class)
{
- identifier_t *class = user_class;
- identifier_t *obj;
+ lookup_identifier_t *class = user_class;
+ lookup_identifier_t *obj;
assert (expect_new_obj);
char const *type, char const *type_instance,
unsigned int group_by)
{
- identifier_t ident;
+ lookup_identifier_t ident;
void *user_class;
strncpy (ident.host, host, sizeof (ident.host));