X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lttng-utils.h;fp=lttng-utils.h;h=c669036b8bf7ce6f52abfdb95a9e5f2de2d041e5;hb=63629d862e5c6010d362dc30f2e8721221ef0dd5;hp=0000000000000000000000000000000000000000;hpb=721caea47b6506f7ad9086c3e9801dc9dfe06b6a;p=deliverable%2Flttng-modules.git diff --git a/lttng-utils.h b/lttng-utils.h new file mode 100644 index 00000000..c669036b --- /dev/null +++ b/lttng-utils.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) */ +#ifndef _LTTNG_UTILS_H +#define _LTTNG_UTILS_H +/* + * Copyright (C) 2020 Francis Deslauriers + */ + +#include +#include +#include + +static inline +struct hlist_head *utils_borrow_hash_table_bucket( + struct hlist_head *hash_table, + unsigned int hash_table_size, + const char *event_name) +{ + size_t name_len; + uint32_t hash; + + name_len = strlen(event_name); + + hash = jhash(event_name, name_len, 0); + return &hash_table[hash & (hash_table_size - 1)]; +} +#endif /* _LTTNG_UTILS_H */