Copyright ownership transfer
[lttng-ust.git] / src / common / events.c
1
2 #include <string.h>
3
4 #include "common/events.h"
5 #include "common/jhash.h"
6
7 /*
8 * Needed by comm layer.
9 */
10 struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_ust_session *session,
11 const struct lttng_ust_enum_desc *enum_desc)
12 {
13 struct lttng_enum *_enum;
14 struct cds_hlist_head *head;
15 struct cds_hlist_node *node;
16 size_t name_len = strlen(enum_desc->name);
17 uint32_t hash;
18
19 hash = jhash(enum_desc->name, name_len, 0);
20 head = &session->priv->enums_ht.table[hash & (LTTNG_UST_ENUM_HT_SIZE - 1)];
21 cds_hlist_for_each_entry(_enum, node, head, hlist) {
22 assert(_enum->desc);
23 if (_enum->desc == enum_desc)
24 return _enum;
25 }
26 return NULL;
27 }
This page took 0.04177 seconds and 4 git commands to generate.