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