1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3 
4 #include "journal-file.h"
5 
6 typedef struct {
7         JournalFile *file;
8 } ManagedJournalFile;
9 
10 int managed_journal_file_open(
11                 int fd,
12                 const char *fname,
13                 int open_flags,
14                 JournalFileFlags file_flags,
15                 mode_t mode,
16                 uint64_t compress_threshold_bytes,
17                 JournalMetrics *metrics,
18                 MMapCache *mmap_cache,
19                 Set *deferred_closes,
20                 ManagedJournalFile *template,
21                 ManagedJournalFile **ret);
22 
23 int managed_journal_file_set_offline(ManagedJournalFile *f, bool wait);
24 bool managed_journal_file_is_offlining(ManagedJournalFile *f);
25 ManagedJournalFile* managed_journal_file_close(ManagedJournalFile *f);
26 DEFINE_TRIVIAL_CLEANUP_FUNC(ManagedJournalFile*, managed_journal_file_close);
27 
28 int managed_journal_file_open_reliably(
29                 const char *fname,
30                 int open_flags,
31                 JournalFileFlags file_flags,
32                 mode_t mode,
33                 uint64_t compress_threshold_bytes,
34                 JournalMetrics *metrics,
35                 MMapCache *mmap_cache,
36                 Set *deferred_closes,
37                 ManagedJournalFile *template,
38                 ManagedJournalFile **ret);
39 
40 ManagedJournalFile* managed_journal_file_initiate_close(ManagedJournalFile *f, Set *deferred_closes);
41 int managed_journal_file_rotate(ManagedJournalFile **f, MMapCache *mmap_cache, JournalFileFlags file_flags, uint64_t compress_threshold_bytes, Set *deferred_closes);
42