Add base support for event rule hit
[lttng-tools.git] / include / lttng / kernel-probe-internal.h
CommitLineData
808cb744
JR
1/*
2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
8#ifndef LTTNG_KERNEL_PROBE_INTERNAL_H
9#define LTTNG_KERNEL_PROBE_INTERNAL_H
10
11#include <common/fd-handle.h>
12#include <common/macros.h>
13#include <lttng/kernel-probe.h>
14#include <stdbool.h>
15#include <stdint.h>
16#include <sys/types.h>
17
18struct lttng_payload;
19struct lttng_payload_view;
20struct lttng_dynamic_buffer;
21
22typedef bool (*kernel_probe_location_equal_cb)(
23 const struct lttng_kernel_probe_location *a,
24 const struct lttng_kernel_probe_location *b);
25typedef int (*kernel_probe_location_serialize_cb)(
26 const struct lttng_kernel_probe_location *kernel_probe_location,
27 struct lttng_payload *payload);
28typedef bool (*kernel_probe_location_equal_cb)(
29 const struct lttng_kernel_probe_location *a,
30 const struct lttng_kernel_probe_location *b);
31typedef ssize_t (*kernel_probe_location_create_from_payload_cb)(
32 struct lttng_payload_view *view,
33 struct lttng_kernel_probe_location **kernel_probe_location);
959e3c66
JR
34typedef unsigned long (*kernel_probe_location_hash_cb)(
35 const struct lttng_kernel_probe_location *location);
808cb744
JR
36
37struct lttng_kernel_probe_location_comm {
38 /* enum lttng_kernel_probe_location_type */
39 int8_t type;
40 /*
41 * Payload is composed of, in that order,
42 * - type-specific payload
43 */
44 char payload[];
45} LTTNG_PACKED;
46
47struct lttng_kernel_probe_location_symbol_comm {
48 /* Includes the trailing \0. */
49 uint32_t symbol_len;
50 /* The offset from the symbol. */
51 uint64_t offset;
52 /*
53 * Payload is composed of, in that order,
54 * - symbol name (with trailing \0).
55 */
56 char payload[];
57} LTTNG_PACKED;
58
59struct lttng_kernel_probe_location_address_comm {
60 uint64_t address;
61} LTTNG_PACKED;
62
63/* Common ancestor of all kernel probe locations. */
64struct lttng_kernel_probe_location {
65 enum lttng_kernel_probe_location_type type;
66 kernel_probe_location_equal_cb equal;
67 kernel_probe_location_serialize_cb serialize;
959e3c66 68 kernel_probe_location_hash_cb hash;
808cb744
JR
69};
70
71struct lttng_kernel_probe_location_symbol {
72 struct lttng_kernel_probe_location parent;
73 char *symbol_name;
74 uint64_t offset;
75};
76
77struct lttng_kernel_probe_location_address {
78 struct lttng_kernel_probe_location parent;
79 uint64_t address;
80};
81
82LTTNG_HIDDEN
83int lttng_kernel_probe_location_serialize(
84 const struct lttng_kernel_probe_location *location,
85 struct lttng_payload *payload);
86
87LTTNG_HIDDEN
88ssize_t lttng_kernel_probe_location_create_from_payload(
89 struct lttng_payload_view *view,
90 struct lttng_kernel_probe_location **probe_location);
91
92LTTNG_HIDDEN
93bool lttng_kernel_probe_location_is_equal(
94 const struct lttng_kernel_probe_location *a,
95 const struct lttng_kernel_probe_location *b);
96
077192fd
JR
97LTTNG_HIDDEN
98struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
99 const struct lttng_kernel_probe_location *location);
100
959e3c66
JR
101LTTNG_HIDDEN
102unsigned long lttng_kernel_probe_location_hash(
103 const struct lttng_kernel_probe_location *location);
104
808cb744 105#endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */
This page took 0.037151 seconds and 4 git commands to generate.