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/kernel-probe.h>
14 #include <lttng/lttng-error.h>
17 #include <sys/types.h>
24 struct lttng_payload_view
;
25 struct lttng_dynamic_buffer
;
28 typedef bool (*kernel_probe_location_equal_cb
)(
29 const struct lttng_kernel_probe_location
*a
,
30 const struct lttng_kernel_probe_location
*b
);
31 typedef int (*kernel_probe_location_serialize_cb
)(
32 const struct lttng_kernel_probe_location
*kernel_probe_location
,
33 struct lttng_payload
*payload
);
34 typedef bool (*kernel_probe_location_equal_cb
)(
35 const struct lttng_kernel_probe_location
*a
,
36 const struct lttng_kernel_probe_location
*b
);
37 typedef ssize_t (*kernel_probe_location_create_from_payload_cb
)(
38 struct lttng_payload_view
*view
,
39 struct lttng_kernel_probe_location
**kernel_probe_location
);
40 typedef unsigned long (*kernel_probe_location_hash_cb
)(
41 const struct lttng_kernel_probe_location
*location
);
42 typedef enum lttng_error_code (*kernel_probe_location_mi_serialize_cb
)(
43 const struct lttng_kernel_probe_location
*location
,
44 struct mi_writer
*writer
);
46 struct lttng_kernel_probe_location_comm
{
47 /* enum lttng_kernel_probe_location_type */
50 * Payload is composed of, in that order,
51 * - type-specific payload
56 struct lttng_kernel_probe_location_symbol_comm
{
57 /* Includes the trailing \0. */
59 /* The offset from the symbol. */
62 * Payload is composed of, in that order,
63 * - symbol name (with trailing \0).
68 struct lttng_kernel_probe_location_address_comm
{
72 /* Common ancestor of all kernel probe locations. */
73 struct lttng_kernel_probe_location
{
74 enum lttng_kernel_probe_location_type type
;
75 kernel_probe_location_equal_cb equal
;
76 kernel_probe_location_serialize_cb serialize
;
77 kernel_probe_location_hash_cb hash
;
78 kernel_probe_location_mi_serialize_cb mi_serialize
;
81 struct lttng_kernel_probe_location_symbol
{
82 struct lttng_kernel_probe_location parent
;
87 struct lttng_kernel_probe_location_address
{
88 struct lttng_kernel_probe_location parent
;
92 int lttng_kernel_probe_location_serialize(
93 const struct lttng_kernel_probe_location
*location
,
94 struct lttng_payload
*payload
);
96 ssize_t
lttng_kernel_probe_location_create_from_payload(
97 struct lttng_payload_view
*view
,
98 struct lttng_kernel_probe_location
**probe_location
);
100 bool lttng_kernel_probe_location_is_equal(
101 const struct lttng_kernel_probe_location
*a
,
102 const struct lttng_kernel_probe_location
*b
);
104 struct lttng_kernel_probe_location
*lttng_kernel_probe_location_copy(
105 const struct lttng_kernel_probe_location
*location
);
107 unsigned long lttng_kernel_probe_location_hash(
108 const struct lttng_kernel_probe_location
*location
);
110 enum lttng_error_code
lttng_kernel_probe_location_mi_serialize(
111 const struct lttng_kernel_probe_location
*location
,
112 struct mi_writer
*writer
);
118 #endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */