{
/* initialize platform */
global_barectf_platform_ctx =
- barectf_platform_linux_fs_init(512, "ctf-linux-fs", 1, 2, 7);
+ barectf_platform_linux_fs_init(512, "ctf-linux-fs/stream",
+ 1, 2, 7);
if (!global_barectf_platform_ctx) {
fprintf(stderr, "Error: could not initialize platform\n");
int exit_status = 0;
/* Initialize platform */
- platform_ctx = barectf_platform_linux_fs_init(512, "trace", 1, 2, 7);
+ platform_ctx = barectf_platform_linux_fs_init(512, "trace/stream",
+ 1, 2, 7);
if (!platform_ctx) {
fprintf(stderr,
= barectf Linux FS platform
Philippe Proulx
-16 September 2020
+23 September 2020
:toc: left
The barectf Linux FS platform is a very simple platform used to
[source,c]
----
struct barectf_platform_linux_fs_ctx *barectf_platform_linux_fs_init(
- unsigned int buf_size, const char *trace_dir, int simulate_full_backend,
- unsigned int full_backend_rand_max, unsigned int full_backend_rand_lt);
+ unsigned int buf_size, const char *data_stream_file_path,
+ int simulate_full_backend, unsigned int full_backend_rand_max,
+ unsigned int full_backend_rand_lt);
----
==== Parameters
|`buf_size`
|Size of the packet buffer to allocate (bytes).
-|`trace_dir`
-|Path of the directory to which to write the single data stream file
- named `stream`.
+|`data_stream_file_path`
+|Path of the data stream file to which to append packets.
|`simulate_full_backend`
|
struct barectf_default_ctx *barectf_ctx;
unsigned int i;
- platform_ctx = barectf_platform_linux_fs_init(256, "trace", 0, 0, 0);
+ platform_ctx = barectf_platform_linux_fs_init(256, "trace/stream",
+ 0, 0, 0);
assert(platform_ctx);
barectf_ctx = barectf_platform_linux_fs_get_barectf_ctx(platform_ctx);
}
struct barectf_platform_linux_fs_ctx *barectf_platform_linux_fs_init(
- const unsigned int buf_size, const char * const trace_dir,
+ const unsigned int buf_size, const char * const data_stream_file_path,
const int simulate_full_backend,
const unsigned int full_backend_rand_lt,
const unsigned int full_backend_rand_max)
{
- char stream_path[256];
uint8_t *buf = NULL;
struct barectf_platform_linux_fs_ctx *platform_ctx;
struct barectf_platform_callbacks cbs;
goto error;
}
- sprintf(stream_path, "%s/stream", trace_dir);
- platform_ctx->fh = fopen(stream_path, "wb");
+ platform_ctx->fh = fopen(data_stream_file_path, "wb");
if (!platform_ctx->fh) {
goto error;
struct barectf_platform_linux_fs_ctx;
struct barectf_platform_linux_fs_ctx *barectf_platform_linux_fs_init(
- unsigned int buf_size, const char *trace_dir, int simulate_full_backend,
- unsigned int full_backend_rand_max, unsigned int full_backend_rand_lt);
+ unsigned int buf_size, const char *data_stream_file_path,
+ int simulate_full_backend, unsigned int full_backend_rand_max,
+ unsigned int full_backend_rand_lt);
void barectf_platform_linux_fs_fini(struct barectf_platform_linux_fs_ctx *ctx);