Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
udev
0028-udev-re-initialize-builtins-in-the-daemon-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0028-udev-re-initialize-builtins-in-the-daemon-process-no.patch of Package udev
From 7781e063e8e9d3e92e4e158e1588b885808cda24 Mon Sep 17 00:00:00 2001 From: Kay Sievers <kay@vrfy.org> Date: Wed, 8 Aug 2012 16:27:11 +0200 Subject: [PATCH] udev: re-initialize builtins in the daemon process, not in the worker Index: udev-182/src/udev-builtin-kmod.c =================================================================== --- udev-182.orig/src/udev-builtin-kmod.c +++ udev-182/src/udev-builtin-kmod.c @@ -23,6 +23,7 @@ #include <stdarg.h> #include <unistd.h> #include <string.h> +#include <assert.h> #include <errno.h> #include <fcntl.h> #include <sys/stat.h> @@ -39,6 +40,8 @@ static int load_module(struct udev *udev struct kmod_list *l; int err; + assert(ctx); + err = kmod_module_new_from_lookup(ctx, alias, &list); if (err < 0) return err; @@ -76,16 +79,6 @@ static int builtin_kmod(struct udev_devi struct udev *udev = udev_device_get_udev(dev); int i; - if (!ctx) { - ctx = kmod_new(NULL, NULL); - if (!ctx) - return -ENOMEM; - - info(udev, "load module index\n"); - kmod_set_log_fn(ctx, udev_kmod_log, udev); - kmod_load_resources(ctx); - } - if (argc < 3 || strcmp(argv[1], "load")) { err(udev, "expect: %s load <module>\n", argv[0]); return EXIT_FAILURE; @@ -99,7 +92,7 @@ static int builtin_kmod(struct udev_devi return EXIT_SUCCESS; } -/* called at udev startup */ +/* called at udev startup and reload */ static int builtin_kmod_init(struct udev *udev) { if (ctx) @@ -126,9 +119,9 @@ static void builtin_kmod_exit(struct ude static bool builtin_kmod_validate(struct udev *udev) { info(udev, "validate module index\n"); - if (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK) - return true; - return false; + if (!ctx) + return false; + return (kmod_validate_resources(ctx) != KMOD_RESOURCES_OK); } const struct udev_builtin udev_builtin_kmod = { Index: udev-182/src/udev-builtin.c =================================================================== --- udev-182.orig/src/udev-builtin.c +++ udev-182/src/udev-builtin.c @@ -25,6 +25,8 @@ #include "udev.h" +static bool initialized; + static const struct udev_builtin *builtins[] = { [UDEV_BUILTIN_BLKID] = &udev_builtin_blkid, [UDEV_BUILTIN_FIRMWARE] = &udev_builtin_firmware, @@ -39,7 +41,10 @@ static const struct udev_builtin *builti int udev_builtin_init(struct udev *udev) { unsigned int i; - int err; + int err = 0; + + if (initialized) + return 0; for (i = 0; i < ARRAY_SIZE(builtins); i++) { if (builtins[i]->init) { @@ -48,6 +53,8 @@ int udev_builtin_init(struct udev *udev) break; } } + + initialized = true; return err; } @@ -55,9 +62,14 @@ void udev_builtin_exit(struct udev *udev { unsigned int i; + if (!initialized) + return; + for (i = 0; i < ARRAY_SIZE(builtins); i++) if (builtins[i]->exit) builtins[i]->exit(udev); + + initialized = false; } bool udev_builtin_validate(struct udev *udev) Index: udev-182/src/udevd.c =================================================================== --- udev-182.orig/src/udevd.c +++ udev-182/src/udevd.c @@ -1670,7 +1670,7 @@ int main(int argc, char *argv[]) worker_kill(udev, 0); rules = udev_rules_unref(rules); udev_builtin_exit(udev); - reload = 0; + reload = false; } /* event has finished */ @@ -1692,6 +1692,7 @@ int main(int argc, char *argv[]) /* start new events */ if (!udev_list_node_is_empty(&event_list) && !udev_exit && !stop_exec_queue) { + udev_builtin_init(udev); if (rules == NULL) rules = udev_rules_new(udev, resolve_names); if (rules != NULL)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor