src: implement REUSE with SPDX identifiers
[lttng-ust.git] / src / common / events.c
CommitLineData
71ca2509
MJ
1// SPDX-FileCopyrightText: 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
810185f3
MJ
4
5#include <string.h>
6
7#include "common/events.h"
8#include "common/jhash.h"
9
10/*
11 * Needed by comm layer.
12 */
13struct lttng_enum *lttng_ust_enum_get_from_desc(struct lttng_ust_session *session,
14 const struct lttng_ust_enum_desc *enum_desc)
15{
16 struct lttng_enum *_enum;
17 struct cds_hlist_head *head;
18 struct cds_hlist_node *node;
19 size_t name_len = strlen(enum_desc->name);
20 uint32_t hash;
21
22 hash = jhash(enum_desc->name, name_len, 0);
23 head = &session->priv->enums_ht.table[hash & (LTTNG_UST_ENUM_HT_SIZE - 1)];
24 cds_hlist_for_each_entry(_enum, node, head, hlist) {
25 assert(_enum->desc);
26 if (_enum->desc == enum_desc)
27 return _enum;
28 }
29 return NULL;
30}
This page took 0.027586 seconds and 4 git commands to generate.