SoW-2019-0002: Dynamic Snapshot
[deliverable/lttng-modules.git] / lttng-utils.h
CommitLineData
63629d86
FD
1/* SPDX-License-Identifier: (GPL-2.0 or LGPL-2.1) */
2#ifndef _LTTNG_UTILS_H
3#define _LTTNG_UTILS_H
4/*
5 * Copyright (C) 2020 Francis Deslauriers <francis.deslauriers@efficios.com>
6 */
7
8#include <linux/jhash.h>
9#include <linux/string.h>
10#include <linux/types.h>
11
12static inline
13struct hlist_head *utils_borrow_hash_table_bucket(
14 struct hlist_head *hash_table,
15 unsigned int hash_table_size,
16 const char *event_name)
17{
18 size_t name_len;
19 uint32_t hash;
20
21 name_len = strlen(event_name);
22
23 hash = jhash(event_name, name_len, 0);
24 return &hash_table[hash & (hash_table_size - 1)];
25}
26#endif /* _LTTNG_UTILS_H */
This page took 0.025359 seconds and 5 git commands to generate.