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.h>
12 #include <common/macros.h>
13 #include <lttng/lttng-error.h>
14 #include <lttng/kernel-probe.h>
15 #include <lttng/lttng-error.h>
18 #include <sys/types.h>
21 struct lttng_payload_view
;
22 struct lttng_dynamic_buffer
;
25 typedef bool (*kernel_probe_location_equal_cb
)(
26 const struct lttng_kernel_probe_location
*a
,
27 const struct lttng_kernel_probe_location
*b
);
28 typedef int (*kernel_probe_location_serialize_cb
)(
29 const struct lttng_kernel_probe_location
*kernel_probe_location
,
30 struct lttng_payload
*payload
);
31 typedef bool (*kernel_probe_location_equal_cb
)(
32 const struct lttng_kernel_probe_location
*a
,
33 const struct lttng_kernel_probe_location
*b
);
34 typedef ssize_t (*kernel_probe_location_create_from_payload_cb
)(
35 struct lttng_payload_view
*view
,
36 struct lttng_kernel_probe_location
**kernel_probe_location
);
37 typedef unsigned long (*kernel_probe_location_hash_cb
)(
38 const struct lttng_kernel_probe_location
*location
);
39 typedef enum lttng_error_code (*kernel_probe_location_mi_serialize_cb
)(
40 const struct lttng_kernel_probe_location
*location
,
41 struct mi_writer
*writer
);
43 struct lttng_kernel_probe_location_comm
{
44 /* enum lttng_kernel_probe_location_type */
47 * Payload is composed of, in that order,
48 * - type-specific payload
53 struct lttng_kernel_probe_location_symbol_comm
{
54 /* Includes the trailing \0. */
56 /* The offset from the symbol. */
59 * Payload is composed of, in that order,
60 * - symbol name (with trailing \0).
65 struct lttng_kernel_probe_location_address_comm
{
69 /* Common ancestor of all kernel probe locations. */
70 struct lttng_kernel_probe_location
{
71 enum lttng_kernel_probe_location_type type
;
72 kernel_probe_location_equal_cb equal
;
73 kernel_probe_location_serialize_cb serialize
;
74 kernel_probe_location_hash_cb hash
;
75 kernel_probe_location_mi_serialize_cb mi_serialize
;
78 struct lttng_kernel_probe_location_symbol
{
79 struct lttng_kernel_probe_location parent
;
84 struct lttng_kernel_probe_location_address
{
85 struct lttng_kernel_probe_location parent
;
89 int lttng_kernel_probe_location_serialize(
90 const struct lttng_kernel_probe_location
*location
,
91 struct lttng_payload
*payload
);
93 ssize_t
lttng_kernel_probe_location_create_from_payload(
94 struct lttng_payload_view
*view
,
95 struct lttng_kernel_probe_location
**probe_location
);
97 bool lttng_kernel_probe_location_is_equal(
98 const struct lttng_kernel_probe_location
*a
,
99 const struct lttng_kernel_probe_location
*b
);
101 struct lttng_kernel_probe_location
*lttng_kernel_probe_location_copy(
102 const struct lttng_kernel_probe_location
*location
);
104 unsigned long lttng_kernel_probe_location_hash(
105 const struct lttng_kernel_probe_location
*location
);
107 enum lttng_error_code
lttng_kernel_probe_location_mi_serialize(
108 const struct lttng_kernel_probe_location
*location
,
109 struct mi_writer
*writer
);
111 #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */