chiark / gitweb /
udev: use container_of() macro
[elogind.git] / src / udev / collect / collect.c
index 076fe479e22720758879b2c16628aa9558c31e9c..777542979a174ab37f7bb696d190b4c9dbb78b98 100644 (file)
@@ -55,13 +55,9 @@ static int debug;
 /* This can increase dynamically */
 static size_t bufsize = BUFSIZE;
 
-static struct _mate *node_to_mate(struct udev_list_node *node)
+static inline struct _mate *node_to_mate(struct udev_list_node *node)
 {
-        char *mate;
-
-        mate = (char *)node;
-        mate -= offsetof(struct _mate, node);
-        return (struct _mate *)mate;
+        return container_of(node, struct _mate, node);
 }
 
 static void sig_alrm(int signo)
@@ -405,7 +401,7 @@ int main(int argc, char **argv)
         if (debug)
                 fprintf(stderr, "Using checkpoint '%s'\n", checkpoint);
 
-        util_strscpyl(tmpdir, sizeof(tmpdir), udev_get_run_path(udev), "/collect", NULL);
+        util_strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL);
         fd = prepare(tmpdir, checkpoint);
         if (fd < 0) {
                 ret = 3;