mirror of
https://github.com/systemd/systemd.git
synced 2024-10-30 06:25:37 +03:00
journald: some minor modernizations
This commit is contained in:
parent
2308cf7c9c
commit
0e8330262e
@ -423,6 +423,7 @@ int managed_journal_file_open(
|
||||
Set *deferred_closes,
|
||||
ManagedJournalFile *template,
|
||||
ManagedJournalFile **ret) {
|
||||
|
||||
_cleanup_free_ ManagedJournalFile *f = NULL;
|
||||
int r;
|
||||
|
||||
@ -432,8 +433,17 @@ int managed_journal_file_open(
|
||||
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;
|
||||
|
||||
@ -442,7 +452,6 @@ int managed_journal_file_open(
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
ManagedJournalFile* managed_journal_file_initiate_close(ManagedJournalFile *f, Set *deferred_closes) {
|
||||
int r;
|
||||
|
||||
@ -480,16 +489,16 @@ int managed_journal_file_rotate(
|
||||
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);
|
||||
@ -513,8 +522,18 @@ int managed_journal_file_open_reliably(
|
||||
_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 */
|
||||
|
@ -522,11 +522,11 @@ static int journal_file_verify_header(JournalFile *f) {
|
||||
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user