rpms/udev/devel udevstart2.patch,1.3,1.4
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Thu Dec 15 11:47:31 UTC 2005
- Previous message (by thread): rpms/udev/devel start_udev, 1.46, 1.47 udev.rules, 1.46, 1.47 udev.spec, 1.130, 1.131
- Next message (by thread): rpms/openoffice.org/devel .cvsignore, 1.92, 1.93 openoffice.org-2.0.1.rhXXXXX.extensions.defaulttoevo2.patch, 1.1, 1.2 openoffice.org.spec, 1.589, 1.590 sources, 1.146, 1.147 openoffice.org-2.0.1.rh175242.connectivity.mozab.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: harald
Update of /cvs/dist/rpms/udev/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16657
Added Files:
udevstart2.patch
Log Message:
udevstart2.patch:
udevstart.c | 128 +++++++++++++++++++++++++++++-------------------------------
1 files changed, 62 insertions(+), 66 deletions(-)
Index: udevstart2.patch
===================================================================
RCS file: udevstart2.patch
diff -N udevstart2.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ udevstart2.patch 15 Dec 2005 11:47:26 -0000 1.4
@@ -0,0 +1,198 @@
+--- udev-077/udevstart.c.udevstart2 2005-12-04 03:01:48.000000000 +0100
++++ udev-077/udevstart.c 2005-12-15 11:15:37.000000000 +0100
+@@ -37,6 +37,7 @@
+ #include <sys/wait.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <fcntl.h>
+
+ #include "libsysfs/sysfs/libsysfs.h"
+ #include "udev_libc_wrapper.h"
+@@ -47,9 +48,7 @@
+ #include "udev_rules.h"
+ #include "list.h"
+
+-static const char *udev_run_str;
+ static const char *udev_log_str;
+-static struct udev_rules rules;
+
+ #ifdef USE_LOG
+ void log_message(int priority, const char *format, ...)
+@@ -109,71 +108,27 @@
+ static char *first_list[] = {
+ "/class/mem",
+ "/class/tty",
++ "/bus",
+ NULL,
+ };
+
+ static int add_device(const char *devpath, const char *subsystem)
+ {
+- struct udevice udev;
+- struct sysfs_class_device *class_dev;
+- char path[PATH_SIZE];
+-
+- /* clear and set environment for next event */
+- clearenv();
+- setenv("ACTION", "add", 1);
+- setenv("DEVPATH", devpath, 1);
+- setenv("SUBSYSTEM", subsystem, 1);
+- setenv("UDEV_START", "1", 1);
+- if (udev_log_str)
+- setenv("UDEV_LOG", udev_log_str, 1);
+- if (udev_run_str)
+- setenv("UDEV_RUN", udev_run_str, 1);
+- dbg("add '%s'", devpath);
+-
+- snprintf(path, sizeof(path), "%s%s", sysfs_path, devpath);
+- path[sizeof(path)-1] = '\0';
+- class_dev = sysfs_open_class_device_path(path);
+- if (class_dev == NULL) {
+- dbg("sysfs_open_class_device_path failed");
+- return -1;
+- }
+-
+- udev_init_device(&udev, &class_dev->path[strlen(sysfs_path)], subsystem, "add");
+- udev.devt = get_devt(class_dev);
+- if (!udev.devt && udev.type != DEV_NET) {
+- dbg("sysfs_open_class_device_path failed");
+- return -1;
+- }
+- udev_rules_get_name(&rules, &udev, class_dev);
+- if (udev.ignore_device) {
+- dbg("device event will be ignored");
+- goto exit;
+- }
+- if (udev.name[0] == '\0') {
+- dbg("device node creation supressed");
+- goto run;
+- }
++ char filename[PATH_SIZE];
++ int fd;
+
+- udev_add_device(&udev, class_dev);
+- if (udev.devname[0] != '\0')
+- setenv("DEVNAME", udev.devname, 1);
+-run:
+- if (udev_run && !list_empty(&udev.run_list)) {
+- struct name_entry *name_loop;
+-
+- dbg("executing run list");
+- list_for_each_entry(name_loop, &udev.run_list, node) {
+- if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0)
+- pass_env_to_socket(&name_loop->name[strlen("socket:")], devpath, "add");
+- else
+- run_program(name_loop->name, udev.subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
+- }
+- }
+-exit:
+- sysfs_close_class_device(class_dev);
+- udev_cleanup_device(&udev);
++ snprintf(filename, sizeof(filename), "%s/%s/uevent", sysfs_path, devpath);
++ filename[sizeof(filename)-1] = '\0';
+
+- return 0;
++ dbg("Trigger %s", filename);
++ fd = open(filename, O_WRONLY);
++ if (fd > 0) {
++ write(fd, "add\n", 4);
++ close(fd);
++ }
++ else return 1;
++
++ return 0;
+ }
+
+ static void exec_list(struct list_head *device_list)
+@@ -224,7 +179,7 @@
+ char filename[PATH_SIZE];
+ struct stat statbuf;
+
+- snprintf(filename, sizeof(filename), "%s/dev", path);
++ snprintf(filename, sizeof(filename), "%s/uevent", path);
+ filename[sizeof(filename)-1] = '\0';
+
+ if (stat(filename, &statbuf) == 0)
+@@ -281,6 +236,50 @@
+ }
+ }
+
++static void udev_scan_bus(struct list_head *device_list)
++{
++ char base[PATH_SIZE];
++ DIR *dir;
++ struct dirent *dent;
++
++ snprintf(base, sizeof(base), "%s/bus", sysfs_path);
++ base[sizeof(base)-1] = '\0';
++
++ dir = opendir(base);
++ if (dir != NULL) {
++ for (dent = readdir(dir); dent != NULL; dent = readdir(dir)) {
++ char dirname[PATH_SIZE];
++ DIR *dir2;
++ struct dirent *dent2;
++
++ if (dent->d_name[0] == '.')
++ continue;
++
++ snprintf(dirname, sizeof(dirname), "%s/%s/devices", base, dent->d_name);
++ dirname[sizeof(dirname)-1] = '\0';
++
++ dir2 = opendir(dirname);
++ if (dir2 != NULL) {
++ for (dent2 = readdir(dir2); dent2 != NULL; dent2 = readdir(dir2)) {
++ char dirname2[PATH_SIZE];
++
++ if (dent2->d_name[0] == '.')
++ continue;
++
++ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
++ dirname2[sizeof(dirname2)-1] = '\0';
++
++ if (has_devt(dirname2))
++ device_list_insert(dirname2, dent->d_name, device_list);
++ }
++ closedir(dir2);
++ }
++ }
++ closedir(dir);
++ }
++}
++
++
+ static void udev_scan_class(struct list_head *device_list)
+ {
+ char base[PATH_SIZE];
+@@ -314,7 +313,7 @@
+ snprintf(dirname2, sizeof(dirname2), "%s/%s", dirname, dent2->d_name);
+ dirname2[sizeof(dirname2)-1] = '\0';
+
+- if (has_devt(dirname2) || strcmp(dent->d_name, "net") == 0)
++ if (has_devt(dirname2))
+ device_list_insert(dirname2, dent->d_name, device_list);
+ }
+ closedir(dir2);
+@@ -344,7 +343,6 @@
+ udev_init_config();
+ dbg("version %s", UDEV_VERSION);
+
+- udev_run_str = getenv("UDEV_RUN");
+ udev_log_str = getenv("UDEV_LOG");
+
+ /* disable all logging if not explicitely requested */
+@@ -363,13 +361,11 @@
+ /* trigger timeout to prevent hanging processes */
+ alarm(UDEV_ALARM_TIMEOUT);
+
+- udev_rules_init(&rules, 1);
+-
++ udev_scan_bus(&device_list);
+ udev_scan_class(&device_list);
+ udev_scan_block(&device_list);
+ exec_list(&device_list);
+
+- udev_rules_close(&rules);
+ logging_close();
+ return 0;
+ }
- Previous message (by thread): rpms/udev/devel start_udev, 1.46, 1.47 udev.rules, 1.46, 1.47 udev.spec, 1.130, 1.131
- Next message (by thread): rpms/openoffice.org/devel .cvsignore, 1.92, 1.93 openoffice.org-2.0.1.rhXXXXX.extensions.defaulttoevo2.patch, 1.1, 1.2 openoffice.org.spec, 1.589, 1.590 sources, 1.146, 1.147 openoffice.org-2.0.1.rh175242.connectivity.mozab.patch, 1.1, NONE
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-cvs-commits
mailing list