]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/device.h
Merge pull request #8798 from yuwata/follow-up-8675
[thirdparty/systemd.git] / src / core / device.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2010 Lennart Poettering
8 ***/
9
10 typedef struct Device Device;
11
12 typedef enum DeviceFound {
13 DEVICE_NOT_FOUND = 0,
14 DEVICE_FOUND_UDEV = 1 << 1,
15 DEVICE_FOUND_UDEV_DB = 1 << 2,
16 DEVICE_FOUND_MOUNT = 1 << 3,
17 DEVICE_FOUND_SWAP = 1 << 4,
18 } DeviceFound;
19
20 struct Device {
21 Unit meta;
22
23 char *sysfs;
24 DeviceFound found;
25
26 /* In order to be able to distinguish dependencies on
27 different device nodes we might end up creating multiple
28 devices for the same sysfs path. We chain them up here. */
29 LIST_FIELDS(struct Device, same_sysfs);
30
31 DeviceState state, deserialized_state;
32
33 bool bind_mounts;
34 };
35
36 extern const UnitVTable device_vtable;
37
38 int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now);
39 bool device_shall_be_bound_by(Unit *device, Unit *u);