summaryrefslogtreecommitdiff
path: root/src/libudev/path-util.c
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2014-01-11 20:21:43 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-01-11 20:21:43 -0500
commit9df52d1915b56d5d83cacf834b02d98dadf3bb2e (patch)
tree994e8b8db64f1f4a875bf875a7f8ce8a2d4057fb /src/libudev/path-util.c
parent1e60f44be995edf571ece7a11dac2a7333d47096 (diff)
src/udev/path-util.[ch]: remove duplicates
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/libudev/path-util.c')
-rw-r--r--src/libudev/path-util.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libudev/path-util.c b/src/libudev/path-util.c
index 417450f283..616577088c 100644
--- a/src/libudev/path-util.c
+++ b/src/libudev/path-util.c
@@ -331,3 +331,34 @@ fallback:
return a.st_dev != b.st_dev;
}
+
+bool paths_check_timestamp(char **paths, usec_t *paths_ts_usec, bool update)
+{
+ unsigned int i;
+ bool changed = false;
+
+ if (paths == NULL)
+ goto out;
+
+ for (i = 0; paths[i]; i++) {
+ struct stat stats;
+
+ if (stat(paths[i], &stats) < 0)
+ continue;
+
+ if (paths_ts_usec[i] == timespec_load(&stats.st_mtim))
+ continue;
+
+ /* first check */
+ if (paths_ts_usec[i] != 0) {
+ log_debug("reload - timestamp of '%s' changed\n", paths[i]);
+ changed = true;
+ }
+
+ /* update timestamp */
+ if (update)
+ paths_ts_usec[i] = timespec_load(&stats.st_mtim);
+ }
+out:
+ return changed;
+}