summaryrefslogtreecommitdiff
path: root/udev/udevd.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-10-18 15:02:01 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-10-18 15:02:01 +0200
commitd7ddce186c8a0171eb98862b6f8ff72d64261b33 (patch)
treeddacebf3401680c0e5da78132c3c7ed03b23519f /udev/udevd.c
parentc7521974a39bcb68f313a324b8ec60ec11fed3d8 (diff)
make struct udev_rules opaque
Diffstat (limited to 'udev/udevd.c')
-rw-r--r--udev/udevd.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/udev/udevd.c b/udev/udevd.c
index 5388961c42..918825ae50 100644
--- a/udev/udevd.c
+++ b/udev/udevd.c
@@ -58,7 +58,7 @@ static void log_fn(struct udev *udev, int priority,
}
static int debug_trace;
-static struct udev_rules rules;
+static struct udev_rules *rules;
static struct udev_ctrl *udev_ctrl;
static struct udev_monitor *kernel_monitor;
static int inotify_fd = -1;
@@ -208,7 +208,7 @@ static void event_fork(struct udev_event *event)
alarm(UDEV_EVENT_TIMEOUT);
/* apply rules, create node, symlinks */
- err = udev_event_run(event, &rules);
+ err = udev_event_run(event, rules);
/* rules may change/disable the timeout */
if (udev_device_get_event_timeout(event->dev) >= 0)
@@ -748,9 +748,13 @@ int main(int argc, char *argv[])
goto exit;
}
+ rules = udev_rules_new(udev, 1);
+ if (rules == NULL) {
+ err(udev, "error reading rules\n");
+ goto exit;
+ }
udev_list_init(&running_list);
udev_list_init(&exec_list);
- udev_rules_init(udev, &rules, 1);
export_initial_seqnum(udev);
if (daemonize) {
@@ -934,9 +938,14 @@ int main(int argc, char *argv[])
/* rules changed, set by inotify or a HUP signal */
if (reload_config) {
+ struct udev_rules *rules_new;
+
reload_config = 0;
- udev_rules_cleanup(&rules);
- udev_rules_init(udev, &rules, 1);
+ rules_new = udev_rules_new(udev, 1);
+ if (rules_new != NULL) {
+ udev_rules_unref(rules);
+ rules = rules_new;
+ }
}
if (sigchilds_waiting) {
@@ -953,7 +962,7 @@ int main(int argc, char *argv[])
rc = 0;
exit:
- udev_rules_cleanup(&rules);
+ udev_rules_unref(rules);
if (signal_pipe[READ_END] >= 0)
close(signal_pipe[READ_END]);