+#define LTTNG_COUNTER_DIMENSION_MAX 8
+
+struct lttng_counter_dimension {
+ uint64_t size;
+ uint64_t underflow_index;
+ uint64_t overflow_index;
+ uint8_t has_underflow;
+ uint8_t has_overflow;
+};
+
+struct lttng_counter_ops {
+ struct lib_counter *(*counter_create)(size_t nr_dimensions,
+ const struct lttng_counter_dimension *dimensions,
+ int64_t global_sum_step,
+ int global_counter_fd,
+ int nr_counter_cpu_fds,
+ const int *counter_cpu_fds,
+ bool is_daemon);
+ void (*counter_destroy)(struct lib_counter *counter);
+ int (*counter_add)(struct lib_counter *counter,
+ const size_t *dimension_indexes, int64_t v);
+ int (*counter_read)(struct lib_counter *counter,
+ const size_t *dimension_indexes, int cpu,
+ int64_t *value, bool *overflow, bool *underflow);
+ int (*counter_aggregate)(struct lib_counter *counter,
+ const size_t *dimension_indexes, int64_t *value,
+ bool *overflow, bool *underflow);
+ int (*counter_clear)(struct lib_counter *counter, const size_t *dimension_indexes);
+};
+
+#define LTTNG_UST_STACK_CTX_PADDING 32
+struct lttng_stack_ctx {
+ struct lttng_event *event;
+ struct lttng_ctx *chan_ctx; /* RCU dereferenced. */
+ struct lttng_ctx *event_ctx; /* RCU dereferenced. */
+ char padding[LTTNG_UST_STACK_CTX_PADDING];
+};
+
+#define LTTNG_UST_EVENT_HT_BITS 12
+#define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS)
+
+struct lttng_ust_event_ht {
+ struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE];
+};
+
+#define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12
+#define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS)
+struct lttng_ust_event_notifier_ht {
+ struct cds_hlist_head table[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE];
+};
+
+#define LTTNG_UST_ENUM_HT_BITS 12
+#define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS)
+
+struct lttng_ust_enum_ht {
+ struct cds_hlist_head table[LTTNG_UST_ENUM_HT_SIZE];
+};
+
+/*
+ * IMPORTANT: this structure is part of the ABI between the probe and
+ * UST. Fields need to be only added at the end, never reordered, never
+ * removed.
+ */
+struct lttng_session {
+ int active; /* Is trace session active ? */
+ int been_active; /* Been active ? */
+ int objd; /* Object associated */
+ void *_deprecated1;
+ struct cds_list_head chan_head; /* Channel list head */
+ struct cds_list_head events_head; /* list of events */
+ struct cds_list_head _deprecated2;
+ struct cds_list_head node; /* Session list */
+ int _deprecated3;
+ unsigned int _deprecated4:1;
+
+ /* New UST 2.1 */
+ /* List of enablers */
+ struct cds_list_head enablers_head;
+ struct lttng_ust_event_ht events_ht; /* ht of events */
+ void *owner; /* object owner */
+ int tstate:1; /* Transient enable state */
+
+ /* New UST 2.4 */
+ int statedump_pending:1;
+
+ /* New UST 2.8 */
+ struct lttng_ust_enum_ht enums_ht; /* ht of enumerations */
+ struct cds_list_head enums_head;
+ struct lttng_ctx *ctx; /* contexts for filters. */
+};
+
+struct lttng_counter {
+ int objd;
+ struct lttng_event_notifier_group *event_notifier_group; /* owner */
+ struct lttng_counter_transport *transport;
+ struct lib_counter *counter;
+ struct lttng_counter_ops *ops;
+};
+
+struct lttng_event_notifier_group {
+ int objd;
+ void *owner;
+ int notification_fd;
+ struct cds_list_head node; /* Event notifier group handle list */
+ struct cds_list_head enablers_head;
+ struct cds_list_head event_notifiers_head; /* list of event_notifiers */
+ struct lttng_ust_event_notifier_ht event_notifiers_ht; /* hashtable of event_notifiers */
+ struct lttng_ctx *ctx; /* contexts for filters. */
+
+ struct lttng_counter *error_counter;
+ size_t error_counter_len;