mirror of
https://github.com/systemd/systemd
synced 2024-07-24 03:36:24 +00:00
udev: split out check that udev property can be updated
This commit is contained in:
parent
3e00171dcd
commit
513ca8b6f0
|
@ -10,6 +10,7 @@
|
|||
#include "alloc-util.h"
|
||||
#include "log.h"
|
||||
#include "macro.h"
|
||||
#include "strv.h"
|
||||
|
||||
#define device_unref_and_replace(a, b) \
|
||||
unref_and_replace_full(a, b, sd_device_ref, sd_device_unref)
|
||||
|
@ -105,3 +106,10 @@ char** device_make_log_fields(sd_device *device);
|
|||
|
||||
bool device_in_subsystem(sd_device *device, const char *subsystem);
|
||||
bool device_is_devtype(sd_device *device, const char *devtype);
|
||||
|
||||
static inline bool device_property_can_set(const char *property) {
|
||||
return property &&
|
||||
!STR_IN_SET(property,
|
||||
"ACTION", "DEVLINKS", "DEVNAME", "DEVPATH", "DEVTYPE", "DRIVER",
|
||||
"IFINDEX", "MAJOR", "MINOR", "SEQNUM", "SUBSYSTEM", "TAGS");
|
||||
}
|
||||
|
|
|
@ -691,9 +691,7 @@ static int parse_token(UdevRuleLine *rule_line, const char *key, char *attr, Ude
|
|||
}
|
||||
|
||||
if (!is_match) {
|
||||
if (STR_IN_SET(attr,
|
||||
"ACTION", "DEVLINKS", "DEVNAME", "DEVPATH", "DEVTYPE", "DRIVER",
|
||||
"IFINDEX", "MAJOR", "MINOR", "SEQNUM", "SUBSYSTEM", "TAGS"))
|
||||
if (!device_property_can_set(attr))
|
||||
return log_line_error_errno(rule_line, SYNTHETIC_ERRNO(EINVAL),
|
||||
"Invalid ENV attribute. '%s' cannot be set.", attr);
|
||||
|
||||
|
|
Loading…
Reference in a new issue