2 * Copyright (C) 2021 Francis Deslauriers <francis.deslauriers@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #ifndef LTTNG_KERNEL_FUNCTION_INTERNAL_H
9 #define LTTNG_KERNEL_FUNCTION_INTERNAL_H
13 #include <sys/types.h>
15 #include <common/fd-handle.h>
16 #include <common/macros.h>
17 #include <lttng/kernel-function.h>
20 struct lttng_payload_view
;
21 struct lttng_dynamic_buffer
;
23 typedef bool (*kernel_function_location_equal_cb
)(
24 const struct lttng_kernel_function_location
*a
,
25 const struct lttng_kernel_function_location
*b
);
26 typedef int (*kernel_function_location_serialize_cb
)(
27 const struct lttng_kernel_function_location
*kernel_function_location
,
28 struct lttng_payload
*payload
);
29 typedef bool (*kernel_function_location_equal_cb
)(
30 const struct lttng_kernel_function_location
*a
,
31 const struct lttng_kernel_function_location
*b
);
32 typedef ssize_t (*kernel_function_location_create_from_payload_cb
)(
33 struct lttng_payload_view
*view
,
34 struct lttng_kernel_function_location
**kernel_function_location
);
35 typedef unsigned long (*kernel_function_location_hash_cb
)(
36 const struct lttng_kernel_function_location
*location
);
38 struct lttng_kernel_function_location_comm
{
39 /* enum lttng_kernel_function_location_type */
42 * Payload is composed of, in that order,
43 * - type-specific payload
48 struct lttng_kernel_function_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_function_location_address_comm
{
64 /* Common ancestor of all kernel function locations. */
65 struct lttng_kernel_function_location
{
66 enum lttng_kernel_function_location_type type
;
67 kernel_function_location_equal_cb equal
;
68 kernel_function_location_serialize_cb serialize
;
69 kernel_function_location_hash_cb hash
;
72 struct lttng_kernel_function_location_symbol
{
73 struct lttng_kernel_function_location parent
;
78 struct lttng_kernel_function_location_address
{
79 struct lttng_kernel_function_location parent
;
84 int lttng_kernel_function_location_serialize(
85 const struct lttng_kernel_function_location
*location
,
86 struct lttng_payload
*payload
);
89 ssize_t
lttng_kernel_function_location_create_from_payload(
90 struct lttng_payload_view
*view
,
91 struct lttng_kernel_function_location
**function_location
);
94 bool lttng_kernel_function_location_is_equal(
95 const struct lttng_kernel_function_location
*a
,
96 const struct lttng_kernel_function_location
*b
);
99 struct lttng_kernel_function_location
*lttng_kernel_function_location_copy(
100 const struct lttng_kernel_function_location
*location
);
103 unsigned long lttng_kernel_function_location_hash(
104 const struct lttng_kernel_function_location
*location
);
106 #endif /* LTTNG_KERNEL_FUNCTION_INTERNAL_H */