]> err.no Git - systemd/commitdiff
udev_rules_run() -> udev_event_execute_run();
authorKay Sievers <kay.sievers@vrfy.org>
Sat, 18 Oct 2008 13:50:16 +0000 (15:50 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Sat, 18 Oct 2008 13:50:16 +0000 (15:50 +0200)
udev/test-udev.c
udev/udev-event.c
udev/udev-rules.c
udev/udev.h
udev/udevd.c

index d304a1cc159a96ea8ac5a7a1fb2f4708440c4ada..1cc83c4a694886ef0cae01c3eceeb5f951abc507 100644 (file)
@@ -104,7 +104,7 @@ int main(int argc, char *argv[])
                alarm(udev_device_get_event_timeout(dev));
 
        if (err == 0 && !event->ignore_device && udev_get_run(udev))
-               udev_rules_run(event);
+               udev_event_execute_run(event);
 
        udev_event_unref(event);
        udev_device_unref(dev);
index fe4dcec4e1dcf0dadcfe066af70376f65e3fd8ba..b7c3ff142ac15a714918362710304927e37ee761 100644 (file)
@@ -282,3 +282,36 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules)
 exit:
        return err;
 }
+
+int udev_event_execute_run(struct udev_event *event)
+{
+       struct udev_list_entry *list_entry;
+       int err = 0;
+
+       dbg(event->udev, "executing run list\n");
+       udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) {
+               const char *cmd = udev_list_entry_get_name(list_entry);
+
+               if (strncmp(cmd, "socket:", strlen("socket:")) == 0) {
+                       struct udev_monitor *monitor;
+
+                       monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]);
+                       if (monitor == NULL)
+                               continue;
+                       udev_monitor_send_device(monitor, event->dev);
+                       udev_monitor_unref(monitor);
+               } else {
+                       char program[UTIL_PATH_SIZE];
+                       char **envp;
+
+                       util_strlcpy(program, cmd, sizeof(program));
+                       udev_rules_apply_format(event, program, sizeof(program));
+                       envp = udev_device_get_properties_envp(event->dev);
+                       if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) {
+                               if (!udev_list_entry_get_flag(list_entry))
+                                       err = -1;
+                       }
+               }
+       }
+       return err;
+}
index 62624bbc8525469e4ec0a435591f6f007c8f08f7..978581fb502a0b21ba84420eaf58a9eae31b2beb 100644 (file)
@@ -374,39 +374,6 @@ static int import_parent_into_env(struct udev_device *dev, const char *filter)
        return 0;
 }
 
-int udev_rules_run(struct udev_event *event)
-{
-       struct udev_list_entry *list_entry;
-       int err = 0;
-
-       dbg(event->udev, "executing run list\n");
-       udev_list_entry_foreach(list_entry, udev_list_get_entry(&event->run_list)) {
-               const char *cmd = udev_list_entry_get_name(list_entry);
-
-               if (strncmp(cmd, "socket:", strlen("socket:")) == 0) {
-                       struct udev_monitor *monitor;
-
-                       monitor = udev_monitor_new_from_socket(event->udev, &cmd[strlen("socket:")]);
-                       if (monitor == NULL)
-                               continue;
-                       udev_monitor_send_device(monitor, event->dev);
-                       udev_monitor_unref(monitor);
-               } else {
-                       char program[UTIL_PATH_SIZE];
-                       char **envp;
-
-                       util_strlcpy(program, cmd, sizeof(program));
-                       udev_rules_apply_format(event, program, sizeof(program));
-                       envp = udev_device_get_properties_envp(event->dev);
-                       if (run_program(event->udev, program, envp, NULL, 0, NULL) != 0) {
-                               if (!udev_list_entry_get_flag(list_entry))
-                                       err = -1;
-                       }
-               }
-       }
-       return err;
-}
-
 #define WAIT_LOOP_PER_SECOND           50
 static int wait_for_file(struct udev_event *event, const char *file, int timeout)
 {
index d0ffb6cb3119f9fe9d8c4aab3feb34e4bb0f25b4..c8425f768f8c9f83d3f95688bf46c4fc008c2904 100644 (file)
@@ -90,13 +90,13 @@ struct udev_rules;
 extern struct udev_event *udev_event_new(struct udev_device *dev);
 extern void udev_event_unref(struct udev_event *event);
 extern int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules);
+extern int udev_event_execute_run(struct udev_event *event);
 
 /* udev-rules.c */
 extern struct udev_rules *udev_rules_new(struct udev *udev, int resolve_names);
 extern void udev_rules_unref(struct udev_rules *rules);
 extern int udev_rules_get_name(struct udev_rules *rules, struct udev_event *event);
 extern int udev_rules_get_run(struct udev_rules *rules, struct udev_event *event);
-extern int udev_rules_run(struct udev_event *event);
 extern void udev_rules_apply_format(struct udev_event *event, char *string, size_t maxsize);
 
 /* udev-node.c */
index 111f1200062de5d05f3a191323654edd5b2025d7..f812940364423dc6179220faed4c03f81de7be0c 100644 (file)
@@ -220,7 +220,7 @@ static void event_fork(struct udev_event *event)
 
                /* execute RUN= */
                if (err == 0 && !event->ignore_device && udev_get_run(event->udev))
-                       udev_rules_run(event);
+                       udev_event_execute_run(event);
                info(event->udev, "seq %llu exit with %i\n", udev_device_get_seqnum(event->dev), err);
                logging_close();
                if (err != 0)