ABI runtime fixes
authorMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 8 Dec 2010 19:41:36 +0000 (14:41 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Wed, 8 Dec 2010 19:41:36 +0000 (14:41 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
ltt-debugfs-abi.c
ltt-events.c

index f9b7e9b014bcf901c81926a372aae88c9986dea3..d136a779a23a5450817010aa406ce6cdd18866a0 100644 (file)
@@ -141,7 +141,7 @@ int lttng_abi_create_channel(struct file *session_file,
                                  chan_param.switch_timer_interval,
                                  chan_param.read_timer_interval);
        if (!chan) {
-               ret = -ENOMEM;
+               ret = -EINVAL;
                goto chan_error;
        }
        chan->file = chan_file;
@@ -412,7 +412,7 @@ int __init ltt_debugfs_abi_init(void)
        int ret = 0;
 
        lttng_dentry = debugfs_create_file("lttng", S_IWUSR, NULL, NULL,
-                                          &lttng_session_fops);
+                                          &lttng_fops);
        if (IS_ERR(lttng_dentry) || !lttng_dentry) {
                printk(KERN_ERR "Error creating LTTng control file\n");
                ret = -ENOMEM;
index f3f7ab78152bb31ac624cbe0f3553d2c292d92a5..603170682a822dea830830cf0ec155e5651b124b 100644 (file)
@@ -32,10 +32,11 @@ struct ltt_session *ltt_session_create(void)
        struct ltt_session *session;
 
        mutex_lock(&sessions_mutex);
-       session = kmalloc(sizeof(struct ltt_session), GFP_KERNEL);
+       session = kzalloc(sizeof(struct ltt_session), GFP_KERNEL);
        if (!session)
                return NULL;
        INIT_LIST_HEAD(&session->chan);
+       INIT_LIST_HEAD(&session->events);
        list_add(&session->list, &sessions);
        mutex_unlock(&sessions_mutex);
        return session;
@@ -90,6 +91,17 @@ end:
        return ret;
 }
 
+static struct ltt_transport *ltt_transport_find(char *name)
+{
+       struct ltt_transport *transport;
+
+       list_for_each_entry(transport, &ltt_transport_list, node) {
+               if (!strcmp(transport->name, name))
+                       return transport;
+       }
+       return NULL;
+}
+
 struct ltt_channel *ltt_channel_create(struct ltt_session *session,
                                       int overwrite, void *buf_addr,
                                       size_t subbuf_size, size_t num_subbuf,
@@ -97,22 +109,23 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
                                       unsigned int read_timer_interval)
 {
        struct ltt_channel *chan;
-       struct ltt_transport *transport = NULL, *tran_iter;
+       struct ltt_transport *transport;
        char *transport_name;
 
        mutex_lock(&sessions_mutex);
-       if (session->active)
+       if (session->active) {
+               printk(KERN_WARNING "LTTng refusing to add channel to active session\n");
                goto active;    /* Refuse to add channel to active session */
-       transport_name = overwrite ? "relay-overwrite" : "relay-discard";
-       list_for_each_entry(tran_iter, &ltt_transport_list, node) {
-               if (!strcmp(tran_iter->name, transport_name)) {
-                       transport = tran_iter;
-                       break;
-               }
        }
-       if (!transport)
+       transport_name = overwrite ? "relay-overwrite" : "relay-discard";
+       transport = ltt_transport_find(transport_name);
+       if (!transport) {
+               printk(KERN_WARNING "LTTng transport %s not found\n",
+                      transport_name);
                goto notransport;
-       chan = kmalloc(sizeof(struct ltt_channel), GFP_KERNEL);
+       }
+       printk("got transport\n");
+       chan = kzalloc(sizeof(struct ltt_channel), GFP_KERNEL);
        if (!chan)
                goto nomem;
        chan->session = session;
@@ -120,11 +133,16 @@ struct ltt_channel *ltt_channel_create(struct ltt_session *session,
        chan->chan = transport->ops.channel_create("[lttng]", session, buf_addr,
                        subbuf_size, num_subbuf, switch_timer_interval,
                        read_timer_interval);
+       printk("chan create %p\n", chan->chan);
+       if (!chan->chan)
+               goto create_error;
        chan->ops = &transport->ops;
        list_add(&chan->list, &session->chan);
        mutex_unlock(&sessions_mutex);
        return chan;
 
+create_error:
+       kfree(chan);
 nomem:
 notransport:
 active:
This page took 0.028244 seconds and 4 git commands to generate.