#include <linux/file.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
-#include <linux/ringbuffer/vfs.h>
+#include "wrapper/vmalloc.h" /* for wrapper_vmalloc_sync_all() */
+#include "wrapper/ringbuffer/vfs.h"
#include "ltt-debugfs-abi.h"
#include "ltt-events.h"
enum channel_type {
PER_CPU_CHANNEL,
- GLOBAL_CHANNEL,
METADATA_CHANNEL,
};
void lttng_metadata_create_events(struct file *channel_file)
{
struct ltt_channel *channel = channel_file->private_data;
- char *event_name = "lttng-metadata";
+ char *event_name = "lttng_metadata";
+ const struct lttng_event_desc *event_desc;
struct ltt_event *event;
int ret;
- void *probe;
- probe = ltt_probe_get(event_name);
- if (!probe) {
+ event_desc = ltt_event_get(event_name);
+ if (!event_desc) {
ret = -ENOENT;
- goto probe_error;
+ goto get_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);
+ event_desc, NULL);
if (!event) {
- goto event_error;
+ goto create_error;
ret = -EEXIST;
}
return;
-event_error:
- ltt_probe_put(probe);
-probe_error:
+create_error:
+ ltt_event_put(event_desc);
+get_error:
WARN_ON(1);
return; /* not allowed to return error */
}
"relay-overwrite" : "relay-discard";
fops = <tng_channel_fops;
break;
- case GLOBAL_CHANNEL:
- transport_name = chan_param.overwrite ?
- "global-relay-overwrite" : "global-relay-discard";
- fops = <tng_channel_fops;
- break;
case METADATA_CHANNEL:
- transport_name = "global-relay-discard";
+ transport_name = "relay-metadata";
fops = <tng_metadata_fops;
break;
default:
chan->file = chan_file;
chan_file->private_data = chan;
fd_install(chan_fd, chan_file);
- if (channel_type == METADATA_CHANNEL)
+ if (channel_type == METADATA_CHANNEL) {
lttng_metadata_create_events(chan_file);
+ session->metadata = chan;
+ }
/* The channel created holds a reference on the session */
atomic_long_inc(&session_file->f_count);
struct lttng_event __user *uevent_param)
{
struct ltt_channel *channel = channel_file->private_data;
+ const struct lttng_event_desc *event_desc;
struct ltt_event *event;
char *event_name;
struct lttng_event event_param;
int event_fd, ret;
struct file *event_file;
- void *probe;
if (copy_from_user(&event_param, uevent_param, sizeof(event_param)))
return -EFAULT;
}
event_name[PATH_MAX - 1] = '\0';
- probe = ltt_probe_get(event_name);
- if (!probe) {
+ event_desc = ltt_event_get(event_name);
+ if (!event_desc) {
ret = -ENOENT;
- goto probe_error;
+ goto get_error;
}
event_fd = get_unused_fd();
if (event_fd < 0) {
* invariant for the rest of the session.
*/
event = ltt_event_create(channel, event_name, event_param.itype,
- probe, NULL);
+ event_desc, NULL);
if (!event) {
goto event_error;
ret = -EEXIST;
file_error:
put_unused_fd(event_fd);
fd_error:
- ltt_probe_put(probe);
-probe_error:
+ ltt_event_put(event_desc);
+get_error:
name_error:
kfree(event_name);
return ret;
{
int ret = 0;
+ wrapper_vmalloc_sync_all();
lttng_dentry = debugfs_create_file("lttng", S_IWUSR, NULL, NULL,
<tng_fops);
if (IS_ERR(lttng_dentry) || !lttng_dentry) {