X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust%2Fust-core.c;h=60751dc32a9aa56058e1452f3e9ddec4a395981b;hb=c785c634a51956094130218c2bffeff32756cb69;hp=60cdbfa91a2c876f5d5ae05db7a6ceae2a065df6;hpb=aaf93c608bb7591f0a5411c221a3ad3fbd8efdfd;p=lttng-ust.git diff --git a/liblttng-ust/ust-core.c b/liblttng-ust/ust-core.c index 60cdbfa9..60751dc3 100644 --- a/liblttng-ust/ust-core.c +++ b/liblttng-ust/ust-core.c @@ -21,6 +21,7 @@ #include #include #include +#include "jhash.h" static CDS_LIST_HEAD(lttng_transport_list); @@ -56,3 +57,26 @@ void lttng_transport_unregister(struct lttng_transport *transport) { cds_list_del(&transport->node); } + +/* + * Needed by comm layer. + */ +struct lttng_enum *lttng_ust_enum_get(struct lttng_session *session, + const char *enum_name) +{ + struct lttng_enum *_enum; + struct cds_hlist_head *head; + struct cds_hlist_node *node; + size_t name_len = strlen(enum_name); + uint32_t hash; + + hash = jhash(enum_name, name_len, 0); + head = &session->enums_ht.table[hash & (LTTNG_UST_ENUM_HT_SIZE - 1)]; + cds_hlist_for_each_entry(_enum, node, head, hlist) { + assert(_enum->desc); + if (!strncmp(_enum->desc->name, enum_name, + LTTNG_UST_SYM_NAME_LEN - 1)) + return _enum; + } + return NULL; +}