Commit | Line | Data |
---|---|---|
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 | ||
c9e313bc SM |
11 | #include <common/fd-handle.hpp> |
12 | #include <common/macros.hpp> | |
488dbb60 | 13 | #include <lttng/lttng-error.h> |
808cb744 | 14 | #include <lttng/kernel-probe.h> |
740da7d5 | 15 | #include <lttng/lttng-error.h> |
808cb744 JR |
16 | #include <stdbool.h> |
17 | #include <stdint.h> | |
18 | #include <sys/types.h> | |
19 | ||
20 | struct lttng_payload; | |
21 | struct lttng_payload_view; | |
22 | struct lttng_dynamic_buffer; | |
6a751b95 | 23 | struct mi_writer; |
808cb744 | 24 | |
e665dfbc JG |
25 | using kernel_probe_location_equal_cb = bool (*)(const struct lttng_kernel_probe_location *, |
26 | const struct lttng_kernel_probe_location *); | |
27 | using kernel_probe_location_serialize_cb = int (*)(const struct lttng_kernel_probe_location *, | |
28 | struct lttng_payload *); | |
29 | using kernel_probe_location_equal_cb = bool (*)(const struct lttng_kernel_probe_location *, | |
30 | const struct lttng_kernel_probe_location *); | |
31 | using kernel_probe_location_create_from_payload_cb = | |
32 | ssize_t (*)(struct lttng_payload_view *, struct lttng_kernel_probe_location **); | |
33 | using kernel_probe_location_hash_cb = unsigned long (*)(const struct lttng_kernel_probe_location *); | |
34 | using kernel_probe_location_mi_serialize_cb = | |
35 | enum lttng_error_code (*)(const struct lttng_kernel_probe_location *, struct mi_writer *); | |
808cb744 JR |
36 | |
37 | struct 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 | ||
47 | struct 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 | ||
59 | struct lttng_kernel_probe_location_address_comm { | |
60 | uint64_t address; | |
61 | } LTTNG_PACKED; | |
62 | ||
63 | /* Common ancestor of all kernel probe locations. */ | |
64 | struct 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; |
6a751b95 | 69 | kernel_probe_location_mi_serialize_cb mi_serialize; |
808cb744 JR |
70 | }; |
71 | ||
72 | struct lttng_kernel_probe_location_symbol { | |
73 | struct lttng_kernel_probe_location parent; | |
74 | char *symbol_name; | |
75 | uint64_t offset; | |
76 | }; | |
77 | ||
78 | struct lttng_kernel_probe_location_address { | |
79 | struct lttng_kernel_probe_location parent; | |
80 | uint64_t address; | |
81 | }; | |
82 | ||
808cb744 JR |
83 | int lttng_kernel_probe_location_serialize( |
84 | const struct lttng_kernel_probe_location *location, | |
85 | struct lttng_payload *payload); | |
86 | ||
808cb744 JR |
87 | ssize_t lttng_kernel_probe_location_create_from_payload( |
88 | struct lttng_payload_view *view, | |
89 | struct lttng_kernel_probe_location **probe_location); | |
90 | ||
808cb744 JR |
91 | bool lttng_kernel_probe_location_is_equal( |
92 | const struct lttng_kernel_probe_location *a, | |
93 | const struct lttng_kernel_probe_location *b); | |
94 | ||
077192fd JR |
95 | struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy( |
96 | const struct lttng_kernel_probe_location *location); | |
97 | ||
959e3c66 JR |
98 | unsigned long lttng_kernel_probe_location_hash( |
99 | const struct lttng_kernel_probe_location *location); | |
100 | ||
6a751b95 JR |
101 | enum lttng_error_code lttng_kernel_probe_location_mi_serialize( |
102 | const struct lttng_kernel_probe_location *location, | |
103 | struct mi_writer *writer); | |
104 | ||
808cb744 | 105 | #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */ |