Use LTTNG_KERNEL_* namespace for exported header
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2011 23:45:22 +0000 (19:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 May 2011 23:45:22 +0000 (19:45 -0400)
Also add lttng kprobes ABI.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-debugfs-abi.c
ltt-debugfs-abi.h
ltt-events.c
ltt-events.h

index 403657e6c4c6b86107b06eb8c8631ddcc7582516..41b9f8fa55d7108a01290ec37bab95b3a4d14f7d 100644 (file)
@@ -91,7 +91,7 @@ fd_error:
  *     @arg: command arg
  *
  *     This ioctl implements lttng commands:
- *     LTTNG_SESSION
+ *     LTTNG_KERNEL_SESSION
  *             Returns a LTTng trace session file descriptor
  *
  * The returned session will be deleted when its file descriptor is closed.
@@ -100,7 +100,7 @@ static
 long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        switch (cmd) {
-       case LTTNG_SESSION:
+       case LTTNG_KERNEL_SESSION:
                return lttng_abi_create_session();
        default:
                return -ENOIOCTLCMD;
@@ -137,7 +137,7 @@ void lttng_metadata_create_events(struct file *channel_file)
         * 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,
+       event = ltt_event_create(channel, event_name, LTTNG_KERNEL_TRACEPOINTS,
                                 event_desc, NULL);
        if (!event) {
                goto create_error;
@@ -154,7 +154,7 @@ get_error:
 
 static
 int lttng_abi_create_channel(struct file *session_file,
-                            struct lttng_channel __user *uchan_param,
+                            struct lttng_kernel_channel __user *uchan_param,
                             enum channel_type channel_type)
 {
        struct ltt_session *session = session_file->private_data;
@@ -162,7 +162,7 @@ int lttng_abi_create_channel(struct file *session_file,
        const char *transport_name;
        struct ltt_channel *chan;
        struct file *chan_file;
-       struct lttng_channel chan_param;
+       struct lttng_kernel_channel chan_param;
        int chan_fd;
        int ret = 0;
 
@@ -236,7 +236,7 @@ fd_error:
  *     @arg: command arg
  *
  *     This ioctl implements lttng commands:
- *     LTTNG_CHANNEL
+ *     LTTNG_KERNEL_CHANNEL
  *             Returns a LTTng channel file descriptor
  *
  * The returned channel will be deleted when its file descriptor is closed.
@@ -247,17 +247,17 @@ long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        struct ltt_session *session = file->private_data;
 
        switch (cmd) {
-       case LTTNG_CHANNEL:
+       case LTTNG_KERNEL_CHANNEL:
                return lttng_abi_create_channel(file,
-                               (struct lttng_channel __user *)arg,
+                               (struct lttng_kernel_channel __user *) arg,
                                PER_CPU_CHANNEL);
-       case LTTNG_SESSION_START:
+       case LTTNG_KERNEL_SESSION_START:
                return ltt_session_start(session);
-       case LTTNG_SESSION_STOP:
+       case LTTNG_KERNEL_SESSION_STOP:
                return ltt_session_stop(session);
-       case LTTNG_METADATA:
+       case LTTNG_KERNEL_METADATA:
                return lttng_abi_create_channel(file,
-                               (struct lttng_channel __user *)arg,
+                               (struct lttng_kernel_channel __user *) arg,
                                METADATA_CHANNEL);
        default:
                return -ENOIOCTLCMD;
@@ -337,13 +337,13 @@ fd_error:
 
 static
 int lttng_abi_create_event(struct file *channel_file,
-                          struct lttng_event __user *uevent_param)
+                          struct lttng_kernel_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;
+       struct lttng_kernel_event event_param;
        int event_fd, ret;
        struct file *event_file;
 
@@ -379,7 +379,7 @@ int lttng_abi_create_event(struct file *channel_file,
         * 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, event_param.itype,
+       event = ltt_event_create(channel, event_name, event_param.instrumentation,
                                 event_desc, NULL);
        if (!event) {
                goto event_error;
@@ -412,10 +412,10 @@ name_error:
  *     @arg: command arg
  *
  *     This ioctl implements lttng commands:
- *      LTTNG_STREAM
+ *      LTTNG_KERNEL_STREAM
  *              Returns an event stream file descriptor or failure.
  *              (typically, one event stream records events from one CPU)
- *     LTTNG_EVENT
+ *     LTTNG_KERNEL_EVENT
  *             Returns an event file descriptor or failure.
  *
  * Channel and event file descriptors also hold a reference on the session.
@@ -424,10 +424,10 @@ static
 long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        switch (cmd) {
-       case LTTNG_STREAM:
+       case LTTNG_KERNEL_STREAM:
                return lttng_abi_open_stream(file);
-       case LTTNG_EVENT:
-               return lttng_abi_create_event(file, (struct lttng_event __user *)arg);
+       case LTTNG_KERNEL_EVENT:
+               return lttng_abi_create_event(file, (struct lttng_kernel_event __user *) arg);
        default:
                return -ENOIOCTLCMD;
        }
@@ -441,7 +441,7 @@ long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
  *     @arg: command arg
  *
  *     This ioctl implements lttng commands:
- *      LTTNG_STREAM
+ *      LTTNG_KERNEL_STREAM
  *              Returns an event stream file descriptor or failure.
  *
  * Channel and event file descriptors also hold a reference on the session.
@@ -450,7 +450,7 @@ static
 long lttng_metadata_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
        switch (cmd) {
-       case LTTNG_STREAM:
+       case LTTNG_KERNEL_STREAM:
                return lttng_abi_open_stream(file);
        default:
                return -ENOIOCTLCMD;
index 2d02b44fb1995b497e321a0e41df308d028dd807..103e561b45f0460b8ac43bdb1acbd8f7c76d3dcc 100644 (file)
 
 #include <linux/fs.h>
 
-enum instrum_type {
-       INSTRUM_TRACEPOINTS,
+enum lttng_kernel_instrumentation {
+       LTTNG_KERNEL_TRACEPOINTS,
+       LTTNG_KERNEL_KPROBES,
 };
 
 /*
  * LTTng DebugFS ABI structures.
  */
 
-struct lttng_channel {
+struct lttng_kernel_channel {
        int overwrite;                  /* 1: overwrite, 0: discard */
        u64 subbuf_size;
        u64 num_subbuf;
@@ -27,20 +28,34 @@ struct lttng_channel {
        unsigned int read_timer_interval;
 };
 
-struct lttng_event {
-       enum instrum_type itype;
+struct lttng_kernel_event {
+       enum lttng_kernel_instrumentation instrumentation;
        char name[];
 };
 
-/* TODO: LTTNG_KERNEL_SESSION..... */
-/* TODO: ioctl LTTNG_KERNEL_TRACER_VERSION */
+/*
+ * Either addr is used, or symbol_name and offset.
+ */
+struct lttng_kernel_kprobe {
+       u64 addr;
+
+       u64 offset;
+       char symbol_name[];
+};
 
-#define LTTNG_SESSION          _IO(0xF6, 0x40)
-#define LTTNG_SESSION_START    _IO(0xF6, 0x41)
-#define LTTNG_SESSION_STOP     _IO(0xF6, 0x42)
-#define LTTNG_CHANNEL          _IOW(0xF6, 0x43, struct lttng_channel)
-#define LTTNG_STREAM           _IO(0xF6, 0x44)
-#define LTTNG_EVENT            _IOW(0xF6, 0x45, struct lttng_event)
-#define LTTNG_METADATA         _IOW(0xF6, 0x46, struct lttng_channel)
+#define LTTNG_KERNEL_SESSION           _IO(0xF6, 0x40)
+#define LTTNG_KERNEL_SESSION_START     _IO(0xF6, 0x41)
+#define LTTNG_KERNEL_SESSION_STOP      _IO(0xF6, 0x42)
+#define LTTNG_KERNEL_CHANNEL           \
+       _IOW(0xF6, 0x43, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_STREAM            _IO(0xF6, 0x44)
+#define LTTNG_KERNEL_EVENT             \
+       _IOW(0xF6, 0x45, struct lttng_kernel_event)
+#define LTTNG_KERNEL_METADATA          \
+       _IOW(0xF6, 0x46, struct lttng_kernel_channel)
+#define LTTNG_KERNEL_KPROBE            \
+       _IOW(0xF6, 0x47, struct lttng_kernel_kprobe)
+#define LTTNG_KERNEL_TRACER_VERSION    \
+       _IOW(0xF6, 0x48, struct lttng_kernel_tracer_version)
 
 #endif /* _LTT_DEBUGFS_ABI_H */
index 703fd3d7fa5ddac330460e802de0e74fb79567de..526fb823952219e74cbe1fcebe64da69b7a05865 100644 (file)
@@ -202,7 +202,7 @@ void _ltt_channel_destroy(struct ltt_channel *chan)
  * Supports event creation while tracing session is active.
  */
 struct ltt_event *ltt_event_create(struct ltt_channel *chan, char *name,
-                                  enum instrum_type itype,
+                                  enum lttng_kernel_instrumentation instrumentation,
                                   const struct lttng_event_desc *event_desc,
                                   void *filter)
 {
@@ -226,11 +226,11 @@ struct ltt_event *ltt_event_create(struct ltt_channel *chan, char *name,
        event->desc = event_desc;
        event->filter = filter;
        event->id = chan->free_event_id++;
-       event->itype = itype;
+       event->instrumentation = instrumentation;
        /* Populate ltt_event structure before tracepoint registration. */
        smp_wmb();
-       switch (itype) {
-       case INSTRUM_TRACEPOINTS:
+       switch (instrumentation) {
+       case LTTNG_KERNEL_TRACEPOINTS:
                ret = tracepoint_probe_register(name, event_desc->probe_callback,
                                                event);
                if (ret)
@@ -265,8 +265,8 @@ int _ltt_event_unregister(struct ltt_event *event)
 {
        int ret = -EINVAL;
 
-       switch (event->itype) {
-       case INSTRUM_TRACEPOINTS:
+       switch (event->instrumentation) {
+       case LTTNG_KERNEL_TRACEPOINTS:
                ret = tracepoint_probe_unregister(event->desc->name,
                                                  event->desc->probe_callback,
                                                  event);
index bf0ac599df7ad53e2b8d3774179a1bb31037cec5..7076185308f59fce9140ff87e8a438a28ba7ef27 100644 (file)
@@ -128,7 +128,7 @@ struct ltt_event {
        struct ltt_channel *chan;
        const struct lttng_event_desc *desc;
        void *filter;
-       enum instrum_type itype;
+       enum lttng_kernel_instrumentation instrumentation;
        struct list_head list;          /* Event list */
        int metadata_dumped:1;
 };
@@ -209,7 +209,7 @@ void _ltt_channel_destroy(struct ltt_channel *chan);
 
 struct ltt_event *ltt_event_create(struct ltt_channel *chan,
                                   char *name,
-                                  enum instrum_type itype,
+                                  enum lttng_kernel_instrumentation instrumentation,
                                   const struct lttng_event_desc *event_desc,
                                   void *filter);
 int ltt_event_unregister(struct ltt_event *event);
This page took 0.039841 seconds and 4 git commands to generate.