]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/journal-importer.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
3 This file is part of systemd.
5 Copyright 2016 Zbigniew Jędrzejewski-Szmek
7 systemd is free software; you can redistribute it and/or modify it
8 under the terms of the GNU Lesser General Public License as published by
9 the Free Software Foundation; either version 2.1 of the License, or
10 (at your option) any later version.
12 systemd is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 You should have received a copy of the GNU Lesser General Public License
18 along with systemd; If not, see <http://www.gnu.org/licenses/>.
27 #include "time-util.h"
29 /* Make sure not to make this smaller than the maximum coredump size.
30 * See COREDUMP_MAX in coredump.c */
31 #define ENTRY_SIZE_MAX (1024*1024*770u)
32 #define DATA_SIZE_MAX (1024*1024*768u)
33 #define LINE_CHUNK 8*1024u
35 struct iovec_wrapper
{
41 size_t iovw_size(struct iovec_wrapper
*iovw
);
43 typedef struct JournalImporter
{
49 size_t size
; /* total size of the buffer */
50 size_t offset
; /* offset to the beginning of live data in the buffer */
51 size_t scanned
; /* number of bytes since the beginning of data without a newline */
52 size_t filled
; /* total number of bytes in the buffer */
54 size_t field_len
; /* used for binary fields: the field name length */
55 size_t data_size
; /* and the size of the binary data chunk being processed */
57 struct iovec_wrapper iovw
;
63 void journal_importer_cleanup(JournalImporter
*);
64 int journal_importer_process_data(JournalImporter
*);
65 int journal_importer_push_data(JournalImporter
*, const char *data
, size_t size
);
66 void journal_importer_drop_iovw(JournalImporter
*);
67 bool journal_importer_eof(const JournalImporter
*);
69 static inline size_t journal_importer_bytes_remaining(const JournalImporter
*imp
) {