+/*
+ * We tolerate no failure in this function (if one happens, we print a dmesg
+ * error, but cannot return any error, because the channel information is
+ * invariant.
+ */
+static
+void lttng_metadata_create_events(struct file *channel_file)
+{
+ struct ltt_channel *channel = channel_file->private_data;
+ char *event_name = "lttng-metadata";
+ struct ltt_event *event;
+ int ret;
+ void *probe;
+
+ probe = ltt_probe_get(event_name);
+ if (!probe) {
+ ret = -ENOENT;
+ goto probe_error;
+ }
+ /*
+ * We tolerate no failure path after event creation. It will stay
+ * invariant for the rest of the session.
+ */
+ event = ltt_event_create(channel, event_name, INSTRUM_TRACEPOINTS,
+ probe, NULL);
+ if (!event) {
+ goto event_error;
+ ret = -EEXIST;
+ }
+ return;
+
+event_error:
+ ltt_probe_put(probe);
+probe_error:
+ WARN_ON(1);
+ return; /* not allowed to return error */
+}
+
+static