util: introduce device_for_action()
It will be used in later commits.
This commit is contained in:
@@ -181,3 +181,14 @@ int device_is_renaming(sd_device *dev) {
|
||||
|
||||
return r >= 0;
|
||||
}
|
||||
|
||||
bool device_for_action(sd_device *dev, DeviceAction action) {
|
||||
DeviceAction a;
|
||||
|
||||
assert(dev);
|
||||
|
||||
if (device_get_action(dev, &a) < 0)
|
||||
return false;
|
||||
|
||||
return a == action;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "sd-device.h"
|
||||
|
||||
#include "device-private.h"
|
||||
#include "time-util.h"
|
||||
|
||||
typedef enum ResolveNameTiming {
|
||||
@@ -28,3 +29,4 @@ static inline int udev_parse_config(void) {
|
||||
|
||||
int device_wait_for_initialization(sd_device *device, const char *subsystem, sd_device **ret);
|
||||
int device_is_renaming(sd_device *dev);
|
||||
bool device_for_action(sd_device *dev, DeviceAction action);
|
||||
|
||||
Reference in New Issue
Block a user