1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

core/device: use udev_available()

This commit is contained in:
Yu Watanabe 2022-04-28 22:01:12 +09:00
parent 4212fa83d6
commit f374631a56

View File

@ -946,18 +946,6 @@ static int device_dispatch_io(sd_device_monitor *monitor, sd_device *dev, void *
return 0;
}
static bool device_supported(void) {
static int read_only = -1;
/* If /sys is read-only we don't support device units, and any
* attempts to start one should fail immediately. */
if (read_only < 0)
read_only = path_is_read_only_fs("/sys");
return read_only <= 0;
}
static int validate_node(Manager *m, const char *node, sd_device **ret) {
struct stat st;
int r;
@ -1003,7 +991,7 @@ void device_found_node(Manager *m, const char *node, DeviceFound found, DeviceFo
assert(m);
assert(node);
if (!device_supported())
if (!udev_available())
return;
if (mask == 0)
@ -1073,7 +1061,7 @@ const UnitVTable device_vtable = {
.enumerate = device_enumerate,
.shutdown = device_shutdown,
.supported = device_supported,
.supported = udev_available,
.status_message_formats = {
.starting_stopping = {