X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fcore%2Fstore.c;h=80beffbb2b15b5f389da7f435e4606b43fd6c742;hb=c435485f72b61ec60e1830ff85ba8aa633e3aa1b;hp=888fbb973449870ae82b5c2910a386e47a2481f9;hpb=ad0100d18b3e1b754a92f36ef91f52382b0b6ead;p=sysdb.git diff --git a/src/core/store.c b/src/core/store.c index 888fbb9..80beffb 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -1,5 +1,5 @@ /* - * syscollector - src/core/store.c + * SysDB - src/core/store.c * Copyright (C) 2012 Sebastian 'tokkee' Harl * All rights reserved. * @@ -25,10 +25,11 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "syscollector.h" +#include "sysdb.h" #include "core/store.h" +#include "core/error.h" +#include "core/plugin.h" #include "utils/llist.h" -#include "utils/string.h" #include @@ -41,406 +42,561 @@ #include /* - * private data types + * private variables */ -/* type used for looking up named objects */ -typedef struct { - sc_object_t parent; - const char *obj_name; -} sc_store_lookup_obj_t; -#define SC_STORE_LOOKUP_OBJ_INIT { SC_OBJECT_INIT, NULL } +static sdb_llist_t *obj_list = NULL; +static pthread_rwlock_t obj_lock = PTHREAD_RWLOCK_INITIALIZER; /* - * private variables + * private types */ -static sc_llist_t *host_list = NULL; -static pthread_rwlock_t host_lock = PTHREAD_RWLOCK_INITIALIZER; +static sdb_type_t sdb_store_obj_type; +static sdb_type_t sdb_attribute_type; -/* - * private helper functions - */ +struct store_obj; +typedef struct store_obj store_obj_t; + +struct store_obj { + sdb_object_t super; + sdb_time_t last_update; + store_obj_t *parent; +}; +#define STORE_OBJ(obj) ((store_obj_t *)(obj)) +#define STORE_CONST_OBJ(obj) ((const store_obj_t *)(obj)) + +typedef struct { + store_obj_t super; + + char *value; +} sdb_attribute_t; +#define SDB_ATTR(obj) ((sdb_attribute_t *)(obj)) +#define SDB_CONST_ATTR(obj) ((const sdb_attribute_t *)(obj)) + +typedef struct { + store_obj_t super; + + int type; + sdb_llist_t *children; + + sdb_llist_t *attributes; +} sdb_store_obj_t; +#define SDB_STORE_OBJ(obj) ((sdb_store_obj_t *)(obj)) +#define SDB_CONST_STORE_OBJ(obj) ((const sdb_store_obj_t *)(obj)) + +enum { + SDB_HOST = 1, + SDB_SERVICE, +}; + +/* shortcuts for accessing the sdb_store_obj_t attributes + * of inheriting objects */ +#define _last_update super.last_update static int -sc_store_obj_cmp_by_name(const sc_object_t *a, const sc_object_t *b) +store_obj_init(sdb_object_t *obj, va_list __attribute__((unused)) ap) +{ + store_obj_t *sobj = STORE_OBJ(obj); + sobj->last_update = sdb_gettime(); + /* ignore errors -> last_update will be updated later */ + + sobj->parent = NULL; + return 0; +} /* store_obj_init */ + +static void +store_obj_destroy(sdb_object_t *obj) { - const sc_store_obj_t *h1 = (const sc_store_obj_t *)a; - const sc_store_obj_t *h2 = (const sc_store_obj_t *)b; + const store_obj_t *sobj = STORE_OBJ(obj); - assert(h1 && h2); - return strcasecmp(h1->name, h2->name); -} /* sc_store_obj_cmp_by_name */ + if (sobj->parent) + sdb_object_deref(SDB_OBJ(sobj->parent)); +} /* store_obj_destroy */ -static int -sc_cmp_store_obj_with_name(const sc_object_t *a, const sc_object_t *b) +static sdb_object_t * +store_obj_clone(const sdb_object_t *obj) { - const sc_store_obj_t *obj = (const sc_store_obj_t *)a; - const sc_store_lookup_obj_t *lookup = (const sc_store_lookup_obj_t *)b; + const store_obj_t *sobj = STORE_CONST_OBJ(obj); + store_obj_t *new; + + new = STORE_OBJ(sdb_object_create(obj->name, obj->type)); + if (! new) + return NULL; - assert(obj && lookup); - return strcasecmp(obj->name, lookup->obj_name); -} /* sc_cmp_store_obj_with_name */ + new->last_update = sobj->last_update; + sdb_object_ref(SDB_OBJ(sobj->parent)); + new->parent = sobj->parent; + return SDB_OBJ(new); +} /* store_obj_clone */ static int -sc_host_init(sc_object_t *obj, va_list ap) +sdb_store_obj_init(sdb_object_t *obj, va_list ap) { - const char *name = va_arg(ap, const char *); + sdb_store_obj_t *sobj = SDB_STORE_OBJ(obj); + int ret; - SC_HOST(obj)->host_name = strdup(name); - if (! SC_HOST(obj)->host_name) - return -1; + ret = store_obj_init(obj, ap); + if (ret) + return ret; - SC_HOST(obj)->host_last_update = sc_gettime(); - /* ignore errors -> last_update will be updated later */ + sobj->type = va_arg(ap, int); - SC_HOST(obj)->services = sc_llist_create(); - if (! SC_HOST(obj)->services) + sobj->children = sdb_llist_create(); + if (! sobj->children) + return -1; + sobj->attributes = sdb_llist_create(); + if (! sobj->attributes) return -1; return 0; -} /* sc_host_init */ +} /* sdb_store_obj_init */ static void -sc_host_destroy(sc_object_t *obj) +sdb_store_obj_destroy(sdb_object_t *obj) { + sdb_store_obj_t *sobj = SDB_STORE_OBJ(obj); + assert(obj); - if (SC_HOST(obj)->host_name) - free(SC_HOST(obj)->host_name); + store_obj_destroy(obj); + + if (sobj->children) + sdb_llist_destroy(sobj->children); + if (sobj->attributes) + sdb_llist_destroy(sobj->attributes); +} /* sdb_store_obj_destroy */ + +static sdb_object_t * +sdb_store_obj_clone(const sdb_object_t *obj) +{ + const sdb_store_obj_t *sobj = SDB_CONST_STORE_OBJ(obj); + sdb_store_obj_t *new; + + new = SDB_STORE_OBJ(store_obj_clone(obj)); + if (! new) + return NULL; + + new->type = sobj->type; + + /* make sure these are initialized; else sdb_object_deref() might access + * arbitrary memory in case of an error */ + new->children = new->attributes = NULL; + + if (sobj->children) { + new->children = sdb_llist_clone(sobj->children); + if (! new->children) { + sdb_object_deref(SDB_OBJ(new)); + return NULL; + } + } + if (sobj->attributes) { + new->attributes = sdb_llist_clone(sobj->attributes); + if (! new->attributes) { + sdb_object_deref(SDB_OBJ(new)); + return NULL; + } + } - if (SC_HOST(obj)->services) - sc_llist_destroy(SC_HOST(obj)->services); -} /* sc_host_destroy */ + new->_last_update = sobj->_last_update; + return SDB_OBJ(new); +} /* sdb_store_obj_clone */ static int -sc_svc_init(sc_object_t *obj, va_list ap) +sdb_attr_init(sdb_object_t *obj, va_list ap) { - const char *hostname = va_arg(ap, const char *); - const char *name = va_arg(ap, const char *); + const char *value = va_arg(ap, const char *); + int ret; - SC_SVC(obj)->hostname = strdup(hostname); - SC_SVC(obj)->svc_name = strdup(name); - if ((! SC_SVC(obj)->hostname) || (! SC_SVC(obj)->svc_name)) - return -1; + ret = store_obj_init(obj, ap); + if (ret) + return ret; - SC_SVC(obj)->svc_last_update = sc_gettime(); - /* ignore errors -> last_update will be updated later */ + SDB_ATTR(obj)->value = strdup(value); + if (! SDB_ATTR(obj)->value) + return -1; return 0; -} /* sc_svc_init */ +} /* sdb_attr_init */ static void -sc_svc_destroy(sc_object_t *obj) +sdb_attr_destroy(sdb_object_t *obj) { assert(obj); - if (SC_SVC(obj)->hostname) - free(SC_SVC(obj)->hostname); - if (SC_SVC(obj)->svc_name) - free(SC_SVC(obj)->svc_name); -} /* sc_svc_destroy */ + store_obj_destroy(obj); -/* - * public API - */ + if (SDB_ATTR(obj)->value) + free(SDB_ATTR(obj)->value); +} /* sdb_attr_destroy */ -sc_host_t * -sc_host_create(const char *name) +static sdb_object_t * +sdb_attr_clone(const sdb_object_t *obj) { - sc_object_t *obj; + const sdb_attribute_t *attr = (const sdb_attribute_t *)obj; + sdb_attribute_t *new; - if (! name) + new = SDB_ATTR(store_obj_clone(obj)); + if (! new) return NULL; - obj = sc_object_create(sizeof(sc_host_t), sc_host_init, - sc_host_destroy, name); - if (! obj) + if (attr->value) + new->value = strdup(attr->value); + if (! new->value) { + sdb_object_deref(SDB_OBJ(new)); return NULL; - return SC_HOST(obj); -} /* sc_host_create */ + } + return SDB_OBJ(new); +} /* sdb_attr_clone */ -sc_host_t * -sc_host_clone(const sc_host_t *host) +static sdb_type_t sdb_store_obj_type = { + sizeof(sdb_store_obj_t), + + sdb_store_obj_init, + sdb_store_obj_destroy, + sdb_store_obj_clone +}; + +static sdb_type_t sdb_attribute_type = { + sizeof(sdb_attribute_t), + + sdb_attr_init, + sdb_attr_destroy, + sdb_attr_clone +}; + +/* + * private helper functions + */ + +static sdb_store_obj_t * +sdb_store_lookup_in_list(sdb_llist_t *l, int type, const char *name) { - sc_host_t *clone; + sdb_llist_iter_t *iter; - clone = sc_host_create(host->host_name); - if (! clone) + if (! l) return NULL; - clone->host_last_update = host->host_last_update; - if (host->services) { - clone->services = sc_llist_clone(host->services); - if (! clone->services) { - sc_object_deref(SC_OBJ(clone)); - return NULL; + iter = sdb_llist_get_iter(l); + if (! iter) + return NULL; + + while (sdb_llist_iter_has_next(iter)) { + sdb_store_obj_t *sobj = SDB_STORE_OBJ(sdb_llist_iter_get_next(iter)); + assert(sobj); + + if ((sobj->type == type) + && (! strcasecmp(SDB_OBJ(sobj)->name, name))) { + sdb_llist_iter_destroy(iter); + return sobj; + } + + sobj = sdb_store_lookup_in_list(sobj->children, type, name); + if (sobj) { + sdb_llist_iter_destroy(iter); + return sobj; } } - else - clone->services = NULL; - return clone; -} /* sc_host_clone */ + sdb_llist_iter_destroy(iter); + return NULL; +} /* sdb_store_lookup_in_list */ + +static sdb_store_obj_t * +sdb_store_lookup(int type, const char *name) +{ + return sdb_store_lookup_in_list(obj_list, type, name); +} /* sdb_store_lookup */ + +/* + * public API + */ int -sc_store_host(const sc_host_t *host) +sdb_store_host(const char *name, sdb_time_t last_update) { - sc_store_lookup_obj_t lookup = SC_STORE_LOOKUP_OBJ_INIT; - sc_time_t last_update; + sdb_store_obj_t *old; - sc_host_t *old; + char *cname; int status = 0; - if ((! host) || (! host->host_name)) + if (! name) return -1; - last_update = host->host_last_update; + cname = sdb_plugin_cname(strdup(name)); + if (! cname) { + sdb_log(SDB_LOG_ERR, "store: strdup failed"); + return -1; + } + if (last_update <= 0) - last_update = sc_gettime(); + last_update = sdb_gettime(); - pthread_rwlock_wrlock(&host_lock); + pthread_rwlock_wrlock(&obj_lock); - if (! host_list) { - if (! (host_list = sc_llist_create())) { - pthread_rwlock_unlock(&host_lock); + if (! obj_list) { + if (! (obj_list = sdb_llist_create())) { + pthread_rwlock_unlock(&obj_lock); return -1; } } - lookup.obj_name = host->host_name; - old = SC_HOST(sc_llist_search(host_list, (const sc_object_t *)&lookup, - sc_cmp_store_obj_with_name)); + old = sdb_store_lookup(SDB_HOST, cname); if (old) { - if (old->host_last_update > last_update) { - fprintf(stderr, "store: Cannot update host '%s' - " - "value too old (%"PRIscTIME" < %"PRIscTIME")\n", - host->host_name, last_update, old->host_last_update); + if (old->_last_update > last_update) { + sdb_log(SDB_LOG_DEBUG, "store: Cannot update host '%s' - " + "value too old (%"PRIscTIME" < %"PRIscTIME")", + cname, last_update, old->_last_update); /* don't report an error; the host may be updated by multiple * backends */ status = 1; } else { - old->host_last_update = last_update; + old->_last_update = last_update; } + free(cname); } else { - sc_host_t *new = sc_host_clone(host); + sdb_store_obj_t *new = SDB_STORE_OBJ(sdb_object_create(cname, + sdb_store_obj_type, SDB_HOST)); if (! new) { char errbuf[1024]; - fprintf(stderr, "store: Failed to clone host object: %s\n", - sc_strerror(errno, errbuf, sizeof(errbuf))); + sdb_log(SDB_LOG_ERR, "store: Failed to create host %s: %s", + cname, sdb_strerror(errno, errbuf, sizeof(errbuf))); + free(cname); + pthread_rwlock_unlock(&obj_lock); return -1; } + free(cname); - if (! new->services) { - if (! (new->services = sc_llist_create())) { - char errbuf[1024]; - fprintf(stderr, "store: Failed to initialize " - "host object '%s': %s\n", host->host_name, - sc_strerror(errno, errbuf, sizeof(errbuf))); - sc_object_deref(SC_OBJ(new)); - return -1; - } - } - - status = sc_llist_insert_sorted(host_list, SC_OBJ(new), - sc_store_obj_cmp_by_name); + /* TODO: add support for hierarchical inserts */ + status = sdb_llist_insert_sorted(obj_list, SDB_OBJ(new), + sdb_object_cmp_by_name); /* pass control to the list or destroy in case of an error */ - sc_object_deref(SC_OBJ(new)); + sdb_object_deref(SDB_OBJ(new)); } - pthread_rwlock_unlock(&host_lock); + pthread_rwlock_unlock(&obj_lock); return status; -} /* sc_store_host */ +} /* sdb_store_host */ -const sc_host_t * -sc_store_get_host(const char *name) +_Bool +sdb_store_has_host(const char *name) { - sc_store_lookup_obj_t lookup = SC_STORE_LOOKUP_OBJ_INIT; - sc_host_t *host; + sdb_store_obj_t *host; if (! name) return NULL; - lookup.obj_name = name; - host = SC_HOST(sc_llist_search(host_list, (const sc_object_t *)&lookup, - sc_cmp_store_obj_with_name)); + host = sdb_store_lookup(SDB_HOST, name); + return host != NULL; +} /* sdb_store_has_host */ - if (! host) - return NULL; - return host; -} /* sc_store_get_host */ - -sc_service_t * -sc_service_create(const char *hostname, const char *name) +int +sdb_store_attribute(const char *hostname, const char *key, const char *value, + sdb_time_t last_update) { - sc_object_t *obj; + sdb_store_obj_t *sobj; + sdb_attribute_t *old; - if ((! hostname) || (! name)) - return NULL; + int status = 0; - obj = sc_object_create(sizeof(sc_service_t), sc_svc_init, - sc_svc_destroy, hostname, name); - if (! obj) - return NULL; - return SC_SVC(obj); -} /* sc_service_create */ + if ((! hostname) || (! key)) + return -1; -sc_service_t * -sc_service_clone(const sc_service_t *svc) -{ - sc_service_t *clone; + if (last_update <= 0) + last_update = sdb_gettime(); - clone = sc_service_create(svc->hostname, svc->svc_name); - if (! clone) - return NULL; + if (! obj_list) + return -1; - clone->svc_last_update = svc->svc_last_update; - return clone; -} /* sc_service_clone */ + pthread_rwlock_wrlock(&obj_lock); -int -sc_store_service(const sc_service_t *svc) -{ - sc_store_lookup_obj_t lookup = SC_STORE_LOOKUP_OBJ_INIT; - sc_host_t *host; + sobj = sdb_store_lookup(SDB_HOST, hostname); + if (! sobj) { + pthread_rwlock_unlock(&obj_lock); + return -1; + } - sc_service_t *old; + old = SDB_ATTR(sdb_llist_search_by_name(sobj->attributes, key)); + if (old) { + if (old->_last_update > last_update) { + sdb_log(SDB_LOG_DEBUG, "store: Cannot update attribute " + "'%s/%s' - value too old (%"PRIscTIME" < %"PRIscTIME")", + hostname, key, last_update, old->_last_update); + status = 1; + } + else { + old->_last_update = last_update; + } + } + else { + sdb_attribute_t *new = SDB_ATTR(sdb_object_create(key, + sdb_attribute_type, value)); + if (! new) { + char errbuf[1024]; + sdb_log(SDB_LOG_ERR, "store: Failed to clone attribute " + "object: %s", sdb_strerror(errno, errbuf, sizeof(errbuf))); + pthread_rwlock_unlock(&obj_lock); + return -1; + } + + status = sdb_llist_insert_sorted(sobj->attributes, SDB_OBJ(new), + sdb_object_cmp_by_name); - sc_time_t last_update; + /* pass control to the list or destroy in case of an error */ + sdb_object_deref(SDB_OBJ(new)); + } + + pthread_rwlock_unlock(&obj_lock); + return status; +} /* sdb_store_attribute */ + +int +sdb_store_service(const char *hostname, const char *name, + sdb_time_t last_update) +{ + sdb_store_obj_t *host; + sdb_store_obj_t *old; int status = 0; - if (! svc) + if ((! hostname) || (! name)) return -1; - last_update = svc->svc_last_update; if (last_update <= 0) - last_update = sc_gettime(); + last_update = sdb_gettime(); - if (! host_list) + if (! obj_list) return -1; - pthread_rwlock_wrlock(&host_lock); + pthread_rwlock_wrlock(&obj_lock); - lookup.obj_name = svc->hostname; - host = SC_HOST(sc_llist_search(host_list, (const sc_object_t *)&lookup, - sc_cmp_store_obj_with_name)); - - if (! host) + host = sdb_store_lookup(SDB_HOST, hostname); + if (! host) { + pthread_rwlock_unlock(&obj_lock); return -1; + } - lookup.obj_name = svc->svc_name; - old = SC_SVC(sc_llist_search(host->services, (const sc_object_t *)&lookup, - sc_cmp_store_obj_with_name)); - + /* TODO: only look into direct children? */ + old = sdb_store_lookup_in_list(host->children, SDB_SERVICE, name); if (old) { - if (old->host_last_update > last_update) { - fprintf(stderr, "store: Cannot update service '%s/%s' - " - "value too old (%"PRIscTIME" < %"PRIscTIME")\n", - svc->hostname, svc->svc_name, last_update, - old->host_last_update); + if (old->_last_update > last_update) { + sdb_log(SDB_LOG_DEBUG, "store: Cannot update service " + "'%s/%s' - value too old (%"PRIscTIME" < %"PRIscTIME")", + hostname, name, last_update, old->_last_update); status = 1; } else { - old->svc_last_update = last_update; + old->_last_update = last_update; } } else { - sc_service_t *new = sc_service_clone(svc); + sdb_store_obj_t *new = SDB_STORE_OBJ(sdb_object_create(name, + sdb_store_obj_type, SDB_SERVICE)); if (! new) { char errbuf[1024]; - fprintf(stderr, "store: Failed to clone service object: %s\n", - sc_strerror(errno, errbuf, sizeof(errbuf))); + sdb_log(SDB_LOG_ERR, "store: Failed to clone service " + "object: %s", sdb_strerror(errno, errbuf, sizeof(errbuf))); + pthread_rwlock_unlock(&obj_lock); return -1; } - status = sc_llist_insert_sorted(host->services, SC_OBJ(new), - sc_store_obj_cmp_by_name); + status = sdb_llist_insert_sorted(host->children, SDB_OBJ(new), + sdb_object_cmp_by_name); /* pass control to the list or destroy in case of an error */ - sc_object_deref(SC_OBJ(new)); + sdb_object_deref(SDB_OBJ(new)); } - pthread_rwlock_unlock(&host_lock); + pthread_rwlock_unlock(&obj_lock); return status; -} /* sc_store_service */ - -const sc_service_t * -sc_store_get_service(const sc_host_t *host, const char *name) -{ - sc_store_lookup_obj_t lookup = SC_STORE_LOOKUP_OBJ_INIT; - sc_service_t *svc; - - if ((! host) || (! name)) - return NULL; - - lookup.obj_name = name; - svc = SC_SVC(sc_llist_search(host->services, (const sc_object_t *)&lookup, - sc_cmp_store_obj_with_name)); - - if (! svc) - return NULL; - return svc; -} /* sc_store_get_service */ +} /* sdb_store_service */ +/* TODO: actually support hierarchical data */ int -sc_store_dump(FILE *fh) +sdb_store_dump(FILE *fh) { - sc_llist_iter_t *host_iter; + sdb_llist_iter_t *host_iter; if (! fh) return -1; - pthread_rwlock_rdlock(&host_lock); + pthread_rwlock_rdlock(&obj_lock); - host_iter = sc_llist_get_iter(host_list); - if (! host_iter) + host_iter = sdb_llist_get_iter(obj_list); + if (! host_iter) { + pthread_rwlock_unlock(&obj_lock); return -1; + } - while (sc_llist_iter_has_next(host_iter)) { - sc_host_t *host = SC_HOST(sc_llist_iter_get_next(host_iter)); - sc_llist_iter_t *svc_iter; + while (sdb_llist_iter_has_next(host_iter)) { + sdb_store_obj_t *host = SDB_STORE_OBJ(sdb_llist_iter_get_next(host_iter)); + sdb_llist_iter_t *svc_iter; + sdb_llist_iter_t *attr_iter; char time_str[64]; assert(host); - if (! sc_strftime(time_str, sizeof(time_str), - "%F %T %z", host->host_last_update)) + if (! sdb_strftime(time_str, sizeof(time_str), + "%F %T %z", host->_last_update)) snprintf(time_str, sizeof(time_str), ""); time_str[sizeof(time_str) - 1] = '\0'; fprintf(fh, "Host '%s' (last updated: %s):\n", - host->host_name, time_str); + SDB_OBJ(host)->name, time_str); + + attr_iter = sdb_llist_get_iter(host->attributes); + if (! attr_iter) { + char errbuf[1024]; + fprintf(fh, "Failed to retrieve attributes: %s\n", + sdb_strerror(errno, errbuf, sizeof(errbuf))); + continue; + } + + while (sdb_llist_iter_has_next(attr_iter)) { + sdb_attribute_t *attr = SDB_ATTR(sdb_llist_iter_get_next(attr_iter)); + assert(attr); + + if (! sdb_strftime(time_str, sizeof(time_str), + "%F %T %z", attr->_last_update)) + snprintf(time_str, sizeof(time_str), ""); + time_str[sizeof(time_str) - 1] = '\0'; + + fprintf(fh, "\tAttribute '%s' -> '%s' (last updated: %s)\n", + SDB_OBJ(attr)->name, attr->value, time_str); + } + + sdb_llist_iter_destroy(attr_iter); - svc_iter = sc_llist_get_iter(host->services); + svc_iter = sdb_llist_get_iter(host->children); if (! svc_iter) { char errbuf[1024]; fprintf(fh, "Failed to retrieve services: %s\n", - sc_strerror(errno, errbuf, sizeof(errbuf))); + sdb_strerror(errno, errbuf, sizeof(errbuf))); continue; } - while (sc_llist_iter_has_next(svc_iter)) { - sc_service_t *svc = SC_SVC(sc_llist_iter_get_next(svc_iter)); + while (sdb_llist_iter_has_next(svc_iter)) { + sdb_store_obj_t *svc = SDB_STORE_OBJ(sdb_llist_iter_get_next(svc_iter)); assert(svc); - if (! sc_strftime(time_str, sizeof(time_str), - "%F %T %z", host->host_last_update)) + if (! sdb_strftime(time_str, sizeof(time_str), + "%F %T %z", svc->_last_update)) snprintf(time_str, sizeof(time_str), ""); time_str[sizeof(time_str) - 1] = '\0'; fprintf(fh, "\tService '%s' (last updated: %s)\n", - svc->svc_name, time_str); + SDB_OBJ(svc)->name, time_str); } - sc_llist_iter_destroy(svc_iter); + sdb_llist_iter_destroy(svc_iter); } - sc_llist_iter_destroy(host_iter); + sdb_llist_iter_destroy(host_iter); + pthread_rwlock_unlock(&obj_lock); return 0; -} /* sc_store_dump */ +} /* sdb_store_dump */ /* vim: set tw=78 sw=4 ts=4 noexpandtab : */