mirror of
https://github.com/systemd/systemd
synced 2024-09-06 16:56:43 +00:00
udev-util: rename device_is_processing() -> device_is_processed()
And make it also check the existence of the udev database.
This commit is contained in:
parent
2aef0ac819
commit
3df2b4557a
|
@ -1630,9 +1630,9 @@ static int link_check_initialized(Link *link) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = sd_device_get_is_initialized(device);
|
||||
r = device_is_processed(device);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Could not determine whether the device is initialized: %m");
|
||||
return log_link_warning_errno(link, r, "Could not determine whether the device is processed by udevd: %m");
|
||||
if (r == 0) {
|
||||
/* not yet ready */
|
||||
log_link_debug(link, "link pending udev initialization...");
|
||||
|
@ -1647,14 +1647,6 @@ static int link_check_initialized(Link *link) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
r = device_is_processing(device);
|
||||
if (r < 0)
|
||||
return log_link_warning_errno(link, r, "Failed to determine whether the device is being processed: %m");
|
||||
if (r > 0) {
|
||||
log_link_debug(link, "Interface is being processed by udevd, pending initialization.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return link_initialized(link, device);
|
||||
}
|
||||
|
||||
|
|
|
@ -237,16 +237,27 @@ int device_is_renaming(sd_device *dev) {
|
|||
return r;
|
||||
}
|
||||
|
||||
int device_is_processing(sd_device *dev) {
|
||||
int device_is_processed(sd_device *dev) {
|
||||
int r;
|
||||
|
||||
assert(dev);
|
||||
|
||||
/* sd_device_get_is_initialized() only checks if the udev database file exists. However, even if the
|
||||
* database file exist, systemd-udevd may be still processing the device, e.g. when the udev rules
|
||||
* for the device have RUN tokens. See issue #30056. Hence, to check if the device is really
|
||||
* processed by systemd-udevd, we also need to read ID_PROCESSING property. */
|
||||
|
||||
r = sd_device_get_is_initialized(dev);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = device_get_property_bool(dev, "ID_PROCESSING");
|
||||
if (r == -ENOENT)
|
||||
return false; /* defaults to false */
|
||||
return true; /* If the property does not exist, then it means that the device is processed. */
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return r;
|
||||
return !r;
|
||||
}
|
||||
|
||||
bool device_for_action(sd_device *dev, sd_device_action_t a) {
|
||||
|
|
|
@ -13,7 +13,7 @@ int udev_parse_config(void);
|
|||
int device_wait_for_initialization(sd_device *device, const char *subsystem, usec_t timeout_usec, sd_device **ret);
|
||||
int device_wait_for_devlink(const char *path, const char *subsystem, usec_t timeout_usec, sd_device **ret);
|
||||
int device_is_renaming(sd_device *dev);
|
||||
int device_is_processing(sd_device *dev);
|
||||
int device_is_processed(sd_device *dev);
|
||||
|
||||
bool device_for_action(sd_device *dev, sd_device_action_t action);
|
||||
|
||||
|
|
Loading…
Reference in a new issue