babeltrace.git
4 weeks agosrc.ctf.fs: initialize ctf_fs_ds_index_entry::packet_seq_num to UINT64_MAX in class
Simon Marchi [Mon, 13 Jun 2022 16:47:53 +0000 (12:47 -0400)] 
src.ctf.fs: initialize ctf_fs_ds_index_entry::packet_seq_num to UINT64_MAX in class

Initialize the field directly to the right value.  The field was
originally initialized to 0 to mimic the g_new0 behavior.

Change-Id: Ia1df1be730b77ca0d69ae05dae12bd60ef9e9ed8
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8346
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12341
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove goto error handling from data-stream-file.cpp
Simon Marchi [Fri, 2 Feb 2024 17:33:00 +0000 (17:33 +0000)] 
src.ctf.fs: remove goto error handling from data-stream-file.cpp

Same as previous patch, but for data-stream-file.cpp.

Change-Id: Ieb52faca6142ff33591fce2d880bcde664f2c1b7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8320
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12340
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove goto error handling from fs.cpp
Simon Marchi [Tue, 9 Apr 2024 21:09:47 +0000 (17:09 -0400)] 
src.ctf.fs: remove goto error handling from fs.cpp

gotos prevent declaring variables in the middle of functions, which is
sometimes necessary in C++.  Remove gotos used for error handling,
replace them with returning directly.

Change-Id: I15b5d6aa4897e5326fc03e2626045c83258d8eca
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8318
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12339
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use GMappedFileUP in build_index_from_idx_file
Simon Marchi [Tue, 5 Dec 2023 05:52:55 +0000 (05:52 +0000)] 
src.ctf.fs: use GMappedFileUP in build_index_from_idx_file

Change-Id: I24d4cf509839923e704870953b6c9fb379cf1880
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8312
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12338
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use std::string in build_index_from_idx_file
Simon Marchi [Tue, 5 Dec 2023 05:50:32 +0000 (05:50 +0000)] 
src.ctf.fs: use std::string in build_index_from_idx_file

Change-Id: Ifdb2c818f66efbc328b095408ae2834646fba4fe
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8310
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12337
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use GCharUP in build_index_from_idx_file
Simon Marchi [Tue, 5 Dec 2023 05:46:56 +0000 (05:46 +0000)] 
src.ctf.fs: use GCharUP in build_index_from_idx_file

Change-Id: Ifb4e1b3ac7d484af2d570d75cff21e310f752add
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8309
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12336
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_ds_index_create
Simon Marchi [Tue, 5 Dec 2023 05:43:19 +0000 (05:43 +0000)] 
src.ctf.fs: remove ctf_fs_ds_index_create

Remove ctf_fs_ds_index_create, since it's now just a wrapper around
constructing a ctf_fs_ds_index.

Change-Id: Ia256fde3286f3f77a514835806f8862678e02359
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8308
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12335
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_component_create
Simon Marchi [Tue, 9 Apr 2024 21:08:57 +0000 (17:08 -0400)] 
src.ctf.fs: remove ctf_fs_component_create

Remove this function, as it's now a simple wrapper around constructing a
ctf_fs_component.

Change-Id: Ifc6c751ff66f43c81c1a0abd6d7b27393b96f4ad
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8307
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12334
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_file_create
Simon Marchi [Mon, 11 Dec 2023 17:24:27 +0000 (12:24 -0500)] 
src.ctf.fs: remove ctf_fs_file_create

Remove this function, it's now just a wrapper around constructing a
ctf_fs_file.

Change-Id: I95e4d6eb26b0d359e0f480cac51af11f3a1db539
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8297
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12333
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_make_port_name return std::string
Simon Marchi [Tue, 9 Apr 2024 21:08:37 +0000 (17:08 -0400)] 
src.ctf.fs: make ctf_fs_make_port_name return std::string

Change-Id: I9e2f4d2ac47e4f061e5dda1a3813d1a092ffe433
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8296
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12332
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use GDirUp in create_ds_file_groups
Simon Marchi [Tue, 5 Dec 2023 05:28:25 +0000 (05:28 +0000)] 
src.ctf.fs: use GDirUp in create_ds_file_groups

Change-Id: I0d0ca566d8123e8419a9345f78224f92f17e9a47
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8295
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12331
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use std::vector<std::string> in ctf_fs_component_create_ctf_fs_trace
Simon Marchi [Tue, 5 Dec 2023 05:25:32 +0000 (05:25 +0000)] 
src.ctf.fs: use std::vector<std::string> in ctf_fs_component_create_ctf_fs_trace

Change-Id: I51af73cb2bdaf10318b19aa493129bdb8401cc3b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8293
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12330
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use std::string in path_is_ctf_trace
Simon Marchi [Thu, 9 Jun 2022 15:32:46 +0000 (11:32 -0400)] 
src.ctf.fs: use std::string in path_is_ctf_trace

Change-Id: I796d135f7daee29a4481e61cf073e8bbd2e0f05f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8292
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12329
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use std::string in set_trace_name
Simon Marchi [Tue, 5 Dec 2023 05:19:53 +0000 (05:19 +0000)] 
src.ctf.fs: use std::string in set_trace_name

Change-Id: Ib44748ebda40b197d5ef0ca20d23b55496c3e918
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8291
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12328
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make get_stream_instance_unique_name return `const std::string &`
Simon Marchi [Tue, 9 Apr 2024 21:08:19 +0000 (17:08 -0400)] 
src.ctf.fs: make get_stream_instance_unique_name return `const std::string &`

We always return the first stream's name.  Return a reference to that
name instead of a new object and a copy of the string.

Change-Id: I657265b74e0566a36f2ae05f6b5b1b6d21f53c66
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8290
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12327
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use GStringUP in ctf_fs_component_create_ctf_fs_trace_one_path
Simon Marchi [Tue, 5 Dec 2023 05:12:00 +0000 (05:12 +0000)] 
src.ctf.fs: use GStringUP in ctf_fs_component_create_ctf_fs_trace_one_path

Change-Id: I6405c80bdfc519fe45ebadadcfd2e396da9a74cb
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8289
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12326
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_trace_destroy
Simon Marchi [Tue, 5 Dec 2023 05:09:22 +0000 (05:09 +0000)] 
src.ctf.fs: remove ctf_fs_trace_destroy

Remove it and the custom deleter, since ctf_fs_trace instances can now
be simply deleted.

Change-Id: I59f3f89b4b3faee45b3708245242cee009d218b7
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8287
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12325
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_trace::metadata a unique_ptr
Simon Marchi [Thu, 9 Jun 2022 15:19:30 +0000 (11:19 -0400)] 
src.ctf.fs: make ctf_fs_trace::metadata a unique_ptr

Introduce ctf_fs_metadata::UP and change the ctf_fs_trace::metadata
field to be of that type.

Change-Id: I0221ef7786cc8fb4c2e8a9264573ab5c2e5420d6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8286
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12324
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_metadata_init and ctf_fs_metadata_fini
Simon Marchi [Thu, 2 Nov 2023 19:04:35 +0000 (19:04 +0000)] 
src.ctf.fs: remove ctf_fs_metadata_init and ctf_fs_metadata_fini

Change-Id: Ie34c0a5c5aea60aa2fc771d35a39b61ec0eca336
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8285
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12323
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_metadata::trace_class a bt2::TraceClass::Shared
Simon Marchi [Tue, 5 Dec 2023 04:57:52 +0000 (04:57 +0000)] 
src.ctf.fs: make ctf_fs_metadata::trace_class a bt2::TraceClass::Shared

Change-Id: I1ee6a21525757197213c35acfa1f0a17d7052541
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8284
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12322
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_visitor_generate_ir::trace_class a bt2::TraceClass::Shared
Simon Marchi [Mon, 11 Dec 2023 17:24:09 +0000 (12:24 -0500)] 
src.ctf.fs: make ctf_visitor_generate_ir::trace_class a bt2::TraceClass::Shared

Change-Id: I9b414384b025f39c3cfb9900659235a17426b649
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8283
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12321
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_metadata::text
Simon Marchi [Thu, 9 Jun 2022 15:05:38 +0000 (11:05 -0400)] 
src.ctf.fs: remove ctf_fs_metadata::text

Change-Id: Id15010c2d5c1f9fccd60adfb0920b1dca2f2074b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8282
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12320
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_trace::path an std::string
Simon Marchi [Tue, 5 Dec 2023 04:44:06 +0000 (04:44 +0000)] 
src.ctf.fs: make ctf_fs_trace::path an std::string

Change-Id: I9938c37f4effca7e83ed2e495feb5dd596d2320e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8281
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12319
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared
Simon Marchi [Tue, 5 Dec 2023 04:40:07 +0000 (04:40 +0000)] 
src.ctf.fs: make ctf_fs_trace::trace a bt2::Trace::Shared

Change-Id: I4fabe113da7b5adb794377706ab07fac9b59df02
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8280
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12318
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: introduce and use ctf_fs_msg_iter_data::UP
Simon Marchi [Tue, 9 Apr 2024 20:30:19 +0000 (16:30 -0400)] 
src.ctf.fs: introduce and use ctf_fs_msg_iter_data::UP

Introduce ctf_fs_msg_iter_data::UP and use it in ctf_fs_iterator_init
and ctf_fs_iterator_finalize.

Change-Id: I448cedc164d93f9ba26da5640578889b0fff580c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8279
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12317
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use ctf_msg_iter_up in decode_clock_snapshot_after_event
Simon Marchi [Tue, 5 Dec 2023 04:29:51 +0000 (04:29 +0000)] 
src.ctf.fs: use ctf_msg_iter_up in decode_clock_snapshot_after_event

Change-Id: I4f230d16b96764d5097cb30b8a063d41268bb237
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8278
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12316
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use ctf_msg_iter_up in add_ds_file_to_ds_file_group
Simon Marchi [Tue, 5 Dec 2023 04:25:06 +0000 (04:25 +0000)] 
src.ctf.fs: use ctf_msg_iter_up in add_ds_file_to_ds_file_group

Change-Id: I3970358b6eab556fd5971d94a8e35b720c6f9450
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8277
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12315
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_msg_iter_data::msg_iter a ctf_msg_iter_up
Simon Marchi [Sat, 9 Dec 2023 16:26:12 +0000 (16:26 +0000)] 
src.ctf.fs: make ctf_fs_msg_iter_data::msg_iter a ctf_msg_iter_up

Change-Id: I44ef5f74fdee99a4bf5962cf03757acc7ba774b2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8276
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12314
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_msg_iter_create return a unique_ptr
Simon Marchi [Tue, 9 Apr 2024 20:36:45 +0000 (16:36 -0400)] 
src.ctf.fs: make ctf_msg_iter_create return a unique_ptr

Introduce ctf_msg_iter_up, a unique_ptr type with a deleter that calls
ctf_msg_iter_destroy.  Make ctf_msg_iter_create return that.

Change-Id: Ibba15a84c58804a88f18c6ed47b9197fe46541b3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8275
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12313
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_destroy
Simon Marchi [Tue, 5 Dec 2023 04:11:57 +0000 (04:11 +0000)] 
src.ctf.fs: remove ctf_fs_destroy

Remove it, since a ctf_fs_destroy instance can simply be deleted.

Change-Id: Ic6b879dbdff5e5172c2f07c810f97ceaf45a77f9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8274
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12312
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_ds_group_medops_data_destroy
Simon Marchi [Thu, 9 Jun 2022 14:27:25 +0000 (10:27 -0400)] 
src.ctf.fs: remove ctf_fs_ds_group_medops_data_destroy

Remove it, simply delete `data` in the custom deleter.  Note that we
still use a custom deleter because ctf_fs_ds_group_medops_data is in the
.cpp file, and therefore not visible to other compilation units.  We
could move it to the .hpp to avoid this, but it's going to be removed
soon anyway, so it's not worth it.

Change-Id: Ib5741e0e0a535cb84b2a4e27ff6ff9620eaaebce
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8273
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12311
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_ds_group_medops_data_create return a unique_ptr
Simon Marchi [Tue, 5 Dec 2023 04:06:35 +0000 (04:06 +0000)] 
src.ctf.fs: make ctf_fs_ds_group_medops_data_create return a unique_ptr

Introduce ctf_fs_ds_group_medops_data_up, a unique_ptr type with a
deleter that calls ctf_fs_ds_group_medops_data_destroy.  Make
ctf_fs_ds_group_medops_data_create return (by parameter) a value of this
type.

Change ctf_fs_msg_iter_data::msg_iter_medops_data to be of this type too,
since the result of ctf_fs_ds_group_medops_data_create is put directly in
that field.

Change-Id: I971e2e6db622f5cfe492eaede239852886a24483
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8272
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12310
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_ds_group_medops_data::file a ctf_fs_ds_file::UP
Simon Marchi [Tue, 5 Dec 2023 04:03:12 +0000 (04:03 +0000)] 
src.ctf.fs: make ctf_fs_ds_group_medops_data::file a ctf_fs_ds_file::UP

Change-Id: Ibe6b3882c29725f7563fb141bd823ec2adeabc6a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8271
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12309
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use ctf_fs_ds_file::UP in add_ds_file_to_ds_file_group
Simon Marchi [Tue, 5 Dec 2023 04:00:16 +0000 (04:00 +0000)] 
src.ctf.fs: use ctf_fs_ds_file::UP in add_ds_file_to_ds_file_group

Change-Id: I8b7a55f28b746cc6b93bfb4459bfc41789d7d4f2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8270
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12308
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use ctf_fs_ds_file::UP in decode_clock_snapshot_after_event
Simon Marchi [Sat, 9 Dec 2023 14:50:47 +0000 (14:50 +0000)] 
src.ctf.fs: use ctf_fs_ds_file::UP in decode_clock_snapshot_after_event

Change-Id: I0b476dd18ee4dfd53ac7bffb12d9fae9b1a1b359
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8269
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12307
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_create return a unique_ptr
Simon Marchi [Sat, 9 Dec 2023 14:37:28 +0000 (14:37 +0000)] 
src.ctf.fs: make ctf_fs_ds_file_create return a unique_ptr

Introduce ctf_fs_ds_file::UP, make ctf_fs_ds_file_create return it.

Change-Id: I0139e9504d65425bf53fb21a5b81a4e48da4fe4e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8268
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12306
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: rename ctf_fs_ds_file_destroy to ~ctf_fs_ds_file
Simon Marchi [Tue, 5 Dec 2023 03:42:10 +0000 (03:42 +0000)] 
src.ctf.fs: rename ctf_fs_ds_file_destroy to ~ctf_fs_ds_file

This makes the ctf_fs_ds_file type deletable.

Change-Id: Ibaedb136777a39db11a1bd30355c7123e186e489
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8267
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12305
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: remove ctf_fs_file_destroy
Simon Marchi [Tue, 5 Dec 2023 03:38:56 +0000 (03:38 +0000)] 
src.ctf.fs: remove ctf_fs_file_destroy

Remove it, and the custom deleter, now that a ctf_fs_file can be simply
deleted.

Change-Id: Iaef8b0cdbe525272019e0258665b45cbaee6ad05
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8266
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12304
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_file::path an std::string
Simon Marchi [Tue, 5 Dec 2023 03:35:00 +0000 (03:35 +0000)] 
src.ctf.fs: make ctf_fs_file::path an std::string

Change-Id: Ifbe7cd2c184031465428c28701131a82ba219b02
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8265
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12303
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_file::fp a FileUP
Simon Marchi [Tue, 5 Dec 2023 03:25:35 +0000 (03:25 +0000)] 
src.ctf.fs: make ctf_fs_file::fp a FileUP

Change-Id: I7c0467a20942cf107d8f10951c8a393e3da7c608
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8264
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12302
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make get_file return ctf_fs_file::UP
Simon Marchi [Tue, 5 Dec 2023 03:21:28 +0000 (03:21 +0000)] 
src.ctf.fs: make get_file return ctf_fs_file::UP

Change-Id: I9f115907d062db0a227a49adb7d5786342ca4147
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8263
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12301

4 weeks agosrc.ctf.fs: use ctf_fs_file::UP in create_ds_file_groups
Simon Marchi [Tue, 5 Dec 2023 03:17:40 +0000 (03:17 +0000)] 
src.ctf.fs: use ctf_fs_file::UP in create_ds_file_groups

Change-Id: I45b50e6c808d5ae17ac755b96e03f260a0972c15
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8262
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12300

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file::file a ctf_fs_file::UP
Simon Marchi [Tue, 5 Dec 2023 03:08:45 +0000 (03:08 +0000)] 
src.ctf.fs: make ctf_fs_ds_file::file a ctf_fs_file::UP

Change-Id: Id6a62715e3e2a29216debe1c72986215d7f47459
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8261
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12299

4 weeks agosrc.ctf.fs: make ctf_fs_file_create return a unique_ptr
Simon Marchi [Fri, 5 Apr 2024 19:45:51 +0000 (15:45 -0400)] 
src.ctf.fs: make ctf_fs_file_create return a unique_ptr

Introduce ctf_fs_file::UP, make ctf_fs_file_create return that, adjust
impacted callers.

Change-Id: Ice241fd596af3d54e9c7bc7f562ca010bb5833aa
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8260
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12298

4 weeks agosrc.ctf.fs: move ctf_fs_file to file.hpp
Simon Marchi [Tue, 12 Dec 2023 04:59:05 +0000 (04:59 +0000)] 
src.ctf.fs: move ctf_fs_file to file.hpp

This helps resolve some cyclic include problem between file.hpp and
fs.hpp in the next patches (and I think it makes sense to put it there).

Change-Id: I2904d17eb3ea51699464fba17a992ddf3b691f60
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8259
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12297

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file::stream a bt2::Stream::Shared
Simon Marchi [Mon, 4 Dec 2023 21:51:03 +0000 (21:51 +0000)] 
src.ctf.fs: make ctf_fs_ds_file::stream a bt2::Stream::Shared

Change-Id: I2df309d73c7a1b987e4d25c63251e13bf47a38a3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8258
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12296

4 weeks agosrc.ctf.fs: remove ctf_fs_ds_file_group_destroy
Simon Marchi [Thu, 9 Jun 2022 13:34:22 +0000 (09:34 -0400)] 
src.ctf.fs: remove ctf_fs_ds_file_group_destroy

Remove ctf_fs_ds_file_group_destroy and the custom deleter, now that
ctf_fs_ds_file_group can be simply deleted.

Change-Id: I41100be8a99276ef17df4c9aa37a7f4db0275869
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8257
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12295

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_group::stream a bt2::Stream::Shared
Simon Marchi [Mon, 4 Dec 2023 21:34:02 +0000 (21:34 +0000)] 
src.ctf.fs: make ctf_fs_ds_file_group::stream a bt2::Stream::Shared

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I0f84b26ccf43b0469da15946fa825a1255e7ab3d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8256
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12294

4 weeks agosrc.ctf.fs: remove ctf_fs_ds_index_destroy
Simon Marchi [Thu, 9 Jun 2022 13:24:46 +0000 (09:24 -0400)] 
src.ctf.fs: remove ctf_fs_ds_index_destroy

Remove ctf_fs_ds_index_destroy and ctf_fs_ds_index_deleter, since
ctf_fs_ds_index objects can simply be deleted now.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I64eb93eb3f06174523e7f9ceaf94cf103a9e69eb
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8255
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12293

4 weeks agosrc.ctf.fs: make ctf_fs_ds_index::entries a vector of ctf_fs_ds_index_entry::UP
Simon Marchi [Tue, 9 Apr 2024 21:07:50 +0000 (17:07 -0400)] 
src.ctf.fs: make ctf_fs_ds_index::entries a vector of ctf_fs_ds_index_entry::UP

Change-Id: If56c5ab6c35b6d93bf38b264f384496d2d06f4eb
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8254
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12292

4 weeks agosrc.ctf.fs: make ctf_fs_ds_index_entry_create return a unique_ptr
Simon Marchi [Mon, 4 Dec 2023 21:13:53 +0000 (21:13 +0000)] 
src.ctf.fs: make ctf_fs_ds_index_entry_create return a unique_ptr

Introduce ctf_fs_ds_index_entry::UP and make
ctf_fs_ds_index_entry_create return that.  Modify a few functions in
data-stream-file.cpp that deal with this.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I39598d860327cff5af32804f75b68b58e4ee0821
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8253
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12291

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_group::index a ctf_fs_ds_index::UP
Simon Marchi [Sat, 6 Apr 2024 04:08:54 +0000 (00:08 -0400)] 
src.ctf.fs: make ctf_fs_ds_file_group::index a ctf_fs_ds_index::UP

Change that field to be a unique_ptr.  Adjust some functions in fs.cpp
around that.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ie2cdfe0b81f1d817093de74faf6c12ef2e6169a1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8252
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12290

4 weeks agosrc.ctf.fs: make ctf_fs_ds_index_create return a unique_ptr
Simon Marchi [Mon, 4 Dec 2023 20:20:20 +0000 (20:20 +0000)] 
src.ctf.fs: make ctf_fs_ds_index_create return a unique_ptr

Introduce ctf_fs_ds_index::UP, a unique_ptr with a deleter that calls
ctf_fs_ds_index_destroy.  Make ctf_fs_ds_index_create (and the
other functions creating an index in data-stream-file.cpp) return it.

Change-Id: Id04124aeaff3384e566a43fbbd6c1fedd2bf9bc3
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8251
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12289

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_group::ds_file_infos a vector of ctf_fs_ds_file_info::UP
Simon Marchi [Wed, 8 Jun 2022 19:56:51 +0000 (15:56 -0400)] 
src.ctf.fs: make ctf_fs_ds_file_group::ds_file_infos a vector of ctf_fs_ds_file_info::UP

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I8df18be3ea1e78c78a8f0e7f0bfe1d43c390555b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8250
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12288

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_info_create return a unique_ptr
Simon Marchi [Mon, 11 Dec 2023 17:23:19 +0000 (12:23 -0500)] 
src.ctf.fs: make ctf_fs_ds_file_info_create return a unique_ptr

Introduce ctf_fs_ds_file_info::UP, make ctf_fs_ds_file_info_create
return it.  We don't need a custom deleter, because ctf_fs_ds_file_info
can simply be deleted.  ctf_fs_ds_file_info_destroy will disappear in
the next patches.

Change-Id: Iae4fdf68035d45762f2606685f712fd12976f008
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8249
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12287

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_info::path an std::string
Simon Marchi [Mon, 4 Dec 2023 20:06:58 +0000 (20:06 +0000)] 
src.ctf.fs: make ctf_fs_ds_file_info::path an std::string

Change-Id: If7e5c09024451b1c344a0446a75703929aff480e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8248
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12286

4 weeks agosrc.ctf.fs: make ctf_fs_trace::ds_file_groups a vector of ctf_fs_ds_file_group::UP
Simon Marchi [Tue, 9 Apr 2024 21:04:13 +0000 (17:04 -0400)] 
src.ctf.fs: make ctf_fs_trace::ds_file_groups a vector of ctf_fs_ds_file_group::UP

Replace the GPtrArray with an std::vector of unique_ptr, simplifying
memory management.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I47a6b60a35b6d776a7234af1950e460da8c1e1f4
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8247
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12285

4 weeks agosrc.ctf.fs: make ctf_fs_ds_file_group_create return a ctf_fs_ds_file_group::UP
Simon Marchi [Thu, 7 Dec 2023 20:33:44 +0000 (20:33 +0000)] 
src.ctf.fs: make ctf_fs_ds_file_group_create return a ctf_fs_ds_file_group::UP

Introduced ctf_fs_ds_file_group::UP, a unique_ptr type with a deleter
that calls ctf_fs_ds_file_group_destroy.  Change
ctf_fs_ds_file_group_create to return that type.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: Ic89ec8edc5d7dd779c836beb962dcad7e45ab996
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8245
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12284

4 weeks agosrc.ctf.fs: make ctf_fs_component::port_data a vector
Simon Marchi [Tue, 12 Dec 2023 04:43:15 +0000 (04:43 +0000)] 
src.ctf.fs: make ctf_fs_component::port_data a vector

Replace a GPtrArray with a vector of unique pointers of
ctf_fs_port_data, simplifying memory management.

Change-Id: I4f832f32b0ca893242cc3e61e8aaac495fe86003
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8243
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12283

4 weeks agosrc.ctf.fs: move `ctf_fs_ds_*` structures and functions to data-stream-file.hpp
Simon Marchi [Fri, 5 Apr 2024 18:42:41 +0000 (14:42 -0400)] 
src.ctf.fs: move `ctf_fs_ds_*` structures and functions to data-stream-file.hpp

Change-Id: I15392536482968db492fe806ee5fa5e0ecff643e
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12282
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agosrc.ctf.fs: switch to using ctf_fs_trace::UP where possible
Simon Marchi [Mon, 4 Dec 2023 19:34:29 +0000 (19:34 +0000)] 
src.ctf.fs: switch to using ctf_fs_trace::UP where possible

Change a few function in fs.cpp to use ctf_fs_trace::UP.  Change a use of
GPtrArray to an std::vector.

Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Change-Id: I7bd8fdefea538cc778bbca5157b92e960052e1cc
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8242
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12281

4 weeks agosrc.ctf.fs: make ctf_fs_trace_create return ctf_fs_trace::UP
Simon Marchi [Mon, 4 Dec 2023 19:24:52 +0000 (19:24 +0000)] 
src.ctf.fs: make ctf_fs_trace_create return ctf_fs_trace::UP

Change-Id: I342285ece6b6d68c2375658cb0aff2b363b4b156
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8241
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12280

4 weeks agosrc.ctf.fs: make ctf_fs_component::trace a unique_ptr
Simon Marchi [Tue, 9 Apr 2024 21:03:42 +0000 (17:03 -0400)] 
src.ctf.fs: make ctf_fs_component::trace a unique_ptr

Define ctf_fs_trace::UP to be a unique_ptr type with a deleter that
calls ctf_fs_trace_destroy (the custom deleter will go away once
ctf_fs_trace is properly destructible).  Change ctf_fs_component::trace
to be of this type.

Change-Id: Iaf8111922b320781d7e9333bcdc5db129192509d
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8240
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12279

4 weeks agosrc.ctf.fs: move struct ctf_fs_trace and struct ctf_fs_port_data up
Simon Marchi [Tue, 12 Dec 2023 04:39:00 +0000 (04:39 +0000)] 
src.ctf.fs: move struct ctf_fs_trace and struct ctf_fs_port_data up

Move them so they are before ctf_fs_component.  This enables the
following patches to use a unique_ptr to hold them in ctf_fs_component.

Change-Id: If97956d0c74795f8ee18ecebe035c8b186d85a2b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8239
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12278

4 weeks agosrc.ctf.fs: use DataLen in ctf_fs_ds_index_entry
Simon Marchi [Thu, 7 Dec 2023 20:33:04 +0000 (20:33 +0000)] 
src.ctf.fs: use DataLen in ctf_fs_ds_index_entry

Change-Id: I6ff4bdbad5358faa6f504b1ae52b6a4151fef27b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8205
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12277

4 weeks agocpp-common/bt2c: add `DataLen` class (general-purpose data length)
Philippe Proulx [Mon, 5 Feb 2024 17:39:07 +0000 (12:39 -0500)] 
cpp-common/bt2c: add `DataLen` class (general-purpose data length)

This patch adds the `bt2c::DataLen` class so that you can make sure your
function accepts an expected data length instead of specifying that you
need bits or bytes:

    Something buildSomething(bt2c::DataLen len, ...)
    {
        using namespace bt2c::literals::datalen;

        if (...) {
            len += 16_MiBytes;
        } else {
            len *= 2;
        }

        // ...
    }

    // ...

    const auto something = buildSomething(DataLen::fromBytes(sz), ...);

As you can see above, you can use the `bt2c::literals::datalen`
namespace to access handy data length user literals.

The `bt2c::DataLen` constructor is private: you need to use the
bt2c::DataLen::fromBits() and bt2c::DataLen::fromBytes()
static methods to build an instance.

Because a `bt2c::DataLen` instance is just an `unsigned long long`
value in memory, the intention of this API is to copy data length
instances as much as possible. Therefore, I suppose it's cheaper to
accept a `const bt2c::DataLen` parameter than
`const bt2c::DataLen&` which would add an indirection.

The constructor and many methods are `constexpr` to make this useable in
constant context.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I1375fb5697c0d952f3669dc587603839d511dd18
Reviewed-on: https://review.lttng.org/c/babeltrace/+/7726
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12250

4 weeks agoctf: add ClkClsConfig and use it
Simon Marchi [Mon, 11 Dec 2023 17:22:44 +0000 (12:22 -0500)] 
ctf: add ClkClsConfig and use it

Different parts of the code in the ctf plugin (in fs-src, lttng-live and
common) use these three values:

 - clock offset (seconds)
 - clock offset (nanoseconds)
 - force origin to be Unix epoch

Gather these three values in a new structure, `ClkClsConfig`, so that
these they can easily be passed around.  This replaces the existing
ctf_fs_metadata_config structure, which contained the exact same thing,
but was specific to the fs component class.

Change-Id: If9b4d88c9fd5eb3352c5de4007dc4343fac485c1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8228
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12276

4 weeks agosrc.ctf.fs: remove uneeded check in create_streams_for_trace
Simon Marchi [Thu, 9 Jun 2022 17:52:02 +0000 (13:52 -0400)] 
src.ctf.fs: remove uneeded check in create_streams_for_trace

At this point, we certainly have a stream class.

The ir_sc field is set in ctf_stream_class_to_ir.
ctf_stream_class_to_ir is called by ctf_trace_class_translate, which is
called by ctf_visitor_generate_ir_visit_node if ctx->trace_class is set.
That trace_class field is set if a self_comp was passed to
ctf_visitor_generate_ir_create, in the decoder_config object.  Going up
the stack, we get to ctf_fs_metadata_set_trace_class, called by
ctf_fs_trace_create, called by ctf_fs_component_create_ctf_fs_trace.

create_streams_for_trace is called by ctf_fs_trace_create, which always
passes a self_comp to ctf_fs_component_create_ctf_fs_trace, ensuring we
always end up with a stream class.

ctf_fs_component_create_ctf_fs_trace is also used in the context of
queries, where no self_comp if passed, and therefore no stream class is
created..  But in that context, create_streams_for_trace is not called.

Change-Id: I5e8ef72a1013fc156a7bc6ac0d4cbb231a5ab704
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8237
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12274
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: query.cpp: change assertions into exceptions
Simon Marchi [Tue, 9 Apr 2024 21:02:39 +0000 (17:02 -0400)] 
src.ctf.fs: query.cpp: change assertions into exceptions

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I21d5f8950ca8efa78713404a29c36442cba6502a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8181
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12273
Tested-by: jenkins <jenkins@lttng.org>
CI-Build: Simon Marchi <simon.marchi@efficios.com>

4 weeks agocpp-common: add `dataFromFile()`
Francis Deslauriers [Fri, 9 Feb 2024 21:26:01 +0000 (16:26 -0500)] 
cpp-common: add `dataFromFile()`

Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: Ief289d7d12a1cc964af16dc7dd74a4422c81920a
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8159
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12272
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use C++ value wrappers in queries
Simon Marchi [Tue, 12 Dec 2023 04:27:56 +0000 (04:27 +0000)] 
src.ctf.fs: use C++ value wrappers in queries

 - Pass the query parameters as a bt2::ConstMapValue
 - Return the query result as a bt2::Value::Shared
 - Communicate errors via exceptions
 - Use std::string instead of GString to build the metadata text

Change-Id: If75da1efc1accb5c42dd98d830ab9abf2ffff932
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8165
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12271
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoctf: use unique_ptr to manage ctf_metadata_decoder lifetime
Simon Marchi [Mon, 11 Dec 2023 17:21:12 +0000 (12:21 -0500)] 
ctf: use unique_ptr to manage ctf_metadata_decoder lifetime

Introduce the ctf_metadata_decoder_up type, a unique_ptr with a deleter
that calls ctf_metadata_decoder_destroy.  Change
ctf_metadata_decoder_create to return a ctf_metadata_decoder_up, and
adjust callers / callees accordingly.

Note that this is temporary, ctf_metadata_decoder is going to be deleted
in a future refactor.  But in the mean time, it helps make the callers
use RAII and become more exception-safe.

Change-Id: Ia0e24b425c47b90dc71b10d1c7fd0a3000c89180
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8167
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12270
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: manage lifetime of open file with FileUP
Simon Marchi [Mon, 29 Jan 2024 16:58:13 +0000 (16:58 +0000)] 
src.ctf.fs: manage lifetime of open file with FileUP

Change-Id: Ic1c5d8be3761e449a154e1fd8cc1f0ec7c957197
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8173
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12269
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use GCharUP to hold metadata path
Simon Marchi [Sat, 28 May 2022 18:15:14 +0000 (14:15 -0400)] 
src.ctf.fs: use GCharUP to hold metadata path

Change-Id: I2cf43f7da567da3af2786a87026e25272925ed6f
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8171
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12268
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: make ctf_fs_make_port_name return a GCharUP
Simon Marchi [Mon, 11 Dec 2023 18:26:39 +0000 (13:26 -0500)] 
src.ctf.fs: make ctf_fs_make_port_name return a GCharUP

Make ctf_fs_make_port_name return a GCharUP, which then helps use
automatic memory management in the callers.

Change-Id: I9191ddbafa86a4788fc5e16fc561dfda7696cfa6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8166
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12267
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosrc.ctf.fs: use unique_ptr to manage ctf_fs_component lifetime
Simon Marchi [Mon, 11 Dec 2023 17:21:01 +0000 (12:21 -0500)] 
src.ctf.fs: use unique_ptr to manage ctf_fs_component lifetime

Define ctf_fs_component::UP to be a unique_ptr with a deleter that calls
ctf_fs_destroy.  Change ctf_fs_component_create to return a
ctf_fs_component::UP and adjust the appropriate callers / callees.

Move where the ctf_fs_component instance is assigned as the "data" of
the self component.  Make it so it's assigned in ctf_fs_init (the
component initialization entry point), as the very last step.  This way,
ctf_fs_create can return a unique_ptr, and there's no ambiguity on who
owns the ctf_fs_component instance at any given time, and what happens
in case of failure.

Change-Id: I3ab1d70b0e7aa7772b7fa09deec70db7ea5a022c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8164
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12266
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoctf: use unique_ptr to manage ctf_visitor_generate_ir lifetime
Simon Marchi [Tue, 9 Apr 2024 20:29:35 +0000 (16:29 -0400)] 
ctf: use unique_ptr to manage ctf_visitor_generate_ir lifetime

Define ctf_visitor_generate_ir::UP as a unique_ptr type with a custom
deleter that calls ctf_visitor_generate_ir_destroy.  Make
ctf_visitor_generate_ir_create return a ctf_visitor_generate_ir::UP and
adjust relevant callers / callees.

Change-Id: I9db22bd66e69473e67c2571e0b2bb7682863cff7
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8163
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12265
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoctf: move ctf_visitor_generate_ir to header file
Simon Marchi [Tue, 9 Apr 2024 20:29:13 +0000 (16:29 -0400)] 
ctf: move ctf_visitor_generate_ir to header file

Move ctf_visitor_generate_ir to the `ast.h` header file, the header file
containing all the declarations for the CTF 1 metadata visitors.  This
will allow exposing it as a proper C++ class and remove the accessor
functions.

Change-Id: Ic13494d0040ee9e2214ecca45d8ea2e7b75ec4fa
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8162
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12264
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoctf: add try/catch at entry points
Simon Marchi [Tue, 12 Dec 2023 04:17:44 +0000 (04:17 +0000)] 
ctf: add try/catch at entry points

Add try / catch at the entry points of the CTF component classes to
convert thrown exceptions in the proper statuses.  The handled
exceptions are:

 - std::bad_alloc: converted to MEMORY_ERROR
 - bt2::Error: converted to ERROR

Any other exception (for example, coming from a third-party library we
would eventually use) should be caught and converted to a
bt2_common::Error.

Change-Id: I06c2ccb43947f5a9e61568967f2812ccb0821b36
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12263
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agosink.text.details: don't write empty strings
Philippe Proulx [Mon, 18 Mar 2024 17:59:52 +0000 (13:59 -0400)] 
sink.text.details: don't write empty strings

This patch makes a `sink.text.details` not write the value of a trace
environment entry or of a value object when it's an empty string.

This is mostly because I don't like to keep plain text files with
significant trailing whitespaces in this repository, and
`data/plugins/src.ctf.lttng-live/cli-multi-domains.expect` had some,
for example:

    trace_creation_datetime:️▒
    trace_name:▒

where `▒` is a space.

Of course we'll have the same issue if a user string contains only
whitespaces instead of being empty, but since it's unlikely that we'll
do this in our own tests, this patch is good enough for me.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I6be83e2721bc6ce98e1459a7df42e32ccf6b661d
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12249
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agosink.ctf.fs: use bt2c::Logger
Simon Marchi [Wed, 3 Apr 2024 19:34:14 +0000 (15:34 -0400)] 
sink.ctf.fs: use bt2c::Logger

Use `bt2c::Logger` throughout the `sink.ctf.fs` code.

When printing C strings that may be NULL (e.g. result of
`bt_trace_get_name()`), we currently rely on glibc printf's behavior of
printing `(null)` when passed a NULL pointer for `%s`.  {fmt} doesn't
accept a nullptr `const char *`.  Add the `bt2c::maybeNull()` function
to emulate the existing behavior.

Change-Id: I6ab259c8db526a3b4c0de9295a4360180c56b398
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12241
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2: make `FieldPathScope` a wise enum
Simon Marchi [Thu, 4 Apr 2024 03:03:44 +0000 (23:03 -0400)] 
cpp-common/bt2: make `FieldPathScope` a wise enum

Change-Id: Ia07b63ff3afe01401ba633d0787ed726143abb05
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12247
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2: make `ValueType` a wise enum
Simon Marchi [Thu, 4 Apr 2024 02:16:13 +0000 (22:16 -0400)] 
cpp-common/bt2: make `ValueType` a wise enum

Change-Id: I0a0b060a094022844b159cedba87de566d4cfbac
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12246
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agosink.ctf.fs: initialize structure fields
Simon Marchi [Fri, 27 May 2022 15:38:44 +0000 (11:38 -0400)] 
sink.ctf.fs: initialize structure fields

In preparation to using some C++ objects as fields.  Allocate with new
and deallocate with delete where relevant.

Change-Id: I924a6088b17e1d3ae4b8a239cf059fc3a7ecc8c6
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12239
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agoctf: rename `ctx` structures
Simon Marchi [Thu, 2 Nov 2023 20:00:27 +0000 (20:00 +0000)] 
ctf: rename `ctx` structures

Rename the various structures named `ctx` to something else, to avoid
ODR problems when C++-ifying them.

Change-Id: I1b30c38ba6b88687b5baa5b965b805b0a9097ffe
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12236
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2: make `UniqueConstError::_mError` a pointer
Simon Marchi [Wed, 3 Apr 2024 17:07:36 +0000 (13:07 -0400)] 
cpp-common/bt2: make `UniqueConstError::_mError` a pointer

Make this field a pointer instead of a reference, in order to make
`UniqueConstError` assignable.  I don't really have a need for this, but
it seems more correct.

Change-Id: I29ae7a7380f75fa6b680116168a309e70c381f11
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12235
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoctf: use `bt2c::Logger` throughout `src.ctf.fs`, `src.ctf.lttng-live`
Simon Marchi [Thu, 28 Mar 2024 18:31:12 +0000 (14:31 -0400)] 
ctf: use `bt2c::Logger` throughout `src.ctf.fs`, `src.ctf.lttng-live`

A lot of functions and structures have parameters or fields of type
`bt_self_component`, `bt_self_component_class` and `bt_logging_level`
for the sole purpose of logging.  This becomes quite verbose, especially
when a function can be used in both self component and self component
class context, then it will have both of these parameters.

The `bt2c::Logger` class exists to encapsulate this context in a single
value that can be passed around.  Use it as much as practically possible
(as well as the corresponding logging macros) throughout the sources of
the ctf plugin, as well as in the common directory that they depend on.

Update all format strings to use {fmt}'s format string syntax.

Change all "enum to string" functions to be `format_as()` functions
understood by {fmt}.  Move these functions near the type they format,
for convenience.

Remove all the macros that appear at the beginning of source files that
influence the logging (such as `BT_COMP_LOG_SELF_COMP` and `BT_LOG_TAG`).

The log tags were previously defined per-source file, whereas they are
now defined per `Logger` object.  I tried to re-use the existing log
tags when it made sense, but in some places the log tags are now a bit
more granular.

Remove the `ctf_plugin_metadata_log_level` variable, controlled by the
`BABELTRACE_PLUGIN_CTF_METADATA_LOG_LEVEL` environment variable.  This
variable controlled the logging level in the lexer and parser (generated
by flex and bison).   It existed because the generated lexer and parser
don't provide an easy way to pass user data around.

Work around this by define the following variable:

   thread_local const ctf_scanner *currentCtfScanner;

and making the logging in the lexer and parser code use
`currentCtfScanner->logger`.  Set `currentCtfScanner` when entering the
parser in `ctf_scanner_append_ast()` and install an RAII cleanup to
reset it.

Change-Id: I0f6844d2cb83d2bf52b81ae9dee4179c7b1f2e12
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12199
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2c: make `Logger::Level` a wise enum
Simon Marchi [Thu, 4 Apr 2024 03:03:08 +0000 (23:03 -0400)] 
cpp-common/bt2c: make `Logger::Level` a wise enum

Change-Id: I5298a6af1a6e5a8127d20f546746d5050d767f06
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12245
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2: make `MessageType` a wise enum
Simon Marchi [Thu, 4 Apr 2024 03:02:27 +0000 (23:02 -0400)] 
cpp-common/bt2: make `MessageType` a wise enum

Change-Id: I46182e774ae480b20461ce44add48cea47bb0f3a
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12244
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2c: add format_as() template functions for wise enums
Simon Marchi [Thu, 4 Apr 2024 03:01:05 +0000 (23:01 -0400)] 
cpp-common/bt2c: add format_as() template functions for wise enums

Add some format_as() functions in the bt2 and bt2c namespaces that will
apply to all wise enums defined in that namespace.

Change-Id: I4952f062fc36e94925d2f0b093ac09d0fae6fdc0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12248
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/vendor: add copy of wise_enum
Simon Marchi [Wed, 3 Apr 2024 20:18:23 +0000 (16:18 -0400)] 
cpp-common/vendor: add copy of wise_enum

Add a copy of wise_enum, a smart enum library that allows doing cool
things like getting the number of enumerators of an enum, iterating on
enumerators, and converting enumerators to string while effectively
keeping vanilla `enum`/`enum class` behind the scenes (no enum-like
class).

The version is 3.1.0, which corresponds to the git tag `3.1.0`, which
corresponds to this git commit:

  https://github.com/quicknir/wise_enum/commit/34ac79f7ea2658a148359ce82508cc9301e31dd3

Change-Id: I9b92d5cd012dee427cdd725c17eeae9f2a529cb0
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12242
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2: move some enum classes out of enclosing classes
Simon Marchi [Wed, 3 Apr 2024 20:12:12 +0000 (16:12 -0400)] 
cpp-common/bt2: move some enum classes out of enclosing classes

Settle on the standard of having these enumerations out of the classes
that use them.

Change-Id: I241bdca560bf7f9e892d8884c86662166ad2d2c4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12240
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2c: use relative include for uuid.hpp in fmt.hpp
Simon Marchi [Wed, 3 Apr 2024 19:10:54 +0000 (15:10 -0400)] 
cpp-common/bt2c: use relative include for uuid.hpp in fmt.hpp

Change-Id: Ic5b5dee8cd967ab8bc5ab476747e4b09e7aa1127
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12237
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2c: add `BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC`
Simon Marchi [Wed, 3 Apr 2024 16:05:13 +0000 (12:05 -0400)] 
cpp-common/bt2c: add `BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC`

Add the `BT_CPPLOGE_ERRNO_APPEND_CAUSE_SPEC` macro, allowing to log an
error and append an error cause based on `errno`, without throwing.

Change-Id: I5837ef4b78a6d89b5574072f23d4aba6665e6bb4
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12232
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2c: add `BT_CPPLOGE_APPEND_CAUSE_SPEC`
Simon Marchi [Wed, 3 Apr 2024 17:12:05 +0000 (13:12 -0400)] 
cpp-common/bt2c: add `BT_CPPLOGE_APPEND_CAUSE_SPEC`

Add the `BT_CPPLOGE_APPEND_CAUSE_SPEC` macro, allowing to log an error,
append a cause, but not throw.

Change-Id: I6a09dd8775a85202c2049e902ab9edfcbd32080b
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12231
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
4 weeks agocpp-common/bt2c: Logger: remove `noThrow` suffixes
Simon Marchi [Thu, 4 Apr 2024 02:29:21 +0000 (22:29 -0400)] 
cpp-common/bt2c: Logger: remove `noThrow` suffixes

I think that the `noThrow` suffixes are unnecessary.  Since the methods
that throw (or rethrow) have the `AndThrow` (or `AndRethrow`) suffixes,
it is implied that those that don't, don't.

Simplify some macro comments to omit "without appending nor throwing",
for the same reason (if the macro name doesn't contain "APPEND_CAUSE",
it doesn't append a cause, if it doesn't contain "THROW", it doesn't
throw).

Change-Id: Ia71cf733e857e89578648eda12bf64b2bfc65027
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12229
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agocpp-common/bt2c: fix some function names in comments
Simon Marchi [Thu, 4 Apr 2024 02:28:31 +0000 (22:28 -0400)] 
cpp-common/bt2c: fix some function names in comments

Change-Id: I1d66d431e36794daf3b35ab5b3600bcea3bc42d1
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12225
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoChange naming convention for enum class enumerators
Simon Marchi [Thu, 28 Mar 2024 18:55:27 +0000 (14:55 -0400)] 
Change naming convention for enum class enumerators

Change the naming convention for enum class enumerators to not use
`ALL_CAPS`, as suggested by the C++ Core Guidelines [1].  Instead, use
camel case starting with a capital letter.

Update `CONTRIBUTING.adoc` to reflect this change.

gcc emits warnings like this:

    /home/smarchi/src/babeltrace/src/cpp-common/bt2/trace-ir.hpp:880:9: error: declaration of 'bt2::CommonEventClass<LibObjT>::LogLevel::Error' shadows a global declaration [-Werror=shadow]
      880 |         Error = BT_EVENT_CLASS_LOG_LEVEL_ERROR,
          |         ^~~~~
    In file included from /home/smarchi/src/babeltrace/src/cpp-common/bt2/clock-class.hpp:20,
                     from /home/smarchi/src/babeltrace/src/clock-correlation-validator/clock-correlation-validator.cpp:7:
    /home/smarchi/src/babeltrace/src/cpp-common/bt2/exc.hpp:14:7: note: shadowed declaration is here
       14 | using Error = bt2c::Error;
          |       ^~~~~

Whether or not this is a compiler bug is not clear [2], but in our case
we know it's fine.  Add and use `BT_DIAG_IGNORE_SHADOW` in some places
to silence these warnings.

[1] https://cpp-core-guidelines-docs.vercel.app/enum#Renum-caps
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55776

Change-Id: I59bb7f3c8572106c325596bc80a4d70714d86dee
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12212
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agoFix: cpp-common/bt2c: copy `_mSelfCompCls` when constructing `Logger`
Simon Marchi [Thu, 28 Mar 2024 18:30:22 +0000 (14:30 -0400)] 
Fix: cpp-common/bt2c: copy `_mSelfCompCls` when constructing `Logger`

Change-Id: Ic7e8ddc09a4f943f845821e16323cf2d5c1a667c
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12211
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Tested-by: jenkins <jenkins@lttng.org>
4 weeks agobuild: make out-of-tree builds with Python bindings work on msys2
Simon Marchi [Thu, 11 Apr 2024 16:57:08 +0000 (12:57 -0400)] 
build: make out-of-tree builds with Python bindings work on msys2

When doing an out of tree build on msys2 with
`--enable-python-bindings`, where the path to configure is absolute, I
get:

    Making all in bindings/python/bt2
    make[3]: Entering directory '/home/smarchi/build/babeltrace-mingw-w64-ucrt-x86_64/src/bindings/python/bt2'
    touch copy-static-deps.stamp
      SWIG      bt2/native_bt.c
    CC="ccache gcc" CFLAGS="-IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include -fvisibility=hidden -pthread -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include   -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wnull-derefere
nce -Wundef -Wredundant-decls -Wshadow -Wjump-misses-init -Wsuggest-attribute=format -Wnested-externs -Wwrite-strings -Wformat=2 -Wstrict-aliasing -Wmissing-noreturn -Winit-self -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wsuggest-override -Wno-sign-compare -Wno-cast-functi
on-type -Wno-maybe-uninitialized -Wold-style-definition -Wstrict-prototypes -g -O2 -Wno-shadow -Wno-null-dereference -Wno-deprecated-declarations -Wno-redundant-decls -Wno-missing-field-initializers -Wno-unused-parameter -Wno-undef" CPPFLAGS="-I/home/smarchi/src/babeltrace/include -I
../../../../src -I/home/smarchi/src/babeltrace/src -include common/config.h  -I/home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2" LDFLAGS="-L../../../../src/lib/.libs  -lgmodule-2.0 -lglib-2.0 -lintl -LC:/msys64/ucrt64/lib -lpython3.11  -lversion -lshlwapi -lpathcch -lbcrypt -
lm   -lgmodule-2.0 -lglib-2.0 -lintl" /ucrt64/bin/python ./setup.py build --force
    [...]
    ccache gcc -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include -fvisibility=hidden -pthread -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wnull-dereference -Wundef -Wr
edundant-decls -Wshadow -Wjump-misses-init -Wsuggest-attribute=format -Wnested-externs -Wwrite-strings -Wformat=2 -Wstrict-aliasing -Wmissing-noreturn -Winit-self -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wsuggest-override -Wno-sign-compare -Wno-cast-function-type -Wno-ma
ybe-uninitialized -Wold-style-definition -Wstrict-prototypes -g -O2 -Wno-shadow -Wno-null-dereference -Wno-deprecated-declarations -Wno-redundant-decls -Wno-missing-field-initializers -Wno-unused-parameter -Wno-undef -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0
/include -fvisibility=hidden -pthread -IC:/msys64/ucrt64/include/glib-2.0 -IC:/msys64/ucrt64/lib/glib-2.0/include -Wall -Wextra -Wmissing-prototypes -Wmissing-declarations -Wnull-dereference -Wundef -Wredundant-decls -Wshadow -Wjump-misses-init -Wsuggest-attribute=format -Wnested-ext
erns -Wwrite-strings -Wformat=2 -Wstrict-aliasing -Wmissing-noreturn -Winit-self -Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wsuggest-override -Wno-sign-compare -Wno-cast-function-type -Wno-maybe-uninitialized -Wold-style-definition -Wstrict-prototypes -g -O2 -Wno-shadow -W
no-null-dereference -Wno-deprecated-declarations -Wno-redundant-decls -Wno-missing-field-initializers -Wno-unused-parameter -Wno-undef -IC:/msys64/home/smarchi/src/babeltrace/include -I../../../../src -I/home/smarchi/src/babeltrace/src -include common/config.h -I/home/smarchi/src/bab
eltrace/src/bindings/python/bt2/bt2 -IC:/msys64/ucrt64/include/python3.11 -c /home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/logging.c -o build/temp.mingw_x86_64_ucrt-3.11/home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/logging.o
    cc1.exe: warning: command-line option '-Wsuggest-override' is valid for C++/ObjC++ but not for C
    cc1.exe: fatal error: /home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/logging.c: No such file or directory
    compilation terminated.
    error: command 'C:\\msys64\\ucrt64\\bin/ccache.exe' failed with exit code 1
    make[3]: *** [Makefile:735: build-python-bindings.stamp] Error 1
    make[3]: Leaving directory '/home/smarchi/build/babeltrace-mingw-w64-ucrt-x86_64/src/bindings/python/bt2'

For 'in-tree' builds all the paths are relative and thus compatible with
native windows binaries while in an 'out-of-tree' build some of the
paths are absolute and thus incompatible. The MSYS2 shell does a lot of
'magic' conversion [1] on paths passed as arguments and through environment
variables but the heuristics are limited and it doesn't apply when
binaries are called directly without using the shell.

The first issue is the include paths in the CFLAGS and CPPFLAGS
environment variables which don't get converted because they start with
'-I'.

The second issue is that the path to 'logging.c' in the generated
'setup.py is absolute:

    sources=["bt2/native_bt.c", "/home/smarchi/src/babeltrace/src/bindings/python/bt2/bt2/logging.c"],

When distutils invokes gcc to compile this file, it spawns it directly,
not through a shell, so no automatic Unix -> Windows path conversion
takes place.

Fix both of those issues by modifying 'setup.py' to detect the MSYS2
environment and convert absolute path to Windows style using the
'cygpath' command.

[1] https://www.msys2.org/docs/filesystem-paths/

Change-Id: I9003878a6582a0dc3f4ee18b07885f332348b8bf
Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12397
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
This page took 0.045935 seconds and 4 git commands to generate.