[systemd-commits] 2 commits - src/libudev src/udev
Tom Gundersen
tomegun at kemper.freedesktop.org
Mon Mar 9 15:37:19 PDT 2015
src/libudev/libudev-device.c | 43 +++++++++++++++++++-----------------------
src/libudev/libudev-private.h | 2 -
src/udev/udev-builtin.c | 7 ------
src/udev/udev-event.c | 8 ++-----
src/udev/udev-rules.c | 1
5 files changed, 25 insertions(+), 36 deletions(-)
New commits:
commit b94da8cf72aa363582e0acae134d45c88d13bc75
Author: Tom Gundersen <teg at jklm.no>
Date: Thu Mar 5 18:08:50 2015 +0100
libudev: add missing hunks
This should have been committed with
udev_device_add_property - implicitly mark properties for saving to db
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c
index d2aec1b..fabc653 100644
--- a/src/udev/udev-builtin.c
+++ b/src/udev/udev-builtin.c
@@ -123,12 +123,7 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c
}
int udev_builtin_add_property(struct udev_device *dev, bool test, const char *key, const char *val) {
- 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);
if (test)
printf("%s=%s\n", key, val);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index 7d0d98c..67fb1f7 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -824,13 +824,11 @@ void udev_event_execute_rules(struct udev_event *event,
for ((entry = udev_device_get_properties_list_entry(event->dev_db)); entry; entry = udev_list_entry_get_next(entry)) {
const char *key, *value;
- struct udev_list_entry *property;
key = udev_list_entry_get_name(entry);
value = udev_list_entry_get_value(entry);
- property = udev_device_add_property(dev, key, value);
- udev_list_entry_set_num(property, true);
+ udev_device_add_property(dev, key, value);
}
}
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 2420913..e8387d7 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -555,7 +555,6 @@ static int import_property_from_string(struct udev_device *dev, char *line) {
char *key;
char *val;
size_t len;
- struct udev_list_entry *entry;
/* find key */
key = line;
commit 570b83cc62067f518c119e4803b4f234d1f0f01c
Author: Tom Gundersen <teg at jklm.no>
Date: Mon Mar 9 23:22:43 2015 +0100
libudev: udev_device_read_db - drop unused argument
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index a7647b9..242a0d8 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -565,30 +565,27 @@ _public_ const char *udev_device_get_property_value(struct udev_device *udev_dev
return udev_list_entry_get_value(list_entry);
}
-int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
+int udev_device_read_db(struct udev_device *udev_device)
{
char filename[UTIL_PATH_SIZE];
char line[UTIL_LINE_SIZE];
+ const char *id;
FILE *f;
- /* providing a database file will always force-load it */
- if (dbfile == NULL) {
- const char *id;
+ if (udev_device->db_loaded)
+ return 0;
- if (udev_device->db_loaded)
- return 0;
- udev_device->db_loaded = true;
+ udev_device->db_loaded = true;
- id = udev_device_get_id_filename(udev_device);
- if (id == NULL)
- return -1;
- strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
- dbfile = filename;
- }
+ id = udev_device_get_id_filename(udev_device);
+ if (id == NULL)
+ return -1;
- f = fopen(dbfile, "re");
+ strscpyl(filename, sizeof(filename), "/run/udev/data/", id, NULL);
+
+ f = fopen(filename, "re");
if (f == NULL)
- return log_debug_errno(errno, "no db file to read %s: %m", dbfile);
+ return log_debug_errno(errno, "no db file to read %s: %m", filename);
/* devices with a database entry are initialized */
udev_device->is_initialized = true;
@@ -1306,7 +1303,7 @@ _public_ struct udev_list_entry *udev_device_get_devlinks_list_entry(struct udev
if (udev_device == NULL)
return NULL;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_list_get_entry(&udev_device->devlinks_list);
}
@@ -1334,7 +1331,7 @@ _public_ struct udev_list_entry *udev_device_get_properties_list_entry(struct ud
return NULL;
if (!udev_device->info_loaded) {
udev_device_read_uevent_file(udev_device);
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
}
if (!udev_device->devlinks_uptodate) {
char symlinks[UTIL_PATH_SIZE];
@@ -1407,7 +1404,7 @@ _public_ unsigned long long int udev_device_get_usec_since_initialized(struct ud
if (udev_device == NULL)
return 0;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
if (udev_device->usec_initialized == 0)
return 0;
now_ts = now(CLOCK_MONOTONIC);
@@ -1736,7 +1733,7 @@ const char *udev_device_get_id_filename(struct udev_device *udev_device)
_public_ int udev_device_get_is_initialized(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->is_initialized;
}
@@ -1796,7 +1793,7 @@ _public_ struct udev_list_entry *udev_device_get_tags_list_entry(struct udev_dev
if (udev_device == NULL)
return NULL;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_list_get_entry(&udev_device->tags_list);
}
@@ -1816,7 +1813,7 @@ _public_ int udev_device_has_tag(struct udev_device *udev_device, const char *ta
if (udev_device == NULL)
return false;
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
list_entry = udev_device_get_tags_list_entry(udev_device);
if (udev_list_entry_get_by_name(list_entry, tag) != NULL)
return true;
@@ -1905,7 +1902,7 @@ int udev_device_set_action(struct udev_device *udev_device, const char *action)
int udev_device_get_devlink_priority(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->devlink_priority;
}
@@ -1918,7 +1915,7 @@ int udev_device_set_devlink_priority(struct udev_device *udev_device, int prio)
int udev_device_get_watch_handle(struct udev_device *udev_device)
{
if (!udev_device->info_loaded)
- udev_device_read_db(udev_device, NULL);
+ udev_device_read_db(udev_device);
return udev_device->watch_handle;
}
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index f6b641a..9153e67 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -48,7 +48,7 @@ void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
int udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
char **udev_device_get_properties_envp(struct udev_device *udev_device);
ssize_t udev_device_get_properties_monitor_buf(struct udev_device *udev_device, const char **buf);
-int udev_device_read_db(struct udev_device *udev_device, const char *dbfile);
+int udev_device_read_db(struct udev_device *udev_device);
int udev_device_read_uevent_file(struct udev_device *udev_device);
int udev_device_set_action(struct udev_device *udev_device, const char *action);
const char *udev_device_get_devpath_old(struct udev_device *udev_device);
diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c
index e5a5175..7d0d98c 100644
--- a/src/udev/udev-event.c
+++ b/src/udev/udev-event.c
@@ -793,7 +793,7 @@ void udev_event_execute_rules(struct udev_event *event,
return;
if (streq(udev_device_get_action(dev), "remove")) {
- udev_device_read_db(dev, NULL);
+ udev_device_read_db(dev);
udev_device_delete_db(dev);
udev_device_tag_index(dev, NULL, false);
@@ -810,7 +810,7 @@ void udev_event_execute_rules(struct udev_event *event,
} else {
event->dev_db = udev_device_shallow_clone(dev);
if (event->dev_db != NULL) {
- udev_device_read_db(event->dev_db, NULL);
+ udev_device_read_db(event->dev_db);
udev_device_set_info_loaded(event->dev_db);
/* disable watch during event processing */
More information about the systemd-commits
mailing list