*/
#include "lttng/lttng-error.h"
+
#include <common/error.hpp>
#include <common/hashtable/hashtable.hpp>
#include <common/hashtable/utils.hpp>
#include <common/mi-lttng.hpp>
#include <common/payload-view.hpp>
#include <common/payload.hpp>
-#include <fcntl.h>
+
#include <lttng/constant.h>
#include <lttng/kernel-probe-internal.hpp>
#include <lttng/kernel-probe.h>
+
+#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
-static
-int lttng_kernel_probe_location_address_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload);
-
-static
-int lttng_kernel_probe_location_symbol_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload);
-
-static
-bool lttng_kernel_probe_location_address_is_equal(
- const struct lttng_kernel_probe_location *a,
- const struct lttng_kernel_probe_location *b);
-
-static
-bool lttng_kernel_probe_location_symbol_is_equal(
- const struct lttng_kernel_probe_location *a,
- const struct lttng_kernel_probe_location *b);
-
-static
-unsigned long lttng_kernel_probe_location_address_hash(
- const struct lttng_kernel_probe_location *location);
-
-static
-unsigned long lttng_kernel_probe_location_symbol_hash(
- const struct lttng_kernel_probe_location *location);
-
-static
-enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer);
-
-static
-enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer);
-
-enum lttng_kernel_probe_location_type lttng_kernel_probe_location_get_type(
- const struct lttng_kernel_probe_location *location)
+static int
+lttng_kernel_probe_location_address_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload);
+
+static int
+lttng_kernel_probe_location_symbol_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload);
+
+static bool
+lttng_kernel_probe_location_address_is_equal(const struct lttng_kernel_probe_location *a,
+ const struct lttng_kernel_probe_location *b);
+
+static bool
+lttng_kernel_probe_location_symbol_is_equal(const struct lttng_kernel_probe_location *a,
+ const struct lttng_kernel_probe_location *b);
+
+static unsigned long
+lttng_kernel_probe_location_address_hash(const struct lttng_kernel_probe_location *location);
+
+static unsigned long
+lttng_kernel_probe_location_symbol_hash(const struct lttng_kernel_probe_location *location);
+
+static enum lttng_error_code
+lttng_kernel_probe_location_address_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer);
+
+static enum lttng_error_code
+lttng_kernel_probe_location_symbol_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer);
+
+enum lttng_kernel_probe_location_type
+lttng_kernel_probe_location_get_type(const struct lttng_kernel_probe_location *location)
{
- return location ? location->type :
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN;
+ return location ? location->type : LTTNG_KERNEL_PROBE_LOCATION_TYPE_UNKNOWN;
}
-static
-void lttng_kernel_probe_location_address_destroy(
- struct lttng_kernel_probe_location *location)
+static void
+lttng_kernel_probe_location_address_destroy(struct lttng_kernel_probe_location *location)
{
LTTNG_ASSERT(location);
free(location);
}
-static
-void lttng_kernel_probe_location_symbol_destroy(
- struct lttng_kernel_probe_location *location)
+static void lttng_kernel_probe_location_symbol_destroy(struct lttng_kernel_probe_location *location)
{
- struct lttng_kernel_probe_location_symbol *location_symbol = NULL;
+ struct lttng_kernel_probe_location_symbol *location_symbol = nullptr;
LTTNG_ASSERT(location);
- location_symbol = container_of(location,
- struct lttng_kernel_probe_location_symbol,
- parent);
+ location_symbol =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_symbol::parent);
LTTNG_ASSERT(location_symbol);
free(location);
}
-void lttng_kernel_probe_location_destroy(
- struct lttng_kernel_probe_location *location)
+void lttng_kernel_probe_location_destroy(struct lttng_kernel_probe_location *location)
{
if (!location) {
return;
}
}
-struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_address_create(uint64_t address)
+struct lttng_kernel_probe_location *lttng_kernel_probe_location_address_create(uint64_t address)
{
- struct lttng_kernel_probe_location *ret = NULL;
+ struct lttng_kernel_probe_location *ret = nullptr;
struct lttng_kernel_probe_location_address *location;
location = zmalloc<lttng_kernel_probe_location_address>();
}
struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_symbol_create(const char *symbol_name,
- uint64_t offset)
+lttng_kernel_probe_location_symbol_create(const char *symbol_name, uint64_t offset)
{
- char *symbol_name_copy = NULL;
- struct lttng_kernel_probe_location *ret = NULL;
+ char *symbol_name_copy = nullptr;
+ struct lttng_kernel_probe_location *ret = nullptr;
struct lttng_kernel_probe_location_symbol *location;
if (!symbol_name || strlen(symbol_name) >= LTTNG_SYMBOL_NAME_LEN) {
}
enum lttng_kernel_probe_location_status
-lttng_kernel_probe_location_address_get_address(
- const struct lttng_kernel_probe_location *location,
- uint64_t *offset)
+lttng_kernel_probe_location_address_get_address(const struct lttng_kernel_probe_location *location,
+ uint64_t *offset)
{
- enum lttng_kernel_probe_location_status ret =
- LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
+ enum lttng_kernel_probe_location_status ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
struct lttng_kernel_probe_location_address *address_location;
LTTNG_ASSERT(offset);
- if (!location || lttng_kernel_probe_location_get_type(location) !=
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) {
+ if (!location ||
+ lttng_kernel_probe_location_get_type(location) !=
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) {
ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID;
goto end;
}
- address_location = container_of(location,
- struct lttng_kernel_probe_location_address, parent);
+ address_location =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_address::parent);
*offset = address_location->address;
end:
return ret;
}
-const char *lttng_kernel_probe_location_symbol_get_name(
- const struct lttng_kernel_probe_location *location)
+const char *
+lttng_kernel_probe_location_symbol_get_name(const struct lttng_kernel_probe_location *location)
{
- const char *ret = NULL;
+ const char *ret = nullptr;
struct lttng_kernel_probe_location_symbol *symbol_location;
- if (!location || lttng_kernel_probe_location_get_type(location) !=
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
+ if (!location ||
+ lttng_kernel_probe_location_get_type(location) !=
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
goto end;
}
- symbol_location = container_of(location,
- struct lttng_kernel_probe_location_symbol, parent);
+ symbol_location =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_symbol::parent);
ret = symbol_location->symbol_name;
end:
return ret;
}
enum lttng_kernel_probe_location_status
-lttng_kernel_probe_location_symbol_get_offset(
- const struct lttng_kernel_probe_location *location,
- uint64_t *offset)
+lttng_kernel_probe_location_symbol_get_offset(const struct lttng_kernel_probe_location *location,
+ uint64_t *offset)
{
- enum lttng_kernel_probe_location_status ret =
- LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
+ enum lttng_kernel_probe_location_status ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK;
struct lttng_kernel_probe_location_symbol *symbol_location;
LTTNG_ASSERT(offset);
- if (!location || lttng_kernel_probe_location_get_type(location) !=
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
+ if (!location ||
+ lttng_kernel_probe_location_get_type(location) !=
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) {
ERR("Invalid argument(s) passed to '%s'", __FUNCTION__);
ret = LTTNG_KERNEL_PROBE_LOCATION_STATUS_INVALID;
goto end;
}
- symbol_location = container_of(location,
- struct lttng_kernel_probe_location_symbol, parent);
+ symbol_location =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_symbol::parent);
*offset = symbol_location->offset;
end:
return ret;
}
-static
-int lttng_kernel_probe_location_symbol_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload)
+static int
+lttng_kernel_probe_location_symbol_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload)
{
int ret;
size_t symbol_name_len;
}
LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
original_payload_size = payload->buffer.size;
- location_symbol = container_of(location,
- struct lttng_kernel_probe_location_symbol, parent);
+ location_symbol =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_symbol::parent);
if (!location_symbol->symbol_name) {
ret = -LTTNG_ERR_INVALID;
location_symbol_comm.symbol_len = symbol_name_len + 1;
location_symbol_comm.offset = location_symbol->offset;
- ret = lttng_dynamic_buffer_append(&payload->buffer,
- &location_symbol_comm, sizeof(location_symbol_comm));
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, &location_symbol_comm, sizeof(location_symbol_comm));
if (ret) {
ret = -LTTNG_ERR_INVALID;
goto end;
}
- ret = lttng_dynamic_buffer_append(&payload->buffer,
- location_symbol->symbol_name,
- location_symbol_comm.symbol_len);
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, location_symbol->symbol_name, location_symbol_comm.symbol_len);
if (ret) {
ret = -LTTNG_ERR_INVALID;
goto end;
return ret;
}
-static
-int lttng_kernel_probe_location_address_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload)
+static int
+lttng_kernel_probe_location_address_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload)
{
int ret;
size_t original_payload_size;
LTTNG_ASSERT(location);
LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) ==
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
+ LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
original_payload_size = payload->buffer.size;
- location_address = container_of(location,
- struct lttng_kernel_probe_location_address,
- parent);
+ location_address =
+ lttng::utils::container_of(location, <tng_kernel_probe_location_address::parent);
location_address_comm.address = location_address->address;
- ret = lttng_dynamic_buffer_append(&payload->buffer,
- &location_address_comm,
- sizeof(location_address_comm));
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, &location_address_comm, sizeof(location_address_comm));
if (ret) {
ret = -LTTNG_ERR_INVALID;
goto end;
return ret;
}
-int lttng_kernel_probe_location_serialize(
- const struct lttng_kernel_probe_location *location,
- struct lttng_payload *payload)
+int lttng_kernel_probe_location_serialize(const struct lttng_kernel_probe_location *location,
+ struct lttng_payload *payload)
{
int ret;
size_t original_payload_size;
original_payload_size = payload->buffer.size;
location_generic_comm.type = (int8_t) location->type;
- ret = lttng_dynamic_buffer_append(&payload->buffer,
- &location_generic_comm,
- sizeof(location_generic_comm));
+ ret = lttng_dynamic_buffer_append(
+ &payload->buffer, &location_generic_comm, sizeof(location_generic_comm));
if (ret) {
goto end;
}
return ret;
}
-static
-int lttng_kernel_probe_location_symbol_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_kernel_probe_location **location)
+static int lttng_kernel_probe_location_symbol_create_from_payload(
+ struct lttng_payload_view *view, struct lttng_kernel_probe_location **location)
{
struct lttng_kernel_probe_location_symbol_comm *location_symbol_comm;
const char *symbol_name_src;
goto end;
}
- location_symbol_comm =
- (typeof(location_symbol_comm)) view->buffer.data;
+ location_symbol_comm = (typeof(location_symbol_comm)) view->buffer.data;
- expected_size = sizeof(*location_symbol_comm) +
- location_symbol_comm->symbol_len;
+ expected_size = sizeof(*location_symbol_comm) + location_symbol_comm->symbol_len;
if (view->buffer.size < expected_size) {
ret = -LTTNG_ERR_INVALID;
symbol_name_src = view->buffer.data + sizeof(*location_symbol_comm);
- if (!lttng_buffer_view_contains_string(&view->buffer, symbol_name_src,
- location_symbol_comm->symbol_len)) {
+ if (!lttng_buffer_view_contains_string(
+ &view->buffer, symbol_name_src, location_symbol_comm->symbol_len)) {
ret = -LTTNG_ERR_INVALID;
goto end;
}
- *location = lttng_kernel_probe_location_symbol_create(
- symbol_name_src, location_symbol_comm->offset);
+ *location = lttng_kernel_probe_location_symbol_create(symbol_name_src,
+ location_symbol_comm->offset);
if (!(*location)) {
ret = -LTTNG_ERR_INVALID;
goto end;
return ret;
}
-static
-ssize_t lttng_kernel_probe_location_address_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_kernel_probe_location **location)
+static ssize_t lttng_kernel_probe_location_address_create_from_payload(
+ struct lttng_payload_view *view, struct lttng_kernel_probe_location **location)
{
struct lttng_kernel_probe_location_address_comm *location_address_comm;
ssize_t ret = 0;
goto end;
}
- location_address_comm =
- (typeof(location_address_comm)) view->buffer.data;
+ location_address_comm = (typeof(location_address_comm)) view->buffer.data;
*location = lttng_kernel_probe_location_address_create(location_address_comm->address);
if (!(*location)) {
return ret;
}
-ssize_t lttng_kernel_probe_location_create_from_payload(
- struct lttng_payload_view *view,
- struct lttng_kernel_probe_location **location)
+ssize_t
+lttng_kernel_probe_location_create_from_payload(struct lttng_payload_view *view,
+ struct lttng_kernel_probe_location **location)
{
enum lttng_kernel_probe_location_type type;
ssize_t consumed = 0;
ssize_t ret;
const struct lttng_kernel_probe_location_comm *probe_location_comm;
const struct lttng_payload_view probe_location_comm_view =
- lttng_payload_view_from_view(
- view, 0, sizeof(*probe_location_comm));
+ lttng_payload_view_from_view(view, 0, sizeof(*probe_location_comm));
LTTNG_ASSERT(view);
LTTNG_ASSERT(location);
case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
{
struct lttng_payload_view location_view =
- lttng_payload_view_from_view(
- view, consumed, -1);
+ lttng_payload_view_from_view(view, consumed, -1);
- ret = lttng_kernel_probe_location_symbol_create_from_payload(
- &location_view, location);
+ ret = lttng_kernel_probe_location_symbol_create_from_payload(&location_view,
+ location);
break;
}
case LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS:
{
struct lttng_payload_view location_view =
- lttng_payload_view_from_view(view, consumed, -1);
+ lttng_payload_view_from_view(view, consumed, -1);
- ret = lttng_kernel_probe_location_address_create_from_payload(
- &location_view, location);
+ ret = lttng_kernel_probe_location_address_create_from_payload(&location_view,
+ location);
break;
}
default:
return ret;
}
-static
-unsigned long lttng_kernel_probe_location_address_hash(
- const struct lttng_kernel_probe_location *location)
+static unsigned long
+lttng_kernel_probe_location_address_hash(const struct lttng_kernel_probe_location *location)
{
- unsigned long hash = hash_key_ulong(
- (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS,
- lttng_ht_seed);
+ unsigned long hash =
+ hash_key_ulong((void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS, lttng_ht_seed);
struct lttng_kernel_probe_location_address *address_location =
- container_of(location, typeof(*address_location),
- parent);
+ lttng::utils::container_of(location, <tng_kernel_probe_location_address::parent);
hash ^= hash_key_u64(&address_location->address, lttng_ht_seed);
return hash;
}
-static
-bool lttng_kernel_probe_location_address_is_equal(
- const struct lttng_kernel_probe_location *_a,
- const struct lttng_kernel_probe_location *_b)
+static bool
+lttng_kernel_probe_location_address_is_equal(const struct lttng_kernel_probe_location *_a,
+ const struct lttng_kernel_probe_location *_b)
{
bool is_equal = false;
struct lttng_kernel_probe_location_address *a, *b;
- a = container_of(_a, struct lttng_kernel_probe_location_address,
- parent);
- b = container_of(_b, struct lttng_kernel_probe_location_address,
- parent);
+ a = lttng::utils::container_of(_a, <tng_kernel_probe_location_address::parent);
+ b = lttng::utils::container_of(_b, <tng_kernel_probe_location_address::parent);
if (a->address != b->address) {
goto end;
return is_equal;
}
-static
-unsigned long lttng_kernel_probe_location_symbol_hash(
- const struct lttng_kernel_probe_location *location)
+static unsigned long
+lttng_kernel_probe_location_symbol_hash(const struct lttng_kernel_probe_location *location)
{
- unsigned long hash = hash_key_ulong(
- (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET,
- lttng_ht_seed);
+ unsigned long hash = hash_key_ulong((void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET,
+ lttng_ht_seed);
struct lttng_kernel_probe_location_symbol *symbol_location =
- container_of(location, typeof(*symbol_location),
- parent);
+ lttng::utils::container_of(location, <tng_kernel_probe_location_symbol::parent);
hash ^= hash_key_str(symbol_location->symbol_name, lttng_ht_seed);
hash ^= hash_key_u64(&symbol_location->offset, lttng_ht_seed);
return hash;
}
-static
-bool lttng_kernel_probe_location_symbol_is_equal(
- const struct lttng_kernel_probe_location *_a,
- const struct lttng_kernel_probe_location *_b)
+static bool
+lttng_kernel_probe_location_symbol_is_equal(const struct lttng_kernel_probe_location *_a,
+ const struct lttng_kernel_probe_location *_b)
{
bool is_equal = false;
struct lttng_kernel_probe_location_symbol *a, *b;
- a = container_of(_a, struct lttng_kernel_probe_location_symbol,
- parent);
- b = container_of(_b, struct lttng_kernel_probe_location_symbol,
- parent);
+ a = lttng::utils::container_of(_a, <tng_kernel_probe_location_symbol::parent);
+ b = lttng::utils::container_of(_b, <tng_kernel_probe_location_symbol::parent);
LTTNG_ASSERT(a->symbol_name);
LTTNG_ASSERT(b->symbol_name);
- if (strcmp(a->symbol_name, b->symbol_name)) {
+ if (strcmp(a->symbol_name, b->symbol_name) != 0) {
goto end;
}
return is_equal;
}
-bool lttng_kernel_probe_location_is_equal(
- const struct lttng_kernel_probe_location *a,
- const struct lttng_kernel_probe_location *b)
+bool lttng_kernel_probe_location_is_equal(const struct lttng_kernel_probe_location *a,
+ const struct lttng_kernel_probe_location *b)
{
bool is_equal = false;
}
static struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_symbol_copy(
- const struct lttng_kernel_probe_location *location)
+lttng_kernel_probe_location_symbol_copy(const struct lttng_kernel_probe_location *location)
{
- struct lttng_kernel_probe_location *new_location = NULL;
- struct lttng_kernel_probe_location_symbol *symbol_location;
+ struct lttng_kernel_probe_location *new_location = nullptr;
enum lttng_kernel_probe_location_status status;
- const char *symbol_name = NULL;
+ const char *symbol_name = nullptr;
uint64_t offset;
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
- symbol_location = container_of(
- location, typeof(*symbol_location), parent);
- /* Get probe location offset */
+ /* Get probe location offset */
status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
if (status != LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK) {
ERR("Get kernel probe location offset failed.");
}
/* Create the probe_location */
- new_location = lttng_kernel_probe_location_symbol_create(
- symbol_name, offset);
+ new_location = lttng_kernel_probe_location_symbol_create(symbol_name, offset);
goto end;
error:
- new_location = NULL;
+ new_location = nullptr;
end:
return new_location;
}
static struct lttng_kernel_probe_location *
-lttng_kernel_probe_location_address_copy(
- const struct lttng_kernel_probe_location *location)
+lttng_kernel_probe_location_address_copy(const struct lttng_kernel_probe_location *location)
{
- struct lttng_kernel_probe_location *new_location = NULL;
- struct lttng_kernel_probe_location_address *address_location;
+ struct lttng_kernel_probe_location *new_location = nullptr;
enum lttng_kernel_probe_location_status status;
uint64_t address;
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
- address_location = container_of(
- location, typeof(*address_location), parent);
-
- /* Get probe location fields */
+ /* Get probe location fields */
status = lttng_kernel_probe_location_address_get_address(location, &address);
if (status != LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK) {
ERR("Get kernel probe address failed.");
goto end;
error:
- new_location = NULL;
+ new_location = nullptr;
end:
return new_location;
}
-struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy(
- const struct lttng_kernel_probe_location *location)
+struct lttng_kernel_probe_location *
+lttng_kernel_probe_location_copy(const struct lttng_kernel_probe_location *location)
{
- struct lttng_kernel_probe_location *new_location = NULL;
+ struct lttng_kernel_probe_location *new_location = nullptr;
enum lttng_kernel_probe_location_type type;
if (!location) {
type = lttng_kernel_probe_location_get_type(location);
switch (type) {
case LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS:
- new_location =
- lttng_kernel_probe_location_address_copy(location);
+ new_location = lttng_kernel_probe_location_address_copy(location);
if (!new_location) {
goto err;
}
break;
case LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET:
- new_location =
- lttng_kernel_probe_location_symbol_copy(location);
+ new_location = lttng_kernel_probe_location_symbol_copy(location);
if (!new_location) {
goto err;
}
break;
default:
- new_location = NULL;
+ new_location = nullptr;
goto err;
}
err:
return new_location;
}
-unsigned long lttng_kernel_probe_location_hash(
- const struct lttng_kernel_probe_location *location)
+unsigned long lttng_kernel_probe_location_hash(const struct lttng_kernel_probe_location *location)
{
return location->hash(location);
}
-static
-enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_kernel_probe_location_address_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
LTTNG_ASSERT(writer);
LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS);
- status = lttng_kernel_probe_location_address_get_address(
- location, &address);
+ status = lttng_kernel_probe_location_address_get_address(location, &address);
LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
/* Open kernel probe location address element. */
- ret = mi_lttng_writer_open_element(
- writer, mi_lttng_element_kernel_probe_location_address);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_kernel_probe_location_address);
if (ret) {
goto mi_error;
}
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_kernel_probe_location_address_address,
- address);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_kernel_probe_location_address_address, address);
if (ret) {
goto mi_error;
}
return ret_code;
}
-static
-enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer)
+static enum lttng_error_code
+lttng_kernel_probe_location_symbol_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
enum lttng_kernel_probe_location_status status;
- const char *name = NULL;
+ const char *name = nullptr;
uint64_t offset;
LTTNG_ASSERT(location);
LTTNG_ASSERT(writer);
- LTTNG_ASSERT(location->type ==
- LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
+ LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET);
name = lttng_kernel_probe_location_symbol_get_name(location);
LTTNG_ASSERT(name);
- status = lttng_kernel_probe_location_symbol_get_offset(
- location, &offset);
+ status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK);
/* Open kernel probe location symbol offset element. */
ret = mi_lttng_writer_open_element(writer,
- mi_lttng_element_kernel_probe_location_symbol_offset);
+ mi_lttng_element_kernel_probe_location_symbol_offset);
if (ret) {
goto mi_error;
}
/* Name. */
- ret = mi_lttng_writer_write_element_string(writer,
- mi_lttng_element_kernel_probe_location_symbol_offset_name,
- name);
+ ret = mi_lttng_writer_write_element_string(
+ writer, mi_lttng_element_kernel_probe_location_symbol_offset_name, name);
if (ret) {
goto mi_error;
}
/* Offset. */
- ret = mi_lttng_writer_write_element_unsigned_int(writer,
- mi_lttng_element_kernel_probe_location_symbol_offset_offset,
- offset);
+ ret = mi_lttng_writer_write_element_unsigned_int(
+ writer, mi_lttng_element_kernel_probe_location_symbol_offset_offset, offset);
if (ret) {
goto mi_error;
}
return ret_code;
}
-enum lttng_error_code lttng_kernel_probe_location_mi_serialize(
- const struct lttng_kernel_probe_location *location,
- struct mi_writer *writer)
+enum lttng_error_code
+lttng_kernel_probe_location_mi_serialize(const struct lttng_kernel_probe_location *location,
+ struct mi_writer *writer)
{
int ret;
enum lttng_error_code ret_code;
LTTNG_ASSERT(writer);
/* Open kernel probe location element. */
- ret = mi_lttng_writer_open_element(
- writer, mi_lttng_element_kernel_probe_location);
+ ret = mi_lttng_writer_open_element(writer, mi_lttng_element_kernel_probe_location);
if (ret) {
goto mi_error;
}