Set *deferred_closes,
ManagedJournalFile *template,
ManagedJournalFile **ret) {
+
_cleanup_free_ ManagedJournalFile *f = NULL;
int r;
if (!f)
return -ENOMEM;
- r = journal_file_open(fd, fname, open_flags, file_flags, mode, compress_threshold_bytes, metrics,
- mmap_cache, template ? template->file : NULL, &f->file);
+ r = journal_file_open(
+ fd,
+ fname,
+ open_flags,
+ file_flags,
+ mode,
+ compress_threshold_bytes,
+ metrics,
+ mmap_cache,
+ template ? template->file : NULL,
+ &f->file);
if (r < 0)
return r;
return 0;
}
-
ManagedJournalFile* managed_journal_file_initiate_close(ManagedJournalFile *f, Set *deferred_closes) {
int r;
return r;
r = managed_journal_file_open(
- -1,
+ /* fd= */ -1,
path,
(*f)->file->open_flags,
file_flags,
(*f)->file->mode,
compress_threshold_bytes,
- NULL, /* metrics */
+ /* metrics= */ NULL,
mmap_cache,
deferred_closes,
- *f, /* template */
+ /* template= */ *f,
&new_file);
managed_journal_file_initiate_close(*f, deferred_closes);
_cleanup_(managed_journal_file_closep) ManagedJournalFile *old_file = NULL;
int r;
- r = managed_journal_file_open(-1, fname, open_flags, file_flags, mode, compress_threshold_bytes, metrics,
- mmap_cache, deferred_closes, template, ret);
+ r = managed_journal_file_open(
+ /* fd= */ -1,
+ fname,
+ open_flags,
+ file_flags,
+ mode,
+ compress_threshold_bytes,
+ metrics,
+ mmap_cache,
+ deferred_closes,
+ template,
+ ret);
if (!IN_SET(r,
-EBADMSG, /* Corrupted */
-ENODATA, /* Truncated */
if (state == STATE_ARCHIVED)
return -ESHUTDOWN; /* Already archived */
- else if (state == STATE_ONLINE)
+ if (state == STATE_ONLINE)
return log_debug_errno(SYNTHETIC_ERRNO(EBUSY),
"Journal file %s is already online. Assuming unclean closing.",
f->path);
- else if (state != STATE_OFFLINE)
+ if (state != STATE_OFFLINE)
return log_debug_errno(SYNTHETIC_ERRNO(EBUSY),
"Journal file %s has unknown state %i.",
f->path, state);