diff options
author | Andrew Tridgell <tridge@samba.org> | 2007-04-21 07:23:42 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:17 -0500 |
commit | 650d81b252cc669ef848448afad7e9bb79c4f20e (patch) | |
tree | 7108ada18c4d7fff581470791832850c17eab6bf /source4/cluster/ctdb/common/ctdb_util.c | |
parent | 66a9f1e2764900a2c22a4bfad9f9caf3db729385 (diff) | |
download | samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.gz samba-650d81b252cc669ef848448afad7e9bb79c4f20e.tar.xz samba-650d81b252cc669ef848448afad7e9bb79c4f20e.zip |
r22421: merged in latest ctdb changes from bzr
(This used to be commit 3633f862b966866819c9a0a6ad0238a858e15e62)
Diffstat (limited to 'source4/cluster/ctdb/common/ctdb_util.c')
-rw-r--r-- | source4/cluster/ctdb/common/ctdb_util.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source4/cluster/ctdb/common/ctdb_util.c b/source4/cluster/ctdb/common/ctdb_util.c index cf0c72a58b7..9a5e51bfa0b 100644 --- a/source4/cluster/ctdb/common/ctdb_util.c +++ b/source4/cluster/ctdb/common/ctdb_util.c @@ -25,6 +25,8 @@ #include "system/filesys.h" #include "../include/ctdb_private.h" +int LogLevel; + /* return error string for last error */ @@ -100,3 +102,29 @@ uint32_t ctdb_hash(const TDB_DATA *key) return (1103515243 * value + 12345); } + +/* + a type checking varient of idr_find + */ +void *_idr_find_type(struct idr_context *idp, int id, const char *type, const char *location) +{ + void *p = idr_find(idp, id); + if (p && talloc_check_name(p, type) == NULL) { + DEBUG(0,("%s idr_find_type expected type %s but got %s\n", + location, type, talloc_get_name(p))); + return NULL; + } + return p; +} + + +/* + update a max latency number + */ +void ctdb_latency(double *latency, struct timeval t) +{ + double l = timeval_elapsed(&t); + if (l > *latency) { + *latency = l; + } +} |