X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fkernel-probe.c;h=42f42f641010b185b13fc0622b5a811b04b460de;hb=48a4000561343808724f7cb5fa8c131877489ccd;hp=2beb53fabd94e4c361bf170b21611659b7d81dd9;hpb=6a751b953a43c566b74818ec6325db0978e16c66;p=lttng-tools.git diff --git a/src/common/kernel-probe.c b/src/common/kernel-probe.c index 2beb53fab..42f42f641 100644 --- a/src/common/kernel-probe.c +++ b/src/common/kernel-probe.c @@ -6,7 +6,6 @@ */ #include "lttng/lttng-error.h" -#include #include #include #include @@ -71,7 +70,7 @@ static void lttng_kernel_probe_location_address_destroy( struct lttng_kernel_probe_location *location) { - assert(location); + LTTNG_ASSERT(location); free(location); } @@ -81,13 +80,13 @@ void lttng_kernel_probe_location_symbol_destroy( { struct lttng_kernel_probe_location_symbol *location_symbol = NULL; - assert(location); + LTTNG_ASSERT(location); location_symbol = container_of(location, struct lttng_kernel_probe_location_symbol, parent); - assert(location_symbol); + LTTNG_ASSERT(location_symbol); free(location_symbol->symbol_name); free(location); @@ -187,7 +186,7 @@ lttng_kernel_probe_location_address_get_address( LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK; struct lttng_kernel_probe_location_address *address_location; - assert(offset); + LTTNG_ASSERT(offset); if (!location || lttng_kernel_probe_location_get_type(location) != LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS) { @@ -231,7 +230,7 @@ lttng_kernel_probe_location_symbol_get_offset( LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK; struct lttng_kernel_probe_location_symbol *symbol_location; - assert(offset); + LTTNG_ASSERT(offset); if (!location || lttng_kernel_probe_location_get_type(location) != LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET) { @@ -264,7 +263,7 @@ int lttng_kernel_probe_location_symbol_serialize( goto end; } - assert(lttng_kernel_probe_location_get_type(location) == + LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET); original_payload_size = payload->buffer.size; @@ -315,8 +314,8 @@ int lttng_kernel_probe_location_address_serialize( struct lttng_kernel_probe_location_address *location_address; struct lttng_kernel_probe_location_address_comm location_address_comm; - assert(location); - assert(lttng_kernel_probe_location_get_type(location) == + LTTNG_ASSERT(location); + LTTNG_ASSERT(lttng_kernel_probe_location_get_type(location) == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS); original_payload_size = payload->buffer.size; @@ -339,7 +338,6 @@ end: return ret; } -LTTNG_HIDDEN int lttng_kernel_probe_location_serialize( const struct lttng_kernel_probe_location *location, struct lttng_payload *payload) @@ -383,7 +381,7 @@ int lttng_kernel_probe_location_symbol_create_from_payload( ssize_t ret = 0; size_t expected_size; - assert(location); + LTTNG_ASSERT(location); if (view->buffer.size < sizeof(*location_symbol_comm)) { ret = -LTTNG_ERR_INVALID; @@ -430,7 +428,7 @@ ssize_t lttng_kernel_probe_location_address_create_from_payload( ssize_t ret = 0; size_t expected_size; - assert(location); + LTTNG_ASSERT(location); expected_size = sizeof(*location_address_comm); @@ -453,7 +451,6 @@ end: return ret; } -LTTNG_HIDDEN ssize_t lttng_kernel_probe_location_create_from_payload( struct lttng_payload_view *view, struct lttng_kernel_probe_location **location) @@ -466,8 +463,8 @@ ssize_t lttng_kernel_probe_location_create_from_payload( lttng_payload_view_from_view( view, 0, sizeof(*probe_location_comm)); - assert(view); - assert(location); + LTTNG_ASSERT(view); + LTTNG_ASSERT(location); if (!lttng_payload_view_is_valid(&probe_location_comm_view)) { ret = -LTTNG_ERR_INVALID; @@ -583,8 +580,8 @@ bool lttng_kernel_probe_location_symbol_is_equal( b = container_of(_b, struct lttng_kernel_probe_location_symbol, parent); - assert(a->symbol_name); - assert(b->symbol_name); + LTTNG_ASSERT(a->symbol_name); + LTTNG_ASSERT(b->symbol_name); if (strcmp(a->symbol_name, b->symbol_name)) { goto end; } @@ -599,7 +596,6 @@ end: return is_equal; } -LTTNG_HIDDEN bool lttng_kernel_probe_location_is_equal( const struct lttng_kernel_probe_location *a, const struct lttng_kernel_probe_location *b) @@ -634,8 +630,8 @@ lttng_kernel_probe_location_symbol_copy( const char *symbol_name = NULL; uint64_t offset; - assert(location); - assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET); + LTTNG_ASSERT(location); + LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET); symbol_location = container_of( location, typeof(*symbol_location), parent); @@ -672,8 +668,8 @@ lttng_kernel_probe_location_address_copy( enum lttng_kernel_probe_location_status status; uint64_t address; - assert(location); - assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS); + LTTNG_ASSERT(location); + LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS); address_location = container_of( location, typeof(*address_location), parent); @@ -696,7 +692,6 @@ end: return new_location; } -LTTNG_HIDDEN struct lttng_kernel_probe_location *lttng_kernel_probe_location_copy( const struct lttng_kernel_probe_location *location) { @@ -731,7 +726,6 @@ err: return new_location; } -LTTNG_HIDDEN unsigned long lttng_kernel_probe_location_hash( const struct lttng_kernel_probe_location *location) { @@ -748,13 +742,13 @@ enum lttng_error_code lttng_kernel_probe_location_address_mi_serialize( enum lttng_kernel_probe_location_status status; uint64_t address; - assert(location); - assert(writer); - assert(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS); + LTTNG_ASSERT(location); + LTTNG_ASSERT(writer); + LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_ADDRESS); status = lttng_kernel_probe_location_address_get_address( location, &address); - assert(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK); + LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK); /* Open kernel probe location address element. */ ret = mi_lttng_writer_open_element( @@ -796,17 +790,17 @@ enum lttng_error_code lttng_kernel_probe_location_symbol_mi_serialize( const char *name = NULL; uint64_t offset; - assert(location); - assert(writer); - assert(location->type == + LTTNG_ASSERT(location); + LTTNG_ASSERT(writer); + LTTNG_ASSERT(location->type == LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET); name = lttng_kernel_probe_location_symbol_get_name(location); - assert(name); + LTTNG_ASSERT(name); status = lttng_kernel_probe_location_symbol_get_offset( location, &offset); - assert(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK); + LTTNG_ASSERT(status == LTTNG_KERNEL_PROBE_LOCATION_STATUS_OK); /* Open kernel probe location symbol offset element. */ ret = mi_lttng_writer_open_element(writer, @@ -846,7 +840,6 @@ end: return ret_code; } -LTTNG_HIDDEN enum lttng_error_code lttng_kernel_probe_location_mi_serialize( const struct lttng_kernel_probe_location *location, struct mi_writer *writer) @@ -854,8 +847,8 @@ enum lttng_error_code lttng_kernel_probe_location_mi_serialize( int ret; enum lttng_error_code ret_code; - assert(location); - assert(writer); + LTTNG_ASSERT(location); + LTTNG_ASSERT(writer); /* Open kernel probe location element. */ ret = mi_lttng_writer_open_element(