2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2013-10-13 02:28:21 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-12-14 12:32:33 +01:00
|
|
|
#include "sd-device.h"
|
|
|
|
|
2019-03-09 02:45:15 +01:00
|
|
|
#include "device-private.h"
|
2018-11-13 11:10:13 +01:00
|
|
|
#include "time-util.h"
|
|
|
|
|
2020-12-14 08:45:12 +01:00
|
|
|
#define UDEV_NAME_SIZE 512
|
|
|
|
#define UDEV_PATH_SIZE 1024
|
|
|
|
#define UDEV_LINE_SIZE 16384
|
|
|
|
|
2018-11-13 13:42:42 +01:00
|
|
|
typedef enum ResolveNameTiming {
|
|
|
|
RESOLVE_NAME_NEVER,
|
|
|
|
RESOLVE_NAME_LATE,
|
|
|
|
RESOLVE_NAME_EARLY,
|
|
|
|
_RESOLVE_NAME_TIMING_MAX,
|
|
|
|
_RESOLVE_NAME_TIMING_INVALID = -1,
|
|
|
|
} ResolveNameTiming;
|
|
|
|
|
|
|
|
ResolveNameTiming resolve_name_timing_from_string(const char *s) _pure_;
|
|
|
|
const char *resolve_name_timing_to_string(ResolveNameTiming i) _const_;
|
|
|
|
|
2018-11-13 11:10:13 +01:00
|
|
|
int udev_parse_config_full(
|
|
|
|
unsigned *ret_children_max,
|
|
|
|
usec_t *ret_exec_delay_usec,
|
2018-11-13 11:33:32 +01:00
|
|
|
usec_t *ret_event_timeout_usec,
|
2020-04-09 11:14:25 +02:00
|
|
|
ResolveNameTiming *ret_resolve_name_timing,
|
|
|
|
int *ret_timeout_signal);
|
2018-11-13 11:10:13 +01:00
|
|
|
|
|
|
|
static inline int udev_parse_config(void) {
|
2020-04-09 11:14:25 +02:00
|
|
|
return udev_parse_config_full(NULL, NULL, NULL, NULL, NULL);
|
2018-11-13 11:10:13 +01:00
|
|
|
}
|
2018-12-14 12:32:33 +01:00
|
|
|
|
2020-10-12 18:18:33 +02:00
|
|
|
int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t deadline, sd_device **ret);
|
|
|
|
int device_wait_for_devlink(const char *path, const char *subsystem, usec_t deadline, sd_device **ret);
|
2019-03-04 04:16:46 +01:00
|
|
|
int device_is_renaming(sd_device *dev);
|
2019-03-09 02:45:15 +01:00
|
|
|
bool device_for_action(sd_device *dev, DeviceAction action);
|
2020-10-20 18:38:21 +02:00
|
|
|
|
2020-12-08 14:36:42 +01:00
|
|
|
void log_device_uevent(sd_device *device, const char *str);
|
|
|
|
|
2020-10-20 18:38:21 +02:00
|
|
|
int udev_rule_parse_value(char *str, char **ret_value, char **ret_endpos);
|
2020-12-14 08:11:51 +01:00
|
|
|
size_t udev_replace_whitespace(const char *str, char *to, size_t len);
|
2020-12-14 08:26:13 +01:00
|
|
|
size_t udev_replace_chars(char *str, const char *allow);
|
2020-12-14 08:40:10 +01:00
|
|
|
int udev_resolve_subsys_kernel(const char *string, char *result, size_t maxsize, bool read_value);
|