| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
#pragma once |
| 3 |
|
| 4 |
#include <sys/stat.h> |
| 5 |
#include <syslog.h> |
| 6 |
|
| 7 |
#include "shared-forward.h" |
| 8 |
#include "locale-setup.h" |
| 9 |
#include "vconsole-util.h" |
| 10 |
|
| 11 |
typedef struct Context { |
| 12 |
sd_bus_message *locale_cache; |
| 13 |
LocaleContext locale_context; |
| 14 |
|
| 15 |
sd_bus_message *x11_cache; |
| 16 |
struct stat x11_stat; |
| 17 |
X11Context x11_from_xorg; |
| 18 |
X11Context x11_from_vc; |
| 19 |
|
| 20 |
sd_bus_message *vc_cache; |
| 21 |
struct stat vc_stat; |
| 22 |
VCContext vc; |
| 23 |
|
| 24 |
Hashmap *polkit_registry; |
| 25 |
} Context; |
| 26 |
|
| 27 |
int x11_context_verify_and_warn(const X11Context *xc, int log_level, sd_bus_error *error); |
| 28 |
static inline int x11_context_verify(const X11Context *xc) { |
| 29 |
return x11_context_verify_and_warn(xc, LOG_DEBUG, NULL); |
| 30 |
} |
| 31 |
X11Context *context_get_x11_context(Context *c); |
| 32 |
|
| 33 |
int vc_context_verify_and_warn(const VCContext *vc, int log_level, sd_bus_error *error); |
| 34 |
static inline int vc_context_verify(const VCContext *vc) { |
| 35 |
return vc_context_verify_and_warn(vc, LOG_DEBUG, NULL); |
| 36 |
} |
| 37 |
|
| 38 |
int locale_read_data(Context *c, sd_bus_message *m); |
| 39 |
int vconsole_read_data(Context *c, sd_bus_message *m); |
| 40 |
int x11_read_data(Context *c, sd_bus_message *m); |
| 41 |
|
| 42 |
void context_clear(Context *c); |
| 43 |
int vconsole_write_data(Context *c); |
| 44 |
int x11_write_data(Context *c); |
| 45 |
|
| 46 |
bool locale_gen_check_available(void); |
| 47 |
int locale_gen_enable_locale(const char *locale); |
| 48 |
int locale_gen_run(void); |