X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Flttng-abi.c;h=6829c239cc991c4a9d85016843b37b7d588dc8a9;hb=17f90b04459c851547b2dc6e90e3bded1b1206d5;hp=9f06295ffa6981d9de6bf4182f8d57be74c825f9;hpb=ef784b4d0f4e732a570f19e9ac365028817a6c2d;p=lttng-modules.git diff --git a/src/lttng-abi.c b/src/lttng-abi.c index 9f06295f..6829c239 100644 --- a/src/lttng-abi.c +++ b/src/lttng-abi.c @@ -793,6 +793,37 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg) struct lttng_kernel_abi_channel chan_param; struct lttng_kernel_abi_old_channel old_chan_param; + /* + * Handle backward compatibility. OLD commands have wrong + * directions, replace them by the correct direction. + */ + switch (cmd) { + case LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_PID: + cmd = LTTNG_KERNEL_ABI_SESSION_TRACK_PID; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_PID: + cmd = LTTNG_KERNEL_ABI_SESSION_UNTRACK_PID; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_TRACK_ID: + cmd = LTTNG_KERNEL_ABI_SESSION_TRACK_ID; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_UNTRACK_ID: + cmd = LTTNG_KERNEL_ABI_SESSION_UNTRACK_ID; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_LIST_TRACKER_IDS: + cmd = LTTNG_KERNEL_ABI_SESSION_LIST_TRACKER_IDS; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_SET_NAME: + cmd = LTTNG_KERNEL_ABI_SESSION_SET_NAME; + break; + case LTTNG_KERNEL_ABI_OLD_SESSION_SET_CREATION_TIME: + cmd = LTTNG_KERNEL_ABI_SESSION_SET_CREATION_TIME; + break; + default: + /* Nothing to do. */ + break; + } + switch (cmd) { case LTTNG_KERNEL_ABI_OLD_CHANNEL: { @@ -1860,15 +1891,14 @@ int lttng_abi_create_event(struct file *channel_file, case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ case LTTNG_KERNEL_ABI_UPROBE: { - struct lttng_event *event; + struct lttng_kernel_event_recorder *event; /* * We tolerate no failure path after event creation. It * will stay invariant for the rest of the session. */ - event = lttng_event_create(channel, event_param, - NULL, NULL, - event_param->instrumentation); + event = lttng_kernel_event_recorder_create(channel, event_param, + NULL, event_param->instrumentation); WARN_ON_ONCE(!event); if (IS_ERR(event)) { ret = PTR_ERR(event); @@ -1901,19 +1931,19 @@ fd_error: static long lttng_event_notifier_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct lttng_event_notifier *event_notifier = file->private_data; + struct lttng_kernel_event_notifier *event_notifier = file->private_data; switch (cmd) { case LTTNG_KERNEL_ABI_ENABLE: - return lttng_event_notifier_enable(event_notifier); + return lttng_event_enable(&event_notifier->parent); case LTTNG_KERNEL_ABI_DISABLE: - return lttng_event_notifier_disable(event_notifier); + return lttng_event_disable(&event_notifier->parent); case LTTNG_KERNEL_ABI_FILTER: return -EINVAL; case LTTNG_KERNEL_ABI_CAPTURE: return -EINVAL; case LTTNG_KERNEL_ABI_ADD_CALLSITE: - return lttng_event_notifier_add_callsite(event_notifier, + return lttng_event_add_callsite(&event_notifier->parent, (struct lttng_kernel_abi_event_callsite __user *) arg); default: return -ENOIOCTLCMD; @@ -1948,10 +1978,10 @@ long lttng_event_notifier_enabler_ioctl(struct file *file, unsigned int cmd, uns static int lttng_event_notifier_event_release(struct inode *inode, struct file *file) { - struct lttng_event_notifier *event_notifier = file->private_data; + struct lttng_kernel_event_notifier *event_notifier = file->private_data; if (event_notifier) - fput(event_notifier->group->file); + fput(event_notifier->priv->group->file); return 0; } @@ -2084,7 +2114,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, case LTTNG_KERNEL_ABI_KRETPROBE: /* Fall-through */ case LTTNG_KERNEL_ABI_UPROBE: { - struct lttng_event_notifier *event_notifier; + struct lttng_kernel_event_notifier *event_notifier; /* * We tolerate no failure path after event notifier creation. @@ -2094,7 +2124,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file, event_notifier_param->event.token, event_notifier_param->error_counter_index, event_notifier_group, - event_notifier_param, NULL, + event_notifier_param, event_notifier_param->event.instrumentation); WARN_ON_ONCE(!event_notifier); if (IS_ERR(event_notifier)) { @@ -2583,7 +2613,7 @@ static const struct file_operations lttng_metadata_fops = { static long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { - struct lttng_event *event = file->private_data; + struct lttng_kernel_event_recorder *event_recorder = file->private_data; switch (cmd) { case LTTNG_KERNEL_ABI_OLD_CONTEXT: @@ -2598,14 +2628,14 @@ long lttng_event_recorder_event_ioctl(struct file *file, unsigned int cmd, unsig } case LTTNG_KERNEL_ABI_OLD_ENABLE: case LTTNG_KERNEL_ABI_ENABLE: - return lttng_event_enable(event); + return lttng_event_enable(&event_recorder->parent); case LTTNG_KERNEL_ABI_OLD_DISABLE: case LTTNG_KERNEL_ABI_DISABLE: - return lttng_event_disable(event); + return lttng_event_disable(&event_recorder->parent); case LTTNG_KERNEL_ABI_FILTER: return -EINVAL; case LTTNG_KERNEL_ABI_ADD_CALLSITE: - return lttng_event_add_callsite(event, + return lttng_event_add_callsite(&event_recorder->parent, (struct lttng_kernel_abi_event_callsite __user *) arg); default: return -ENOIOCTLCMD; @@ -2663,7 +2693,7 @@ long lttng_event_recorder_enabler_ioctl(struct file *file, unsigned int cmd, uns static int lttng_event_recorder_event_release(struct inode *inode, struct file *file) { - struct lttng_event *event = file->private_data; + struct lttng_kernel_event_recorder *event = file->private_data; if (event) fput(event->chan->file);