]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/output-mode.h
hwdb: Add mapping for Xiaomi Mipad 2 bottom bezel capacitive buttons
[thirdparty/systemd.git] / src / shared / output-mode.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "json.h"
5 #include "macro.h"
6
7 typedef enum OutputMode {
8 OUTPUT_SHORT,
9 OUTPUT_SHORT_FULL,
10 OUTPUT_SHORT_ISO,
11 OUTPUT_SHORT_ISO_PRECISE,
12 OUTPUT_SHORT_PRECISE,
13 OUTPUT_SHORT_MONOTONIC,
14 OUTPUT_SHORT_DELTA,
15 OUTPUT_SHORT_UNIX,
16 OUTPUT_VERBOSE,
17 OUTPUT_EXPORT,
18 OUTPUT_JSON,
19 OUTPUT_JSON_PRETTY,
20 OUTPUT_JSON_SSE,
21 OUTPUT_JSON_SEQ,
22 OUTPUT_CAT,
23 OUTPUT_WITH_UNIT,
24 _OUTPUT_MODE_MAX,
25 _OUTPUT_MODE_INVALID = -EINVAL,
26 } OutputMode;
27
28 static inline bool OUTPUT_MODE_IS_JSON(OutputMode m) {
29 return IN_SET(m, OUTPUT_JSON, OUTPUT_JSON_PRETTY, OUTPUT_JSON_SSE, OUTPUT_JSON_SEQ);
30 }
31
32 /* The output flags definitions are shared by the logs and process tree output. Some apply to both, some only to the
33 * logs output, others only to the process tree output. */
34
35 typedef enum OutputFlags {
36 OUTPUT_SHOW_ALL = 1 << 0,
37 OUTPUT_FULL_WIDTH = 1 << 1,
38 OUTPUT_COLOR = 1 << 2,
39
40 /* Specific to log output */
41 OUTPUT_WARN_CUTOFF = 1 << 3,
42 OUTPUT_CATALOG = 1 << 4,
43 OUTPUT_BEGIN_NEWLINE = 1 << 5,
44 OUTPUT_UTC = 1 << 6,
45 OUTPUT_NO_HOSTNAME = 1 << 7,
46 OUTPUT_TRUNCATE_NEWLINE = 1 << 8,
47
48 /* Specific to process tree output */
49 OUTPUT_KERNEL_THREADS = 1 << 9,
50 OUTPUT_CGROUP_XATTRS = 1 << 10,
51 OUTPUT_CGROUP_ID = 1 << 11,
52 } OutputFlags;
53
54 JsonFormatFlags output_mode_to_json_format_flags(OutputMode m);
55
56 const char* output_mode_to_string(OutputMode m) _const_;
57 OutputMode output_mode_from_string(const char *s) _pure_;