-static void ltt_relay_release_channel(struct kref *kref)
-{
- struct ust_channel *ltt_chan = container_of(kref,
- struct ust_channel, kref);
- free(ltt_chan->buf);
-}
-
-/*
- * Create ltt buffer.
- */
-//ust// static int ltt_relay_create_buffer(struct ust_trace *trace,
-//ust// struct ltt_channel_struct *ltt_chan, struct rchan_buf *buf,
-//ust// unsigned int cpu, unsigned int n_subbufs)
-//ust// {
-//ust// struct ltt_channel_buf_struct *ltt_buf =
-//ust// percpu_ptr(ltt_chan->buf, cpu);
-//ust// unsigned int j;
-//ust//
-//ust// ltt_buf->commit_count =
-//ust// kzalloc_node(sizeof(ltt_buf->commit_count) * n_subbufs,
-//ust// GFP_KERNEL, cpu_to_node(cpu));
-//ust// if (!ltt_buf->commit_count)
-//ust// return -ENOMEM;
-//ust// kref_get(&trace->kref);
-//ust// kref_get(&trace->ltt_transport_kref);
-//ust// kref_get(<t_chan->kref);
-//ust// uatomic_set(<t_buf->offset, ltt_subbuffer_header_size());
-//ust// uatomic_set(<t_buf->consumed, 0);
-//ust// uatomic_set(<t_buf->active_readers, 0);
-//ust// for (j = 0; j < n_subbufs; j++)
-//ust// uatomic_set(<t_buf->commit_count[j], 0);
-//ust// init_waitqueue_head(<t_buf->write_wait);
-//ust// uatomic_set(<t_buf->wakeup_readers, 0);
-//ust// spin_lock_init(<t_buf->full_lock);
-//ust//
-//ust// ltt_buffer_begin_callback(buf, trace->start_tsc, 0);
-//ust// /* atomic_add made on local variable on data that belongs to
-//ust// * various CPUs : ok because tracing not started (for this cpu). */
-//ust// uatomic_add(<t_buf->commit_count[0], ltt_subbuffer_header_size());
-//ust//
-//ust// uatomic_set(<t_buf->events_lost, 0);
-//ust// uatomic_set(<t_buf->corrupted_subbuffers, 0);
-//ust//
-//ust// return 0;
-//ust// }
-
-static int ust_buffers_init_buffer(struct ust_trace *trace,
- struct ust_channel *ltt_chan, struct ust_buffer *buf,
- unsigned int n_subbufs)
-{
- unsigned int j;
- int fds[2];
- int result;
-
- buf->commit_count =
- zmalloc(sizeof(*buf->commit_count) * n_subbufs);
- if (!buf->commit_count)
- return -ENOMEM;
- kref_get(&trace->kref);
- kref_get(&trace->ltt_transport_kref);
- kref_get(<t_chan->kref);
- uatomic_set(&buf->offset, ltt_subbuffer_header_size());
- uatomic_set(&buf->consumed, 0);
- uatomic_set(&buf->active_readers, 0);
- for (j = 0; j < n_subbufs; j++) {
- uatomic_set(&buf->commit_count[j].cc, 0);
- uatomic_set(&buf->commit_count[j].cc_sb, 0);
- }
-//ust// init_waitqueue_head(&buf->write_wait);
-//ust// uatomic_set(&buf->wakeup_readers, 0);
-//ust// spin_lock_init(&buf->full_lock);
-
- ltt_buffer_begin(buf, trace->start_tsc, 0);
-
- uatomic_add(&buf->commit_count[0].cc, ltt_subbuffer_header_size());
-
- uatomic_set(&buf->events_lost, 0);
- uatomic_set(&buf->corrupted_subbuffers, 0);
-
- result = pipe(fds);
- if(result == -1) {
- PERROR("pipe");
- return -1;
- }
- buf->data_ready_fd_read = fds[0];
- buf->data_ready_fd_write = fds[1];
-
-//ust// buf->commit_seq = malloc(sizeof(buf->commit_seq) * n_subbufs);
-//ust// if(!ltt_buf->commit_seq) {
-//ust// return -1;
-//ust// }
- memset(buf->commit_seq, 0, sizeof(buf->commit_seq[0]) * n_subbufs);
-
- /* FIXME: decrementally destroy on error */
-
- return 0;
-}
-
-/* FIXME: use this function */
-static void ust_buffers_destroy_buffer(struct ust_channel *ltt_chan, int cpu)
-{
- struct ust_trace *trace = ltt_chan->trace;
- struct ust_buffer *ltt_buf = ltt_chan->buf[cpu];
-
- kref_put(<t_chan->trace->ltt_transport_kref,
- ltt_release_transport);
- ltt_relay_print_buffer_errors(ltt_chan, cpu);
-//ust// free(ltt_buf->commit_seq);
- free(ltt_buf->commit_count);
- ltt_buf->commit_count = NULL;
- kref_put(<t_chan->kref, ltt_relay_release_channel);
- kref_put(&trace->kref, ltt_release_trace);
-//ust// wake_up_interruptible(&trace->kref_wq);
-}
-
-static int ust_buffers_alloc_channel_buf_structs(struct ust_channel *chan)