common: compile libcompat as C++
[lttng-tools.git] / include / lttng / kernel-probe-internal.h
CommitLineData
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
11#include <common/fd-handle.h>
12#include <common/macros.h>
13#include <lttng/kernel-probe.h>
740da7d5 14#include <lttng/lttng-error.h>
808cb744
JR
15#include <stdbool.h>
16#include <stdint.h>
17#include <sys/types.h>
18
740da7d5
SM
19#ifdef __cplusplus
20extern "C" {
21#endif
22
808cb744
JR
23struct lttng_payload;
24struct lttng_payload_view;
25struct lttng_dynamic_buffer;
6a751b95 26struct mi_writer;
808cb744
JR
27
28typedef bool (*kernel_probe_location_equal_cb)(
29 const struct lttng_kernel_probe_location *a,
30 const struct lttng_kernel_probe_location *b);
31typedef int (*kernel_probe_location_serialize_cb)(
32 const struct lttng_kernel_probe_location *kernel_probe_location,
33 struct lttng_payload *payload);
34typedef bool (*kernel_probe_location_equal_cb)(
35 const struct lttng_kernel_probe_location *a,
36 const struct lttng_kernel_probe_location *b);
37typedef ssize_t (*kernel_probe_location_create_from_payload_cb)(
38 struct lttng_payload_view *view,
39 struct lttng_kernel_probe_location **kernel_probe_location);
959e3c66
JR
40typedef unsigned long (*kernel_probe_location_hash_cb)(
41 const struct lttng_kernel_probe_location *location);
6a751b95
JR
42typedef enum lttng_error_code (*kernel_probe_location_mi_serialize_cb)(
43 const struct lttng_kernel_probe_location *location,
44 struct mi_writer *writer);
808cb744
JR
45
46struct lttng_kernel_probe_location_comm {
47 /* enum lttng_kernel_probe_location_type */
48 int8_t type;
49 /*
50 * Payload is composed of, in that order,
51 * - type-specific payload
52 */
53 char payload[];
54} LTTNG_PACKED;
55
56struct lttng_kernel_probe_location_symbol_comm {
57 /* Includes the trailing \0. */
58 uint32_t symbol_len;
59 /* The offset from the symbol. */
60 uint64_t offset;
61 /*
62 * Payload is composed of, in that order,
63 * - symbol name (with trailing \0).
64 */
65 char payload[];
66} LTTNG_PACKED;
67
68struct lttng_kernel_probe_location_address_comm {
69 uint64_t address;
70} LTTNG_PACKED;
71
72/* Common ancestor of all kernel probe locations. */
73struct 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;
959e3c66 77 kernel_probe_location_hash_cb hash;
6a751b95 78 kernel_probe_location_mi_serialize_cb mi_serialize;
808cb744
JR
79};
80
81struct lttng_kernel_probe_location_symbol {
82 struct lttng_kernel_probe_location parent;
83 char *symbol_name;
84 uint64_t offset;
85};
86
87struct lttng_kernel_probe_location_address {
88 struct lttng_kernel_probe_location parent;
89 uint64_t address;
90};
91
808cb744
JR
92int lttng_kernel_probe_location_serialize(
93 const struct lttng_kernel_probe_location *location,
94 struct lttng_payload *payload);
95
808cb744
JR
96ssize_t lttng_kernel_probe_location_create_from_payload(
97 struct lttng_payload_view *view,
98 struct lttng_kernel_probe_location **probe_location);
99
808cb744
JR
100bool lttng_kernel_probe_location_is_equal(
101 const struct lttng_kernel_probe_location *a,
102 const struct lttng_kernel_probe_location *b);
103
077192fd
JR
104struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
105 const struct lttng_kernel_probe_location *location);
106
959e3c66
JR
107unsigned long lttng_kernel_probe_location_hash(
108 const struct lttng_kernel_probe_location *location);
109
6a751b95
JR
110enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
111 const struct lttng_kernel_probe_location *location,
112 struct mi_writer *writer);
113
740da7d5
SM
114#ifdef __cplusplus
115}
116#endif
117
808cb744 118#endif /* LTTNG_KERNEL_PROBE_INTERNAL_H */
This page took 0.029027 seconds and 4 git commands to generate.