Fix: test_seek should only output one TAP plan

On critical failure paths, the test_seek test was outputting multiple
TAP plans, which according to the specification [1] is invalid. This
causes parsing issues on very strict TAP parsers.

[1] - http://podwiki.hexten.net/TAP/TAP.html?page=TAP

Signed-off-by: Christian Babeux <christian.babeux@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Don't create a new packet when ctf_move_pos reaches the end of a packet

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Use the packet's final size when mmap-ing the next packet

ctf_packet_seek() assumed that a packet would be of fixed size
"WRITE_PACKET_LEN" when seeking to the next packet in write mode. This ensures
that the real size (rounded to the next page boundary) is used.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Fix: Uninitialized ctf_stream_pos structure in ctf_float_write()

This structure is passed to _ctf_float_copy() which used the
uninitialized mmap_offset and offset values to read the source
floating point value.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Do not automatically create a new packet when aligning ctf_stream_pos

ctf_align_pos() will call ctf_packet_seek() and start a new packet if
the alignment cannot be achieved in the current packet. This change
performs the ctf_pos_access_ok() check before aligning. EFAULT will
be returned to the caller, thus giving him a chance to either resize
the current packet or to create a new one.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add public CTF Writer API headers

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Add CTF Writer implementation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Tests: Add a CTF Writer test

The test will be ran as part of the "tests" test plan.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>