2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_KERNEL_PROBE_INTERNAL_H
9 #define LTTNG_KERNEL_PROBE_INTERNAL_H
11 #include <common/fd-handle.hpp>
12 #include <common/macros.hpp>
14 #include <lttng/kernel-probe.h>
15 #include <lttng/lttng-error.h>
19 #include <sys/types.h>
22 struct lttng_payload_view;
23 struct lttng_dynamic_buffer;
26 using kernel_probe_location_equal_cb = bool (*)(const struct lttng_kernel_probe_location *,
27 const struct lttng_kernel_probe_location *);
28 using kernel_probe_location_serialize_cb = int (*)(const struct lttng_kernel_probe_location *,
29 struct lttng_payload *);
30 using kernel_probe_location_equal_cb = bool (*)(const struct lttng_kernel_probe_location *,
31 const struct lttng_kernel_probe_location *);
32 using kernel_probe_location_create_from_payload_cb =
33 ssize_t (*)(struct lttng_payload_view *, struct lttng_kernel_probe_location **);
34 using kernel_probe_location_hash_cb = unsigned long (*)(const struct lttng_kernel_probe_location *);
35 using kernel_probe_location_mi_serialize_cb =
36 enum lttng_error_code (*)(const struct lttng_kernel_probe_location *, struct mi_writer *);
38 struct lttng_kernel_probe_location_comm {
39 /* enum lttng_kernel_probe_location_type */
42 * Payload is composed of, in that order,
43 * - type-specific payload
48 struct lttng_kernel_probe_location_symbol_comm {
49 /* Includes the trailing \0. */
51 /* The offset from the symbol. */
54 * Payload is composed of, in that order,
55 * - symbol name (with trailing \0).
60 struct lttng_kernel_probe_location_address_comm {
64 /* Common ancestor of all kernel probe locations. */
65 struct lttng_kernel_probe_location {
66 enum lttng_kernel_probe_location_type type;
67 kernel_probe_location_equal_cb equal;
68 kernel_probe_location_serialize_cb serialize;
69 kernel_probe_location_hash_cb hash;
70 kernel_probe_location_mi_serialize_cb mi_serialize;
73 struct lttng_kernel_probe_location_symbol {
74 struct lttng_kernel_probe_location parent;
79 struct lttng_kernel_probe_location_address {
80 struct lttng_kernel_probe_location parent;
84 int lttng_kernel_probe_location_serialize(const struct lttng_kernel_probe_location *location,
85 struct lttng_payload *payload);
87 ssize_t lttng_kernel_probe_location_create_from_payload(
88 struct lttng_payload_view *view, struct lttng_kernel_probe_location **probe_location);
90 bool lttng_kernel_probe_location_is_equal(const struct lttng_kernel_probe_location *a,
91 const struct lttng_kernel_probe_location *b);
93 struct lttng_kernel_probe_location *
94 lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *location);
96 unsigned long lttng_kernel_probe_location_hash(const struct lttng_kernel_probe_location *location);
99 lttng_kernel_probe_location_mi_serialize(const struct lttng_kernel_probe_location *location,
100 struct mi_writer *writer);
102 #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */