]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/device.h
core: s/reexection/reexecution/ typo fix
[thirdparty/systemd.git] / src / core / device.h
CommitLineData
03467c88 1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
5cb5a6ff 2
c2f1db8f 3#pragma once
5cb5a6ff 4
a7334b09
LP
5/***
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
a7334b09
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
a7334b09 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
a7334b09
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
5cb5a6ff
LP
24typedef struct Device Device;
25
5cb5a6ff
LP
26/* We simply watch devices, we cannot plug/unplug them. That
27 * simplifies the state engine greatly */
28typedef enum DeviceState {
29 DEVICE_DEAD,
628c89cc
LP
30 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
31 DEVICE_PLUGGED, /* announced by udev */
6326a423
LP
32 _DEVICE_STATE_MAX,
33 _DEVICE_STATE_INVALID = -1
5cb5a6ff
LP
34} DeviceState;
35
628c89cc
LP
36typedef enum DeviceFound {
37 DEVICE_NOT_FOUND = 0,
38 DEVICE_FOUND_UDEV = 1,
39 DEVICE_FOUND_MOUNT = 2,
40 DEVICE_FOUND_SWAP = 4,
41} DeviceFound;
42
5cb5a6ff 43struct Device {
ac155bb8 44 Unit meta;
5cb5a6ff 45
25ac040b 46 char *sysfs;
628c89cc 47 DeviceFound found;
8fe914ec 48
35b8ca3a 49 /* In order to be able to distinguish dependencies on
8fe914ec
LP
50 different device nodes we might end up creating multiple
51 devices for the same sysfs path. We chain them up here. */
8fe914ec 52 LIST_FIELDS(struct Device, same_sysfs);
7fab9d01 53
f6200941 54 DeviceState state, deserialized_state;
5cb5a6ff
LP
55};
56
87f0e418 57extern const UnitVTable device_vtable;
5cb5a6ff 58
44a6b1b6
ZJS
59const char* device_state_to_string(DeviceState i) _const_;
60DeviceState device_state_from_string(const char *s) _pure_;
628c89cc
LP
61
62int device_found_node(Manager *m, const char *node, bool add, DeviceFound found, bool now);