Kernel 3.15 don't define map unmap for pipe

struct pipe_buf_operations does not have map and unmap fields starting
from kernel 3.15.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Adapt to 3.15 tracepoint API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: module instrumentation: update to 3.15 kernel

Remove show_module_flags() define from lttng module.h instrumentation.
It is already defined within the in-kernel module.h, _and_ LTTng does
not use TP_printk.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: update block instrumentation to 3.15 kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: ext4 update instrumentation to 3.15 kernel

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: update v4l2 instrumentation to 3.15 kernel

show_type() is only used in TP_printk(), which is not used by LTTng
modules. Moreover, it is already defined by the in-kernel
instrumentation. Therefore, we can remove it from the lttng
instrumentation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Statedump event for block devices

Signed-off-by: Houssem Daoud <houssemmh@gmail.com>
[ Edited by Mathieu Desnoyers. ]
Tested-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: allow racy tracepoint string input from kernel and userspace

Fixes #781

Acked-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cleanup: lib ringbuffer: pagecpy has unsigned semantic

Same for lib_ring_buffer_read() orig_len.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: pass proper args when writing commit counter

lib_ring_buffer_write_commit_counter()'s 'buf_offset' argument should
contain offset of beginning of area used by the record being comitted.

However, lib_ring_buffer_commit() passes ctx->buf_offset, that gets
advanced by lib_ring_buffer_write() and thus points to just-after-
end-of-record at lib_ring_buffer_commit() time. This causes
lib_ring_buffer_write_commit_counter() to return without changing
commit_hot[idx].seq, due to

	if (unlikely(subbuf_offset(offset - commit_count, chan)))
		return;

Since after-crash data extraction tool checks 'seq' field to find out
how much data is in buffer, this results into inavailability of
data from partially-filled subbuffer for after-crash analysis.

This patch modifies lib_ring_buffer_write_commit_counter() and all its
callers to pass and expect the end of the area. So code works as it
should, and complete information becomes visible in crash dump.

[ Changelog inspired from Nikita Yushchenko's original patch. ]

Fixes #784

Reported-by: Nikita Yushchenko <nyoushchenko@mvista.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: blktrace instrumentation for v3.2.58+ stable branch

Starting with Linux kernel v3.2.58 within the v3.2 Linux stable branch:

commit 5b85afa68e4f56c27f1d5c6f49e5257bce6448e6
Author: Roman Pen <r.peniaev@gmail.com>
Date:   Tue Mar 4 23:13:10 2014 +0900

    blktrace: fix accounting of partially completed requests

    commit af5040da01ef980670b3741b3e10733ee3e33566 upstream.

The module API for a block layer tracepoint changes. Fix the associated
build failure.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: incorrect rwbs field type in block_bio_queue

Within lttng-modules instrumentation starting from kernel 3.9.0, the
block_bio_queue instrumentation has incorrect rwbs field type, and does
not print "comm" as an array of text.

The result is that we are writing values to what we believe to be an
"unsigned int", which is actually described as an array of RWBS_LEN byte
(8 bytes). This discrepancy between type description and the actual
tp_assign() incrementing the write offset leads to what appears as
corruption of the following "comm" field in the trace viewer output: the
viewer will skip the first bytes of the "comm" field, erroneously
thinking they belong the the previous "rwbs" field.

Fixes #794

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Dump FD flags and mode on state dump

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: lttng modules system call generation script

Fixes #771

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: refuse overwrite mode buffers with less than two subbuffers

Fixes #793

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add TID field to some block_* events

Most of the block events have the "comm" field, but we have no way to
match a block event to a certain thread which makes performing
accurate per-thread analyses difficult. Add the TID field to the events
that already export current->comm.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Version 2.5.0-rc1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: statedump block devices OOPS

Fixes #799

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: blktrace instrumentation for backported branches

The following commit from kernel 3.15 changing the API of a block layer
tracepoint has been backported to multiple branches:

commit af5040da01ef980670b3741b3e10733ee3e33566
Author: Roman Pen <r.peniaev@gmail.com>
Date:   Tue Mar 4 23:13:10 2014 +0900

    blktrace: fix accounting of partially completed requests

This patch fixes the resulting build failure by adding the proper
version checks. The versions and corresponding commit SHA-1 hashes are
as follow:

   3.2.58
       commit 5b85afa68e4f56c27f1d5c6f49e5257bce6448e6

   3.4.91
       commit 14eee5bd065d6aac0acbdc6092a25ba68c55b9c8

   3.10.41
       commit e9d933941569c107e0083c3c115467c699a57db2

   3.12.21
       commit 5104b40a981d26212ced149fbd43ad0b6b72910b

   3.14.15
       commit 0a8eda9c00ef37e8b40de77f2b0714317191bcf2

Signed-off-by: Antoine Busque <antoine.busque@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>