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 used.

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

This structure is passed to _ctf_float_copy() which uses 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>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fix: Don't create a new packet if ctf_move_pos() seeks out of a packet

This change ensures that ctf_move_pos() does not create a new packet
when ctf_move_pos() moves out of the current packet's bounds. The next
call to ctf_pos_access_ok() will report EFAULT which can then be
handled appropriately by the caller.

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

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Christian Babeux <christian.babeux@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Add CTF Writer implementation

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Reviewed-by: Christian Babeux <christian.babeux@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@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>
Reviewed-by: Christian Babeux <christian.babeux@efficios.com>
Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>