struct lttng_userspace_probe_location_lookup_method *ret = NULL;
struct lttng_userspace_probe_location_lookup_method_elf *elf_method;
- elf_method = (lttng_userspace_probe_location_lookup_method_elf *) zmalloc(sizeof(*elf_method));
+ elf_method = zmalloc<lttng_userspace_probe_location_lookup_method_elf>();
if (!elf_method) {
PERROR("zmalloc");
goto end;
struct lttng_userspace_probe_location_lookup_method *ret = NULL;
struct lttng_userspace_probe_location_lookup_method_sdt *sdt_method;
- sdt_method = (lttng_userspace_probe_location_lookup_method_sdt *) zmalloc(sizeof(*sdt_method));
+ sdt_method = zmalloc<lttng_userspace_probe_location_lookup_method_sdt>();
if (!sdt_method) {
PERROR("zmalloc");
goto end;
LTTNG_ASSERT(location);
- location_function = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ location_function = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
LTTNG_ASSERT(location_function);
LTTNG_ASSERT(location);
- location_tracepoint = container_of(location,
- struct lttng_userspace_probe_location_tracepoint,
- parent);
+ location_tracepoint = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
LTTNG_ASSERT(location_tracepoint);
(void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION,
lttng_ht_seed);
struct lttng_userspace_probe_location_function *function_location =
- container_of(location, typeof(*function_location),
- parent);
+ lttng::utils::container_of(
+ location, <tng_userspace_probe_location_function::parent);
hash ^= hash_key_str(function_location->function_name, lttng_ht_seed);
hash ^= hash_key_str(function_location->binary_path, lttng_ht_seed);
bool is_equal = false;
struct lttng_userspace_probe_location_function *a, *b;
- a = container_of(_a, struct lttng_userspace_probe_location_function,
- parent);
- b = container_of(_b, struct lttng_userspace_probe_location_function,
- parent);
+ a = lttng::utils::container_of(_a,
+ <tng_userspace_probe_location_function::parent);
+ b = lttng::utils::container_of(_b,
+ <tng_userspace_probe_location_function::parent);
if (a->instrumentation_type != b->instrumentation_type) {
goto end;
goto error;
}
- location = (lttng_userspace_probe_location_function *) zmalloc(sizeof(*location));
+ location = zmalloc<lttng_userspace_probe_location_function>();
if (!location) {
PERROR("Error allocating userspace probe location");
goto error;
unsigned long hash = hash_key_ulong(
(void *) LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT,
lttng_ht_seed);
- struct lttng_userspace_probe_location_tracepoint *tp_location =
- container_of(location, typeof(*tp_location), parent);
+ struct lttng_userspace_probe_location_tracepoint *tp_location = lttng::utils::container_of(
+ location, <tng_userspace_probe_location_tracepoint::parent);
hash ^= hash_key_str(tp_location->probe_name, lttng_ht_seed);
hash ^= hash_key_str(tp_location->provider_name, lttng_ht_seed);
bool is_equal = false;
struct lttng_userspace_probe_location_tracepoint *a, *b;
- a = container_of(_a, struct lttng_userspace_probe_location_tracepoint,
- parent);
- b = container_of(_b, struct lttng_userspace_probe_location_tracepoint,
- parent);
+ a = lttng::utils::container_of(_a,
+ <tng_userspace_probe_location_tracepoint::parent);
+ b = lttng::utils::container_of(_b,
+ <tng_userspace_probe_location_tracepoint::parent);
LTTNG_ASSERT(a->probe_name);
LTTNG_ASSERT(b->probe_name);
goto error;
}
- location = (lttng_userspace_probe_location_tracepoint *) zmalloc(sizeof(*location));
+ location = zmalloc<lttng_userspace_probe_location_tracepoint>();
if (!location) {
PERROR("zmalloc");
goto error;
LTTNG_ASSERT(lookup_method->type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_FUNCTION_ELF);
- elf_method = (lttng_userspace_probe_location_lookup_method_elf *) zmalloc(sizeof(*elf_method));
+ elf_method = zmalloc<lttng_userspace_probe_location_lookup_method_elf>();
if (!elf_method) {
PERROR("Error allocating ELF userspace probe lookup method");
goto error;
LTTNG_ASSERT(lookup_method->type ==
LTTNG_USERSPACE_PROBE_LOCATION_LOOKUP_METHOD_TYPE_TRACEPOINT_SDT);
- sdt_method = (lttng_userspace_probe_location_lookup_method_sdt *) zmalloc(sizeof(*sdt_method));
+ sdt_method = zmalloc<lttng_userspace_probe_location_lookup_method_sdt>();
if (!sdt_method) {
PERROR("zmalloc");
goto error;
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
- function_location = container_of(
- location, typeof(*function_location), parent);
+ function_location = lttng::utils::container_of(
+ location, <tng_userspace_probe_location_function::parent);
- /* Get probe location fields */
+ /* Get probe location fields */
binary_path = lttng_userspace_probe_location_function_get_binary_path(location);
if (!binary_path) {
ERR("Userspace probe binary path is NULL");
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
- tracepoint_location = container_of(
- location, typeof(*tracepoint_location), parent);
+ tracepoint_location = lttng::utils::container_of(
+ location, <tng_userspace_probe_location_tracepoint::parent);
/* Get probe location fields */
binary_path = lttng_userspace_probe_location_tracepoint_get_binary_path(location);
goto end;
}
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function,
- parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
ret = function_location->binary_path;
end:
return ret;
goto end;
}
- tracepoint_location = container_of(location,
- struct lttng_userspace_probe_location_tracepoint,
- parent);
+ tracepoint_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
ret = tracepoint_location->binary_path;
end:
return ret;
goto end;
}
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
ret = function_location->function_name;
end:
return ret;
goto end;
}
- tracepoint_location = container_of(location,
- struct lttng_userspace_probe_location_tracepoint, parent);
+ tracepoint_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
ret = tracepoint_location->probe_name;
end:
return ret;
goto end;
}
- tracepoint_location = container_of(location,
- struct lttng_userspace_probe_location_tracepoint, parent);
+ tracepoint_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
ret = tracepoint_location->provider_name;
end:
return ret;
goto end;
}
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
ret = function_location->binary_fd_handle ?
fd_handle_get_fd(function_location->binary_fd_handle) : -1;
end:
goto end;
}
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
type = function_location->instrumentation_type;
end:
return type;
goto end;
}
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
function_location->instrumentation_type = instrumentation_type;
end:
return status;
goto end;
}
- tracepoint_location = container_of(location,
- struct lttng_userspace_probe_location_tracepoint, parent);
+ tracepoint_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
ret = tracepoint_location->binary_fd_handle ?
fd_handle_get_fd(tracepoint_location->binary_fd_handle) : -1;
end:
LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
- location_function = container_of(location,
- struct lttng_userspace_probe_location_function,
- parent);
+ location_function = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
if (!location_function->function_name || !location_function->binary_path) {
ret = -LTTNG_ERR_INVALID;
goto end;
LTTNG_ASSERT(lttng_userspace_probe_location_get_type(location) ==
LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
- location_tracepoint = container_of(location,
- struct lttng_userspace_probe_location_tracepoint,
- parent);
+ location_tracepoint = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
if (!location_tracepoint->probe_name ||
!location_tracepoint->provider_name ||
!location_tracepoint->binary_path) {
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_FUNCTION);
- function_location = container_of(location,
- struct lttng_userspace_probe_location_function, parent);
+ function_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
fd_handle_put(function_location->binary_fd_handle);
fd_handle_get(binary_fd);
function_location->binary_fd_handle = binary_fd;
LTTNG_ASSERT(location);
LTTNG_ASSERT(location->type == LTTNG_USERSPACE_PROBE_LOCATION_TYPE_TRACEPOINT);
- tracepoint_location = container_of(location,
- struct lttng_userspace_probe_location_tracepoint, parent);
+ tracepoint_location = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
fd_handle_put(tracepoint_location->binary_fd_handle);
fd_handle_get(binary_fd);
tracepoint_location->binary_fd_handle = binary_fd;
goto end;
}
- probe_function = container_of(location,
- struct lttng_userspace_probe_location_function,
- parent);
+ probe_function = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_function::parent);
LTTNG_ASSERT(probe_function->function_name);
LTTNG_ASSERT(probe_function->binary_path);
ret = -LTTNG_ERR_INVALID;
goto end;
}
- probe_tracepoint = container_of(location,
- struct lttng_userspace_probe_location_tracepoint,
- parent);
+ probe_tracepoint = lttng::utils::container_of(location,
+ <tng_userspace_probe_location_tracepoint::parent);
LTTNG_ASSERT(probe_tracepoint->probe_name);
LTTNG_ASSERT(probe_tracepoint->provider_name);
LTTNG_ASSERT(probe_tracepoint->binary_path);