DBG2("Relay connection by sock %d not found", sock);
goto end;
}
- conn = caa_container_of(node, struct relay_connection, sock_n);
+ conn = lttng::utils::container_of(node, &relay_connection::sock_n);
if (!connection_get(conn)) {
conn = NULL;
}
static void rcu_free_connection(struct rcu_head *head)
{
struct relay_connection *conn =
- caa_container_of(head, struct relay_connection, rcu_node);
+ lttng::utils::container_of(head, &relay_connection::rcu_node);
lttcomm_destroy_sock(conn->sock);
if (conn->viewer_session) {
static void connection_release(struct urcu_ref *ref)
{
struct relay_connection *conn =
- caa_container_of(ref, struct relay_connection, ref);
+ lttng::utils::container_of(ref, &relay_connection::ref);
if (conn->in_socket_ht) {
struct lttng_ht_iter iter;
static void rcu_destroy_ctf_trace(struct rcu_head *rcu_head)
{
struct ctf_trace *trace =
- caa_container_of(rcu_head, struct ctf_trace, rcu_node);
+ lttng::utils::container_of(rcu_head, &ctf_trace::rcu_node);
free(trace);
}
static void ctf_trace_release(struct urcu_ref *ref)
{
struct ctf_trace *trace =
- caa_container_of(ref, struct ctf_trace, ref);
+ lttng::utils::container_of(ref, &ctf_trace::ref);
int ret;
struct lttng_ht_iter iter;
DBG("CTF Trace path %s not found", subpath);
goto end;
}
- trace = caa_container_of(node, struct ctf_trace, node);
+ trace = lttng::utils::container_of(node, &ctf_trace::node);
if (!ctf_trace_get(trace)) {
trace = NULL;
}
lttng_ht_lookup(stream->indexes_ht, &net_seq_num, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
if (node) {
- index = caa_container_of(node, struct relay_index, index_n);
+ index = lttng::utils::container_of(node, &relay_index::index_n);
} else {
struct relay_index *oldindex;
static void index_destroy_rcu(struct rcu_head *rcu_head)
{
struct relay_index *index =
- caa_container_of(rcu_head, struct relay_index, rcu_node);
+ lttng::utils::container_of(rcu_head, &relay_index::rcu_node);
index_destroy(index);
}
/* Stream lock must be held by the caller. */
static void index_release(struct urcu_ref *ref)
{
- struct relay_index *index = caa_container_of(ref, struct relay_index, ref);
+ struct relay_index *index = lttng::utils::container_of(ref, &relay_index::ref);
struct relay_stream *stream = index->stream;
int ret;
struct lttng_ht_iter iter;
/* Continue thread execution */
break;
}
- conn = caa_container_of(node, struct relay_connection, qnode);
+ conn = lttng::utils::container_of(node, &relay_connection::qnode);
DBG("Dispatching viewer request waiting on sock %d",
conn->sock->fd);
/* Continue thread execution */
break;
}
- new_conn = caa_container_of(node, struct relay_connection, qnode);
+ new_conn = lttng::utils::container_of(node, &relay_connection::qnode);
DBG("Dispatching request waiting on sock %d", new_conn->sock->fd);
DBG("Session find by ID %" PRIu64 " id NOT found", id);
goto end;
}
- session = caa_container_of(node, struct relay_session, session_n);
+ session = lttng::utils::container_of(node, &relay_session::session_n);
DBG("Session find by ID %" PRIu64 " id found", id);
if (!session_get(session)) {
session = NULL;
static void session_release(struct urcu_ref *ref)
{
struct relay_session *session =
- caa_container_of(ref, struct relay_session, ref);
+ lttng::utils::container_of(ref, &relay_session::ref);
destroy_session(session);
}
(struct trace_chunk_registry_ht_key *) _key;
struct trace_chunk_registry_ht_element *registry;
- registry = container_of(node, typeof(*registry), ht_node);
+ registry = lttng::utils::container_of(node, &trace_chunk_registry_ht_element::ht_node);
return key->sessiond_uuid == registry->key.sessiond_uuid;
}
static
void trace_chunk_registry_ht_element_free(struct rcu_head *node)
{
- struct trace_chunk_registry_ht_element *element =
- container_of(node, typeof(*element), rcu_node);
+ struct trace_chunk_registry_ht_element *element = lttng::utils::container_of(
+ node, &trace_chunk_registry_ht_element::rcu_node);
free(element);
}
void trace_chunk_registry_ht_element_release(struct urcu_ref *ref)
{
struct trace_chunk_registry_ht_element *element =
- container_of(ref, typeof(*element), ref);
+ lttng::utils::container_of(ref, &trace_chunk_registry_ht_element::ref);
char uuid_str[LTTNG_UUID_STR_LEN];
lttng_uuid_to_str(element->key.sessiond_uuid, uuid_str);
&iter);
node = cds_lfht_iter_get_node(&iter);
if (node) {
- element = container_of(node, typeof(*element), ht_node);
+ element = lttng::utils::container_of(
+ node, &trace_chunk_registry_ht_element::ht_node);
/*
* Only consider the look-up as successful if a reference
* could be acquired.
* was already published and release the reference to the copy
* we created if successful.
*/
- published_element = container_of(published_node,
- typeof(*published_element), ht_node);
+ published_element = lttng::utils::container_of(published_node,
+ &trace_chunk_registry_ht_element::ht_node);
if (trace_chunk_registry_ht_element_get(published_element)) {
DBG("Acquired reference to trace chunk registry of sessiond {%s}",
uuid_str);
DBG("Relay stream %" PRIu64 " not found", stream_id);
goto end;
}
- stream = caa_container_of(node, struct relay_stream, node);
+ stream = lttng::utils::container_of(node, &relay_stream::node);
if (!stream_get(stream)) {
stream = NULL;
}
static void stream_destroy_rcu(struct rcu_head *rcu_head)
{
struct relay_stream *stream =
- caa_container_of(rcu_head, struct relay_stream, rcu_node);
+ lttng::utils::container_of(rcu_head, &relay_stream::rcu_node);
stream_destroy(stream);
}
static void stream_release(struct urcu_ref *ref)
{
struct relay_stream *stream =
- caa_container_of(ref, struct relay_stream, ref);
+ lttng::utils::container_of(ref, &relay_stream::ref);
struct relay_session *session;
session = stream->trace->session;
static void viewer_stream_destroy_rcu(struct rcu_head *head)
{
struct relay_viewer_stream *vstream =
- caa_container_of(head, struct relay_viewer_stream, rcu_node);
+ lttng::utils::container_of(head, &relay_viewer_stream::rcu_node);
viewer_stream_destroy(vstream);
}
DBG("Relay viewer stream %" PRIu64 " not found", id);
goto end;
}
- vstream = caa_container_of(node, struct relay_viewer_stream, stream_n);
+ vstream = lttng::utils::container_of(node, &relay_viewer_stream::stream_n);
if (!viewer_stream_get(vstream)) {
vstream = NULL;
}
static void destroy_event_agent_rcu(struct rcu_head *head)
{
struct lttng_ht_node_str *node =
- caa_container_of(head, struct lttng_ht_node_str, head);
+ lttng::utils::container_of(head, <tng_ht_node_str::head);
struct agent_event *event =
- caa_container_of(node, struct agent_event, node);
+ lttng::utils::container_of(node, &agent_event::node);
agent_destroy_event(event);
}
static void destroy_app_agent_rcu(struct rcu_head *head)
{
struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
+ lttng::utils::container_of(head, <tng_ht_node_ulong::head);
struct agent_app *app =
- caa_container_of(node, struct agent_app, node);
+ lttng::utils::container_of(node, &agent_app::node);
free(app);
}
if (node == NULL) {
goto error;
}
- app = caa_container_of(node, struct agent_app, node);
+ app = lttng::utils::container_of(node, &agent_app::node);
DBG3("Agent app pid %d found by sock %d.", app->pid, sock);
return app;
}
DBG3("Agent event found %s.", name);
- return caa_container_of(node, struct agent_event, node);
+ return lttng::utils::container_of(node, &agent_event::node);
error:
DBG3("Agent event NOT found %s.", name);
void destroy_app_ctx_rcu(struct rcu_head *head)
{
struct agent_app_ctx *ctx =
- caa_container_of(head, struct agent_app_ctx, rcu_node);
+ lttng::utils::container_of(head, &agent_app_ctx::rcu_node);
destroy_app_ctx(ctx);
}
* value is not important since we have to continue anyway
* destroying the object.
*/
- event = caa_container_of(node, struct agent_event, node);
+ event = lttng::utils::container_of(node, &agent_event::node);
(void) agent_disable_event(event, agt->domain);
ret = lttng_ht_del(agt->events, &iter);
the_agent_apps_ht_by_sock->ht, &iter.iter, node, node) {
struct agent_app *app;
- app = caa_container_of(node, struct agent_app, node);
+ app = lttng::utils::container_of(node, &agent_app::node);
agent_destroy_app_by_sock(app->sock->fd);
}
rcu_read_unlock();
cds_lfht_for_each_entry(the_trigger_agents_ht_by_domain->ht,
&iter.iter, node, node) {
struct agent *agent =
- caa_container_of(node, struct agent, node);
+ lttng::utils::container_of(node, &agent::node);
const int ret = lttng_ht_del(
the_trigger_agents_ht_by_domain, &iter);
goto end;
}
- agt = caa_container_of(node, struct agent, node);
+ agt = lttng::utils::container_of(node, &agent::node);
end:
return agt;
if (!node) {
goto end;
}
- reg = caa_container_of(node, struct buffer_reg_uid, node);
+ reg = lttng::utils::container_of(node, &buffer_reg_uid::node);
end:
return reg;
if (!node) {
goto end;
}
- reg = caa_container_of(node, struct buffer_reg_pid, node);
+ reg = lttng::utils::container_of(node, &buffer_reg_pid::node);
end:
return reg;
if (!node) {
goto end;
}
- chan = caa_container_of(node, struct buffer_reg_channel, node);
+ chan = lttng::utils::container_of(node, &buffer_reg_channel::node);
end:
return chan;
static void rcu_free_buffer_reg_uid(struct rcu_head *head)
{
struct lttng_ht_node_u64 *node =
- caa_container_of(head, struct lttng_ht_node_u64, head);
+ lttng::utils::container_of(head, <tng_ht_node_u64::head);
struct buffer_reg_uid *reg =
- caa_container_of(node, struct buffer_reg_uid, node);
+ lttng::utils::container_of(node, &buffer_reg_uid::node);
buffer_reg_session_destroy(reg->registry, reg->domain);
free(reg);
static void rcu_free_buffer_reg_pid(struct rcu_head *head)
{
struct lttng_ht_node_u64 *node =
- caa_container_of(head, struct lttng_ht_node_u64, head);
+ lttng::utils::container_of(head, <tng_ht_node_u64::head);
struct buffer_reg_pid *reg =
- caa_container_of(node, struct buffer_reg_pid, node);
+ lttng::utils::container_of(node, &buffer_reg_pid::node);
buffer_reg_session_destroy(reg->registry, LTTNG_DOMAIN_UST);
free(reg);
unsigned long condition_type;
struct lttng_condition_buffer_usage *condition;
- condition = container_of(_condition,
- struct lttng_condition_buffer_usage, parent);
+ condition = lttng::utils::container_of(_condition,
+ <tng_condition_buffer_usage::parent);
condition_type = (unsigned long) condition->parent.type;
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
struct lttng_condition_session_consumed_size *condition;
uint64_t val;
- condition = container_of(_condition,
- struct lttng_condition_session_consumed_size, parent);
+ condition = lttng::utils::container_of(_condition,
+ <tng_condition_session_consumed_size::parent);
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
if (condition->session_name) {
unsigned long hash, condition_type;
struct lttng_condition_session_rotation *condition;
- condition = container_of(_condition,
- struct lttng_condition_session_rotation, parent);
+ condition = lttng::utils::container_of(_condition,
+ <tng_condition_session_rotation::parent);
condition_type = (unsigned long) condition->parent.type;
hash = hash_key_ulong((void *) condition_type, lttng_ht_seed);
LTTNG_ASSERT(condition->session_name);
&iter);
node = lttng_ht_iter_get_node_ulong(&iter);
if (node != NULL) {
- socket = caa_container_of(node, struct consumer_socket, node);
+ socket = lttng::utils::container_of(node, &consumer_socket::node);
}
return socket;
static void destroy_socket_rcu(struct rcu_head *head)
{
struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
+ lttng::utils::container_of(head, <tng_ht_node_ulong::head);
struct consumer_socket *socket =
- caa_container_of(node, struct consumer_socket, node);
+ lttng::utils::container_of(node, &consumer_socket::node);
free(socket);
}
static void consumer_release_output(struct urcu_ref *ref)
{
struct consumer_output *obj =
- caa_container_of(ref, struct consumer_output, ref);
+ lttng::utils::container_of(ref, &consumer_output::ref);
consumer_destroy_output_sockets(obj);
break;
}
- ust_cmd = caa_container_of(node, struct ust_command, node);
+ ust_cmd = lttng::utils::container_of(node, &ust_command::node);
DBG("Dispatching UST registration pid:%d ppid:%d uid:%d"
" gid:%d sock:%d name:%s (version %d.%d)",
if (node == NULL) {
break;
}
- ust_cmd = caa_container_of(node, struct ust_command, node);
+ ust_cmd = lttng::utils::container_of(node, &ust_command::node);
ret = close(ust_cmd->sock);
if (ret < 0) {
PERROR("close ust sock exit dispatch %d", ust_cmd->sock);
{
int i;
struct ust_error_accounting_entry *entry =
- caa_container_of(head, typeof(*entry), rcu_head);
+ lttng::utils::container_of(head, &ust_error_accounting_entry::rcu_head);
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
lttng_ust_ctl_release_object(-1, entry->cpu_counters[i]);
void ust_error_accounting_entry_release(struct urcu_ref *entry_ref)
{
struct ust_error_accounting_entry *entry =
- container_of(entry_ref, typeof(*entry), ref);
+ lttng::utils::container_of(entry_ref, &ust_error_accounting_entry::ref);
rcu_read_lock();
cds_lfht_del(error_counter_uid_ht->ht, &entry->node.node);
lttng_ht_lookup(state->indices_ht, &tracer_token, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
if (node) {
- index_entry = caa_container_of(
- node, const struct index_ht_entry, node);
+ index_entry = lttng::utils::container_of(node, &index_ht_entry::node);
*error_counter_index = index_entry->error_counter_index;
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
} else {
node = lttng_ht_iter_get_node_u64(&iter);
if (node) {
int del_ret;
- struct index_ht_entry *index_entry = caa_container_of(
- node, typeof(*index_entry), node);
+ struct index_ht_entry *index_entry =
+ lttng::utils::container_of(node, &index_ht_entry::node);
enum lttng_index_allocator_status index_alloc_status;
index_alloc_status = lttng_index_allocator_release(
}
do {
- uevent = caa_container_of(node, struct ltt_ust_event, node);
+ uevent = lttng::utils::container_of(node, <t_ust_event::node);
LTTNG_ASSERT(uevent);
if (uevent->enabled == 0) {
}
do {
- aevent = caa_container_of(node, struct agent_event, node);
+ aevent = lttng::utils::container_of(node, &agent_event::node);
ret = event_agent_disable_one(usess, agt, aevent);
if (ret != LTTNG_OK) {
lttng_ht_lookup(ht, (void *) name, &iter);
node = lttng_ht_iter_get_node_str(&iter);
if (node) {
- ksyscall = caa_container_of(node, struct syscall, node);
+ ksyscall = lttng::utils::container_of(node, &syscall::node);
}
return ksyscall;
{
/* This double-cast is intended to supress pointer-to-cast warning. */
const notification_client_id id = *((notification_client_id *) key);
- const struct notification_client *client = caa_container_of(
- node, struct notification_client, client_id_ht_node);
+ const struct notification_client *client = lttng::utils::container_of(
+ node, ¬ification_client::client_id_ht_node);
return client->id == id;
}
int match_session(struct cds_lfht_node *node, const void *key)
{
const char *name = (const char *) key;
- struct session_info *session_info = caa_container_of(
- node, struct session_info, sessions_ht_node);
+ struct session_info *session_info = lttng::utils::container_of(
+ node, &session_info::sessions_ht_node);
return !strcmp(session_info->name, name);
}
static
void free_channel_info_rcu(struct rcu_head *node)
{
- free(caa_container_of(node, struct channel_info, rcu_node));
+ free(lttng::utils::container_of(node, &channel_info::rcu_node));
}
static
static
void free_session_info_rcu(struct rcu_head *node)
{
- free(caa_container_of(node, struct session_info, rcu_node));
+ free(lttng::utils::container_of(node, &session_info::rcu_node));
}
/* Don't call directly, use the ref-counting mechanism. */
void notification_client_list_release(struct urcu_ref *list_ref)
{
struct notification_client_list *list =
- container_of(list_ref, typeof(*list), ref);
+ lttng::utils::container_of(list_ref, ¬ification_client_list::ref);
struct notification_client_list_element *client_list_element, *tmp;
lttng_condition_put(list->condition);
&iter);
node = cds_lfht_iter_get_node(&iter);
if (node) {
- list = container_of(node, struct notification_client_list,
- notification_trigger_clients_ht_node);
+ list = lttng::utils::container_of(node,
+ ¬ification_client_list::notification_trigger_clients_ht_node);
list = notification_client_list_get(list) ? list : NULL;
}
static
void free_notification_client_rcu(struct rcu_head *node)
{
- free(caa_container_of(node, struct notification_client, rcu_node));
+ free(lttng::utils::container_of(node, ¬ification_client::rcu_node));
}
static
bool result = false;
uint64_t threshold;
enum lttng_condition_type condition_type;
- const struct lttng_condition_buffer_usage *use_condition = container_of(
- condition, struct lttng_condition_buffer_usage,
- parent);
+ const struct lttng_condition_buffer_usage *use_condition = lttng::utils::container_of(
+ condition, <tng_condition_buffer_usage::parent);
if (use_condition->threshold_bytes.set) {
threshold = use_condition->threshold_bytes.value;
{
uint64_t threshold;
const struct lttng_condition_session_consumed_size *size_condition =
- container_of(condition,
- struct lttng_condition_session_consumed_size,
- parent);
+ lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
threshold = size_condition->consumed_threshold_bytes.value;
DBG("Session consumed size condition being evaluated: threshold = %" PRIu64 ", current size = %" PRIu64,
}
evaluation = lttng_evaluation_event_rule_matches_create(
- container_of(lttng_trigger_get_const_condition(
+ lttng::utils::container_of(lttng_trigger_get_const_condition(
element->trigger),
- struct lttng_condition_event_rule_matches,
- parent),
+ <tng_condition_event_rule_matches::parent),
notification->capture_buffer,
notification->capture_buf_size, false);
* Fetch the monitor timer which is located in the parent of
* lttng_ust_channel_attr
*/
- channel = caa_container_of(attr, struct ltt_ust_channel, attr);
+ channel = lttng::utils::container_of(attr, <t_ust_channel::attr);
ret = config_writer_write_element_unsigned_int(writer,
config_element_monitor_timer_interval,
channel->monitor_timer_interval);
rcu_read_lock();
cds_lfht_for_each_entry(events->ht, &iter.iter, node, node) {
- event = caa_container_of(node, struct ltt_ust_event, node);
+ event = lttng::utils::container_of(node, <t_ust_event::node);
if (event->internal) {
/* Internal events must not be exposed to clients */
struct ltt_ust_event fake_event;
memset(&fake_event, 0, sizeof(fake_event));
- agent_event = caa_container_of(node, struct agent_event, node);
+ agent_event = lttng::utils::container_of(node, &agent_event::node);
/*
* Initialize a fake ust event to reuse the same serialization
rcu_read_lock();
cds_lfht_for_each_entry(session->ust_session->domain_global.channels->ht,
&iter.iter, node, node) {
- ust_chan = caa_container_of(node, struct ltt_ust_channel, node);
+ ust_chan = lttng::utils::container_of(node, <t_ust_channel::node);
if (domain == ust_chan->domain) {
ret = save_ust_channel(writer, ust_chan, session->ust_session);
if (ret != LTTNG_OK) {
cds_lfht_first(session->kernel_session->consumer->socks->ht, &iter.iter);
node = cds_lfht_iter_get_node(&iter.iter);
- socket = container_of(node, typeof(*socket), node.node);
+ socket = caa_container_of(node, typeof(*socket), node.node);
cds_list_for_each_entry(chan,
&session->kernel_session->channel_list.head, list) {
int ret;
struct ltt_ust_session *usess;
struct ltt_kernel_session *ksess;
- struct ltt_session *session = container_of(ref, typeof(*session), ref);
+ struct ltt_session *session = lttng::utils::container_of(ref, <t_session::ref);
const bool session_published = session->published;
LTTNG_ASSERT(!session->chunk_being_archived);
if (node == NULL) {
goto end;
}
- ls = caa_container_of(node, struct ltt_session, node);
+ ls = lttng::utils::container_of(node, <t_session::node);
DBG3("Session %" PRIu64 " found by id.", id);
return session_get(ls) ? ls : NULL;
goto end;
}
- ls = caa_container_of(node, struct ltt_session, node_by_name);
+ ls = lttng::utils::container_of(node, <t_session::node_by_name);
*id = ls->id;
found = true;
DBG3("Snapshot output not found with id %" PRId32, id);
goto error;
}
- output = caa_container_of(node, struct snapshot_output, node);
+ output = lttng::utils::container_of(node, &snapshot_output::node);
error:
return output;
static
void lttng_thread_release(struct urcu_ref *ref)
{
- lttng_thread_destroy(container_of(ref, struct lttng_thread, ref));
+ lttng_thread_destroy(lttng::utils::container_of(ref, <tng_thread::ref));
}
static
DBG2("Trace UST channel %s found by name", name);
- return caa_container_of(node, struct ltt_ust_channel, node);
+ return lttng::utils::container_of(node, <t_ust_channel::node);
error:
DBG2("Trace UST channel %s not found by name", name);
DBG2("Trace UST event %s found", key.name);
- return caa_container_of(node, struct ltt_ust_event, node);
+ return lttng::utils::container_of(node, <t_ust_event::node);
error:
DBG2("Trace UST event %s NOT found", key.name);
if (!node) {
goto end;
}
- agt = caa_container_of(node, struct agent, node);
+ agt = lttng::utils::container_of(node, &agent::node);
end:
return agt;
lttng_ht_lookup(id_tracker->ht, (void *) _id, iter);
node = lttng_ht_iter_get_node_ulong(iter);
if (node) {
- return caa_container_of(node, struct ust_id_tracker_node, node);
+ return lttng::utils::container_of(node, &ust_id_tracker_node::node);
} else {
return NULL;
}
static void destroy_context_rcu(struct rcu_head *head)
{
struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
+ lttng::utils::container_of(head, <tng_ht_node_ulong::head);
struct ltt_ust_context *ctx =
- caa_container_of(node, struct ltt_ust_context, node);
+ lttng::utils::container_of(node, <t_ust_context::node);
trace_ust_destroy_context(ctx);
}
rcu_read_lock();
cds_lfht_for_each_entry(ht->ht, &iter.iter, node, node) {
/* Remove from ordered list. */
- ctx = caa_container_of(node, struct ltt_ust_context, node);
+ ctx = lttng::utils::container_of(node, <t_ust_context::node);
cds_list_del(&ctx->list);
/* Remove from channel's hash table. */
ret = lttng_ht_del(ht, &iter);
static void destroy_event_rcu(struct rcu_head *head)
{
struct lttng_ht_node_str *node =
- caa_container_of(head, struct lttng_ht_node_str, head);
+ lttng::utils::container_of(head, <tng_ht_node_str::head);
struct ltt_ust_event *event =
- caa_container_of(node, struct ltt_ust_event, node);
+ lttng::utils::container_of(node, <t_ust_event::node);
trace_ust_destroy_event(event);
}
static void destroy_channel_rcu(struct rcu_head *head)
{
struct lttng_ht_node_str *node =
- caa_container_of(head, struct lttng_ht_node_str, head);
+ lttng::utils::container_of(head, <tng_ht_node_str::head);
struct ltt_ust_channel *channel =
- caa_container_of(node, struct ltt_ust_channel, node);
+ lttng::utils::container_of(node, <t_ust_channel::node);
_trace_ust_destroy_channel(channel);
}
rcu_read_lock();
cds_lfht_for_each_entry(channels->ht, &iter.iter, node, node) {
struct ltt_ust_channel *chan =
- caa_container_of(node, struct ltt_ust_channel, node);
+ lttng::utils::container_of(node, <t_ust_channel::node);
trace_ust_delete_channel(channels, chan);
trace_ust_destroy_channel(chan);
static void process_attr_tracker_value_node_rcu_free(struct rcu_head *rcu_head)
{
- struct process_attr_tracker_value_node *node =
- container_of(rcu_head, typeof(*node), rcu_head);
+ struct process_attr_tracker_value_node *node = lttng::utils::container_of(
+ rcu_head, &process_attr_tracker_value_node::rcu_head);
free(node);
}
node = cds_lfht_iter_get_node(&iter);
rcu_read_unlock();
- return node ? container_of(node, struct process_attr_tracker_value_node,
- inclusion_set_ht_node) :
- NULL;
+ return node ? lttng::utils::container_of(node,
+ &process_attr_tracker_value_node::inclusion_set_ht_node) :
+ NULL;
}
/* Protected by session mutex held by caller. */
{
int ret;
struct ust_app_notify_sock_obj *obj =
- caa_container_of(head, struct ust_app_notify_sock_obj, head);
+ lttng::utils::container_of(head, &ust_app_notify_sock_obj::head);
/* Must have a valid fd here. */
LTTNG_ASSERT(obj->fd >= 0);
static
void free_ust_app_event_notifier_rule_rcu(struct rcu_head *head)
{
- struct ust_app_event_notifier_rule *obj = caa_container_of(
- head, struct ust_app_event_notifier_rule, rcu_head);
+ struct ust_app_event_notifier_rule *obj = lttng::utils::container_of(
+ head, &ust_app_event_notifier_rule::rcu_head);
free(obj);
}
void delete_ust_app_channel_rcu(struct rcu_head *head)
{
struct ust_app_channel *ua_chan =
- caa_container_of(head, struct ust_app_channel, rcu_head);
+ lttng::utils::container_of(head, &ust_app_channel::rcu_head);
lttng_ht_destroy(ua_chan->ctx);
lttng_ht_destroy(ua_chan->events);
void delete_ust_app_session_rcu(struct rcu_head *head)
{
struct ust_app_session *ua_sess =
- caa_container_of(head, struct ust_app_session, rcu_head);
+ lttng::utils::container_of(head, &ust_app_session::rcu_head);
lttng_ht_destroy(ua_sess->channels);
free(ua_sess);
void delete_ust_app_rcu(struct rcu_head *head)
{
struct lttng_ht_node_ulong *node =
- caa_container_of(head, struct lttng_ht_node_ulong, head);
+ lttng::utils::container_of(head, <tng_ht_node_ulong::head);
struct ust_app *app =
- caa_container_of(node, struct ust_app, pid_n);
+ lttng::utils::container_of(node, &ust_app::pid_n);
DBG3("Call RCU deleting app PID %d", app->pid);
delete_ust_app(app);
goto error;
}
- return caa_container_of(node, struct ust_app, sock_n);
+ return lttng::utils::container_of(node, &ust_app::sock_n);
error:
return NULL;
goto error;
}
- return caa_container_of(node, struct ust_app, notify_sock_n);
+ return lttng::utils::container_of(node, &ust_app::notify_sock_n);
error:
return NULL;
goto end;
}
- event = caa_container_of(node, struct ust_app_event, node);
+ event = lttng::utils::container_of(node, &ust_app_event::node);
end:
return event;
goto end;
}
- event_notifier_rule = caa_container_of(
- node, struct ust_app_event_notifier_rule, node);
+ event_notifier_rule = lttng::utils::container_of(
+ node, &ust_app_event_notifier_rule::node);
end:
return event_notifier_rule;
}
goto error;
}
- return caa_container_of(node, struct ust_app_session, node);
+ return lttng::utils::container_of(node, &ust_app_session::node);
error:
return NULL;
goto end;
}
- app_ctx = caa_container_of(node, struct ust_app_ctx, node);
+ app_ctx = lttng::utils::container_of(node, &ust_app_ctx::node);
end:
return app_ctx;
goto error;
}
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
ret = enable_ust_channel(app, ua_sess, ua_chan);
if (ret < 0) {
lttng_ht_lookup(ua_sess->channels, (void *)uchan->name, &iter);
ua_chan_node = lttng_ht_iter_get_node_str(&iter);
if (ua_chan_node != NULL) {
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
goto end;
}
DBG2("Found UST app by pid %d", pid);
- app = caa_container_of(node, struct ust_app, pid_n);
+ app = lttng::utils::container_of(node, &ust_app::pid_n);
error:
return app;
node = lttng_ht_iter_get_node_ulong(&ust_app_sock_iter);
LTTNG_ASSERT(node);
- lta = caa_container_of(node, struct ust_app, sock_n);
+ lta = lttng::utils::container_of(node, &ust_app::sock_n);
DBG("PID %d unregistering with sock %d", lta->pid, sock);
/*
/* If the session if found for the app, the channel must be there */
LTTNG_ASSERT(ua_chan_node);
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
/* The channel must not be already disabled */
LTTNG_ASSERT(ua_chan->enabled == 1);
"Skipping", uchan->name, usess->id, app->pid);
continue;
}
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
uevent->filter, uevent->attr.loglevel,
continue;
}
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
/* Get event node */
ua_event = find_ust_app_event(ua_chan->events, uevent->attr.name,
/* If the channel is not found, there is a code flow error */
LTTNG_ASSERT(ua_chan_node);
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
ret = create_ust_app_event(ua_chan, uevent, app);
pthread_mutex_unlock(&ua_sess->lock);
/* Session is being or is deleted. */
goto end;
}
- ua_sess = caa_container_of(node, struct ust_app_session, node);
+ ua_sess = lttng::utils::container_of(node, &ust_app_session::node);
health_code_update();
destroy_app_session(app, ua_sess);
goto error;
}
- ua_sess = caa_container_of(node, struct ust_app_session, ust_objd_node);
+ ua_sess = lttng::utils::container_of(node, &ust_app_session::ust_objd_node);
error:
return ua_sess;
goto error;
}
- ua_chan = caa_container_of(node, struct ust_app_channel, ust_objd_node);
+ ua_chan = lttng::utils::container_of(node, &ust_app_channel::ust_objd_node);
error:
return ua_chan;
/* If the session is found for the app, the channel must be there */
LTTNG_ASSERT(ua_chan_node);
- ua_chan = caa_container_of(ua_chan_node, struct ust_app_channel, node);
+ ua_chan = lttng::utils::container_of(ua_chan_node, &ust_app_channel::node);
if (overwrite) {
uint64_t _lost;
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
lsu::registry_channel *chan =
- caa_container_of(head, lsu::registry_channel, _rcu_head);
+ lttng::utils::container_of(head, &lsu::registry_channel::_rcu_head);
DIAGNOSTIC_POP
delete chan;
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
lsu::registry_enum *reg_enum =
- caa_container_of(head, lsu::registry_enum, rcu_head);
+ lttng::utils::container_of(head, &lsu::registry_enum::rcu_head);
DIAGNOSTIC_POP
destroy_enum(reg_enum);
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
- auto chan = caa_container_of(node, lsu::registry_channel, _node);
+ auto chan = lttng::utils::container_of(node, &lsu::registry_channel::_node);
DIAGNOSTIC_POP
return *chan;
}
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
- reg_enum = caa_container_of(node, lsu::registry_enum, node);
+ reg_enum = lttng::utils::container_of(node, &lsu::registry_enum::node);
DIAGNOSTIC_POP
return lsu::registry_enum::const_rcu_protected_reference{*reg_enum, std::move(rcu_lock)};
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
- reg_enum = caa_container_of(node, lsu::registry_enum, node);
+ reg_enum = lttng::utils::container_of(node, &lsu::registry_enum::node);
DIAGNOSTIC_POP
end:
*/
static void ust_registry_event_destroy_rcu(struct rcu_head *head)
{
- struct lttng_ht_node_u64 *node = caa_container_of(head, struct lttng_ht_node_u64, head);
+ struct lttng_ht_node_u64 *node = lttng::utils::container_of(head, <tng_ht_node_u64::head);
DIAGNOSTIC_PUSH
DIAGNOSTIC_IGNORE_INVALID_OFFSETOF
lttng::sessiond::ust::registry_event *event =
- caa_container_of(node, lttng::sessiond::ust::registry_event, _node);
+ lttng::utils::container_of(node, <tng::sessiond::ust::registry_event::_node);
DIAGNOSTIC_POP
lttng::sessiond::ust::registry_event_destroy(event);
void action_destroy_ref(struct urcu_ref *ref)
{
struct lttng_action *action =
- container_of(ref, struct lttng_action, ref);
+ lttng::utils::container_of(ref, <tng_action::ref);
action->destroy(action);
}
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_list, parent);
+ return lttng::utils::container_of(action, <tng_action_list::parent);
}
static const struct lttng_action_list *action_list_from_action_const(
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_list, parent);
+ return lttng::utils::container_of(action, <tng_action_list::parent);
}
static bool lttng_action_list_validate(struct lttng_action *action)
{
unsigned int i, count;
enum lttng_action_status action_status;
- const struct lttng_action_list *list =
- container_of(action, typeof(*list), parent);
action_status = lttng_action_list_get_count(action, &count);
if (action_status != LTTNG_ACTION_STATUS_OK) {
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_notify, parent);
+ return lttng::utils::container_of(action, <tng_action_notify::parent);
}
static const struct lttng_action_notify *action_notify_from_action_const(
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_notify, parent);
+ return lttng::utils::container_of(action, <tng_action_notify::parent);
}
static
{
LTTNG_ASSERT(policy);
- return container_of(policy, struct lttng_rate_policy_every_n, parent);
+ return lttng::utils::container_of(policy, <tng_rate_policy_every_n::parent);
}
static const struct lttng_rate_policy_every_n *
{
LTTNG_ASSERT(policy);
- return container_of(policy, struct lttng_rate_policy_every_n, parent);
+ return lttng::utils::container_of(policy, <tng_rate_policy_every_n::parent);
}
static int lttng_rate_policy_every_n_serialize(
{
LTTNG_ASSERT(policy);
- return container_of(
- policy, struct lttng_rate_policy_once_after_n, parent);
+ return lttng::utils::container_of(
+ policy, <tng_rate_policy_once_after_n::parent);
}
static const struct lttng_rate_policy_once_after_n *
{
LTTNG_ASSERT(policy);
- return container_of(
- policy, struct lttng_rate_policy_once_after_n, parent);
+ return lttng::utils::container_of(
+ policy, <tng_rate_policy_once_after_n::parent);
}
static int lttng_rate_policy_once_after_n_serialize(
struct lttng_rate_policy *policy, struct lttng_payload *payload)
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_rotate_session, parent);
+ return lttng::utils::container_of(action, <tng_action_rotate_session::parent);
}
static const struct lttng_action_rotate_session *
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_rotate_session, parent);
+ return lttng::utils::container_of(action, <tng_action_rotate_session::parent);
}
static bool lttng_action_rotate_session_validate(struct lttng_action *action)
{
LTTNG_ASSERT(action);
- return container_of(
- action, struct lttng_action_snapshot_session, parent);
+ return lttng::utils::container_of(
+ action, <tng_action_snapshot_session::parent);
}
static const struct lttng_action_snapshot_session *
{
LTTNG_ASSERT(action);
- return container_of(
- action, struct lttng_action_snapshot_session, parent);
+ return lttng::utils::container_of(
+ action, <tng_action_snapshot_session::parent);
}
static bool lttng_action_snapshot_session_validate(struct lttng_action *action)
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_start_session, parent);
+ return lttng::utils::container_of(action, <tng_action_start_session::parent);
}
static const struct lttng_action_start_session *
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_start_session, parent);
+ return lttng::utils::container_of(action, <tng_action_start_session::parent);
}
static bool lttng_action_start_session_validate(struct lttng_action *action)
bool is_equal = false;
struct lttng_action_start_session *a, *b;
- a = container_of(_a, struct lttng_action_start_session, parent);
- b = container_of(_b, struct lttng_action_start_session, parent);
+ a = lttng::utils::container_of(_a, <tng_action_start_session::parent);
+ b = lttng::utils::container_of(_b, <tng_action_start_session::parent);
/* Action is not valid if this is not true. */
LTTNG_ASSERT(a->session_name);
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_stop_session, parent);
+ return lttng::utils::container_of(action, <tng_action_stop_session::parent);
}
static const struct lttng_action_stop_session *
{
LTTNG_ASSERT(action);
- return container_of(action, struct lttng_action_stop_session, parent);
+ return lttng::utils::container_of(action, <tng_action_stop_session::parent);
}
static bool lttng_action_stop_session_validate(struct lttng_action *action)
{
int ret;
struct lttng_directory_handle *handle =
- container_of(ref, struct lttng_directory_handle, ref);
+ lttng::utils::container_of(ref, <tng_directory_handle::ref);
if (handle->destroy_cb) {
handle->destroy_cb(handle, handle->destroy_cb_data);
void lttng_directory_handle_release(struct urcu_ref *ref)
{
struct lttng_directory_handle *handle =
- container_of(ref, struct lttng_directory_handle, ref);
+ lttng::utils::container_of(ref, <tng_directory_handle::ref);
free(handle->base_path);
lttng_directory_handle_invalidate(handle);
{
struct lttng_condition_buffer_usage *usage;
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
free(usage->session_name);
free(usage->channel_name);
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->session_name) {
ERR("Invalid buffer condition: a target session name must be set.");
goto end;
}
DBG("Serializing buffer usage condition");
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
session_name_len = strlen(usage->session_name) + 1;
channel_name_len = strlen(usage->channel_name) + 1;
bool is_equal = false;
struct lttng_condition_buffer_usage *a, *b;
- a = container_of(_a, struct lttng_condition_buffer_usage, parent);
- b = container_of(_b, struct lttng_condition_buffer_usage, parent);
+ a = lttng::utils::container_of(_a, <tng_condition_buffer_usage::parent);
+ b = lttng::utils::container_of(_b, <tng_condition_buffer_usage::parent);
if ((a->threshold_ratio.set && !b->threshold_ratio.set) ||
(a->threshold_bytes.set && !b->threshold_bytes.set)) {
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->threshold_ratio.set) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
usage->threshold_ratio.set = true;
usage->threshold_bytes.set = false;
usage->threshold_ratio.value = threshold_ratio;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->threshold_bytes.set) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
usage->threshold_ratio.set = false;
usage->threshold_bytes.set = true;
usage->threshold_bytes.value = threshold_bytes;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->session_name) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
session_name_copy = strdup(session_name);
if (!session_name_copy) {
status = LTTNG_CONDITION_STATUS_ERROR;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->channel_name) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
channel_name_copy = strdup(channel_name);
if (!channel_name_copy) {
status = LTTNG_CONDITION_STATUS_ERROR;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
if (!usage->domain.set) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- usage = container_of(condition, struct lttng_condition_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(condition,
+ <tng_condition_buffer_usage::parent);
usage->domain.set = true;
usage->domain.type = type;
end:
struct lttng_evaluation_buffer_usage *usage;
struct lttng_evaluation_buffer_usage_comm comm;
- usage = container_of(evaluation, struct lttng_evaluation_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(evaluation,
+ <tng_evaluation_buffer_usage::parent);
comm.buffer_use = usage->buffer_use;
comm.buffer_capacity = usage->buffer_capacity;
{
struct lttng_evaluation_buffer_usage *usage;
- usage = container_of(evaluation, struct lttng_evaluation_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(evaluation,
+ <tng_evaluation_buffer_usage::parent);
free(usage);
}
goto end;
}
- usage = container_of(evaluation, struct lttng_evaluation_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(evaluation,
+ <tng_evaluation_buffer_usage::parent);
*usage_ratio = (double) usage->buffer_use /
(double) usage->buffer_capacity;
end:
goto end;
}
- usage = container_of(evaluation, struct lttng_evaluation_buffer_usage,
- parent);
+ usage = lttng::utils::container_of(evaluation,
+ <tng_evaluation_buffer_usage::parent);
*usage_bytes = usage->buffer_use;
end:
return status;
static void condition_destroy_ref(struct urcu_ref *ref)
{
struct lttng_condition *condition =
- container_of(ref, struct lttng_condition, ref);
+ lttng::utils::container_of(ref, <tng_condition::ref);
condition->destroy(condition);
}
goto end;
}
- event_rule = container_of(condition,
- struct lttng_condition_event_rule_matches, parent);
+ event_rule = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
if (!event_rule->rule) {
ERR("Invalid on event condition: a rule must be set");
goto end;
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
const struct lttng_event_expr_field *field_expr =
- container_of(expr,
- const struct lttng_event_expr_field,
- parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_field::parent);
/* Serialize the field name. */
DBG("Serializing field event expression's field name: '%s'",
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
{
const struct lttng_event_expr_app_specific_context_field *field_expr =
- container_of(expr,
- const struct lttng_event_expr_app_specific_context_field,
- parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_app_specific_context_field::parent);
/* Serialize the provider name. */
DBG("Serializing app-specific context field event expression's "
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
{
const struct lttng_event_expr_array_field_element *elem_expr =
- container_of(expr,
- const struct lttng_event_expr_array_field_element,
- parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_array_field_element::parent);
const uint32_t index = elem_expr->index;
/* Serialize the index. */
const struct lttng_condition *condition, unsigned int index)
{
const struct lttng_condition_event_rule_matches
- *event_rule_matches_cond = container_of(condition,
- const struct lttng_condition_event_rule_matches,
- parent);
+ *event_rule_matches_cond = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
struct lttng_capture_descriptor *desc = NULL;
unsigned int count;
enum lttng_condition_status status;
}
DBG("Serializing on event condition");
- event_rule_matches_condition = container_of(condition,
- struct lttng_condition_event_rule_matches, parent);
+ event_rule_matches_condition = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
DBG("Serializing on event condition's event rule");
ret = lttng_event_rule_serialize(
bool is_equal = false;
struct lttng_condition_event_rule_matches *a, *b;
- a = container_of(_a, struct lttng_condition_event_rule_matches, parent);
- b = container_of(_b, struct lttng_condition_event_rule_matches, parent);
+ a = lttng::utils::container_of(_a, <tng_condition_event_rule_matches::parent);
+ b = lttng::utils::container_of(_b, <tng_condition_event_rule_matches::parent);
/* Both event rules must be set or both must be unset. */
if ((a->rule && !b->rule) || (!a->rule && b->rule)) {
{
struct lttng_condition_event_rule_matches *event_rule_matches_condition;
- event_rule_matches_condition = container_of(condition,
- struct lttng_condition_event_rule_matches, parent);
+ event_rule_matches_condition = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
lttng_event_rule_put(event_rule_matches_condition->rule);
lttng_dynamic_pointer_array_reset(
goto end;
}
- event_rule = container_of(condition,
- struct lttng_condition_event_rule_matches, parent);
+ event_rule = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
if (!event_rule->rule) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
struct lttng_condition *condition, uint64_t error_counter_index)
{
struct lttng_condition_event_rule_matches *event_rule_matches_cond =
- container_of(condition,
- struct lttng_condition_event_rule_matches,
- parent);
+ lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
LTTNG_OPTIONAL_SET(&event_rule_matches_cond->error_counter_index,
error_counter_index);
const struct lttng_condition *condition)
{
const struct lttng_condition_event_rule_matches
- *event_rule_matches_cond = container_of(condition,
- const struct lttng_condition_event_rule_matches,
- parent);
+ *event_rule_matches_cond = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
return LTTNG_OPTIONAL_GET(event_rule_matches_cond->error_counter_index);
}
int ret;
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
struct lttng_condition_event_rule_matches *event_rule_matches_cond =
- container_of(condition,
- struct lttng_condition_event_rule_matches,
- parent);
+ lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
struct lttng_capture_descriptor *descriptor = NULL;
const struct lttng_event_rule *rule = NULL;
{
enum lttng_condition_status status = LTTNG_CONDITION_STATUS_OK;
const struct lttng_condition_event_rule_matches
- *event_rule_matches_condition = container_of(condition,
- const struct lttng_condition_event_rule_matches,
- parent);
+ *event_rule_matches_condition = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
if (!condition || !IS_EVENT_RULE_MATCHES_CONDITION(condition) ||
!count) {
struct lttng_evaluation_event_rule_matches *hit;
uint32_t capture_payload_size;
- hit = container_of(evaluation,
- struct lttng_evaluation_event_rule_matches, parent);
+ hit = lttng::utils::container_of(evaluation,
+ <tng_evaluation_event_rule_matches::parent);
capture_payload_size = (uint32_t) hit->capture_payload.size;
ret = lttng_dynamic_buffer_append(&payload->buffer, &capture_payload_size,
{
struct lttng_evaluation_event_rule_matches *hit;
- hit = container_of(evaluation,
- struct lttng_evaluation_event_rule_matches, parent);
+ hit = lttng::utils::container_of(evaluation,
+ <tng_evaluation_event_rule_matches::parent);
lttng_dynamic_buffer_reset(&hit->capture_payload);
lttng_event_field_value_destroy(hit->captured_values);
free(hit);
goto end;
}
- hit = container_of(evaluation,
- struct lttng_evaluation_event_rule_matches, parent);
+ hit = lttng::utils::container_of(evaluation,
+ <tng_evaluation_event_rule_matches::parent);
if (!hit->captured_values) {
status = LTTNG_EVALUATION_EVENT_RULE_MATCHES_STATUS_NONE;
goto end;
const struct lttng_condition *condition, unsigned int index)
{
const struct lttng_condition_event_rule_matches
- *event_rule_matches_cond = container_of(condition,
- const struct lttng_condition_event_rule_matches,
- parent);
+ *event_rule_matches_cond = lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent);
struct lttng_capture_descriptor *desc = NULL;
struct lttng_bytecode *bytecode = NULL;
unsigned int count;
{
struct lttng_condition_session_consumed_size *consumed_size;
- consumed_size = container_of(condition,
- struct lttng_condition_session_consumed_size, parent);
+ consumed_size = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
free(consumed_size->session_name);
free(consumed_size);
goto end;
}
- consumed = container_of(condition, struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
if (!consumed->session_name) {
ERR("Invalid session consumed size condition: a target session name must be set.");
goto end;
}
DBG("Serializing session consumed size condition");
- consumed = container_of(condition,
- struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
session_name_len = strlen(consumed->session_name) + 1;
if (session_name_len > LTTNG_NAME_MAX) {
bool is_equal = false;
struct lttng_condition_session_consumed_size *a, *b;
- a = container_of(_a, struct lttng_condition_session_consumed_size, parent);
- b = container_of(_b, struct lttng_condition_session_consumed_size, parent);
+ a = lttng::utils::container_of(_a, <tng_condition_session_consumed_size::parent);
+ b = lttng::utils::container_of(_b, <tng_condition_session_consumed_size::parent);
if (a->consumed_threshold_bytes.set && b->consumed_threshold_bytes.set) {
uint64_t a_value, b_value;
goto end;
}
- consumed = container_of(condition, struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
if (!consumed->consumed_threshold_bytes.set) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- consumed = container_of(condition, struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
consumed->consumed_threshold_bytes.set = true;
consumed->consumed_threshold_bytes.value = consumed_threshold_bytes;
end:
goto end;
}
- consumed = container_of(condition, struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
if (!consumed->session_name) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- consumed = container_of(condition, struct lttng_condition_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(condition,
+ <tng_condition_session_consumed_size::parent);
session_name_copy = strdup(session_name);
if (!session_name_copy) {
status = LTTNG_CONDITION_STATUS_ERROR;
struct lttng_evaluation_session_consumed_size *consumed;
struct lttng_evaluation_session_consumed_size_comm comm;
- consumed = container_of(evaluation,
- struct lttng_evaluation_session_consumed_size, parent);
+ consumed = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_consumed_size::parent);
comm.session_consumed = consumed->session_consumed;
return lttng_dynamic_buffer_append(
&payload->buffer, &comm, sizeof(comm));
{
struct lttng_evaluation_session_consumed_size *consumed;
- consumed = container_of(evaluation, struct lttng_evaluation_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_consumed_size::parent);
free(consumed);
}
goto end;
}
- consumed = container_of(evaluation, struct lttng_evaluation_session_consumed_size,
- parent);
+ consumed = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_consumed_size::parent);
*session_consumed = consumed->session_consumed;
end:
return status;
goto end;
}
- rotation = container_of(condition,
- struct lttng_condition_session_rotation, parent);
+ rotation = lttng::utils::container_of(condition,
+ <tng_condition_session_rotation::parent);
if (!rotation->session_name) {
ERR("Invalid session rotation condition: a target session name must be set.");
goto end;
}
DBG("Serializing session rotation condition");
- rotation = container_of(condition, struct lttng_condition_session_rotation,
- parent);
+ rotation = lttng::utils::container_of(condition,
+ <tng_condition_session_rotation::parent);
session_name_len = strlen(rotation->session_name) + 1;
if (session_name_len > LTTNG_NAME_MAX) {
bool is_equal = false;
struct lttng_condition_session_rotation *a, *b;
- a = container_of(_a, struct lttng_condition_session_rotation, parent);
- b = container_of(_b, struct lttng_condition_session_rotation, parent);
+ a = lttng::utils::container_of(_a, <tng_condition_session_rotation::parent);
+ b = lttng::utils::container_of(_b, <tng_condition_session_rotation::parent);
/* Both session names must be set or both must be unset. */
if ((a->session_name && !b->session_name) ||
{
struct lttng_condition_session_rotation *rotation;
- rotation = container_of(condition,
- struct lttng_condition_session_rotation, parent);
+ rotation = lttng::utils::container_of(condition,
+ <tng_condition_session_rotation::parent);
free(rotation->session_name);
free(rotation);
goto end;
}
- rotation = container_of(condition, struct lttng_condition_session_rotation,
- parent);
+ rotation = lttng::utils::container_of(condition,
+ <tng_condition_session_rotation::parent);
if (!rotation->session_name) {
status = LTTNG_CONDITION_STATUS_UNSET;
goto end;
goto end;
}
- rotation = container_of(condition,
- struct lttng_condition_session_rotation, parent);
+ rotation = lttng::utils::container_of(condition,
+ <tng_condition_session_rotation::parent);
session_name_copy = strdup(session_name);
if (!session_name_copy) {
status = LTTNG_CONDITION_STATUS_ERROR;
struct lttng_evaluation_session_rotation *rotation;
struct lttng_evaluation_session_rotation_comm comm = {};
- rotation = container_of(evaluation,
- struct lttng_evaluation_session_rotation, parent);
+ rotation = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_rotation::parent);
comm.id = rotation->id;
comm.has_location = !!rotation->location;
ret = lttng_dynamic_buffer_append(
{
struct lttng_evaluation_session_rotation *rotation;
- rotation = container_of(evaluation,
- struct lttng_evaluation_session_rotation, parent);
+ rotation = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_rotation::parent);
lttng_trace_archive_location_put(rotation->location);
free(rotation);
}
goto end;
}
- rotation = container_of(evaluation,
- struct lttng_evaluation_session_rotation, parent);
+ rotation = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_rotation::parent);
*id = rotation->id;
end:
return status;
goto end;
}
- rotation = container_of(evaluation,
- struct lttng_evaluation_session_rotation, parent);
+ rotation = lttng::utils::container_of(evaluation,
+ <tng_evaluation_session_rotation::parent);
*location = rotation->location;
end:
return status;
static void free_stream_rcu(struct rcu_head *head)
{
struct lttng_ht_node_u64 *node =
- caa_container_of(head, struct lttng_ht_node_u64, head);
+ lttng::utils::container_of(head, <tng_ht_node_u64::head);
struct lttng_consumer_stream *stream =
- caa_container_of(node, struct lttng_consumer_stream, node);
+ lttng::utils::container_of(node, <tng_consumer_stream::node);
pthread_mutex_destroy(&stream->lock);
free(stream);
lttng_ht_lookup(ht, &key, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
if (node != NULL) {
- stream = caa_container_of(node, struct lttng_consumer_stream, node);
+ stream = lttng::utils::container_of(node, <tng_consumer_stream::node);
}
rcu_read_unlock();
lttng_ht_lookup(the_consumer_data.channel_ht, &key, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
if (node != NULL) {
- channel = caa_container_of(node, struct lttng_consumer_channel, node);
+ channel = lttng::utils::container_of(node, <tng_consumer_channel::node);
}
return channel;
static void free_channel_rcu(struct rcu_head *head)
{
struct lttng_ht_node_u64 *node =
- caa_container_of(head, struct lttng_ht_node_u64, head);
+ lttng::utils::container_of(head, <tng_ht_node_u64::head);
struct lttng_consumer_channel *channel =
- caa_container_of(node, struct lttng_consumer_channel, node);
+ lttng::utils::container_of(node, <tng_consumer_channel::node);
switch (the_consumer_data.type) {
case LTTNG_CONSUMER_KERNEL:
static void free_relayd_rcu(struct rcu_head *head)
{
struct lttng_ht_node_u64 *node =
- caa_container_of(head, struct lttng_ht_node_u64, head);
+ lttng::utils::container_of(head, <tng_ht_node_u64::head);
struct consumer_relayd_sock_pair *relayd =
- caa_container_of(node, struct consumer_relayd_sock_pair, node);
+ lttng::utils::container_of(node, &consumer_relayd_sock_pair::node);
/*
* Close all sockets. This is done in the call RCU since we don't want the
lttng_ht_lookup(the_consumer_data.relayd_ht, &key, &iter);
node = lttng_ht_iter_get_node_u64(&iter);
if (node != NULL) {
- relayd = caa_container_of(node, struct consumer_relayd_sock_pair, node);
+ relayd = lttng::utils::container_of(node, &consumer_relayd_sock_pair::node);
}
error:
case LTTNG_ERROR_QUERY_TARGET_TYPE_TRIGGER:
{
struct lttng_error_query_trigger *trigger_query =
- container_of(query, typeof(*trigger_query),
- parent);
+ lttng::utils::container_of(query, <tng_error_query_trigger::parent);
lttng_trigger_put(trigger_query->trigger);
free(trigger_query);
}
case LTTNG_ERROR_QUERY_TARGET_TYPE_CONDITION:
{
- struct lttng_error_query_condition *condition_query =
- container_of(query, typeof(*condition_query),
- parent);
+ struct lttng_error_query_condition *condition_query = lttng::utils::container_of(
+ query, <tng_error_query_condition::parent);
lttng_trigger_put(condition_query->trigger);
free(condition_query);
}
case LTTNG_ERROR_QUERY_TARGET_TYPE_ACTION:
{
- struct lttng_error_query_action *action_query =
- container_of(query, typeof(*action_query),
- parent);
+ struct lttng_error_query_action *action_query = lttng::utils::container_of(
+ query, <tng_error_query_action::parent);
lttng_trigger_put(action_query->trigger);
lttng_action_path_destroy(action_query->action_path);
const struct lttng_error_query_result_counter *counter_result;
LTTNG_ASSERT(result->type == LTTNG_ERROR_QUERY_RESULT_TYPE_COUNTER);
- counter_result = container_of(result, typeof(*counter_result), parent);
+ counter_result = lttng::utils::container_of(
+ result, <tng_error_query_result_counter::parent);
lttng_error_query_result_counter_comm comm = {
.value = counter_result->value,
{
int ret;
const struct lttng_error_query_trigger *query_trigger =
- container_of(query, typeof(*query_trigger), parent);
+ lttng::utils::container_of(query, <tng_error_query_trigger::parent);
if (!lttng_trigger_validate(query_trigger->trigger)) {
ret = -1;
{
int ret;
const struct lttng_error_query_condition *query_trigger =
- container_of(query, typeof(*query_trigger), parent);
+ lttng::utils::container_of(query, <tng_error_query_condition::parent);
if (!lttng_trigger_validate(query_trigger->trigger)) {
ret = -1;
{
int ret;
const struct lttng_error_query_action *query_action =
- container_of(query, typeof(*query_action), parent);
+ lttng::utils::container_of(query, <tng_error_query_action::parent);
if (!lttng_trigger_validate(query_action->trigger)) {
ret = -1;
const struct lttng_error_query *query)
{
const struct lttng_error_query_trigger *query_trigger =
- container_of(query, typeof(*query_trigger), parent);
+ lttng::utils::container_of(query, <tng_error_query_trigger::parent);
return query_trigger->trigger;
}
const struct lttng_error_query *query)
{
const struct lttng_error_query_condition *query_trigger =
- container_of(query, typeof(*query_trigger), parent);
+ lttng::utils::container_of(query, <tng_error_query_condition::parent);
return query_trigger->trigger;
}
const struct lttng_error_query *query)
{
const struct lttng_error_query_action *query_action =
- container_of(query, typeof(*query_action), parent);
+ lttng::utils::container_of(query, <tng_error_query_action::parent);
return query_action->trigger;
}
struct lttng_action *lttng_error_query_action_borrow_action_target(
- const struct lttng_error_query *query,
- struct lttng_trigger *trigger)
+ const struct lttng_error_query *query, struct lttng_trigger *trigger)
{
const struct lttng_error_query_action *query_action =
- container_of(query, typeof(*query_action), parent);
+ lttng::utils::container_of(query, <tng_error_query_action::parent);
return get_trigger_action_from_path(
trigger, query_action->action_path);
goto end;
}
- counter_result = container_of(result, typeof(*counter_result), parent);
+ counter_result = lttng::utils::container_of(
+ result, <tng_error_query_result_counter::parent);
*value = counter_result->value;
status = LTTNG_ERROR_QUERY_RESULT_STATUS_OK;
LTTNG_ASSERT(condition->type ==
LTTNG_CONDITION_TYPE_EVENT_RULE_MATCHES);
ret = lttng_evaluation_event_rule_matches_create_from_payload(
- container_of(condition,
- const struct lttng_condition_event_rule_matches,
- parent),
+ lttng::utils::container_of(condition,
+ <tng_condition_event_rule_matches::parent),
&evaluation_view, evaluation);
if (ret < 0) {
goto end;
enum lttng_event_expr_type type,
const char *name)
{
- struct lttng_event_expr_field *expr =
- container_of(
- create_empty_expr(type, sizeof(*expr)),
- struct lttng_event_expr_field, parent);
+ struct lttng_event_expr_field *expr = lttng::utils::container_of(
+ create_empty_expr(type, sizeof(*expr)), <tng_event_expr_field::parent);
if (!expr) {
goto error;
goto error;
}
- expr = container_of(create_empty_expr(
+ expr = lttng::utils::container_of(create_empty_expr(
LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD,
sizeof(*expr)),
- struct lttng_event_expr_app_specific_context_field,
- parent);
+ <tng_event_expr_app_specific_context_field::parent);
if (!expr) {
goto error;
}
goto error;
}
- expr = container_of(create_empty_expr(
+ expr = lttng::utils::container_of(create_empty_expr(
LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT,
sizeof(*expr)),
- struct lttng_event_expr_array_field_element,
- parent);
+ <tng_event_expr_array_field_element::parent);
if (!expr) {
goto error;
}
goto end;
}
- ret = container_of(expr,
- const struct lttng_event_expr_field, parent)->name;
+ ret = lttng::utils::container_of(expr,
+ <tng_event_expr_field::parent)->name;
end:
return ret;
goto end;
}
- ret = container_of(expr,
- const struct lttng_event_expr_field, parent)->name;
+ ret = lttng::utils::container_of(expr,
+ <tng_event_expr_field::parent)->name;
end:
return ret;
goto end;
}
- ret = container_of(expr,
- const struct lttng_event_expr_app_specific_context_field,
- parent)->provider_name;
+ ret = lttng::utils::container_of(expr,
+ <tng_event_expr_app_specific_context_field::parent)->provider_name;
end:
return ret;
goto end;
}
- ret = container_of(expr,
- const struct lttng_event_expr_app_specific_context_field,
- parent)->type_name;
+ ret = lttng::utils::container_of(expr,
+ <tng_event_expr_app_specific_context_field::parent)->type_name;
end:
return ret;
goto end;
}
- ret = container_of(expr,
- const struct lttng_event_expr_array_field_element,
- parent)->array_field_expr;
+ ret = lttng::utils::container_of(expr,
+ <tng_event_expr_array_field_element::parent)->array_field_expr;
end:
return ret;
goto end;
}
- *index = container_of(expr,
- const struct lttng_event_expr_array_field_element,
- parent)->index;
+ *index = lttng::utils::container_of(expr,
+ <tng_event_expr_array_field_element::parent)->index;
end:
return ret;
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
const struct lttng_event_expr_field *field_expr_a =
- container_of(expr_a,
- const struct lttng_event_expr_field,
- parent);
+ lttng::utils::container_of(expr_a,
+ <tng_event_expr_field::parent);
const struct lttng_event_expr_field *field_expr_b =
- container_of(expr_b,
- const struct lttng_event_expr_field,
- parent);
+ lttng::utils::container_of(expr_b,
+ <tng_event_expr_field::parent);
if (strcmp(field_expr_a->name, field_expr_b->name) != 0) {
goto not_equal;
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
{
const struct lttng_event_expr_app_specific_context_field *field_expr_a =
- container_of(expr_a,
- const struct lttng_event_expr_app_specific_context_field,
- parent);
+ lttng::utils::container_of(expr_a,
+ <tng_event_expr_app_specific_context_field::parent);
const struct lttng_event_expr_app_specific_context_field *field_expr_b =
- container_of(expr_b,
- const struct lttng_event_expr_app_specific_context_field,
- parent);
+ lttng::utils::container_of(expr_b,
+ <tng_event_expr_app_specific_context_field::parent);
if (strcmp(field_expr_a->provider_name,
field_expr_b->provider_name) != 0) {
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
{
const struct lttng_event_expr_array_field_element *elem_expr_a =
- container_of(expr_a,
- const struct lttng_event_expr_array_field_element,
- parent);
+ lttng::utils::container_of(expr_a,
+ <tng_event_expr_array_field_element::parent);
const struct lttng_event_expr_array_field_element *elem_expr_b =
- container_of(expr_b,
- const struct lttng_event_expr_array_field_element,
- parent);
+ lttng::utils::container_of(expr_b,
+ <tng_event_expr_array_field_element::parent);
if (!lttng_event_expr_is_equal(elem_expr_a->array_field_expr,
elem_expr_b->array_field_expr)) {
case LTTNG_EVENT_EXPR_TYPE_CHANNEL_CONTEXT_FIELD:
{
struct lttng_event_expr_field *field_expr =
- container_of(expr,
- struct lttng_event_expr_field, parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_field::parent);
free(field_expr->name);
break;
case LTTNG_EVENT_EXPR_TYPE_APP_SPECIFIC_CONTEXT_FIELD:
{
struct lttng_event_expr_app_specific_context_field *field_expr =
- container_of(expr,
- struct lttng_event_expr_app_specific_context_field,
- parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_app_specific_context_field::parent);
free(field_expr->provider_name);
free(field_expr->type_name);
case LTTNG_EVENT_EXPR_TYPE_ARRAY_FIELD_ELEMENT:
{
struct lttng_event_expr_array_field_element *elem_expr =
- container_of(expr,
- struct lttng_event_expr_array_field_element,
- parent);
+ lttng::utils::container_of(expr,
+ <tng_event_expr_array_field_element::parent);
lttng_event_expr_destroy(elem_expr->array_field_expr);
break;
{
struct lttng_event_field_value_uint *field_val;
- field_val = container_of(create_empty_field_val(
+ field_val = lttng::utils::container_of(create_empty_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT,
sizeof(*field_val)),
- struct lttng_event_field_value_uint, parent);
+ <tng_event_field_value_uint::parent);
if (!field_val) {
goto error;
}
{
struct lttng_event_field_value_int *field_val;
- field_val = container_of(create_empty_field_val(
+ field_val = lttng::utils::container_of(create_empty_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT,
sizeof(*field_val)),
- struct lttng_event_field_value_int, parent);
+ <tng_event_field_value_int::parent);
if (!field_val) {
goto error;
}
{
struct lttng_event_field_value_enum *field_val;
- field_val = container_of(create_empty_field_val(type, size),
- struct lttng_event_field_value_enum, parent);
+ field_val = lttng::utils::container_of(create_empty_field_val(type, size),
+ <tng_event_field_value_enum::parent);
if (!field_val) {
goto error;
}
{
struct lttng_event_field_value_enum_uint *field_val;
- field_val = container_of(create_enum_field_val(
+ field_val = lttng::utils::container_of(create_enum_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM,
sizeof(*field_val)),
- struct lttng_event_field_value_enum_uint, parent);
+ <tng_event_field_value_enum_uint::parent);
if (!field_val) {
goto error;
}
{
struct lttng_event_field_value_enum_int *field_val;
- field_val = container_of(create_enum_field_val(
+ field_val = lttng::utils::container_of(create_enum_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM,
sizeof(*field_val)),
- struct lttng_event_field_value_enum_int, parent);
+ <tng_event_field_value_enum_int::parent);
if (!field_val) {
goto error;
}
struct lttng_event_field_value *lttng_event_field_value_real_create(double val)
{
- struct lttng_event_field_value_real *field_val = container_of(
+ struct lttng_event_field_value_real *field_val = lttng::utils::container_of(
create_empty_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_REAL,
sizeof(*field_val)),
- struct lttng_event_field_value_real, parent);
+ <tng_event_field_value_real::parent);
if (!field_val) {
goto error;
struct lttng_event_field_value *lttng_event_field_value_string_create_with_size(
const char *val, size_t size)
{
- struct lttng_event_field_value_string *field_val = container_of(
+ struct lttng_event_field_value_string *field_val = lttng::utils::container_of(
create_empty_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_STRING,
sizeof(*field_val)),
- struct lttng_event_field_value_string, parent);
+ <tng_event_field_value_string::parent);
if (!field_val) {
goto error;
struct lttng_event_field_value *lttng_event_field_value_array_create(void)
{
- struct lttng_event_field_value_array *field_val = container_of(
+ struct lttng_event_field_value_array *field_val = lttng::utils::container_of(
create_empty_field_val(
LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY,
sizeof(*field_val)),
- struct lttng_event_field_value_array, parent);
+ <tng_event_field_value_array::parent);
if (!field_val) {
goto error;
case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM:
{
struct lttng_event_field_value_enum *enum_field_val =
- container_of(field_val,
- struct lttng_event_field_value_enum, parent);
+ lttng::utils::container_of(field_val,
+ <tng_event_field_value_enum::parent);
lttng_dynamic_pointer_array_reset(&enum_field_val->labels);
break;
case LTTNG_EVENT_FIELD_VALUE_TYPE_STRING:
{
struct lttng_event_field_value_string *str_field_val =
- container_of(field_val,
- struct lttng_event_field_value_string, parent);
+ lttng::utils::container_of(field_val,
+ <tng_event_field_value_string::parent);
free(str_field_val->val);
break;
case LTTNG_EVENT_FIELD_VALUE_TYPE_ARRAY:
{
struct lttng_event_field_value_array *array_field_expr =
- container_of(field_val,
- struct lttng_event_field_value_array,
- parent);
+ lttng::utils::container_of(field_val,
+ <tng_event_field_value_array::parent);
lttng_dynamic_pointer_array_reset(&array_field_expr->elems);
break;
}
ret = lttng_dynamic_pointer_array_add_pointer(
- &container_of(field_val,
- struct lttng_event_field_value_enum, parent)->labels,
+ <tng::utils::container_of(field_val,
+ <tng_event_field_value_enum::parent)->labels,
new_label);
if (ret == 0) {
new_label = NULL;
LTTNG_ASSERT(array_field_val);
LTTNG_ASSERT(field_val);
return lttng_dynamic_pointer_array_add_pointer(
- &container_of(array_field_val,
- struct lttng_event_field_value_array, parent)->elems,
+ <tng::utils::container_of(array_field_val,
+ <tng_event_field_value_array::parent)->elems,
field_val);
}
{
LTTNG_ASSERT(array_field_val);
return lttng_dynamic_pointer_array_add_pointer(
- &container_of(array_field_val,
- struct lttng_event_field_value_array, parent)->elems,
+ <tng::utils::container_of(array_field_val,
+ <tng_event_field_value_array::parent)->elems,
NULL);
}
switch (field_val->type) {
case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_INT:
- *val = container_of(field_val,
- const struct lttng_event_field_value_uint,
- parent)->val;
+ *val = lttng::utils::container_of(field_val,
+ <tng_event_field_value_uint::parent)->val;
break;
case LTTNG_EVENT_FIELD_VALUE_TYPE_UNSIGNED_ENUM:
{
- const struct lttng_event_field_value_enum *field_val_enum = container_of(
- field_val,
- const struct lttng_event_field_value_enum,
- parent);
- const struct lttng_event_field_value_enum_uint
- *field_val_enum_uint = container_of(
- field_val_enum,
- const struct lttng_event_field_value_enum_uint,
- parent);
+ const struct lttng_event_field_value_enum *field_val_enum =
+ lttng::utils::container_of(
+ field_val, <tng_event_field_value_enum::parent);
+ const struct lttng_event_field_value_enum_uint *field_val_enum_uint =
+ lttng::utils::container_of(field_val_enum,
+ <tng_event_field_value_enum_uint::parent);
*val = field_val_enum_uint->val;
break;
}
switch (field_val->type) {
case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_INT:
- *val = container_of(field_val,
- const struct lttng_event_field_value_int,
- parent)->val;
+ *val = lttng::utils::container_of(field_val,
+ <tng_event_field_value_int::parent)->val;
break;
case LTTNG_EVENT_FIELD_VALUE_TYPE_SIGNED_ENUM:
{
- const struct lttng_event_field_value_enum *field_val_enum = container_of(
+ const struct lttng_event_field_value_enum *field_val_enum = lttng::utils::container_of(
field_val,
- const struct lttng_event_field_value_enum,
- parent);
- const struct lttng_event_field_value_enum_int
- *field_val_enum_uint = container_of(
- field_val_enum,
- const struct lttng_event_field_value_enum_int,
- parent);
+ <tng_event_field_value_enum::parent);
+ const struct lttng_event_field_value_enum_int *field_val_enum_uint =
+ lttng::utils::container_of(field_val_enum,
+ <tng_event_field_value_enum_int::parent);
*val = field_val_enum_uint->val;
break;
}
goto end;
}
- *val = container_of(field_val,
- const struct lttng_event_field_value_real, parent)->val;
+ *val = lttng::utils::container_of(field_val,
+ <tng_event_field_value_real::parent)->val;
status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
end:
}
*count = (unsigned int) lttng_dynamic_pointer_array_get_count(
- &container_of(field_val,
- const struct lttng_event_field_value_enum,
- parent)->labels);
+ <tng::utils::container_of(field_val,
+ <tng_event_field_value_enum::parent)->labels);
status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
end:
goto end;
}
- enum_field_val = container_of(field_val,
- const struct lttng_event_field_value_enum, parent);
+ enum_field_val = lttng::utils::container_of(field_val,
+ <tng_event_field_value_enum::parent);
if (index >= lttng_dynamic_pointer_array_get_count(&enum_field_val->labels)) {
ret = NULL;
goto end;
}
- *value = container_of(field_val,
- const struct lttng_event_field_value_string, parent)->val;
+ *value = lttng::utils::container_of(field_val,
+ <tng_event_field_value_string::parent)->val;
status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
end:
}
*length = (unsigned int) lttng_dynamic_pointer_array_get_count(
- &container_of(field_val,
- const struct lttng_event_field_value_array,
- parent)->elems);
+ <tng::utils::container_of(field_val,
+ <tng_event_field_value_array::parent)->elems);
status = LTTNG_EVENT_FIELD_VALUE_STATUS_OK;
end:
goto end;
}
- array_field_val = container_of(field_val,
- const struct lttng_event_field_value_array, parent);
+ array_field_val = lttng::utils::container_of(
+ field_val, <tng_event_field_value_array::parent);
if (index >= lttng_dynamic_pointer_array_get_count(&array_field_val->elems)) {
status = LTTNG_EVENT_FIELD_VALUE_STATUS_INVALID;
static void lttng_event_rule_release(struct urcu_ref *ref)
{
struct lttng_event_rule *event_rule =
- container_of(ref, typeof(*event_rule), ref);
+ lttng::utils::container_of(ref, <tng_event_rule::ref);
LTTNG_ASSERT(event_rule->destroy);
event_rule->destroy(event_rule);
return;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
lttng_log_level_rule_destroy(jul_logging->log_level_rule);
free(jul_logging->pattern);
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
/* Required field. */
if (!jul_logging->pattern) {
header_offset = payload->buffer.size;
DBG("Serializing jul_logging event rule.");
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
pattern_len = strlen(jul_logging->pattern) + 1;
bool is_equal = false;
struct lttng_event_rule_jul_logging *a, *b;
- a = container_of(_a, struct lttng_event_rule_jul_logging, parent);
- b = container_of(_b, struct lttng_event_rule_jul_logging, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_jul_logging::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_jul_logging::parent);
/* Quick checks. */
LTTNG_ASSERT(rule);
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
status = lttng_event_rule_jul_logging_get_filter(rule, &filter);
if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
struct lttng_event_rule_jul_logging *jul_logging;
LTTNG_ASSERT(rule);
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
return jul_logging->internal_filter.filter;
}
struct lttng_event_rule_jul_logging *jul_logging;
LTTNG_ASSERT(rule);
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
return jul_logging->internal_filter.bytecode;
}
{
unsigned long hash;
struct lttng_event_rule_jul_logging *tp_rule =
- container_of(rule, typeof(*tp_rule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_jul_logging::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_JUL_LOGGING,
lttng_ht_seed);
enum lttng_event_rule_status status;
const struct lttng_log_level_rule *log_level_rule;
- jul_logging = container_of(
- rule, const struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
local_event = zmalloc<lttng_event>();
if (!local_event) {
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
if (!jul_logging->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
PERROR("Failed to copy filter expression");
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
if (!jul_logging->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
if (!log_level_rule_valid(log_level_rule)) {
status = LTTNG_EVENT_RULE_STATUS_INVALID;
goto end;
}
- jul_logging = container_of(
- rule, struct lttng_event_rule_jul_logging, parent);
+ jul_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_jul_logging::parent);
if (jul_logging->log_level_rule == NULL) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
{
struct lttng_event_rule_kernel_kprobe *kprobe;
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
lttng_kernel_probe_location_destroy(kprobe->location);
free(kprobe->name);
goto end;
}
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
/* Required field. */
if (!kprobe->name) {
header_offset = payload->buffer.size;
DBG("Serializing kprobe event rule.");
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
name_len = strlen(kprobe->name) + 1;
kprobe_comm.name_len = name_len;
bool is_equal = false;
struct lttng_event_rule_kernel_kprobe *a, *b;
- a = container_of(_a, struct lttng_event_rule_kernel_kprobe, parent);
- b = container_of(_b, struct lttng_event_rule_kernel_kprobe, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_kernel_kprobe::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_kernel_kprobe::parent);
/* Quick checks */
if (!!a->name != !!b->name) {
{
unsigned long hash;
struct lttng_event_rule_kernel_kprobe *krule =
- container_of(rule, typeof(*krule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_KPROBE,
lttng_ht_seed);
goto end;
}
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
*location = kprobe->location;
if (!*location) {
goto end;
}
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
name_copy = strdup(name);
if (!name_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- kprobe = container_of(rule, struct lttng_event_rule_kernel_kprobe, parent);
+ kprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_kprobe::parent);
if (!kprobe->name) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
return;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
free(syscall->pattern);
free(syscall->filter_expression);
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
/* Required field. */
if (!syscall->pattern) {
}
DBG("Serializing syscall event rule");
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
pattern_len = strlen(syscall->pattern) + 1;
bool is_equal = false;
struct lttng_event_rule_kernel_syscall *a, *b;
- a = container_of(_a, struct lttng_event_rule_kernel_syscall, parent);
- b = container_of(_b, struct lttng_event_rule_kernel_syscall, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_kernel_syscall::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_kernel_syscall::parent);
if (!!a->filter_expression != !!b->filter_expression) {
goto end;
LTTNG_ASSERT(rule);
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
/* Generate the filter bytecode. */
status = lttng_event_rule_kernel_syscall_get_filter(rule, &filter);
struct lttng_event_rule_kernel_syscall *syscall;
LTTNG_ASSERT(rule);
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
return syscall->internal_filter.filter;
}
struct lttng_event_rule_kernel_syscall *syscall;
LTTNG_ASSERT(rule);
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
return syscall->internal_filter.bytecode;
}
{
unsigned long hash;
struct lttng_event_rule_kernel_syscall *syscall_rule =
- container_of(rule, typeof(*syscall_rule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_SYSCALL,
lttng_ht_seed);
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
if (!syscall->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
if (!syscall->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- syscall = container_of(rule, struct lttng_event_rule_kernel_syscall, parent);
+ syscall = lttng::utils::container_of(rule, <tng_event_rule_kernel_syscall::parent);
emission_site = syscall->emission_site;
end:
return;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
free(tracepoint->pattern);
free(tracepoint->filter_expression);
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
/* Required field. */
if (!tracepoint->pattern) {
}
DBG("Serializing kernel tracepoint event rule.");
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
pattern_len = strlen(tracepoint->pattern) + 1;
bool is_equal = false;
struct lttng_event_rule_kernel_tracepoint *a, *b;
- a = container_of(_a, struct lttng_event_rule_kernel_tracepoint, parent);
- b = container_of(_b, struct lttng_event_rule_kernel_tracepoint, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_kernel_tracepoint::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_kernel_tracepoint::parent);
if (!!a->filter_expression != !!b->filter_expression) {
goto end;
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
status = lttng_event_rule_kernel_tracepoint_get_filter(rule, &filter);
if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
struct lttng_event_rule_kernel_tracepoint *tracepoint;
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
return tracepoint->internal_filter.filter;
}
struct lttng_event_rule_kernel_tracepoint *tracepoint;
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
return tracepoint->internal_filter.bytecode;
}
const struct lttng_event_rule *rule)
{
unsigned long hash;
- struct lttng_event_rule_kernel_tracepoint *tp_rule =
- container_of(rule, typeof(*tp_rule), parent);
+ struct lttng_event_rule_kernel_tracepoint *tp_rule = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_TRACEPOINT,
lttng_ht_seed);
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
if (!tracepoint->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
PERROR("Failed to copy filter expression");
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_kernel_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_kernel_tracepoint::parent);
if (!tracepoint->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
{
struct lttng_event_rule_kernel_uprobe *uprobe;
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
lttng_userspace_probe_location_destroy(uprobe->location);
free(uprobe->name);
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
/* Required field. */
if (!uprobe->name) {
header_offset = payload->buffer.size;
DBG("Serializing uprobe event rule.");
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
name_len = strlen(uprobe->name) + 1;
bool is_equal = false;
struct lttng_event_rule_kernel_uprobe *a, *b;
- a = container_of(_a, struct lttng_event_rule_kernel_uprobe, parent);
- b = container_of(_b, struct lttng_event_rule_kernel_uprobe, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_kernel_uprobe::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_kernel_uprobe::parent);
/* uprobe is invalid if this is not true. */
LTTNG_ASSERT(a->name);
{
unsigned long hash;
struct lttng_event_rule_kernel_uprobe *urule =
- container_of(rule, typeof(*urule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_KERNEL_UPROBE,
lttng_ht_seed);
struct lttng_event_rule_kernel_uprobe *uprobe;
LTTNG_ASSERT(rule);
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
return uprobe->location;
}
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
name_copy = strdup(name);
if (!name_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- uprobe = container_of(rule, struct lttng_event_rule_kernel_uprobe, parent);
+ uprobe = lttng::utils::container_of(rule, <tng_event_rule_kernel_uprobe::parent);
if (!uprobe->name) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
return;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
lttng_log_level_rule_destroy(log4j_logging->log_level_rule);
free(log4j_logging->pattern);
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
/* Required field. */
if (!log4j_logging->pattern) {
header_offset = payload->buffer.size;
DBG("Serializing log4j_logging event rule.");
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
pattern_len = strlen(log4j_logging->pattern) + 1;
bool is_equal = false;
struct lttng_event_rule_log4j_logging *a, *b;
- a = container_of(_a, struct lttng_event_rule_log4j_logging, parent);
- b = container_of(_b, struct lttng_event_rule_log4j_logging, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_log4j_logging::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_log4j_logging::parent);
/* Quick checks. */
LTTNG_ASSERT(rule);
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
status = lttng_event_rule_log4j_logging_get_filter(rule, &filter);
if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
struct lttng_event_rule_log4j_logging *log4j_logging;
LTTNG_ASSERT(rule);
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
return log4j_logging->internal_filter.filter;
}
struct lttng_event_rule_log4j_logging *log4j_logging;
LTTNG_ASSERT(rule);
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
return log4j_logging->internal_filter.bytecode;
}
{
unsigned long hash;
struct lttng_event_rule_log4j_logging *tp_rule =
- container_of(rule, typeof(*tp_rule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_log4j_logging::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_LOG4J_LOGGING,
lttng_ht_seed);
enum lttng_event_rule_status status;
const struct lttng_log_level_rule *log_level_rule;
- log4j_logging = container_of(
- rule, const struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
local_event = zmalloc<lttng_event>();
if (!local_event) {
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
if (!log4j_logging->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
PERROR("Failed to copy filter expression");
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
if (!log4j_logging->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
if (!log_level_rule_valid(log_level_rule)) {
status = LTTNG_EVENT_RULE_STATUS_INVALID;
goto end;
}
- log4j_logging = container_of(
- rule, struct lttng_event_rule_log4j_logging, parent);
+ log4j_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_log4j_logging::parent);
if (log4j_logging->log_level_rule == NULL) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
return;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
lttng_log_level_rule_destroy(python_logging->log_level_rule);
free(python_logging->pattern);
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
/* Required field. */
if (!python_logging->pattern) {
header_offset = payload->buffer.size;
DBG("Serializing python_logging event rule.");
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
pattern_len = strlen(python_logging->pattern) + 1;
bool is_equal = false;
struct lttng_event_rule_python_logging *a, *b;
- a = container_of(_a, struct lttng_event_rule_python_logging, parent);
- b = container_of(_b, struct lttng_event_rule_python_logging, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_python_logging::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_python_logging::parent);
/* Quick checks. */
LTTNG_ASSERT(rule);
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
status = lttng_event_rule_python_logging_get_filter(rule, &filter);
if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
struct lttng_event_rule_python_logging *python_logging;
LTTNG_ASSERT(rule);
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
return python_logging->internal_filter.filter;
}
struct lttng_event_rule_python_logging *python_logging;
LTTNG_ASSERT(rule);
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
return python_logging->internal_filter.bytecode;
}
{
unsigned long hash;
struct lttng_event_rule_python_logging *tp_rule =
- container_of(rule, typeof(*tp_rule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_python_logging::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_PYTHON_LOGGING,
lttng_ht_seed);
enum lttng_event_rule_status status;
const struct lttng_log_level_rule *log_level_rule;
- python_logging = container_of(
- rule, const struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
local_event = zmalloc<lttng_event>();
if (!local_event) {
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
if (!python_logging->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
PERROR("Failed to copy filter expression");
enum lttng_event_rule_status lttng_event_rule_python_logging_get_filter(
const struct lttng_event_rule *rule, const char **expression)
{
- struct lttng_event_rule_python_logging *python_logging;
+ const struct lttng_event_rule_python_logging *python_logging;
enum lttng_event_rule_status status = LTTNG_EVENT_RULE_STATUS_OK;
if (!rule || !IS_PYTHON_LOGGING_EVENT_RULE(rule) || !expression) {
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
if (!python_logging->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
if (!log_level_rule_valid(log_level_rule)) {
status = LTTNG_EVENT_RULE_STATUS_INVALID;
goto end;
}
- python_logging = container_of(
- rule, struct lttng_event_rule_python_logging, parent);
+ python_logging = lttng::utils::container_of(
+ rule, <tng_event_rule_python_logging::parent);
if (python_logging->log_level_rule == NULL) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
return;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
lttng_log_level_rule_destroy(tracepoint->log_level_rule);
lttng_dynamic_pointer_array_reset(&tracepoint->exclusions);
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
/* Required field. */
if (!tracepoint->pattern) {
header_offset = payload->buffer.size;
DBG("Serializing user tracepoint event rule.");
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule, &exclusion_count);
LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
unsigned int count_a, count_b;
enum lttng_event_rule_status status;
- a = container_of(_a, struct lttng_event_rule_user_tracepoint, parent);
- b = container_of(_b, struct lttng_event_rule_user_tracepoint, parent);
+ a = lttng::utils::container_of(_a, <tng_event_rule_user_tracepoint::parent);
+ b = lttng::utils::container_of(_b, <tng_event_rule_user_tracepoint::parent);
status = lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(_a, &count_a);
LTTNG_ASSERT(status == LTTNG_EVENT_RULE_STATUS_OK);
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
status = lttng_event_rule_user_tracepoint_get_filter(rule, &filter);
if (status == LTTNG_EVENT_RULE_STATUS_UNSET) {
struct lttng_event_rule_user_tracepoint *tracepoint;
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
return tracepoint->internal_filter.filter;
}
struct lttng_event_rule_user_tracepoint *tracepoint;
LTTNG_ASSERT(rule);
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
return tracepoint->internal_filter.bytecode;
}
unsigned int i, exclusion_count;
enum lttng_event_rule_status status;
struct lttng_event_rule_user_tracepoint *tp_rule =
- container_of(rule, typeof(*tp_rule), parent);
+ lttng::utils::container_of(rule, <tng_event_rule_user_tracepoint::parent);
hash = hash_key_ulong((void *) LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT,
lttng_ht_seed);
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
pattern_copy = strdup(pattern);
if (!pattern_copy) {
status = LTTNG_EVENT_RULE_STATUS_ERROR;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (!tracepoint->pattern) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
expression_copy = strdup(expression);
if (!expression_copy) {
PERROR("Failed to copy filter expression");
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (!tracepoint->filter_expression) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (!log_level_rule_valid(log_level_rule)) {
status = LTTNG_EVENT_RULE_STATUS_INVALID;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (tracepoint->log_level_rule == NULL) {
status = LTTNG_EVENT_RULE_STATUS_UNSET;
goto end;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (strlen(exclusion) >= LTTNG_SYMBOL_NAME_LEN) {
status = LTTNG_EVENT_RULE_STATUS_INVALID;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
*count = lttng_dynamic_pointer_array_get_count(&tracepoint->exclusions);
end:
return status;
goto end;
}
- tracepoint = container_of(
- rule, struct lttng_event_rule_user_tracepoint, parent);
+ tracepoint = lttng::utils::container_of(
+ rule, <tng_event_rule_user_tracepoint::parent);
if (lttng_event_rule_user_tracepoint_get_name_pattern_exclusion_count(rule, &count) !=
LTTNG_EVENT_RULE_STATUS_OK) {
goto end;
static void fd_handle_release(struct urcu_ref *ref)
{
int ret;
- struct fd_handle *handle = container_of(ref, struct fd_handle, ref);
+ struct fd_handle *handle = lttng::utils::container_of(ref, &fd_handle::ref);
LTTNG_ASSERT(handle->fd >= 0);
ret = close(handle->fd);
/* Match function of the tracker's unsuspendable_fds hash table. */
static int match_fd(struct cds_lfht_node *node, const void *key)
{
- struct unsuspendable_fd *entry = caa_container_of(
- node, struct unsuspendable_fd, tracker_node);
+ struct unsuspendable_fd *entry = lttng::utils::container_of(
+ node, &unsuspendable_fd::tracker_node);
return hash_match_key_ulong(
(void *) (unsigned long) entry->fd, (void *) key);
ret = -EINVAL;
goto end_unlock;
}
- entry = caa_container_of(
- node, struct unsuspendable_fd, tracker_node);
+ entry = lttng::utils::container_of(
+ node, &unsuspendable_fd::tracker_node);
cds_lfht_del(tracker->unsuspendable_fds, node);
unsuspendable_fd_destroy(entry);
{
int ret;
struct fs_handle_tracked *handle =
- container_of(_handle, struct fs_handle_tracked, parent);
+ lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
/*
* TODO This should be optimized as it is a fairly hot path.
static void fs_handle_tracked_put_fd(struct fs_handle *_handle)
{
struct fs_handle_tracked *handle =
- container_of(_handle, struct fs_handle_tracked, parent);
+ lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
pthread_mutex_lock(&handle->lock);
handle->in_use = false;
{
int ret;
struct fs_handle_tracked *handle =
- container_of(_handle, struct fs_handle_tracked, parent);
+ lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
pthread_mutex_lock(&handle->tracker->lock);
pthread_mutex_lock(&handle->lock);
int ret = 0;
const char *path = NULL;
struct fs_handle_tracked *handle =
- container_of(_handle, struct fs_handle_tracked, parent);
+ lttng::utils::container_of(_handle, &fs_handle_tracked::parent);
struct lttng_directory_handle *inode_directory_handle = NULL;
if (!handle) {
static int lttng_inode_match(struct cds_lfht_node *node, const void *key)
{
const struct inode_id *id = (inode_id *) key;
- const struct lttng_inode *inode = caa_container_of(
- node, struct lttng_inode, registry_node);
+ const struct lttng_inode *inode = lttng::utils::container_of(
+ node, <tng_inode::registry_node);
return inode->id.device == id->device && inode->id.inode == id->inode;
}
static void lttng_inode_free(struct rcu_head *head)
{
struct lttng_inode *inode =
- caa_container_of(head, struct lttng_inode, rcu_head);
+ lttng::utils::container_of(head, <tng_inode::rcu_head);
free(inode);
}
static void lttng_inode_release(struct urcu_ref *ref)
{
- lttng_inode_destroy(caa_container_of(ref, struct lttng_inode, ref));
+ lttng_inode_destroy(lttng::utils::container_of(ref, <tng_inode::ref));
}
static void lttng_inode_get(struct lttng_inode *inode)
lttng_inode_match, &id, &iter);
node = cds_lfht_iter_get_node(&iter);
if (node) {
- inode = caa_container_of(
- node, struct lttng_inode, registry_node);
+ inode = lttng::utils::container_of(
+ node, <tng_inode::registry_node);
lttng_inode_get(inode);
goto end_unlock;
}
static int match_str(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_str *match_node =
- caa_container_of(node, struct lttng_ht_node_str, node);
+ lttng::utils::container_of(node, <tng_ht_node_str::node);
return hash_match_key_str(match_node->key, (void *) key);
}
static int match_ulong(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_ulong *match_node =
- caa_container_of(node, struct lttng_ht_node_ulong, node);
+ lttng::utils::container_of(node, <tng_ht_node_ulong::node);
return hash_match_key_ulong((void *) match_node->key, (void *) key);
}
static int match_u64(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_u64 *match_node =
- caa_container_of(node, struct lttng_ht_node_u64, node);
+ lttng::utils::container_of(node, <tng_ht_node_u64::node);
return hash_match_key_u64(&match_node->key, (void *) key);
}
static int match_two_u64(struct cds_lfht_node *node, const void *key)
{
struct lttng_ht_node_two_u64 *match_node =
- caa_container_of(node, struct lttng_ht_node_two_u64, node);
+ lttng::utils::container_of(node, <tng_ht_node_two_u64::node);
return hash_match_key_two_u64((void *) &match_node->key, (void *) key);
}
if (!node_ptr) {
return NULL;
} else {
- return caa_container_of(node_ptr, struct lttng_ht_node_ulong, node);
+ return lttng::utils::container_of(node_ptr, <tng_ht_node_ulong::node);
}
LTTNG_ASSERT(node_ptr == &node->node);
}
if (!node_ptr) {
return NULL;
} else {
- return caa_container_of(node_ptr, struct lttng_ht_node_u64, node);
+ return lttng::utils::container_of(node_ptr, <tng_ht_node_u64::node);
}
LTTNG_ASSERT(node_ptr == &node->node);
}
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_str, node);
+ return lttng::utils::container_of(node, <tng_ht_node_str::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_ulong, node);
+ return lttng::utils::container_of(node, <tng_ht_node_ulong::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_u64, node);
+ return lttng::utils::container_of(node, <tng_ht_node_u64::node);
}
/*
if (!node) {
return NULL;
}
- return caa_container_of(node, struct lttng_ht_node_two_u64, node);
+ return lttng::utils::container_of(node, <tng_ht_node_two_u64::node);
}
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);
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;
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;
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;
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;
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;
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);
+ struct lttng_kernel_probe_location_address *address_location = lttng::utils::container_of(
+ location, <tng_kernel_probe_location_address::parent);
hash ^= hash_key_u64(&address_location->address, lttng_ht_seed);
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;
const struct lttng_kernel_probe_location *location)
{
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);
+ (void *) LTTNG_KERNEL_PROBE_LOCATION_TYPE_SYMBOL_OFFSET, lttng_ht_seed);
+ struct lttng_kernel_probe_location_symbol *symbol_location = 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);
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);
const struct lttng_kernel_probe_location *location)
{
struct lttng_kernel_probe_location *new_location = NULL;
- struct lttng_kernel_probe_location_symbol *symbol_location;
enum lttng_kernel_probe_location_status status;
const char *symbol_name = NULL;
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 */
status = lttng_kernel_probe_location_symbol_get_offset(location, &offset);
const struct lttng_kernel_probe_location *location)
{
struct lttng_kernel_probe_location *new_location = NULL;
- struct lttng_kernel_probe_location_address *address_location;
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.");
void trace_archive_location_destroy_ref(struct urcu_ref *ref)
{
struct lttng_trace_archive_location *location =
- container_of(ref, struct lttng_trace_archive_location, ref);
+ lttng::utils::container_of(ref, <tng_trace_archive_location::ref);
switch (location->type) {
case LTTNG_TRACE_ARCHIVE_LOCATION_TYPE_LOCAL:
#define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0])))
#endif
-#ifndef container_of
-#define container_of(ptr, type, member) \
- ({ \
- const typeof(((type *)NULL)->member) * __ptr = (ptr); \
- (type *)((char *)__ptr - offsetof(type, member)); \
- })
-#endif
-
#ifndef LTTNG_PACKED
#define LTTNG_PACKED __attribute__((__packed__))
#endif
return 0;
}
+namespace lttng {
+namespace utils {
+template <class Parent, class Member>
+Parent *container_of(const Member *member, const Member Parent::*ptr_to_member)
+{
+ const Parent *dummy_parent = nullptr;
+ auto *offset_of_member = reinterpret_cast<const char *>(&(dummy_parent->*ptr_to_member));
+ auto address_of_parent = reinterpret_cast<const char *>(member) - offset_of_member;
+
+ return reinterpret_cast<Parent *>(address_of_parent);
+}
+} /* namespace utils */
+} /* namespace lttng */
+
#endif /* _MACROS_H */
header.base.uri_count = uri_count;
if (descriptor->type == LTTNG_SESSION_DESCRIPTOR_TYPE_LIVE) {
- const struct lttng_session_descriptor_live *live =
- container_of(descriptor, typeof(*live),
- base);
+ const struct lttng_session_descriptor_live *live = lttng::utils::container_of(
+ descriptor, <tng_session_descriptor_live::base);
header.live_timer_us = live->live_timer_us;
header_ptr = &header;
{
struct lttng_session_descriptor_live *live;
- live = container_of(descriptor, typeof(*live), base);
+ live = lttng::utils::container_of(descriptor, <tng_session_descriptor_live::base);
return live->live_timer_us;
}
static
int fs_handle_untracked_get_fd(struct fs_handle *_handle)
{
- struct fs_handle_untracked *handle = container_of(
- _handle, struct fs_handle_untracked, parent);
+ struct fs_handle_untracked *handle = lttng::utils::container_of(
+ _handle, &fs_handle_untracked::parent);
return handle->fd;
}
static
int fs_handle_untracked_unlink(struct fs_handle *_handle)
{
- struct fs_handle_untracked *handle = container_of(
- _handle, struct fs_handle_untracked, parent);
+ struct fs_handle_untracked *handle = lttng::utils::container_of(
+ _handle, &fs_handle_untracked::parent);
return lttng_directory_handle_unlink_file(
handle->location.directory_handle,
static
int fs_handle_untracked_close(struct fs_handle *_handle)
{
- struct fs_handle_untracked *handle = container_of(
- _handle, struct fs_handle_untracked, parent);
+ struct fs_handle_untracked *handle = lttng::utils::container_of(
+ _handle, &fs_handle_untracked::parent);
int ret = close(handle->fd);
fs_handle_untracked_destroy(handle);
/*
* Does not close the fd; we just "unbox" it from the fs_handle.
*/
- fs_handle_untracked_destroy(container_of(
- fs_handle, struct fs_handle_untracked, parent));
+ fs_handle_untracked_destroy(lttng::utils::container_of(
+ fs_handle, &fs_handle_untracked::parent));
}
return status;
static
void free_lttng_trace_chunk_registry_element(struct rcu_head *node)
{
- struct lttng_trace_chunk_registry_element *element =
- container_of(node, typeof(*element), rcu_node);
+ struct lttng_trace_chunk_registry_element *element = lttng::utils::container_of(
+ node, <tng_trace_chunk_registry_element::rcu_node);
free(element);
}
static
void lttng_trace_chunk_release(struct urcu_ref *ref)
{
- struct lttng_trace_chunk *chunk = container_of(ref, typeof(*chunk),
- ref);
+ struct lttng_trace_chunk *chunk = lttng::utils::container_of(ref, <tng_trace_chunk::ref);
if (chunk->close_command.is_set) {
chunk_command func = close_command_get_post_release_func(chunk->close_command.value);
*/
lttng_trace_chunk_fini(chunk);
- element = container_of(chunk, typeof(*element), chunk);
+ element = lttng::utils::container_of(
+ chunk, <tng_trace_chunk_registry_element::chunk);
if (element->registry) {
rcu_read_lock();
cds_lfht_del(element->registry->ht,
* already published and release the reference to the copy we
* created if successful.
*/
- published_element = container_of(published_node,
- typeof(*published_element),
- trace_chunk_registry_ht_node);
+ published_element = lttng::utils::container_of(published_node,
+ <tng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
published_chunk = &published_element->chunk;
if (lttng_trace_chunk_get(published_chunk)) {
lttng_trace_chunk_put(&element->chunk);
goto end;
}
- published_element = container_of(published_node,
- typeof(*published_element),
- trace_chunk_registry_ht_node);
+ published_element = lttng::utils::container_of(published_node,
+ <tng_trace_chunk_registry_element::trace_chunk_registry_ht_node);
if (lttng_trace_chunk_get(&published_element->chunk)) {
published_chunk = &published_element->chunk;
}
static void trigger_destroy_ref(struct urcu_ref *ref)
{
struct lttng_trigger *trigger =
- container_of(ref, struct lttng_trigger, ref);
+ lttng::utils::container_of(ref, <tng_trigger::ref);
struct lttng_action *action = lttng_trigger_get_action(trigger);
struct lttng_condition *condition =
lttng_trigger_get_condition(trigger);
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;
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);
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);
goto end;
}
- size_schedule = container_of(schedule,
- struct lttng_rotation_schedule_size_threshold,
- parent);
+ size_schedule = lttng::utils::container_of(schedule,
+ <tng_rotation_schedule_size_threshold::parent);
if (size_schedule->size.set) {
*size_threshold_bytes = size_schedule->size.bytes;
} else {
goto end;
}
- size_schedule = container_of(schedule,
- struct lttng_rotation_schedule_size_threshold,
- parent);
+ size_schedule = lttng::utils::container_of(schedule,
+ <tng_rotation_schedule_size_threshold::parent);
size_schedule->size.bytes = size_threshold_bytes;
size_schedule->size.set = true;
end:
goto end;
}
- periodic_schedule = container_of(schedule,
- struct lttng_rotation_schedule_periodic,
- parent);
+ periodic_schedule = lttng::utils::container_of(schedule,
+ <tng_rotation_schedule_periodic::parent);
if (periodic_schedule->period.set) {
*period_us = periodic_schedule->period.us;
} else {
goto end;
}
- periodic_schedule = container_of(schedule,
- struct lttng_rotation_schedule_periodic,
- parent);
+ periodic_schedule = lttng::utils::container_of(schedule,
+ <tng_rotation_schedule_periodic::parent);
periodic_schedule->period.us = period_us;
periodic_schedule->period.set = true;
end: