]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/journal-remote/journal-remote-write.h
logind: check return value of session_release
[thirdparty/systemd.git] / src / journal-remote / journal-remote-write.h
CommitLineData
fdfccdbc
ZJS
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3/***
4 This file is part of systemd.
5
6 Copyright 2014 Zbigniew Jędrzejewski-Szmek
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
22#pragma once
23
fdfccdbc
ZJS
24
25#include "journal-file.h"
26
9ff48d09
ZJS
27typedef struct RemoteServer RemoteServer;
28
fdfccdbc
ZJS
29struct iovec_wrapper {
30 struct iovec *iovec;
31 size_t size_bytes;
32 size_t count;
33};
34
35int iovw_put(struct iovec_wrapper *iovw, void* data, size_t len);
36void iovw_free_contents(struct iovec_wrapper *iovw);
37size_t iovw_size(struct iovec_wrapper *iovw);
92b10cbc 38void iovw_rebase(struct iovec_wrapper *iovw, char *old, char *new);
fdfccdbc
ZJS
39
40typedef struct Writer {
41 JournalFile *journal;
42 JournalMetrics metrics;
9ff48d09 43
fdfccdbc 44 MMapCache *mmap;
9ff48d09
ZJS
45 RemoteServer *server;
46 char *hashmap_key;
47
fdfccdbc 48 uint64_t seqnum;
9ff48d09
ZJS
49
50 int n_ref;
fdfccdbc
ZJS
51} Writer;
52
9ff48d09
ZJS
53Writer* writer_new(RemoteServer* server);
54Writer* writer_free(Writer *w);
55
56Writer* writer_ref(Writer *w);
57Writer* writer_unref(Writer *w);
58
59DEFINE_TRIVIAL_CLEANUP_FUNC(Writer*, writer_unref);
60#define _cleanup_writer_unref_ _cleanup_(writer_unrefp)
61
fdfccdbc
ZJS
62int writer_write(Writer *s,
63 struct iovec_wrapper *iovw,
64 dual_timestamp *ts,
65 bool compress,
66 bool seal);
8201af08
ZJS
67
68typedef enum JournalWriteSplitMode {
69 JOURNAL_WRITE_SPLIT_NONE,
70 JOURNAL_WRITE_SPLIT_HOST,
71 _JOURNAL_WRITE_SPLIT_MAX,
72 _JOURNAL_WRITE_SPLIT_INVALID = -1
73} JournalWriteSplitMode;