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