]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/journal-importer.h
53354b7c786e679d289fded149543179444424ae
1 /* SPDX-License-Identifier: LGPL-2.1+ */
11 #include "time-util.h"
13 /* Make sure not to make this smaller than the maximum coredump size.
14 * See JOURNAL_SIZE_MAX in coredump.c */
15 #ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
16 #define ENTRY_SIZE_MAX (1024*1024*770u)
17 #define DATA_SIZE_MAX (1024*1024*768u)
19 #define ENTRY_SIZE_MAX (1024*1024*13u)
20 #define DATA_SIZE_MAX (1024*1024*11u)
22 #define LINE_CHUNK 8*1024u
24 struct iovec_wrapper
{
30 size_t iovw_size(struct iovec_wrapper
*iovw
);
32 typedef struct JournalImporter
{
38 size_t size
; /* total size of the buffer */
39 size_t offset
; /* offset to the beginning of live data in the buffer */
40 size_t scanned
; /* number of bytes since the beginning of data without a newline */
41 size_t filled
; /* total number of bytes in the buffer */
43 size_t field_len
; /* used for binary fields: the field name length */
44 size_t data_size
; /* and the size of the binary data chunk being processed */
46 struct iovec_wrapper iovw
;
53 void journal_importer_cleanup(JournalImporter
*);
54 int journal_importer_process_data(JournalImporter
*);
55 int journal_importer_push_data(JournalImporter
*, const char *data
, size_t size
);
56 void journal_importer_drop_iovw(JournalImporter
*);
57 bool journal_importer_eof(const JournalImporter
*);
59 static inline size_t journal_importer_bytes_remaining(const JournalImporter
*imp
) {