Commit | Line | Data |
---|---|---|
e98a2d6e | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
e98a2d6e | 3 | * |
0235b0db | 4 | * Copyright (C) 2016 Philippe Proulx <pproulx@efficios.com> |
e98a2d6e PP |
5 | */ |
6 | ||
0235b0db MJ |
7 | #ifndef CTF_FS_FILE_H |
8 | #define CTF_FS_FILE_H | |
9 | ||
5ff12b25 | 10 | #include <memory> |
a39d9817 | 11 | #include <string> |
5ff12b25 | 12 | |
c7e1be4b | 13 | #include <babeltrace2/babeltrace.h> |
e98a2d6e | 14 | |
85a25425 | 15 | #include "cpp-common/bt2c/libc-up.hpp" |
97601f8e | 16 | #include "cpp-common/bt2c/logging.hpp" |
0f5c5d5c | 17 | |
5ff12b25 SM |
18 | struct ctf_fs_file_deleter |
19 | { | |
20 | void operator()(struct ctf_fs_file *file) noexcept; | |
21 | }; | |
22 | ||
97601f8e SM |
23 | struct ctf_fs_file |
24 | { | |
5ff12b25 SM |
25 | using UP = std::unique_ptr<ctf_fs_file, ctf_fs_file_deleter>; |
26 | ||
97601f8e SM |
27 | explicit ctf_fs_file(const bt2c::Logger& parentLogger) : |
28 | logger {parentLogger, "PLUGIN/SRC.CTF.FS/FILE"} | |
29 | { | |
30 | } | |
0f5c5d5c | 31 | |
97601f8e SM |
32 | bt2c::Logger logger; |
33 | ||
a39d9817 | 34 | std::string path; |
97601f8e | 35 | |
85a25425 | 36 | bt2c::FileUP fp; |
97601f8e SM |
37 | |
38 | off_t size = 0; | |
39 | }; | |
0f5c5d5c | 40 | |
e98a2d6e PP |
41 | void ctf_fs_file_destroy(struct ctf_fs_file *file); |
42 | ||
5ff12b25 | 43 | ctf_fs_file::UP ctf_fs_file_create(const bt2c::Logger& parentLogger); |
e98a2d6e | 44 | |
55314f2a | 45 | int ctf_fs_file_open(struct ctf_fs_file *file, const char *mode); |
e98a2d6e PP |
46 | |
47 | #endif /* CTF_FS_FILE_H */ |