move util library into ddsrt

As was the plan with the introduction of ddsrt; this includes renaming
the identifiers to match the capitalization style and removes old junk.

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-04-16 10:23:32 +02:00 committed by eboasson
parent e965df5db7
commit 6c171a890d
62 changed files with 1702 additions and 1869 deletions

View file

@ -18,7 +18,7 @@
extern "C" {
#endif
extern DDS_EXPORT const ut_avlTreedef_t dds_domaintree_def;
extern DDS_EXPORT const ddsrt_avl_treedef_t dds_domaintree_def;
DDS_EXPORT dds_domain * dds_domain_create (dds_domainid_t id);
DDS_EXPORT void dds_domain_free (dds_domain * domain);

View file

@ -94,9 +94,9 @@ dds_handle_server_fini(void);
* user data.
*
* A kind value != 0 has to be provided, just to make sure that no 0 handles
* will be created. It should also fit the UT_HANDLE_KIND_MASK.
* will be created. It should also fit the DDSRT_HANDLE_KIND_MASK.
* In other words handle creation will fail if
* ((kind & ~UT_HANDLE_KIND_MASK != 0) || (kind & UT_HANDLE_KIND_MASK == 0)).
* ((kind & ~DDSRT_HANDLE_KIND_MASK != 0) || (kind & DDSRT_HANDLE_KIND_MASK == 0)).
*
* It has to do something clever to make sure that a deleted handle is not
* re-issued very quickly after it was deleted.

View file

@ -17,7 +17,7 @@
#include "dds/dds.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsi/q_rtps.h"
#include "dds/util/ut_avl.h"
#include "dds/ddsrt/avl.h"
#include "dds__handles.h"
#if defined (__cplusplus)
@ -94,9 +94,9 @@ struct dds_listener {
typedef struct dds_domain
{
ut_avlNode_t m_node;
ddsrt_avl_node_t m_node;
dds_domainid_t m_id;
ut_avlTree_t m_topics;
ddsrt_avl_tree_t m_topics;
uint32_t m_refc;
}
dds_domain;
@ -151,7 +151,7 @@ typedef struct dds_entity
}
dds_entity;
extern const ut_avlTreedef_t dds_topictree_def;
extern const ddsrt_avl_treedef_t dds_topictree_def;
typedef struct dds_subscriber
{
@ -283,7 +283,7 @@ typedef struct dds_globals
int (*m_dur_wait) (struct dds_reader * reader, dds_duration_t timeout);
void (*m_dur_init) (void);
void (*m_dur_fini) (void);
ut_avlTree_t m_domains;
ddsrt_avl_tree_t m_domains;
ddsrt_mutex_t m_mutex;
}
dds_globals;

View file

@ -17,7 +17,7 @@ static int dds_domain_compare (const int32_t * a, const int32_t * b)
return (*a == *b) ? 0 : (*a < *b) ? -1 : 1;
}
const ut_avlTreedef_t dds_domaintree_def = UT_AVL_TREEDEF_INITIALIZER
const ddsrt_avl_treedef_t dds_domaintree_def = DDSRT_AVL_TREEDEF_INITIALIZER
(
offsetof (dds_domain, m_node),
offsetof (dds_domain, m_id),
@ -27,7 +27,7 @@ const ut_avlTreedef_t dds_domaintree_def = UT_AVL_TREEDEF_INITIALIZER
dds_domain * dds_domain_find_locked (dds_domainid_t id)
{
return ut_avlLookup (&dds_domaintree_def, &dds_global.m_domains, &id);
return ddsrt_avl_lookup (&dds_domaintree_def, &dds_global.m_domains, &id);
}
dds_domain * dds_domain_create (dds_domainid_t id)
@ -39,8 +39,8 @@ dds_domain * dds_domain_create (dds_domainid_t id)
{
domain = dds_alloc (sizeof (*domain));
domain->m_id = id;
ut_avlInit (&dds_topictree_def, &domain->m_topics);
ut_avlInsert (&dds_domaintree_def, &dds_global.m_domains, domain);
ddsrt_avl_init (&dds_topictree_def, &domain->m_topics);
ddsrt_avl_insert (&dds_domaintree_def, &dds_global.m_domains, domain);
}
domain->m_refc++;
ddsrt_mutex_unlock (&dds_global.m_mutex);
@ -52,7 +52,7 @@ void dds_domain_free (dds_domain * domain)
ddsrt_mutex_lock (&dds_global.m_mutex);
if (--domain->m_refc == 0)
{
ut_avlDelete (&dds_domaintree_def, &dds_global.m_domains, domain);
ddsrt_avl_delete (&dds_domaintree_def, &dds_global.m_domains, domain);
dds_free (domain);
}
ddsrt_mutex_unlock (&dds_global.m_mutex);

View file

@ -15,7 +15,7 @@
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/random.h"
#include "dds/util/ut_hopscotch.h"
#include "dds/ddsrt/hopscotch.h"
#include "dds/ddsi/q_thread.h"
#include "dds__handles.h"
#include "dds__types.h"
@ -40,9 +40,9 @@
struct dds_handle_server {
#if USE_CHH
struct ut_chh *ht;
struct ddsrt_chh *ht;
#else
struct ut_hh *ht;
struct ddsrt_hh *ht;
#endif
size_t count;
ddsrt_mutex_t lock;
@ -68,9 +68,9 @@ static int handle_equal (const void *va, const void *vb)
dds_return_t dds_handle_server_init (void (*free_via_gc) (void *x))
{
#if USE_CHH
handles.ht = ut_chhNew (128, handle_hash, handle_equal, free_via_gc);
handles.ht = ddsrt_chh_new (128, handle_hash, handle_equal, free_via_gc);
#else
handles.ht = ut_hhNew (128, handle_hash, handle_equal);
handles.ht = ddsrt_hh_new (128, handle_hash, handle_equal);
(void) free_via_gc;
#endif
handles.count = 0;
@ -83,16 +83,16 @@ void dds_handle_server_fini (void)
{
#if USE_CHH
#ifndef NDEBUG
struct ut_chhIter it;
assert (ut_chhIterFirst (handles.ht, &it) == NULL);
struct ddsrt_chh_iter it;
assert (ddsrt_chh_iter_first (handles.ht, &it) == NULL);
#endif
ut_chhFree (handles.ht);
ddsrt_chh_free (handles.ht);
#else /* USE_CHH */
#ifndef NDEBUG
struct ut_hhIter it;
assert (ut_hhIterFirst (handles.ht, &it) == NULL);
struct ddsrt_hh_iter it;
assert (ddsrt_hh_iter_first (handles.ht, &it) == NULL);
#endif
ut_hhFree (handles.ht);
ddsrt_hh_free (handles.ht);
#endif /* USE_CHH */
ddsrt_cond_destroy (&handles.cond);
ddsrt_mutex_destroy (&handles.lock);
@ -100,9 +100,9 @@ void dds_handle_server_fini (void)
}
#if USE_CHH
static bool hhadd (struct ut_chh *ht, void *elem) { return ut_chhAdd (ht, elem); }
static bool hhadd (struct ddsrt_chh *ht, void *elem) { return ddsrt_chh_add (ht, elem); }
#else
static bool hhadd (struct ut_hh *ht, void *elem) { return ut_hhAdd (ht, elem); }
static bool hhadd (struct ddsrt_hh *ht, void *elem) { return ddsrt_hh_add (ht, elem); }
#endif
static dds_handle_t dds_handle_create_int (struct dds_handle_link *link)
{
@ -176,10 +176,10 @@ int32_t dds_handle_delete (struct dds_handle_link *link, dds_duration_t timeout)
}
#if USE_CHH
thread_state_awake (ts1);
int x = ut_chhRemove (handles.ht, link);
int x = ddsrt_chh_remove (handles.ht, link);
thread_state_asleep (ts1);
#else
int x = ut_hhRemove (handles.ht, link);
int x = ddsrt_hh_remove (handles.ht, link);
#endif
assert(x);
(void)x;
@ -209,10 +209,10 @@ int32_t dds_handle_claim (dds_handle_t hdl, struct dds_handle_link **link)
#if USE_CHH
thread_state_awake (ts1);
*link = ut_chhLookup (handles.ht, &dummy);
*link = ddsrt_chh_lookup (handles.ht, &dummy);
#else
ddsrt_mutex_lock (&handles.lock);
*link = ut_hhLookup (handles.ht, &dummy);
*link = ddsrt_hh_lookup (handles.ht, &dummy);
#endif
if (*link == NULL)
rc = DDS_RETCODE_BAD_PARAMETER;

View file

@ -123,7 +123,7 @@ dds_init(dds_domainid_t domain)
}
upgrade_main_thread();
ut_avlInit(&dds_domaintree_def, &dds_global.m_domains);
ddsrt_avl_init(&dds_domaintree_def, &dds_global.m_domains);
/* Start monitoring the liveliness of all threads. */
if (!config.liveliness_monitoring)

View file

@ -532,14 +532,14 @@ void dds_reader_ddsi2direct (dds_entity_t entity, ddsi2direct_directread_cb_t cb
rd->ddsi2direct_cb = cb;
rd->ddsi2direct_cbarg = cbarg;
while ((m = ut_avlLookupSuccEq (&rd_writers_treedef, &rd->writers, &pwrguid)) != NULL)
while ((m = ddsrt_avl_lookup_succ_eq (&rd_writers_treedef, &rd->writers, &pwrguid)) != NULL)
{
/* have to be careful walking the tree -- pretty is different, but
I want to check this before I write a lookup_succ function. */
struct rd_pwr_match *m_next;
nn_guid_t pwrguid_next;
pwrguid = m->pwr_guid;
if ((m_next = ut_avlFindSucc (&rd_writers_treedef, &rd->writers, m)) != NULL)
if ((m_next = ddsrt_avl_find_succ (&rd_writers_treedef, &rd->writers, m)) != NULL)
pwrguid_next = m_next->pwr_guid;
else
{

View file

@ -27,8 +27,8 @@
#include "dds__reader.h"
#include "dds__rhc.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/util/ut_hopscotch.h"
#include "dds/util/ut_avl.h"
#include "dds/ddsrt/hopscotch.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsi/q_xqos.h"
#include "dds/ddsi/q_error.h"
#include "dds/ddsi/q_unused.h"
@ -174,7 +174,7 @@ struct lwreg
struct lwregs
{
struct ut_ehh * regs;
struct ddsrt_ehh * regs;
};
static uint32_t lwreg_hash (const void *vl)
@ -192,36 +192,36 @@ static int lwreg_equals (const void *va, const void *vb)
static void lwregs_init (struct lwregs *rt)
{
rt->regs = ut_ehhNew (sizeof (struct lwreg), 1, lwreg_hash, lwreg_equals);
rt->regs = ddsrt_ehh_new (sizeof (struct lwreg), 1, lwreg_hash, lwreg_equals);
}
static void lwregs_fini (struct lwregs *rt)
{
ut_ehhFree (rt->regs);
ddsrt_ehh_free (rt->regs);
}
static int lwregs_contains (struct lwregs *rt, uint64_t iid, uint64_t wr_iid)
{
struct lwreg dummy = { .iid = iid, .wr_iid = wr_iid };
return ut_ehhLookup (rt->regs, &dummy) != NULL;
return ddsrt_ehh_lookup (rt->regs, &dummy) != NULL;
}
static int lwregs_add (struct lwregs *rt, uint64_t iid, uint64_t wr_iid)
{
struct lwreg dummy = { .iid = iid, .wr_iid = wr_iid };
return ut_ehhAdd (rt->regs, &dummy);
return ddsrt_ehh_add (rt->regs, &dummy);
}
static int lwregs_delete (struct lwregs *rt, uint64_t iid, uint64_t wr_iid)
{
struct lwreg dummy = { .iid = iid, .wr_iid = wr_iid };
return ut_ehhRemove (rt->regs, &dummy);
return ddsrt_ehh_remove (rt->regs, &dummy);
}
void lwregs_dump (struct lwregs *rt)
{
struct ut_ehhIter it;
for (struct lwreg *r = ut_ehhIterFirst(rt->regs, &it); r; r = ut_ehhIterNext(&it))
struct ddsrt_ehh_iter it;
for (struct lwreg *r = ddsrt_ehh_iter_first(rt->regs, &it); r; r = ddsrt_ehh_iter_next(&it))
printf("iid=%"PRIu64" wr_iid=%"PRIu64"\n", r->iid, r->wr_iid);
}
@ -271,7 +271,7 @@ typedef enum rhc_store_result {
} rhc_store_result_t;
struct rhc {
struct ut_hh *instances;
struct ddsrt_hh *instances;
struct rhc_instance *nonempty_instances; /* circular, points to most recently added one, NULL if none */
struct lwregs registrations; /* should be a global one (with lock-free lookups) */
@ -458,7 +458,7 @@ struct rhc * dds_rhc_new (dds_reader * reader, const struct ddsi_sertopic * topi
lwregs_init (&rhc->registrations);
ddsrt_mutex_init (&rhc->lock);
rhc->instances = ut_hhNew (1, instance_iid_hash, instance_iid_eq);
rhc->instances = ddsrt_hh_new (1, instance_iid_hash, instance_iid_eq);
rhc->topic = topic;
rhc->reader = reader;
@ -620,9 +620,9 @@ static void free_instance_rhc_free_wrap (void *vnode, void *varg)
void dds_rhc_free (struct rhc *rhc)
{
assert (rhc_check_counts_locked (rhc, true, true));
ut_hhEnum (rhc->instances, free_instance_rhc_free_wrap, rhc);
ddsrt_hh_enum (rhc->instances, free_instance_rhc_free_wrap, rhc);
assert (rhc->nonempty_instances == NULL);
ut_hhFree (rhc->instances);
ddsrt_hh_free (rhc->instances);
lwregs_fini (&rhc->registrations);
if (rhc->qcond_eval_samplebuf != NULL)
ddsi_sertopic_free_sample (rhc->topic, rhc->qcond_eval_samplebuf, DDS_FREE_ALL);
@ -848,7 +848,7 @@ static void drop_instance_noupdate_no_writers (struct rhc *rhc, struct rhc_insta
rhc->n_instances--;
ret = ut_hhRemove (rhc->instances, inst);
ret = ddsrt_hh_remove (rhc->instances, inst);
assert (ret);
(void) ret;
@ -1198,7 +1198,7 @@ static rhc_store_result_t rhc_store_new_instance (struct rhc_instance **out_inst
}
account_for_empty_to_nonempty_transition (rhc, inst);
ret = ut_hhAdd (rhc->instances, inst);
ret = ddsrt_hh_add (rhc->instances, inst);
assert (ret);
(void) ret;
rhc->n_instances++;
@ -1248,7 +1248,7 @@ bool dds_rhc_store (struct rhc * __restrict rhc, const struct proxy_writer_info
ddsrt_mutex_lock (&rhc->lock);
inst = ut_hhLookup (rhc->instances, &dummy_instance);
inst = ddsrt_hh_lookup (rhc->instances, &dummy_instance);
if (inst == NULL)
{
/* New instance for this reader. If no data content -- not (also)
@ -1492,13 +1492,13 @@ void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writ
bool trigger_waitsets = false;
bool notify_data_available = false;
struct rhc_instance *inst;
struct ut_hhIter iter;
struct ddsrt_hh_iter iter;
const uint64_t wr_iid = pwr_info->iid;
const int auto_dispose = pwr_info->auto_dispose;
ddsrt_mutex_lock (&rhc->lock);
TRACE ("rhc_unregister_wr_iid(%"PRIx64",%d:\n", wr_iid, auto_dispose);
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
for (inst = ddsrt_hh_iter_first (rhc->instances, &iter); inst; inst = ddsrt_hh_iter_next (&iter))
{
if ((inst->wr_iid_islive && inst->wr_iid == wr_iid) || lwregs_contains (&rhc->registrations, inst->iid, wr_iid))
{
@ -1558,10 +1558,10 @@ void dds_rhc_unregister_wr (struct rhc * __restrict rhc, const struct proxy_writ
void dds_rhc_relinquish_ownership (struct rhc * __restrict rhc, const uint64_t wr_iid)
{
struct rhc_instance *inst;
struct ut_hhIter iter;
struct ddsrt_hh_iter iter;
ddsrt_mutex_lock (&rhc->lock);
TRACE ("rhc_relinquish_ownership(%"PRIx64":\n", wr_iid);
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
for (inst = ddsrt_hh_iter_first (rhc->instances, &iter); inst; inst = ddsrt_hh_iter_next (&iter))
{
if (inst->wr_iid_islive && inst->wr_iid == wr_iid)
{
@ -2234,7 +2234,7 @@ bool dds_rhc_add_readcondition (dds_readcond *cond)
between those attached to a waitset or not. */
struct rhc *rhc = cond->m_rhc;
struct ut_hhIter it;
struct ddsrt_hh_iter it;
assert ((dds_entity_kind (&cond->m_entity) == DDS_KIND_COND_READ && cond->m_query.m_filter == 0) ||
(dds_entity_kind (&cond->m_entity) == DDS_KIND_COND_QUERY && cond->m_query.m_filter != 0));
@ -2296,7 +2296,7 @@ bool dds_rhc_add_readcondition (dds_readcond *cond)
samples, except for those that match the predicate. */
const dds_querycond_mask_t qcmask = cond->m_query.m_qcmask;
uint32_t trigger = 0;
for (struct rhc_instance *inst = ut_hhIterFirst (rhc->instances, &it); inst != NULL; inst = ut_hhIterNext (&it))
for (struct rhc_instance *inst = ddsrt_hh_iter_first (rhc->instances, &it); inst != NULL; inst = ddsrt_hh_iter_next (&it))
{
const bool instmatch = eval_predicate_invsample (rhc, inst, cond->m_query.m_filter);;
uint32_t matches = 0;
@ -2612,7 +2612,7 @@ static int rhc_check_counts_locked (struct rhc *rhc, bool check_conds, bool chec
unsigned cond_match_count[CHECK_MAX_CONDS];
dds_querycond_mask_t enabled_qcmask = 0;
struct rhc_instance *inst;
struct ut_hhIter iter;
struct ddsrt_hh_iter iter;
dds_readcond *rciter;
uint32_t i;
@ -2628,7 +2628,7 @@ static int rhc_check_counts_locked (struct rhc *rhc, bool check_conds, bool chec
enabled_qcmask |= rciter->m_query.m_qcmask;
}
for (inst = ut_hhIterFirst (rhc->instances, &iter); inst; inst = ut_hhIterNext (&iter))
for (inst = ddsrt_hh_iter_first (rhc->instances, &iter); inst; inst = ddsrt_hh_iter_next (&iter))
{
unsigned n_vsamples_in_instance = 0, n_read_vsamples_in_instance = 0;
bool a_sample_free = true;

View file

@ -32,7 +32,7 @@ DECL_ENTITY_LOCK_UNLOCK(extern inline, dds_topic)
#define DDS_TOPIC_STATUS_MASK \
DDS_INCONSISTENT_TOPIC_STATUS
const ut_avlTreedef_t dds_topictree_def = UT_AVL_TREEDEF_INITIALIZER_INDKEY
const ddsrt_avl_treedef_t dds_topictree_def = DDSRT_AVL_TREEDEF_INITIALIZER_INDKEY
(
offsetof (struct ddsi_sertopic, avlnode),
offsetof (struct ddsi_sertopic, name_typename),
@ -118,17 +118,17 @@ dds_topic_lookup_locked(
const char *name)
{
struct ddsi_sertopic *st = NULL;
ut_avlIter_t iter;
ddsrt_avl_iter_t iter;
assert (domain);
assert (name);
st = ut_avlIterFirst (&dds_topictree_def, &domain->m_topics, &iter);
st = ddsrt_avl_iter_first (&dds_topictree_def, &domain->m_topics, &iter);
while (st) {
if (strcmp (st->name, name) == 0) {
break;
}
st = ut_avlIterNext (&iter);
st = ddsrt_avl_iter_next (&iter);
}
return st;
}
@ -155,9 +155,9 @@ dds_topic_free(
assert (st);
ddsrt_mutex_lock (&dds_global.m_mutex);
domain = ut_avlLookup (&dds_domaintree_def, &dds_global.m_domains, &domainid);
domain = ddsrt_avl_lookup (&dds_domaintree_def, &dds_global.m_domains, &domainid);
if (domain != NULL) {
ut_avlDelete (&dds_topictree_def, &domain->m_topics, st);
ddsrt_avl_delete (&dds_topictree_def, &domain->m_topics, st);
}
ddsrt_mutex_unlock (&dds_global.m_mutex);
st->status_cb_entity = NULL;
@ -172,7 +172,7 @@ dds_topic_add_locked(
dds_domain * dom;
dom = dds_domain_find_locked (id);
assert (dom);
ut_avlInsert (&dds_topictree_def, &dom->m_topics, st);
ddsrt_avl_insert (&dds_topictree_def, &dom->m_topics, st);
}
DDS_EXPORT dds_entity_t

View file

@ -22,8 +22,8 @@
#include "dds__whc.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/util/ut_avl.h"
#include "dds/util/ut_hopscotch.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/hopscotch.h"
#include "dds/ddsi/q_time.h"
#include "dds/ddsi/q_rtps.h"
#include "dds/ddsi/q_freelist.h"
@ -47,7 +47,7 @@ struct whc_node {
};
struct whc_intvnode {
ut_avlNode_t avlnode;
ddsrt_avl_node_t avlnode;
seqno_t min;
seqno_t maxp1;
struct whc_node *first; /* linked list of seqs with contiguous sequence numbers [min,maxp1) */
@ -89,12 +89,12 @@ struct whc_impl {
struct whc_node *maxseq_node; /* NULL if empty; if not in open_intv, open_intv is empty */
struct nn_freelist freelist; /* struct whc_node *; linked via whc_node::next_seq */
#if USE_EHH
struct ut_ehh *seq_hash;
struct ddsrt_ehh *seq_hash;
#else
struct ut_hh *seq_hash;
struct ddsrt_hh *seq_hash;
#endif
struct ut_hh *idx_hash;
ut_avlTree_t seq;
struct ddsrt_hh *idx_hash;
ddsrt_avl_tree_t seq;
};
struct whc_sample_iter_impl {
@ -140,8 +140,8 @@ static void whc_default_sample_iter_init (const struct whc *whc, struct whc_samp
static bool whc_default_sample_iter_borrow_next (struct whc_sample_iter *opaque_it, struct whc_borrowed_sample *sample);
static void whc_default_free (struct whc *whc);
static const ut_avlTreedef_t whc_seq_treedef =
UT_AVL_TREEDEF_INITIALIZER (offsetof (struct whc_intvnode, avlnode), offsetof (struct whc_intvnode, min), compare_seq, 0);
static const ddsrt_avl_treedef_t whc_seq_treedef =
DDSRT_AVL_TREEDEF_INITIALIZER (offsetof (struct whc_intvnode, avlnode), offsetof (struct whc_intvnode, min), compare_seq, 0);
static const struct whc_ops whc_ops = {
.insert = whc_default_insert,
@ -225,7 +225,7 @@ static struct whc_node *whc_findmax_procedurally (const struct whc_impl *whc)
}
else
{
struct whc_intvnode *intv = ut_avlFindPred (&whc_seq_treedef, &whc->seq, whc->open_intv);
struct whc_intvnode *intv = ddsrt_avl_find_pred (&whc_seq_treedef, &whc->seq, whc->open_intv);
assert (intv && intv->first);
return intv->last;
}
@ -239,8 +239,8 @@ static void check_whc (const struct whc_impl *whc)
contiguous; all samples in seq & in seqhash; tlidx \subseteq seq;
seq-number ordered list correct; &c. */
assert (whc->open_intv != NULL);
assert (whc->open_intv == ut_avlFindMax (&whc_seq_treedef, &whc->seq));
assert (ut_avlFindSucc (&whc_seq_treedef, &whc->seq, whc->open_intv) == NULL);
assert (whc->open_intv == ddsrt_avl_find_max (&whc_seq_treedef, &whc->seq));
assert (ddsrt_avl_find_succ (&whc_seq_treedef, &whc->seq, whc->open_intv) == NULL);
if (whc->maxseq_node)
{
assert (whc->maxseq_node->next_seq == NULL);
@ -264,7 +264,7 @@ static void check_whc (const struct whc_impl *whc)
struct whc_intvnode *firstintv;
struct whc_node *cur;
seqno_t prevseq = 0;
firstintv = ut_avlFindMin (&whc_seq_treedef, &whc->seq);
firstintv = ddsrt_avl_find_min (&whc_seq_treedef, &whc->seq);
assert (firstintv);
cur = firstintv->first;
while (cur)
@ -283,10 +283,10 @@ static void insert_whcn_in_hash (struct whc_impl *whc, struct whc_node *whcn)
/* precondition: whcn is not in hash */
#if USE_EHH
struct whc_seq_entry e = { .seq = whcn->seq, .whcn = whcn };
if (!ut_ehhAdd (whc->seq_hash, &e))
if (!ddsrt_ehh_add (whc->seq_hash, &e))
assert(0);
#else
if (!ut_hhAdd (whc->seq_hash, whcn))
if (!ddsrt_hh_add (whc->seq_hash, whcn))
assert(0);
#endif
}
@ -296,10 +296,10 @@ static void remove_whcn_from_hash (struct whc_impl *whc, struct whc_node *whcn)
/* precondition: whcn is in hash */
#if USE_EHH
struct whc_seq_entry e = { .seq = whcn->seq };
if (!ut_ehhRemove(whc->seq_hash, &e))
if (!ddsrt_ehh_remove(whc->seq_hash, &e))
assert(0);
#else
if (!ut_hhRemove(whc->seq_hash, whcn))
if (!ddsrt_hh_remove(whc->seq_hash, whcn))
assert(0);
#endif
}
@ -308,14 +308,14 @@ static struct whc_node *whc_findseq (const struct whc_impl *whc, seqno_t seq)
{
#if USE_EHH
struct whc_seq_entry e = { .seq = seq }, *r;
if ((r = ut_ehhLookup(whc->seq_hash, &e)) != NULL)
if ((r = ddsrt_ehh_lookup(whc->seq_hash, &e)) != NULL)
return r->whcn;
else
return NULL;
#else
struct whc_node template;
template.seq = seq;
return ut_hhLookup(whc->seq_hash, &template);
return ddsrt_hh_lookup(whc->seq_hash, &template);
#endif
}
@ -328,7 +328,7 @@ static struct whc_node *whc_findkey (const struct whc_impl *whc, const struct dd
struct whc_idxnode *n;
check_whc (whc);
template.idxn.iid = ddsi_tkmap_lookup(gv.m_tkmap, serdata_key);
n = ut_hhLookup (whc->idx_hash, &template.idxn);
n = ddsrt_hh_lookup (whc->idx_hash, &template.idxn);
if (n == NULL)
return NULL;
else
@ -359,22 +359,22 @@ struct whc *whc_new (int is_transient_local, unsigned hdepth, unsigned tldepth)
whc->total_bytes = 0;
whc->sample_overhead = sample_overhead;
#if USE_EHH
whc->seq_hash = ut_ehhNew (sizeof (struct whc_seq_entry), 32, whc_seq_entry_hash, whc_seq_entry_eq);
whc->seq_hash = ddsrt_ehh_new (sizeof (struct whc_seq_entry), 32, whc_seq_entry_hash, whc_seq_entry_eq);
#else
whc->seq_hash = ut_hhNew(32, whc_node_hash, whc_node_eq);
whc->seq_hash = ddsrt_hh_new(32, whc_node_hash, whc_node_eq);
#endif
if (whc->idxdepth > 0)
whc->idx_hash = ut_hhNew(32, whc_idxnode_hash_key, whc_idxnode_eq_key);
whc->idx_hash = ddsrt_hh_new(32, whc_idxnode_hash_key, whc_idxnode_eq_key);
else
whc->idx_hash = NULL;
/* seq interval tree: always has an "open" node */
ut_avlInit (&whc_seq_treedef, &whc->seq);
ddsrt_avl_init (&whc_seq_treedef, &whc->seq);
intv = ddsrt_malloc (sizeof (*intv));
intv->min = intv->maxp1 = 1;
intv->first = intv->last = NULL;
ut_avlInsert (&whc_seq_treedef, &whc->seq, intv);
ddsrt_avl_insert (&whc_seq_treedef, &whc->seq, intv);
whc->open_intv = intv;
whc->maxseq_node = NULL;
@ -402,11 +402,11 @@ void whc_default_free (struct whc *whc_generic)
if (whc->idx_hash)
{
struct ut_hhIter it;
struct ddsrt_hh_iter it;
struct whc_idxnode *n;
for (n = ut_hhIterFirst(whc->idx_hash, &it); n != NULL; n = ut_hhIterNext(&it))
for (n = ddsrt_hh_iter_first(whc->idx_hash, &it); n != NULL; n = ddsrt_hh_iter_next(&it))
ddsrt_free(n);
ut_hhFree(whc->idx_hash);
ddsrt_hh_free(whc->idx_hash);
}
{
@ -423,13 +423,13 @@ DDSRT_WARNING_MSVC_ON(6001);
}
}
ut_avlFree (&whc_seq_treedef, &whc->seq, ddsrt_free);
ddsrt_avl_free (&whc_seq_treedef, &whc->seq, ddsrt_free);
nn_freelist_fini (&whc->freelist, ddsrt_free);
#if USE_EHH
ut_ehhFree (whc->seq_hash);
ddsrt_ehh_free (whc->seq_hash);
#else
ut_hhFree (whc->seq_hash);
ddsrt_hh_free (whc->seq_hash);
#endif
ddsrt_mutex_destroy (&whc->lock);
ddsrt_free (whc);
@ -445,7 +445,7 @@ static void get_state_locked(const struct whc_impl *whc, struct whc_state *st)
else
{
const struct whc_intvnode *intv;
intv = ut_avlFindMin (&whc_seq_treedef, &whc->seq);
intv = ddsrt_avl_find_min (&whc_seq_treedef, &whc->seq);
/* not empty, open node may be anything but is (by definition)
findmax, and whc is claimed to be non-empty, so min interval
can't be empty */
@ -476,12 +476,12 @@ static struct whc_node *find_nextseq_intv (struct whc_intvnode **p_intv, const s
SEQ < Y can't exist */
#ifndef NDEBUG
{
struct whc_intvnode *predintv = ut_avlLookupPredEq (&whc_seq_treedef, &whc->seq, &seq);
struct whc_intvnode *predintv = ddsrt_avl_lookup_pred_eq (&whc_seq_treedef, &whc->seq, &seq);
assert (predintv == NULL || predintv->maxp1 <= seq);
}
#endif
if ((intv = ut_avlLookupSuccEq (&whc_seq_treedef, &whc->seq, &seq)) == NULL) {
assert (ut_avlLookupPredEq (&whc_seq_treedef, &whc->seq, &seq) == whc->open_intv);
if ((intv = ddsrt_avl_lookup_succ_eq (&whc_seq_treedef, &whc->seq, &seq)) == NULL) {
assert (ddsrt_avl_lookup_pred_eq (&whc_seq_treedef, &whc->seq, &seq) == whc->open_intv);
return NULL;
} else if (intv->min < intv->maxp1) { /* only if not empty interval */
assert (intv->min > seq);
@ -502,7 +502,7 @@ static struct whc_node *find_nextseq_intv (struct whc_intvnode **p_intv, const s
assert (whc->maxseq_node != NULL);
assert (n->seq < whc->maxseq_node->seq);
n = n->next_seq;
*p_intv = ut_avlLookupPredEq (&whc_seq_treedef, &whc->seq, &n->seq);
*p_intv = ddsrt_avl_lookup_pred_eq (&whc_seq_treedef, &whc->seq, &n->seq);
return n;
}
}
@ -538,7 +538,7 @@ static void delete_one_sample_from_idx (struct whc_impl *whc, struct whc_node *w
for (i = 0; i < whc->idxdepth; i++)
assert (i == idxn->headidx || idxn->hist[i] == NULL);
#endif
if (!ut_hhRemove (whc->idx_hash, idxn))
if (!ddsrt_hh_remove (whc->idx_hash, idxn))
assert (0);
ddsi_tkmap_instance_unref(idxn->tk);
ddsrt_free (idxn);
@ -568,7 +568,7 @@ static void free_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_s
static void delete_one_instance_from_idx (struct whc_impl *whc, seqno_t max_drop_seq, struct whc_idxnode *idxn)
{
if (!ut_hhRemove (whc->idx_hash, idxn))
if (!ddsrt_hh_remove (whc->idx_hash, idxn))
assert (0);
free_one_instance_from_idx (whc, max_drop_seq, idxn);
}
@ -612,11 +612,11 @@ static unsigned whc_default_downgrade_to_volatile (struct whc *whc_generic, stru
whc->tldepth = 0;
if (whc->hdepth == 0)
{
struct ut_hhIter it;
struct ddsrt_hh_iter it;
struct whc_idxnode *n;
for (n = ut_hhIterFirst(whc->idx_hash, &it); n != NULL; n = ut_hhIterNext(&it))
for (n = ddsrt_hh_iter_first(whc->idx_hash, &it); n != NULL; n = ddsrt_hh_iter_next(&it))
free_one_instance_from_idx (whc, 0, n);
ut_hhFree(whc->idx_hash);
ddsrt_hh_free(whc->idx_hash);
whc->idxdepth = 0;
whc->idx_hash = NULL;
}
@ -680,9 +680,9 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
if (whcn == intv->last && intv != whc->open_intv)
{
struct whc_intvnode *tmp = intv;
*p_intv = ut_avlFindSucc (&whc_seq_treedef, &whc->seq, intv);
*p_intv = ddsrt_avl_find_succ (&whc_seq_treedef, &whc->seq, intv);
/* only sample in interval and not the open interval => delete interval */
ut_avlDelete (&whc_seq_treedef, &whc->seq, tmp);
ddsrt_avl_delete (&whc_seq_treedef, &whc->seq, tmp);
ddsrt_free (tmp);
}
else
@ -703,7 +703,7 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
assert (whcn->prev_seq->seq + 1 == whcn->seq);
intv->last = whcn->prev_seq;
intv->maxp1--;
*p_intv = ut_avlFindSucc (&whc_seq_treedef, &whc->seq, intv);
*p_intv = ddsrt_avl_find_succ (&whc_seq_treedef, &whc->seq, intv);
}
else
{
@ -712,7 +712,7 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
issue only, and so we can (for now) get away with splitting
it greedily */
struct whc_intvnode *new_intv;
ut_avlIPath_t path;
ddsrt_avl_ipath_t path;
new_intv = ddsrt_malloc (sizeof (*new_intv));
@ -730,9 +730,9 @@ static void whc_delete_one_intv (struct whc_impl *whc, struct whc_intvnode **p_i
/* insert new node & continue the loop with intv set to the
new interval */
if (ut_avlLookupIPath (&whc_seq_treedef, &whc->seq, &new_intv->min, &path) != NULL)
if (ddsrt_avl_lookup_ipath (&whc_seq_treedef, &whc->seq, &new_intv->min, &path) != NULL)
assert (0);
ut_avlInsertIPath (&whc_seq_treedef, &whc->seq, new_intv, &path);
ddsrt_avl_insert_ipath (&whc_seq_treedef, &whc->seq, new_intv, &path);
if (intv == whc->open_intv)
whc->open_intv = new_intv;
@ -744,7 +744,7 @@ static void whc_delete_one (struct whc_impl *whc, struct whc_node *whcn)
{
struct whc_intvnode *intv;
struct whc_node *whcn_tmp = whcn;
intv = ut_avlLookupPredEq (&whc_seq_treedef, &whc->seq, &whcn->seq);
intv = ddsrt_avl_lookup_pred_eq (&whc_seq_treedef, &whc->seq, &whcn->seq);
assert (intv != NULL);
whc_delete_one_intv (whc, &intv, &whcn);
if (whcn_tmp->prev_seq)
@ -804,7 +804,7 @@ static unsigned whc_default_remove_acked_messages_noidx (struct whc_impl *whc, s
#ifndef NDEBUG
whcn = find_nextseq_intv (&intv, whc, whc->max_drop_seq);
assert (whcn == NULL || whcn->prev_seq == NULL);
assert (ut_avlIsSingleton (&whc->seq));
assert (ddsrt_avl_is_singleton (&whc->seq));
#endif
intv = whc->open_intv;
@ -894,7 +894,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
}
if (whcn == intv->last)
intv = ut_avlFindSucc (&whc_seq_treedef, &whc->seq, intv);
intv = ddsrt_avl_find_succ (&whc_seq_treedef, &whc->seq, intv);
if (prev_seq)
prev_seq->next_seq = whcn;
whcn->prev_seq = prev_seq;
@ -975,7 +975,7 @@ static unsigned whc_default_remove_acked_messages_full (struct whc_impl *whc, se
DDS_LOG(DDS_LC_WHC, " del %p %"PRId64, (void *) oldn, oldn->seq);
whc_delete_one (whc, oldn);
#ifndef NDEBUG
assert(ut_hhLookup(whc->idx_hash, &template) == idxn);
assert(ddsrt_hh_lookup(whc->idx_hash, &template) == idxn);
ddsi_serdata_unref(whcn_template.serdata);
#endif
}
@ -1069,14 +1069,14 @@ static struct whc_node *whc_default_insert_seq (struct whc_impl *whc, seqno_t ma
{
/* gap => need new open_intv */
struct whc_intvnode *intv1;
ut_avlIPath_t path;
ddsrt_avl_ipath_t path;
intv1 = ddsrt_malloc (sizeof (*intv1));
intv1->min = seq;
intv1->maxp1 = seq + 1;
intv1->first = intv1->last = newn;
if (ut_avlLookupIPath (&whc_seq_treedef, &whc->seq, &seq, &path) != NULL)
if (ddsrt_avl_lookup_ipath (&whc_seq_treedef, &whc->seq, &seq, &path) != NULL)
assert (0);
ut_avlInsertIPath (&whc_seq_treedef, &whc->seq, intv1, &path);
ddsrt_avl_insert_ipath (&whc_seq_treedef, &whc->seq, intv1, &path);
whc->open_intv = intv1;
}
@ -1128,7 +1128,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
}
template.idxn.iid = tk->m_iid;
if ((idxn = ut_hhLookup (whc->idx_hash, &template)) != NULL)
if ((idxn = ddsrt_hh_lookup (whc->idx_hash, &template)) != NULL)
{
/* Unregisters cause deleting of index entry, non-unregister of adding/overwriting in history */
DDS_LOG(DDS_LC_WHC, " idxn %p", (void *)idxn);
@ -1203,7 +1203,7 @@ static int whc_default_insert (struct whc *whc_generic, seqno_t max_drop_seq, se
idxn->hist[i] = NULL;
newn->idxnode = idxn;
newn->idxnode_pos = 0;
if (!ut_hhAdd (whc->idx_hash, idxn))
if (!ddsrt_hh_add (whc->idx_hash, idxn))
assert (0);
}
else

View file

@ -123,14 +123,14 @@ static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *pay
we fall back to using the GUIDs so that we can deliver all
samples we received from it. As writer being deleted any
reliable samples that are rejected are simply discarded. */
ut_avlIter_t it;
ddsrt_avl_iter_t it;
struct pwr_rd_match *m;
struct proxy_writer_info pwr_info;
dds_duration_t max_block_ms = nn_from_ddsi_duration (wr->xqos->reliability.max_blocking_time);
ddsrt_mutex_unlock (&wr->rdary.rdary_lock);
make_proxy_writer_info (&pwr_info, &wr->e, wr->xqos);
ddsrt_mutex_lock (&wr->e.lock);
for (m = ut_avlIterFirst (&wr_local_readers_treedef, &wr->local_readers, &it); m != NULL; m = ut_avlIterNext (&it))
for (m = ddsrt_avl_iter_first (&wr_local_readers_treedef, &wr->local_readers, &it); m != NULL; m = ddsrt_avl_iter_next (&it))
{
struct reader *rd;
if ((rd = ephash_lookup_reader_guid (&m->rd_guid)) != NULL)