]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/bus-wait-for-units.h
hwdb: Add mapping for Xiaomi Mipad 2 bottom bezel capacitive buttons
[thirdparty/systemd.git] / src / shared / bus-wait-for-units.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
3572d3df
LP
2#pragma once
3
4#include "macro.h"
5#include "sd-bus.h"
6
7typedef struct BusWaitForUnits BusWaitForUnits;
8
9typedef enum BusWaitForUnitsState {
10 BUS_WAIT_SUCCESS, /* Nothing to wait for anymore and nothing failed */
11 BUS_WAIT_FAILURE, /* dito, but something failed */
12 BUS_WAIT_RUNNING, /* Still something to wait for */
13 _BUS_WAIT_FOR_UNITS_STATE_MAX,
2d93c20e 14 _BUS_WAIT_FOR_UNITS_STATE_INVALID = -EINVAL,
3572d3df
LP
15} BusWaitForUnitsState;
16
17typedef enum BusWaitForUnitsFlags {
18 BUS_WAIT_FOR_MAINTENANCE_END = 1 << 0, /* Wait until the unit is no longer in maintenance state */
19 BUS_WAIT_FOR_INACTIVE = 1 << 1, /* Wait until the unit is back in inactive or dead state */
20 BUS_WAIT_NO_JOB = 1 << 2, /* Wait until there's no more job pending */
21 BUS_WAIT_REFFED = 1 << 3, /* The unit is already reffed with RefUnit() */
cc6978d6 22 _BUS_WAIT_FOR_TARGET = BUS_WAIT_FOR_MAINTENANCE_END|BUS_WAIT_FOR_INACTIVE|BUS_WAIT_NO_JOB,
3572d3df
LP
23} BusWaitForUnitsFlags;
24
df0183d8 25typedef void (*bus_wait_for_units_unit_callback_t)(BusWaitForUnits *d, const char *unit_path, bool good, void *userdata);
3572d3df
LP
26
27int bus_wait_for_units_new(sd_bus *bus, BusWaitForUnits **ret);
cbdb8732 28
3572d3df 29BusWaitForUnits* bus_wait_for_units_free(BusWaitForUnits *d);
cbdb8732 30DEFINE_TRIVIAL_CLEANUP_FUNC(BusWaitForUnits*, bus_wait_for_units_free);
3572d3df 31
df0183d8
MY
32int bus_wait_for_units_add_unit(
33 BusWaitForUnits *d,
34 const char *unit,
35 BusWaitForUnitsFlags flags,
36 bus_wait_for_units_unit_callback_t callback,
37 void *userdata);
38
3572d3df 39int bus_wait_for_units_run(BusWaitForUnits *d);
df0183d8 40BusWaitForUnitsState bus_wait_for_units_state(BusWaitForUnits *d);