summaryrefslogtreecommitdiff
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-03-18 19:38:08 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-03-18 19:56:01 -0400
commit5c3965d1a89539ad6042bbfdcc844fc9ed8aa379 (patch)
tree07ea294763228c5a0ae10b16568ca65b48811a65 /src/udev/udev-rules.c
parentced0d2419e3fc88e29f8076363deb4214b87f0f2 (diff)
libudev: udev_device_add_property - implicitly mark properties for saving to db
Note: We also ported touch() and touch_file() from upstream. -AGB. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c35
1 files changed, 8 insertions, 27 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 54c865f143..5bf66fb8ce 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -611,10 +611,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) {
val++;
}
- entry = udev_device_add_property(dev, key, val);
- /* store in db, skip private keys */
- if (key[0] != '.')
- udev_list_entry_set_num(entry, true);
+ udev_device_add_property(dev, key, val);
return 0;
}
@@ -675,12 +672,7 @@ static int import_parent_into_properties(struct udev_device *dev, const char *fi
const char *val = udev_list_entry_get_value(list_entry);
if (fnmatch(filter, key, 0) == 0) {
- struct udev_list_entry *entry;
-
- entry = udev_device_add_property(dev, key, val);
- /* store in db, skip private keys */
- if (key[0] != '.')
- udev_list_entry_set_num(entry, true);
+ udev_device_add_property(dev, key, val);
}
}
return 0;
@@ -2172,12 +2164,9 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
const char *value;
value = udev_device_get_property_value(event->dev_db, key);
- if (value != NULL) {
- struct udev_list_entry *entry;
-
- entry = udev_device_add_property(event->dev, key, value);
- udev_list_entry_set_num(entry, true);
- } else {
+ if (value != NULL)
+ udev_device_add_property(event->dev, key, value);
+ else {
if (cur->key.op != OP_NOMATCH)
goto nomatch;
}
@@ -2197,13 +2186,10 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
pos = strstr(cmdline, key);
if (pos != NULL) {
- struct udev_list_entry *entry;
-
pos += strlen(key);
if (pos[0] == '\0' || isspace(pos[0])) {
/* we import simple flags as 'FLAG=1' */
- entry = udev_device_add_property(event->dev, key, "1");
- udev_list_entry_set_num(entry, true);
+ udev_device_add_property(event->dev, key, "1");
imported = true;
} else if (pos[0] == '=') {
const char *value;
@@ -2213,8 +2199,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
while (pos[0] != '\0' && !isspace(pos[0]))
pos++;
pos[0] = '\0';
- entry = udev_device_add_property(event->dev, key, value);
- udev_list_entry_set_num(entry, true);
+ udev_device_add_property(event->dev, key, value);
imported = true;
}
}
@@ -2387,7 +2372,6 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
char *value = rules_str(rules, cur->key.value_off);
char value_new[UTIL_NAME_SIZE];
const char *value_old = NULL;
- struct udev_list_entry *entry;
if (value[0] == '\0') {
if (cur->key.op == OP_ADD)
@@ -2407,10 +2391,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules,
} else
udev_event_apply_format(event, value, value_new, sizeof(value_new));
- entry = udev_device_add_property(event->dev, name, value_new);
- /* store in db, skip private keys */
- if (name[0] != '.')
- udev_list_entry_set_num(entry, true);
+ udev_device_add_property(event->dev, name, value_new);
break;
}
case TK_A_TAG: {