Compare commits

...
This repository has been archived on 2026-09-10. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.

16 commits

Author SHA1 Message Date
Fedora Release Engineering
97b330deca dist-git conversion 2010-07-29 14:37:23 +00:00
33d57e6374 added patch 2007-11-02 13:55:11 +00:00
2f5badf034 - fixed preun chkconfig
- added /sbin path to chkconfig in post section
- patch: do not generate net rules for type > 256
- fixes glitches appearing in bz#323991
- sparc64 requires -fPIE not -fpie
- version 116
2007-11-02 13:51:15 +00:00
f9d64c11de - added upstream patch for rhbz#328691
- moved floppy module loading to pnp-alias in /etc/modprobe.d/floppy-pnp
Wed Oct 10 2007 Harald Hoyer <harald@redhat.com> 115-5.20070921git
- better modprobe options for the kernel command line 'modprobedebug'
    option
2007-10-12 12:13:18 +00:00
0959955b70 sort changeloG 2007-10-01 11:14:52 +00:00
4aea0d658a sort changeloG 2007-10-01 11:13:39 +00:00
b2f2f346f0 new F7 kernels seem to require a udev update 2007-10-01 11:10:28 +00:00
2958370d13 - removed /dev/tape symlink, because it's now a directory (bug #251755) 2007-08-24 10:41:53 +00:00
7ea57a9c4b - readded firmware rule (#252983) 2007-08-16 14:11:35 +00:00
50092af1c4 - do not run vol_id on non-partition block devices (bug #251401)
- read all multiline pnp modaliases again
2007-08-15 08:17:50 +00:00
5e416af7f7 - added lp* to 50-udev.nodes (#251272) 2007-08-08 11:05:41 +00:00
0347dc6a92 - removed "noreplace" config tag from rules (#250043) 2007-07-30 16:33:59 +00:00
3c645a8b05 new kernels in F-7 need new rules 2007-07-27 19:07:47 +00:00
7d33f5b01b new kernels in F-7 need new rules 2007-07-27 17:57:52 +00:00
aa90da26c9 - fixed modprobedebug option
- removed snd-powermac from the default modules (#200585)
2007-06-26 12:59:34 +00:00
Bill Nottingham
26ede2790d Initialize branch F-7 for udev 2007-05-18 10:47:06 +00:00
25 changed files with 307 additions and 1331 deletions

View file

View file

@ -1,7 +0,0 @@
# Makefile for source rpm: udev
# $Id: Makefile,v 1.1 2004/09/09 13:42:32 cvsdist Exp $
NAME := udev
SPECFILE = $(firstword $(wildcard *.spec))
UPSTREAM_CHECKS = sign
include ../common/Makefile.common

25
fw_unit_symlinks.sh Normal file
View file

@ -0,0 +1,25 @@
#!/bin/sh
SYSFS=/sys
NAME=$1
NUM=$2
for i in "${SYSFS}${DEVPATH}/${NAME}.*/specifier_id"; do
if [ ! -f "$i" ]; then
continue
fi
SPECID="`cat $i`"
if [ $((SPECID)) -eq $((0x00609e)) ]; then
echo -n "sbp2-${NUM} "
elif [ $((SPECID)) -eq $((0x00a02d)) ]; then
SWVER="`cat ${i%/specifier_id}/version`"
if [ $((SWVER)) -ge $((0x100)) -a $((SWVER)) -lt $((0x110)) ]; then
echo -n "iidc${NUM} "
elif [ $((SWVER)) -eq $((0x10001)) ]; then
echo -n "avc${NUM} "
elif [ $((SWVER)) -ge $((0x14000)) -a $((SWVER)) -le $((0x14001)) ]; then
echo -n "vendorfw${NUM} "
fi
fi
done
echo

View file

@ -1 +1 @@
320ccd2d0f4540d10e021bafa14f8985 udev-106.tar.bz2
02c49d93ffda4a104c853c082138b835 udev-116.tar.bz2

View file

@ -183,12 +183,13 @@ kill_udevd > "$udev_root/null" 2>&1
if [ -f "/sys/class/tty/console/uevent" ]; then
# trigger the sorted events
echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
/sbin/udevd -d
ret=$[$ret + $?]
if strstr "$cmdline" modprobedebug; then
/sbin/udevcontrol env MODPROBE_DEBUG=1
MODPROBE_OPTIONS="-s -v"
fi
/sbin/udevd -d
ret=$[$ret + $?]
if strstr "$cmdline" udevdebug; then
/sbin/udevcontrol log_priority=debug
fi

View file

@ -1,29 +0,0 @@
--- udev-084/extras/floppy/create_floppy_devices.c.redhat 2006-01-30 08:51:38.000000000 +0100
+++ udev-084/extras/floppy/create_floppy_devices.c 2006-02-07 10:58:51.000000000 +0100
@@ -111,15 +111,21 @@
return 0;
i = 0;
+
+ char buffer[2048]; buffer[0] = '\000'; buffer[2047]='\000';
+ char cmd[2048]; cmd[0] = '\000'; cmd[2047]='\000';
+
while (table_sup[type][i]) {
sprintf(node, "%s%s",dev, table[table_sup[type][i]]);
- minor = (table_sup[type][i] << 2) + fdnum;
- if (print_nodes)
- printf("%s b %d %d %d\n", node, mode, major, minor);
- if (create_nodes)
- mknod(node, S_IFBLK | mode, makedev(major,minor));
+ strcat(buffer, node);
+ strcat(buffer, " ");
i++;
}
+ if(strlen(buffer)) {
+ if (snprintf(cmd, 2047, "/sbin/MAKEDEV -x %s;/sbin/restorecon %s; /sbin/pam_console_apply %s;", buffer, buffer, buffer) > 0) {
+ system(cmd);
+ }
+ }
return 0;
}

View file

@ -1,105 +0,0 @@
If we're looking for a user's primary GID, look up the primary GID instead of
guessing the name of the user's primary group.
--- udev-084/udev_libc_wrapper.h 2006-01-30 02:51:38.000000000 -0500
+++ udev-084/udev_libc_wrapper.h 2006-02-13 17:22:56.000000000 -0500
@@ -139,6 +139,7 @@
#endif
extern uid_t lookup_user(const char *user);
+extern gid_t lookup_user_primary_group(const char *user);
extern gid_t lookup_group(const char *group);
extern size_t strlcpy(char *dst, const char *src, size_t size);
--- udev-084/udev_libc_wrapper.c 2006-01-30 02:51:38.000000000 -0500
+++ udev-084/udev_libc_wrapper.c 2006-02-13 17:38:48.000000000 -0500
@@ -106,6 +106,20 @@
return uid;
}
+gid_t lookup_user_primary_group(const char *user)
+{
+ struct passwd *pw;
+ gid_t gid = 0;
+
+ pw = getpwnam(user);
+ if (pw == NULL)
+ info("specified user unknown '%s'", user);
+ else
+ gid = pw->pw_gid;
+
+ return gid;
+}
+
gid_t lookup_group(const char *group)
{
struct group *gr;
@@ -126,7 +140,8 @@
#define GROUP_FILE "/etc/group"
/* return the id of a passwd style line, selected by the users name */
-static unsigned long get_id_by_name(const char *uname, const char *dbfile)
+static unsigned long get_id_field_by_name(const char *uname, const char *dbfile,
+ int field)
{
unsigned long id = 0;
char line[LINE_SIZE];
@@ -165,8 +180,14 @@
if (name == NULL)
continue;
- /* skip pass */
- if (strsep(&pos, ":") == NULL)
+ /* skip password and n other fields */
+ field -= 2;
+ while (field > 0) {
+ if ((pos == NULL) || (strsep(&pos, ":") == NULL))
+ continue;
+ field--;
+ }
+ if (pos == NULL)
continue;
/* get id */
@@ -189,6 +210,15 @@
return id;
}
+static unsigned long get_id_by_name(const char *uname, const char *dbfile)
+{
+ return get_id_field_by_name(uname, dbfile, 3);
+}
+static unsigned long get_second_id_by_name(const char *uname, const char *dbfile)
+{
+ return get_id_field_by_name(uname, dbfile, 4);
+}
+
uid_t lookup_user(const char *user)
{
unsigned long id;
@@ -197,6 +227,14 @@
return (uid_t) id;
}
+gid_t lookup_user_primary_group(const char *user)
+{
+ unsigned long id;
+
+ id = get_second_id_by_name(user, PASSWD_FILE);
+ return (gid_t) id;
+}
+
gid_t lookup_group(const char *group)
{
unsigned long id;
--- udev-084/extras/volume_id/vol_id.c 2006-01-30 02:51:38.000000000 -0500
+++ udev-084/extras/volume_id/vol_id.c 2006-02-13 17:22:56.000000000 -0500
@@ -151,7 +151,7 @@
/* drop all privileges */
nobody_uid = lookup_user("nobody");
- nobody_gid = lookup_group("nogroup");
+ nobody_gid = lookup_user_primary_group("nobody");
if (nobody_uid > 0 && nobody_gid > 0) {
if (setgroups(0, NULL) != 0 ||
setgid(nobody_gid) != 0 ||

View file

@ -1,72 +0,0 @@
--- udev-103/udevtrigger.c.last_modalias 2006-10-20 14:43:35.000000000 +0200
+++ udev-103/udevtrigger.c 2006-11-07 14:16:52.000000000 +0100
@@ -30,6 +30,7 @@
#include <fnmatch.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fnmatch.h>
#include "udev.h"
#include "udevd.h"
@@ -42,6 +43,13 @@
LIST_HEAD(filter_attr_match_list);
LIST_HEAD(filter_attr_nomatch_list);
+/* list of devices whose modaliases we should run last */
+static char *last_modalias_list[] = {
+ "pci:v*d*sv*sd*bc0Csc03i*", /* USB controller */
+ "pci:v*d*sv*sd*bc0Csc00i10*", /* Firewire controller */
+ NULL,
+};
+
#ifdef USE_LOG
void log_message(int priority, const char *format, ...)
{
@@ -72,6 +80,36 @@
return 0;
}
+
+
+static int modalias_is_greylisted(const char *path)
+{
+
+ char filename[PATH_SIZE];
+ char alias[PATH_SIZE];
+ int fd, i;
+
+ snprintf(filename,sizeof(filename),"%s/%s/modalias", sysfs_path, path);
+ filename[sizeof(filename)-1] = '\0';
+
+ fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ return 0;
+ read(fd,alias,PATH_SIZE);
+ alias[sizeof(alias)-1] = '\0';
+ alias[strlen(alias)-1] = '\0';
+
+ for (i = 0; last_modalias_list[i] != NULL; i++)
+ if (!fnmatch(last_modalias_list[i], alias, 0)) {
+ close(fd);
+ return 1;
+ }
+
+ close(fd);
+ return 0;
+}
+
+
static int device_list_insert(const char *path)
{
char filename[PATH_SIZE];
@@ -495,6 +533,10 @@
default:
goto exit;
}
+ if (modalias_is_greylisted(path)) {
+ device_list = &device_last_list;
+ break;
+ }
}
if (failed)

View file

@ -1,17 +1,18 @@
--- udev-091/extras/volume_id/lib/Makefile.nopie 2006-04-25 22:39:59.000000000 +0200
+++ udev-091/extras/volume_id/lib/Makefile 2006-05-03 16:23:33.000000000 +0200
@@ -67,7 +67,7 @@
--- udev-113/extras/volume_id/lib/Makefile.nopie 2007-06-23 17:44:48.000000000 +0200
+++ udev-113/extras/volume_id/lib/Makefile 2007-06-26 16:19:25.000000000 +0200
@@ -72,7 +72,8 @@
.shlib/%.o: %.c
$(E) " CC " $@
$(Q) mkdir -p $(dir $@)
- $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@
+ $(Q) $(subst -fpie,,$(subst -pie,,$(CC) )) -c $(CFLAGS) -fPIC $< -o $@
+# $(Q) $(CC) -c $(CFLAGS) -fPIC $< -o $@
libvolume_id.a: $(HEADERS) $(OBJS)
$(Q) rm -f $@
@@ -78,7 +78,7 @@
@@ -83,7 +84,7 @@
$(SHLIB): $(HEADERS) .shlib $(addprefix .shlib/,$(OBJS))
$(SHLIB): $(HEADERS) exported_symbols $(addprefix .shlib/,$(OBJS))
$(E) " CC " $@
- $(Q) $(CC) -shared $(CFLAGS) -o $@ \
+ $(Q) $(subst -fpie,,$(subst -pie,,$(CC) )) -shared $(CFLAGS) -o $@ \

View file

@ -1,6 +1,6 @@
--- udev-091/Makefile.lib64 2006-04-25 22:39:59.000000000 +0200
+++ udev-091/Makefile 2006-05-03 18:16:31.000000000 +0200
@@ -103,6 +103,8 @@
--- udev-113/Makefile.lib64 2007-06-23 17:44:48.000000000 +0200
+++ udev-113/Makefile 2007-06-26 16:37:34.000000000 +0200
@@ -98,6 +98,8 @@
libudevdir = ${prefix}/lib/udev
mandir = ${prefix}/usr/share/man
configdir = ${etcdir}/udev
@ -9,7 +9,7 @@
udevdir = /dev
DESTDIR =
@@ -179,6 +181,8 @@
@@ -168,6 +170,8 @@
RANLIB="$(RANLIB)" \
LIB_OBJS="$(LIB_OBJS)" \
LIBUDEV="$(PWD)/$(LIBUDEV)" \
@ -18,8 +18,8 @@
-C $$target $@ || exit 1; \
done;
.PHONY: all
--- udev-091/extras/volume_id/lib/Makefile.lib64 2006-05-03 18:15:28.000000000 +0200
+++ udev-091/extras/volume_id/lib/Makefile 2006-05-03 18:15:53.000000000 +0200
--- udev-113/extras/volume_id/lib/Makefile.lib64 2007-06-26 16:37:34.000000000 +0200
+++ udev-113/extras/volume_id/lib/Makefile 2007-06-26 16:37:34.000000000 +0200
@@ -4,9 +4,9 @@
#
# Released under the GNU General Public License, version 2.
@ -31,10 +31,18 @@
+libdir ?= ${prefix}/lib
+usrlibdir ?= ${prefix}/usr/lib
INSTALL = /usr/bin/install -c
INSTALL = install -c
INSTALL_DATA = ${INSTALL} -m 644
--- udev-091/extras/volume_id/Makefile.lib64 2006-04-25 22:39:59.000000000 +0200
+++ udev-091/extras/volume_id/Makefile 2006-05-03 18:16:14.000000000 +0200
@@ -106,6 +106,7 @@
$(INSTALL_DATA) -D libvolume_id.h $(DESTDIR)$(includedir)/libvolume_id.h
$(INSTALL_LIB) -D $(SHLIB) $(DESTDIR)$(libdir)/$(SHLIB)
mkdir -p $(DESTDIR)$(usrlibdir)/
+ $(INSTALL_LIB) -D libvolume_id.a $(DESTDIR)$(usrlibdir)/libvolume_id.a
ln -sf $(SHLIB) $(DESTDIR)$(libdir)/libvolume_id.so.$(SHLIB_CUR)
ln -sf $(libdir)/$(SHLIB) $(DESTDIR)$(usrlibdir)/libvolume_id.so
$(INSTALL_DATA) -D libvolume_id.pc $(DESTDIR)$(usrlibdir)/pkgconfig/libvolume_id.pc
--- udev-113/extras/volume_id/Makefile.lib64 2007-06-23 17:44:48.000000000 +0200
+++ udev-113/extras/volume_id/Makefile 2007-06-26 16:37:34.000000000 +0200
@@ -17,6 +17,9 @@
libudevdir = ${prefix}/lib/udev
mandir = ${prefix}/usr/share/man
@ -43,17 +51,18 @@
+usrlibdir ?= ${prefix}/usr/lib
+
INSTALL = /usr/bin/install -c
INSTALL = install -c
INSTALL_PROGRAM = ${INSTALL}
@@ -32,7 +35,10 @@
@@ -34,7 +37,11 @@
$(Q) $(CC) -c $(CFLAGS) $< -o $@
lib/libvolume_id.a:
- $(Q) $(MAKE) -C lib
lib:
- $(Q) $(MAKE) -C $@
+ $(Q) $(MAKE) \
+ libdir=$(libdir) \
+ usrlibdir=$(usrlibdir) \
+ -C lib
+# $(Q) $(MAKE) -C $@
.PHONY: lib
$(PROG): %: $(HEADERS) %.o lib/libvolume_id.a
$(E) " LD " $@
lib/libvolume_id.a: lib

View file

@ -1,80 +0,0 @@
--- udev-095/udev_utils_run.c.dbgwait 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udev_utils_run.c 2006-12-18 11:06:04.000000000 +0100
@@ -33,6 +33,8 @@
#include "udev.h"
+#define WAIT_TIME 100
+
extern char **environ;
int pass_env_to_socket(const char *sockname, const char *devpath, const char *action)
@@ -83,6 +85,8 @@
char *argv[(sizeof(arg) / 2) + 1];
int devnull;
int i;
+ int waited = 0;
+ struct timeval timeout;
/* build argv from comand */
strlcpy(arg, command, sizeof(arg));
@@ -175,6 +179,7 @@
if (errpipe[WRITE_END] > 0)
close(errpipe[WRITE_END]);
+ waited = 0;
/* read child output */
while (outpipe[READ_END] > 0 || errpipe[READ_END] > 0) {
int fdcount;
@@ -185,7 +190,18 @@
FD_SET(outpipe[READ_END], &readfds);
if (errpipe[READ_END] > 0)
FD_SET(errpipe[READ_END], &readfds);
- fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, NULL);
+
+ timeout.tv_sec = 0;
+ timeout.tv_usec = WAIT_TIME * 1000;
+ fdcount = select(UDEV_MAX(outpipe[READ_END], errpipe[READ_END])+1, &readfds, NULL, NULL, &timeout);
+
+ if (fdcount == 0) {
+ waited += WAIT_TIME;
+ if (waited % 1000 == 0)
+ info("Waiting %d seconds for output of '%s(%d)'", waited/1000, command, pid);
+ continue;
+ }
+
if (fdcount < 0) {
if (errno == EINTR)
continue;
@@ -261,14 +277,24 @@
*reslen = respos;
}
}
- waitpid(pid, &status, 0);
- if (WIFEXITED(status)) {
- info("'%s' returned with status %i", argv[0], WEXITSTATUS(status));
- if (WEXITSTATUS(status) != 0)
+ while(1) {
+ if (waitpid(pid, &status, WNOHANG) == 0) {
+ usleep(WAIT_TIME * 1000);
+ waited += WAIT_TIME;
+ if (waited % 1000 == 0)
+ info("Waiting %d seconds for '%s(%d)'", waited/1000, command, pid);
+ continue;
+ }
+
+ if (WIFEXITED(status)) {
+ info("'%s' returned with status %i", argv[0], WEXITSTATUS(status));
+ if (WEXITSTATUS(status) != 0)
+ retval = -1;
+ } else {
+ err("'%s' abnormal exit", argv[0]);
retval = -1;
- } else {
- err("'%s' abnormal exit", argv[0]);
- retval = -1;
+ }
+ break;
}
}

View file

@ -1,24 +0,0 @@
--- udev-095/udev_rules_parse.c.longcomment 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udev_rules_parse.c 2006-08-10 14:00:58.000000000 +0200
@@ -603,6 +603,10 @@
cur += count+1;
lineno++;
+ /* see if this is a comment */
+ if (bufline[0] == COMMENT_CHARACTER)
+ continue;
+
if (count >= sizeof(line)) {
err("line too long, rule skipped '%s:%u'", filename, lineno);
continue;
@@ -616,10 +620,6 @@
if (count == 0)
continue;
- /* see if this is a comment */
- if (bufline[0] == COMMENT_CHARACTER)
- continue;
-
/* skip backslash and newline from multi line rules */
for (i = j = 0; i < count; i++) {
if (bufline[i] == '\\' && bufline[i+1] == '\n')

View file

@ -1,70 +0,0 @@
--- udev-095/extras/path_id/path_id 2006-07-04 12:34:55.000000000 +0200
+++ udev-100/extras/path_id/path_id 2006-09-07 11:32:45.000000000 +0200
@@ -220,7 +220,7 @@
}
handle_firewire () {
- :handle_firewire $*
+ : handle_firewire $*
local DEV=$1
if [ -f "$D/ieee1394_id" ] ; then
read ieee1394_id < $D/ieee1394_id
@@ -407,30 +407,35 @@
handle_device () {
full_sysfs_path="$SYSFS$DEVPATH"
- if [ -L $full_sysfs_path/subsystem ]; then
- # new sysfs block layout
- full_sysfs_path="${full_sysfs_path%/*}"
- cd "$full_sysfs_path/subsystem";
- subsys="`pwd -P`"
- cd "$OPWD"
- subsys="${subsys##*/}"
- if [ "$subsys" = "block" ]; then
- # parent is "block", it's a partition, move one up
- full_sysfs_path="${full_sysfs_path%/*}"
- fi
- cd $full_sysfs_path
- else
- # old sysfs block layout
- if [ ! -L $full_sysfs_path/device ] ; then
- if [ -f $full_sysfs_path/range ] ; then return ; fi
- full_sysfs_path="${full_sysfs_path%/*}"
- : full_sysfs_path "$full_sysfs_path"
- if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then
- return
+ case "$DEVPATH" in
+ /devices/*)
+ # new sysfs layout
+ if [ -L $full_sysfs_path/subsystem ]; then
+ full_sysfs_path="${full_sysfs_path%/*}"
+ cd "$full_sysfs_path/subsystem";
+ subsys="`pwd -P`"
+ cd "$OPWD"
+ subsys="${subsys##*/}"
+ if [ "$subsys" = "block" ]; then
+ # parent is "block", it's a partition, move one up
+ full_sysfs_path="${full_sysfs_path%/*}"
+ fi
+ cd $full_sysfs_path
fi
- fi
- cd $full_sysfs_path/device
- fi
+ ;;
+ *)
+ # old sysfs layout
+ if [ ! -L $full_sysfs_path/device ] ; then
+ if [ -f $full_sysfs_path/range ] ; then return ; fi
+ full_sysfs_path="${full_sysfs_path%/*}"
+ : full_sysfs_path "$full_sysfs_path"
+ if [ ! -L $full_sysfs_path/device -o ! -f $full_sysfs_path/dev ] ; then
+ return
+ fi
+ fi
+ cd $full_sysfs_path/device
+ ;;
+ esac
full_sysfs_device_path="`pwd -P`"
cd "$OPWD"
D=$full_sysfs_device_path

View file

@ -1,73 +0,0 @@
--- udev-095/extras/path_id/path_id 2006-07-04 12:34:55.000000000 +0200
+++ udev-100/extras/path_id/path_id 2006-09-07 11:32:45.000000000 +0200
@@ -278,15 +278,17 @@ handle_sas () {
local DEV=$1
local cil adapter controller_dev
# SAS device
- sas_host_path="${DEV%%/phy*}"
+ sas_host_path="${DEV%%/port*}"
sas_phy_path="${DEV#*/host*/}"
sas_phy_path="${sas_phy_path%%/target*}"
sas_phy_id="${sas_phy_path%%/*}"
- sas_rphy_id="${sas_phy_path##*/}"
- sas_phy_dev="/sys/class/sas_phy/${sas_phy_id}"
+ sas_phy_id="${sas_phy_id##*port-}"
+ sas_port_id="${sas_phy_path%%/end_device*}"
+ sas_port_id="${sas_port_id##*port-}"
+ sas_end_id="${sas_phy_path##*end_device-}"
+ sas_phy_dev="/sys/class/sas_phy/phy-${sas_phy_id}"
if [ -e "$sas_phy_dev/sas_address" ]; then
read phy_address < $sas_phy_dev/sas_address
- read phy_port < $sas_phy_dev/port_identifier
read phy_id < $sas_phy_dev/phy_identifier
fi
if [ -z "$phy_address" ] ; then
@@ -295,22 +297,32 @@ handle_sas () {
RESULT=1
return
fi
+ sas_port_dev="/sys/class/sas_port/port-${sas_port_id}"
+ if [ -e "$sas_port_dev/num_phys" ] ; then
+ read phy_port < $sas_port_dev/num_phys
+ fi
+ if [ -z "$phy_port" ] ; then
+ : no initiator address
+ D=
+ RESULT=1
+ return
+ fi
sas_phy_address="$phy_address:$phy_port:$phy_id"
- sas_rphy_dev="/sys/class/sas_device/${sas_rphy_id}"
- if [ -e "$sas_rphy_dev/sas_address" ]; then
- read rphy_address < $sas_rphy_dev/sas_address
- read rphy_id < $sas_rphy_dev/phy_identifier
+ sas_end_dev="/sys/class/sas_device/end_device-${sas_end_id}"
+ if [ -e "$sas_end_dev/sas_address" ]; then
+ read end_address < $sas_end_dev/sas_address
+ read end_id < $sas_end_dev/phy_identifier
fi
- if [ -z "$rphy_address" ] ; then
+ if [ -z "$end_address" ] ; then
: no initiator address
D=
RESULT=1
return
fi
- sas_rphy_address="$rphy_address:$rphy_id"
+ sas_end_address="$end_address:$end_id"
controller_dev="${sas_host_path%/host[0-9]*}"
# SAS devices are always endpoints
- d="sas-${sas_phy_address}-${sas_rphy_address}"
+ d="sas-${sas_phy_address}-${sas_end_address}"
D="$controller_dev"
RESULT=0
}
@@ -470,7 +482,7 @@ handle_device () {
*/rport-[0-9]*:[0-9]*-[0-9]*/*)
handle_fc "$D"
;;
- */phy-[0-9]*:[0-9]*/*)
+ */end_device-[0-9]*:[0-9]*:[0-9]*/*)
handle_sas "$D"
;;
*/fw-host[0-9]*/*)

View file

@ -1,65 +0,0 @@
--- udev-095/udevstart.c.selinux 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udevstart.c 2006-08-16 13:59:52.000000000 +0200
@@ -40,6 +40,7 @@
#include "udev.h"
#include "udev_rules.h"
+#include "udev_selinux.h"
static const char *udev_run_str;
static const char *udev_log_str;
@@ -339,6 +340,7 @@
logging_init("udevstart");
udev_config_init();
+ selinux_init();
dbg("version %s", UDEV_VERSION);
udev_run_str = getenv("UDEV_RUN");
--- udev-095/udevd.c.selinux 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udevd.c 2006-08-16 13:59:28.000000000 +0200
@@ -45,6 +45,7 @@
#include "udev.h"
#include "udev_rules.h"
#include "udevd.h"
+#include "udev_selinux.h"
static struct udev_rules rules;
static int udevd_sock;
@@ -868,6 +869,7 @@
err("fatal, could not open /dev/null: %s", strerror(errno));
udev_config_init();
+ selinux_init();
dbg("version %s", UDEV_VERSION);
if (getuid() != 0) {
--- udev-095/udev_node.c.selinux 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udev_node.c 2006-08-16 13:59:13.000000000 +0200
@@ -130,8 +129,6 @@
int i;
int retval = 0;
- selinux_init();
-
snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name);
filename[sizeof(filename)-1] = '\0';
--- udev-095/udev.c.selinux 2006-07-04 12:34:55.000000000 +0200
+++ udev-095/udev.c 2006-08-16 13:59:19.000000000 +0200
@@ -32,6 +32,7 @@
#include "udev.h"
#include "udev_rules.h"
+#include "udev_selinux.h"
#ifdef USE_LOG
void log_message(int priority, const char *format, ...)
@@ -93,6 +94,7 @@
if (devnull < 0)
err("fatal, could not open /dev/null: %s", strerror(errno));
udev_config_init();
+ selinux_init();
dbg("version %s", UDEV_VERSION);
/* set signal handlers */

View file

@ -1,38 +0,0 @@
--- udev-106/udev_selinux.c.selinuxmedia 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udev_selinux.c 2007-04-11 11:49:14.000000000 +0200
@@ -118,10 +118,12 @@
char *media;
int ret = -1;
- media = get_media(devname, mode);
- if (media) {
- ret = matchmediacon(media, &scontext);
- free(media);
+ if (devname) {
+ media = get_media(devname, mode);
+ if (media) {
+ ret = matchmediacon(media, &scontext);
+ free(media);
+ }
}
if (ret < 0)
@@ -152,6 +154,8 @@
* restoration creation purposes.
*/
if (is_selinux_running()) {
+ if (!udev_root[0])
+ err("selinux_init: udev_root not set\n");
matchpathcon_init_prefix(NULL, udev_root);
if (getfscreatecon(&prev_scontext) < 0) {
err("getfscreatecon failed\n");
--- udev-106/extras/floppy/create_floppy_devices.c.selinuxmedia 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/extras/floppy/create_floppy_devices.c 2007-04-11 11:45:59.000000000 +0200
@@ -155,6 +155,7 @@
if (type == 0)
return 0;
+ udev_config_init();
selinux_init();
i = 0;

View file

@ -1,99 +0,0 @@
--- udev-106/udevd.c.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udevd.c 2007-04-25 16:22:19.000000000 +0200
@@ -657,6 +657,7 @@
struct ucred *cred;
char cred_msg[CMSG_SPACE(sizeof(struct ucred))];
int *intval;
+ char *pos;
memset(&ctrl_msg, 0x00, sizeof(struct udevd_ctrl_msg));
iov.iov_base = &ctrl_msg;
@@ -693,6 +694,21 @@
}
switch (ctrl_msg.type) {
+ case UDEVD_CTRL_ENV:
+ pos = strchr(ctrl_msg.buf, '=');
+ if (pos == NULL) {
+ err("wrong key format '%s'", ctrl_msg.buf);
+ break;
+ }
+ pos[0] = '\0';
+ if (pos[1] == '\0') {
+ info("udevd message (ENV) received, unset '%s'", ctrl_msg.buf);
+ unsetenv(ctrl_msg.buf);
+ } else {
+ info("udevd message (ENV) received, set '%s=%s'", ctrl_msg.buf, &pos[1]);
+ setenv(ctrl_msg.buf, &pos[1], 1);
+ }
+ break;
case UDEVD_CTRL_STOP_EXEC_QUEUE:
info("udevd message (STOP_EXEC_QUEUE) received");
stop_exec_q = 1;
--- udev-106/udevd.h.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udevd.h 2007-04-25 16:22:19.000000000 +0200
@@ -46,6 +46,7 @@
UDEVD_CTRL_SET_MAX_CHILDS,
UDEVD_CTRL_SET_MAX_CHILDS_RUNNING,
UDEVD_CTRL_RELOAD_RULES,
+ UDEVD_CTRL_ENV,
};
struct udevd_ctrl_msg {
--- udev-106/udev_rules_parse.c.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udev_rules_parse.c 2007-04-25 16:19:01.000000000 +0200
@@ -393,6 +393,7 @@
}
if (strncmp(attr, "PHYSDEV", 7) == 0)
physdev = 1;
+ dbg("add_rule_key_pair(%s %s)", attr, value);
if (add_rule_key_pair(rule, &rule->env, operation, attr, value) != 0)
goto invalid;
valid = 1;
--- udev-106/udevd.8.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udevd.8 2007-04-25 16:22:19.000000000 +0200
@@ -65,6 +65,11 @@
.RS 4
udevcontrol starts the execution of events from udevd.
.RE
+.PP
+\fBenv \fR\fB\fIvar\fR\fR\fB=\fR\fB\fIvalue\fR\fR
+.RS 4
+Set global variable.
+.RE
.SH "ENVIRONMENT"
.PP
\fBUDEV_LOG\fR
--- udev-106/udevd.xml.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udevd.xml 2007-04-25 16:22:19.000000000 +0200
@@ -93,6 +93,12 @@
</listitem>
</varlistentry>
<varlistentry>
+ <term><option>env <replaceable>var</replaceable>=<replaceable>value</replaceable></option></term>
+ <listitem>
+ <para>Set global variable.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
<term><option>start_exec_queue</option></term>
<listitem>
<para>udevcontrol starts the execution of events from udevd.</para>
--- udev-106/udevcontrol.c.setenv 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/udevcontrol.c 2007-04-25 16:22:19.000000000 +0200
@@ -117,6 +117,15 @@
}
*intval = count;
info("send max_childs_running=%i", *intval);
+ } else if (!strncmp(arg, "env", strlen("env"))) {
+ val = argv[++i];
+ if (val == NULL) {
+ fprintf(stderr, "missing key\n");
+ goto exit;
+ }
+ ctrl_msg.type = UDEVD_CTRL_ENV;
+ strlcpy(ctrl_msg.buf, val, sizeof(ctrl_msg.buf));
+ info("send env '%s'", val);
} else if (strcmp(arg, "help") == 0 || strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
printf("Usage: udevcontrol COMMAND\n"
" log_priority=<level> set the udev log level for the daemon\n"

14
udev-116-nettype.patch Normal file
View file

@ -0,0 +1,14 @@
diff -up udev-116/extras/rule_generator/write_net_rules.nettype udev-116/extras/rule_generator/write_net_rules
--- udev-116/extras/rule_generator/write_net_rules.nettype 2007-10-18 21:16:28.000000000 +0200
+++ udev-116/extras/rule_generator/write_net_rules 2007-10-18 21:20:55.000000000 +0200
@@ -23,6 +23,10 @@
RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
+if [ "$MATCHIFTYPE" ]; then
+ [ $[MATCHIFTYPE] -gt 256 ] && return 0
+fi
+
. /lib/udev/rule_generator.functions
interface_name_taken() {

View file

@ -1,121 +0,0 @@
--- /dev/null 2006-02-07 10:47:25.401206250 +0100
+++ udev-084/extras/check-cdrom.sh 2006-02-07 10:58:51.000000000 +0100
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+pos=0
+n=0
+sp="$1"
+what="$2"
+found=0
+
+[ -e /proc/sys/dev/cdrom/info ] || exit 1
+
+/bin/cat /proc/sys/dev/cdrom/info | {
+ while read line; do
+ if [ "$found" = "0" -a "${line/drive name:}" != "$line" ]; then
+ set ${line/drive name:}
+ while [ $# -gt 0 ]; do
+ pos=$[$pos+1]
+ if [ "$1" == "$sp" ]; then
+ found=1
+ break
+ fi
+ shift
+ done
+ [ "$found" = "0" ] && exit 1
+ elif [ "${line/$what:}" != "$line" ]; then
+ set ${line##*$what:}
+ while [ $# -gt 0 ]; do
+ n=$[$n+1]
+ if [ "$n" == "$pos" ]; then
+ if [ "$1" = "1" ]; then
+ exit 0
+ fi
+ break
+ fi
+ shift
+ done
+ fi
+ done
+ exit 1
+}
--- /dev/null 2006-02-07 10:47:25.401206250 +0100
+++ udev-084/extras/run_directory/MAKEDEV.dev 2006-02-07 10:58:51.000000000 +0100
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+if [ "$ACTION" = "add" -a -e "$DEVNAME" ]; then
+ if [ -x /usr/bin/logger ]; then
+ LOGGER=/usr/bin/logger
+ elif [ -x /bin/logger ]; then
+ LOGGER=/bin/logger
+ else
+ unset LOGGER
+ fi
+ #
+ # for diagnostics
+ #
+ if [ -f /etc/udev/udev.conf ]; then
+ . /etc/udev/udev.conf
+ fi
+
+
+ if [ -t 1 -o -z "$LOGGER" ]; then
+ mesg () {
+ echo "$@"
+ }
+ else
+ mesg () {
+ $LOGGER -t $(basename $0)"[$$]" "$@"
+ }
+ fi
+
+ debug_mesg () {
+ test -z "$UDEV_LOG" -o "$UDEV_LOG" != "1" && return
+ mesg "$@"
+ }
+
+ debug_mesg "/sbin/MAKEDEV ${DEVNAME#$udev_root}"
+ /sbin/MAKEDEV "${DEVNAME#$udev_root}"
+ debug_mesg "Restoring permissions for " $DEVNAME*
+ /sbin/pam_console_apply $DEVNAME*
+fi
--- /dev/null 2006-02-07 10:47:25.401206250 +0100
+++ udev-084/extras/load_floppy_module.sh 2006-02-07 10:58:51.000000000 +0100
@@ -0,0 +1,35 @@
+#!/bin/sh
+########################################################################
+#
+# Description : load_floppy_module
+#
+# Authors : Based on Open Suse Udev Rules
+# kay.sievers at suse.de
+#
+# Notes : Loads the floppy module based upon contents of the NVRAM
+#
+########################################################################
+
+PROC=/proc/driver/nvram
+
+# wait for /proc file to appear
+loop=10
+while ! test -e $PROC; do
+ sleep 0.1;
+ test "$loop" -gt 0 || break
+ loop=$(($loop - 1))
+done
+
+if [ ! -r /proc/driver/nvram ]; then
+ exit 0;
+fi
+
+floppy_devices=$(cat $PROC | sed -n '/Floppy.*\..*/p')
+
+if [ -n "$floppy_devices" ]; then
+ /sbin/modprobe block-major-2-
+else
+ /bin/true
+fi
+
+exit $?

View file

@ -1,97 +0,0 @@
--- /dev/null 2006-02-07 10:47:25.401206250 +0100
+++ udev-084/extras/udevpermconv.sh 2006-02-07 10:58:51.000000000 +0100
@@ -0,0 +1,94 @@
+#!/bin/bash
+#
+# convert old udev permissions.d file to the new rules.d format.
+# revision 2
+#
+# Written by Michael Buesch <mbuesch@freenet.de>
+# This is released into the Public Domain.
+#
+
+
+perm_file="$1"
+
+function processLine
+{
+ local line="$1"
+ if [ -z "$line" ]; then
+ echo
+ return 1
+ fi
+ if [ "`echo $line | cut -b1`" = "#" ]; then
+ # comment
+ echo "$line"
+ return 2
+ fi
+
+ local i=
+ local kern_name=
+ local owner=
+ local group=
+ local mode=
+ for ((i = 1; i <= 4; i++)); do
+ local tmp="`echo $line | cut -d: -f $i`"
+ if [ $i -eq 1 ]; then
+ kern_name="$tmp"
+ elif [ $i -eq 2 ]; then
+ owner="$tmp"
+ elif [ $i -eq 3 ]; then
+ group="$tmp"
+ elif [ $i -eq 4 ]; then
+ mode="$tmp"
+ fi
+ done
+ if [ -z "$kern_name" ]; then
+ echo "Malformed line: \"$line\"" >&2
+ return 3
+ fi
+ local need_rule="no"
+ local out="KERNEL==\"$kern_name\""
+ local kern_name_len="`echo $kern_name | wc -c`"
+ kern_name_len="`expr $kern_name_len + 9`"
+ local num_tabs="`expr 32 - $kern_name_len`"
+ num_tabs="`expr $num_tabs / 8`"
+ while [ $num_tabs -gt 0 ]; do
+ out="${out}\t"
+ num_tabs="`expr $num_tabs - 1`"
+ done
+ if [ -n "$owner" ] && [ "$owner" != "root" ]; then
+ out="${out}, OWNER=\"$owner\""
+ need_rule="yes"
+ fi
+ if [ -n "$group" ] && [ "$group" != "root" ]; then
+ out="${out}, GROUP=\"$group\""
+ need_rule="yes"
+ fi
+ if [ -n "$mode" ] && [ "$mode" != "0600" ] && [ "$mode" != "600" ]; then
+ out="${out}, MODE=\"$mode\""
+ need_rule="yes"
+ fi
+ if [ "$need_rule" = "no" ]; then
+ echo "Do not need a rule for: \"$line\" (It's udev default permissions)" >&2
+ return 4
+ fi
+ echo -e "$out"
+ return 0
+}
+
+function processInput
+{
+ echo "Converting udev permissions file. This can take a while..." >&2
+ cat $perm_file | \
+ while read line; do
+ processLine "$line"
+ done
+ echo "done." >&2
+}
+
+if ! [ -r "$perm_file" ]; then
+ echo "Could not read input file" >&2
+ echo "Usage: $0 old_permission_file > new_rules_file" >&2
+ exit 1
+fi
+
+processInput
+exit 0

47
udev-post.init Normal file
View file

@ -0,0 +1,47 @@
#!/bin/bash
#
# udev-post Post script for udev, after all filesystems are mounted
#
# Authors: Harald Hoyer <harald@redhat.com>
#
# chkconfig: 345 26 75
# description: Moves the generated persistent udev rules to /etc/udev/rules.d
#
### BEGIN INIT INFO
# Requires: $local_fs
### END INIT INFO
. /etc/rc.d/init.d/functions
# See how we were called.
case "$1" in
start)
STRING=$"Adding udev persistent rules"
# copy the rules generated before / was mounted read-write
for file in /dev/.udev/tmp-rules--*; do
dest=${file##*tmp-rules--}
# check, if anything is todo
[ "$dest" = '*' ] && exit 0
echo -n $STRING
cat $file >> /etc/udev/rules.d/$dest
rc=$?
rm -f $file
if [ "$rc" -eq "0" ]; then
success "$STRING"
echo
elif [ "$rc" -eq "1" ]; then
failure "$STRING"
echo
fi
done
exit 0
;;
stop)
exit 0
;;
*)
echo $"Usage: $0 {start}"
exit 1
esac
exit 0

View file

@ -1,102 +0,0 @@
--- udev-106/etc/udev/redhat/50-udev.rules.rhrules 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/etc/udev/redhat/50-udev.rules 2007-05-02 12:15:07.000000000 +0200
@@ -41,9 +41,6 @@
KERNEL=="hvc*", NAME="%k", GROUP="uucp", MODE="0660"
KERNEL=="hvsi*", NAME="%k", GROUP="uucp", MODE="0660"
KERNEL=="iseries/vtty*", NAME="%k", GROUP="uucp", MODE="0660"
-KERNEL=="ttyUSB*", ATTRS{product}=="Palm Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
-KERNEL=="ttyUSB*", ATTRS{product}=="palmOne Handheld*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
-KERNEL=="ttyUSB*", ATTRS{product}=="Handspring Visor*", SYMLINK+="pilot", GROUP="uucp", MODE="0660"
# vc devices
KERNEL=="vcs", NAME="%k", OWNER="vcsa", GROUP="tty", OPTIONS="last_rule"
@@ -68,9 +65,6 @@
KERNEL=="nvram", MODE="0660"
KERNEL=="rtc", MODE="0644"
-# pnp devices
-ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'"
-
# floppy devices
KERNEL=="fd[01]*", GROUP="floppy", MODE="0660"
# fix floppy devices
@@ -212,7 +206,7 @@
KERNEL=="vbi0", SYMLINK+="vbi"
KERNEL=="null", SYMLINK+="XOR"
-KERNEL=="tun", NAME="net/%k"
+KERNEL=="tun", NAME="net/%k", MODE="0666"
KERNEL=="device-mapper", NAME="mapper/control"
@@ -233,6 +227,7 @@
KERNEL=="pktcdvd", NAME="%k/control"
+
KERNEL=="hd*[!0-9]", ATTR{removable}=="1", \
ATTR{media}=="floppy", \
SYMLINK+="floppy floppy-%k", OPTIONS+="ignore_remove, all_partitions"
@@ -255,6 +250,7 @@
OPTIONS+="ignore_remove"
+
#######################################
# Persistent block device stuff - begin
#######################################
@@ -280,7 +276,6 @@
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/usb_id -x"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -s %p -d $tempnode"
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}=="", IMPORT{program}="/lib/udev/scsi_id -g -x -a -s %p -d $tempnode"
-KERNEL=="dasd*[!0-9]", IMPORT{program}="/lib/udev/dasd_id --export $tempnode"
KERNEL=="sd*[!0-9]|sr*|dasd*[!0-9]", ENV{ID_SERIAL}=="?*", SYMLINK+="disk/by-id/$env{ID_BUS}-$env{ID_SERIAL}"
# for partitions import parent information
@@ -315,9 +310,6 @@
PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", \
NAME="%c", MODE="0644"
-ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}"
-
-ACTION=="add", SUBSYSTEM=="pcmcia", ENV{MODALIAS}=="?*", RUN+="/bin/sh -c 'echo 1 > /sys/$DEVPATH/allow_func_id_match'"
# sd: 0 TYPE_DISK, 7 TYPE_MOD, 14 TYPE_RBC
# sr: 4 TYPE_WORM, 5 TYPE_ROM
@@ -351,5 +343,6 @@
# mmc block devices
ACTION=="add", SUBSYSTEM=="mmc", RUN+="modprobe mmc_block"
+
RUN+="socket:/org/kernel/udev/monitor"
--- udev-106/etc/udev/redhat/95-pam-console.rules.rhrules 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/etc/udev/redhat/95-pam-console.rules 2007-05-02 12:04:15.000000000 +0200
@@ -1 +1 @@
-ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}"
+ENV{STARTUP}!="1", ACTION=="add", SYSFS{dev}=="?*", KERNEL=="?*", RUN+="/sbin/pam_console_apply $env{DEVNAME} $env{DEVLINKS}"
--- udev-106/etc/udev/redhat/05-udev-early.rules.rhrules 2007-03-03 18:42:09.000000000 +0100
+++ udev-106/etc/udev/redhat/05-udev-early.rules 2007-05-02 12:07:55.000000000 +0200
@@ -1,10 +1,19 @@
# sysfs is populated after the event is sent
ACTION=="add", DEVPATH=="/devices/*", ENV{PHYSDEVBUS}=="?*", WAIT_FOR_SYSFS="bus"
-ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
-ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
-
# ignore these events until someone needs them
SUBSYSTEM=="drivers", OPTIONS="ignore_device"
SUBSYSTEM=="module", OPTIONS="ignore_device"
+
+ACTION=="add", SUBSYSTEM=="?*", ENV{MODALIAS}=="?*", RUN+="modprobe $env{MODALIAS}", GOTO="skip_wait"
+
+# pnp devices
+ACTION=="add", SUBSYSTEM=="pnp", RUN+="/bin/sh -c 'while read id; do /lib/udev/modprobe pnp:d$$id; done < /sys/$devpath/id'"
+
+ACTION=="add", SUBSYSTEM=="net", WAIT_FOR_SYSFS="address"
+
+ACTION=="add", SUBSYSTEM=="scsi", WAIT_FOR_SYSFS="ioerr_cnt"
+
+LABEL="skip_wait"
+
ACTION=="add", SUBSYSTEM=="firmware", ENV{FIRMWARE}=="*", RUN="/sbin/firmware_helper", OPTIONS="last_rule"

View file

@ -22,3 +22,7 @@ ppp
console
null
zero
lp0
lp1
lp2
lp3

254
udev.spec
View file

@ -5,9 +5,9 @@
Summary: A userspace implementation of devfs
Name: udev
Version: 106
Release: 4%{?dist}
License: GPL
Version: 116
Release: 3%{?dist}
License: GPLv2
Group: System Environment/Base
Provides: udev-persistent = %{version}-%{release}
Obsoletes: udev-persistent < 0:030-5
@ -15,23 +15,18 @@ Source: ftp://ftp.kernel.org/pub/linux/utils/kernel/hotplug/%{name}-%{version}.t
Source1: start_udev
Source2: udev.nodes
Source3: modprobe
Source3: udev-post.init
Source4: fw_unit_symlinks.sh
Source10: firmware_helper.c
Patch1: udev-116-nettype.patch
Patch1: udev-permconv.patch
Patch2: udev-rules.patch
Patch5: udev-extras.patch
Patch7: udev-089-nopie.patch
Patch9: udev-091-lib64.patch
Patch10: udev-106-selinuxmedia.patch
Patch14: udev-095-dbgwait.patch
Patch15: udev-106-setenv.patch
Patch100: udev-089-nopie.patch
Patch101: udev-091-lib64.patch
ExclusiveOS: Linux
URL: http://kernel.org/pub/linux/utils/kernel/hotplug/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Requires(pre): /bin/sh fileutils
Requires(pre): /bin/sh fileutils /sbin/chkconfig /sbin/service
Requires(pre): MAKEDEV >= 0:3.11
BuildRequires: sed libselinux-devel >= 0:1.17.9-2 flex libsepol-devel
BuildRequires: pam-devel glib2-devel bison
@ -74,16 +69,10 @@ which contains functions to get volume ids.
%prep
%setup -q
%patch1 -p1 -b .rhpermconv
%patch2 -p1 -b .rhrules
%patch5 -p1 -b .rhextras
%patch7 -p1 -b .nopie
%patch9 -p1 -b .lib64
%patch10 -p1 -b .selinuxmedia
%patch14 -p1 -b .dbgwait
%patch15 -p1 -b .setenv
%patch1 -p1 -b .nettype
%patch100 -p1 -b .nopie
%patch101 -p1 -b .lib64
rm -f etc/udev/redhat/51-hotplug.rules
%build
%if %{with_static}
@ -96,13 +85,14 @@ make \
STRIP="/bin/true" \
udevdir="/dev" \
USE_LOG=false DEBUG=%{debug} \
VOLUME_ID_STATIC=true \
EXTRAS=" \
extras/scsi_id \
extras/ata_id \
extras/usb_id \
extras/edd_id \
extras/volume_id \
extras/run_directory \
extras/cdrom_id \
extras/floppy \
" all
@ -111,10 +101,10 @@ for i in udevd udevtrigger udevsettle \
extras/ata_id/ata_id \
extras/edd_id/edd_id \
extras/usb_id/usb_id \
extras/cdrom_id/cdrom_id \
extras/volume_id/vol_id \
extras/floppy/create_floppy_devices \
extras/run_directory/udev_run_devd \
extras/run_directory/udev_run_hotplugd; do
; do
mv $i $i.static
touch $i
done
@ -123,7 +113,11 @@ make clean
make E='@echo' Q='@' -C extras/volume_id/lib clean
%endif
%ifarch sparc64
make CC="gcc $RPM_OPT_FLAGS -fPIE -pie" LDFLAGS="-pie" \
%else
make CC="gcc $RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-pie" \
%endif
USE_KLIBC=false \
USE_SELINUX=true \
udevdir="/dev" \
@ -137,18 +131,22 @@ make CC="gcc $RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-pie" \
extras/edd_id \
extras/path_id \
extras/volume_id \
extras/run_directory \
extras/cdrom_id \
extras/floppy \
extras/rule_generator \
extras/firmware \
" all
%{__cc} %{optflags} -fpie -pie -o firmware_helper %{SOURCE10}
%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
%ifarch sparc64
make DESTDIR=$RPM_BUILD_ROOT CC="gcc $RPM_OPT_FLAGS -fPIE -pie" LDFLAGS="-pie"\
%else
make DESTDIR=$RPM_BUILD_ROOT CC="gcc $RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-pie"\
%endif
libdir="/%{_lib}" \
usrlibdir="%{_libdir}" \
EXTRAS=" \
@ -158,16 +156,19 @@ make DESTDIR=$RPM_BUILD_ROOT CC="gcc $RPM_OPT_FLAGS -fpie -pie" LDFLAGS="-pie"\
extras/edd_id \
extras/path_id \
extras/volume_id \
extras/run_directory \
extras/cdrom_id \
extras/floppy \
extras/rule_generator \
extras/firmware \
" install
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/udev/udev.rules
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/init.d/udev
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/hotplug.d/default/10-udev.hotplug
# Deprecated, but keep the ownership
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/{rules.d,makedev.d,scripts,devices}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dev.d/{default,block}
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/dev.d
# force relative symlinks
ln -sf ..%{udev_scriptdir}/scsi_id $RPM_BUILD_ROOT/sbin/scsi_id
@ -181,8 +182,7 @@ for i in extras/scsi_id/scsi_id \
extras/usb_id/usb_id \
extras/volume_id/vol_id \
extras/floppy/create_floppy_devices \
extras/run_directory/udev_run_devd \
extras/run_directory/udev_run_hotplugd; do
; do
install -m 0755 $i.static $RPM_BUILD_ROOT%{udev_scriptdir}/$(basename $i).static
done
@ -191,41 +191,47 @@ for i in udevd udevtrigger udevsettle; do
done
%endif
install -m 0644 etc/udev/redhat/05-udev-early.rules $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/05-udev-early.rules
install -m 0644 etc/udev/redhat/50-udev.rules $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/50-udev.rules
install -m 0644 etc/udev/redhat/95-pam-console.rules $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/95-pam-console.rules
for i in \
etc/udev/redhat/*.rules \
%ifarch ia64
etc/udev/packages/40-ia64.rules \
%endif
%ifarch ppc ppc64
etc/udev/packages/40-ppc.rules \
%endif
%ifarch s390 s390x
etc/udev/packages/40-s390.rules \
%endif
etc/udev/packages/40-alsa.rules \
etc/udev/packages/64-md-raid.rules \
etc/udev/packages/64-device-mapper.rules \
; do
install -m 0644 "$i" "$RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/${i##*/}"
done
install -m 0644 etc/udev/udev.conf $RPM_BUILD_ROOT%{_sysconfdir}/udev/udev.conf
mkdir -p $RPM_BUILD_ROOT%{udev_scriptdir}/{,devices}
for i in load_floppy_module.sh check-cdrom.sh udevpermconv.sh; do
install -m 0755 extras/$i $RPM_BUILD_ROOT%{udev_scriptdir}
done
install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d/50-udev.nodes
install -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{udev_scriptdir}/modprobe
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d/50-udev.nodes
install -m 0755 %{SOURCE4} $RPM_BUILD_ROOT%{udev_scriptdir}/fw_unit_symlinks.sh
mkdir -p $RPM_BUILD_ROOT%{_datadir}/udev
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/sbin/start_udev
install -m 0755 firmware_helper $RPM_BUILD_ROOT/sbin
install -m 0755 %{SOURCE1} $RPM_BUILD_ROOT/sbin/start_udev
#install -m 0755 udevtrigger $RPM_BUILD_ROOT/sbin
install -m 0644 extras/run_directory/MAKEDEV.dev $RPM_BUILD_ROOT/%{udev_scriptdir}/MAKEDEV.dev
mkdir -p -m 0755 $RPM_BUILD_ROOT%{firmwaredir}
# short-term workaround
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig/modules
cat >$RPM_BUILD_ROOT/etc/sysconfig/modules/udev-stw.modules <<EOF
#!/bin/sh
for i in loop nvram floppy parport lp snd-powermac sonypi;do
modprobe \$i >/dev/null 2>&1
done
mkdir -p -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d
cat > $RPM_BUILD_ROOT%{_sysconfdir}/modprobe.d/floppy-pnp <<EOF
alias pnp:dPNP0700 floppy
EOF
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d
install -m 0755 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/udev-post
%preun
if [ $1 = 0 -a -f %{_initrddir}/udev ]; then
if [ "$1" = 0 -a -f %{_initrddir}/udev ]; then
if [ -x /sbin/pidof ]; then
pid=$(/sbin/pidof -c udevd)
if [ -n "$pid" ]; then
@ -234,6 +240,9 @@ if [ $1 = 0 -a -f %{_initrddir}/udev ]; then
fi
/sbin/chkconfig --del udev
fi
if [ "$1" = 0 ]; then
/sbin/chkconfig --del udev-post
fi
exit 0
%post
@ -244,6 +253,7 @@ if [ "$1" -ge "1" -a -x /sbin/pidof ]; then
/sbin/udevd -d
fi
fi
/sbin/chkconfig --add udev-post
exit 0
%triggerpostun -- dev <= 0:3.12-1
@ -276,16 +286,20 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) /sbin/udevsettle
%attr(0755,root,root) /sbin/start_udev
%attr(0755,root,root) /sbin/scsi_id
%attr(0755,root,root) %{udev_scriptdir}/udev_run_devd
%attr(0755,root,root) %{udev_scriptdir}/udev_run_hotplugd
%attr(0755,root,root) %{udev_scriptdir}/scsi_id
%attr(0755,root,root) %{udev_scriptdir}/ata_id
%attr(0755,root,root) %{udev_scriptdir}/edd_id
%attr(0755,root,root) %{udev_scriptdir}/usb_id
%attr(0755,root,root) %{udev_scriptdir}/vol_id
%attr(0755,root,root) %{udev_scriptdir}/cdrom_id
%attr(0755,root,root) %{udev_scriptdir}/path_id
%attr(0755,root,root) %{udev_scriptdir}/create_floppy_devices
%attr(0755,root,root) /sbin/firmware_helper
%attr(0755,root,root) %{udev_scriptdir}/fw_unit_symlinks.sh
%attr(0755,root,root) %{udev_scriptdir}/firmware.sh
%attr(0755,root,root) %{udev_scriptdir}/rule_generator.functions
%attr(0755,root,root) %{udev_scriptdir}/write_cd_rules
%attr(0755,root,root) %{udev_scriptdir}/write_net_rules
%attr(0755,root,root) %{_sysconfdir}/rc.d/init.d/udev-post
%attr(0755,root,root) %{_bindir}/udevtest
%attr(0755,root,root) %{_bindir}/udevinfo
%attr(0755,root,root) %{_sbindir}/udevmonitor
@ -293,27 +307,16 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) %dir %{_sysconfdir}/udev/rules.d/
%attr(0755,root,root) %dir %{udev_scriptdir}/
%attr(0755,root,root) %dir %{udev_scriptdir}/devices/
%ghost %dir %{_sysconfdir}/udev/scripts/
%ghost %dir %{_sysconfdir}/udev/devices/
%attr(0755,root,root) %dir %{_sysconfdir}/udev/makedev.d/
%attr(0755,root,root) %dir %{_sysconfdir}/dev.d/default
%attr(0755,root,root) %dir %{_sysconfdir}/dev.d/
%attr(0755,root,root) %{udev_scriptdir}/MAKEDEV.dev
%attr(0755,root,root) %{udev_scriptdir}/check-cdrom.sh
%attr(0755,root,root) %{udev_scriptdir}/udevpermconv.sh
%attr(0755,root,root) %{udev_scriptdir}/load_floppy_module.sh
%attr(0755,root,root) %{udev_scriptdir}/modprobe
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/udev/udev.conf
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/udev/rules.d/05-udev-early.rules
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/udev/rules.d/50-udev.rules
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/udev/rules.d/95-pam-console.rules
%config(noreplace) %attr(0644,root,root) %dir %{_sysconfdir}/udev/makedev.d/50-udev.nodes
%config %attr(0644,root,root) %{_sysconfdir}/udev/rules.d/*.rules
%config %attr(0644,root,root) %dir %{_sysconfdir}/udev/makedev.d/50-udev.nodes
#%config(missingok) %{_sysconfdir}/hotplug.d/default/10-udev.hotplug
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/scsi_id.config
%config(noreplace) %attr(0755,root,root)/etc/sysconfig/modules/udev-stw.modules
%attr(0644,root,root) %{_sysconfdir}/modprobe.d/floppy-pnp
%dir %attr(0755,root,root) %{firmwaredir}
%attr(0644,root,root) %{_mandir}/man8/udev*.8*
@ -322,6 +325,14 @@ rm -rf $RPM_BUILD_ROOT
%attr(0644,root,root) %{_mandir}/man8/ata_id*.8*
%attr(0644,root,root) %{_mandir}/man8/edd_id*.8*
%attr(0644,root,root) %{_mandir}/man8/vol_id*.8*
%attr(0644,root,root) %{_mandir}/man8/path_id*.8*
%attr(0644,root,root) %{_mandir}/man8/cdrom_id*.8*
%attr(0644,root,root) %{_mandir}/man8/create_floppy_devices*.8*
# Deprecated, but keep the ownership
%ghost %dir %{_sysconfdir}/udev/scripts/
%ghost %dir %{_sysconfdir}/udev/devices/
%ghost %dir %{_sysconfdir}/dev.d/
%if %{with_static}
%files static
@ -329,8 +340,6 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,root,root) /sbin/udevd.static
%attr(0755,root,root) /sbin/udevtrigger.static
%attr(0755,root,root) /sbin/udevsettle.static
%attr(0755,root,root) %{udev_scriptdir}/udev_run_devd.static
%attr(0755,root,root) %{udev_scriptdir}/udev_run_hotplugd.static
%attr(755,root,root) %{udev_scriptdir}/scsi_id.static
%attr(755,root,root) %{udev_scriptdir}/ata_id.static
%attr(755,root,root) %{udev_scriptdir}/edd_id.static
@ -352,6 +361,105 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/libvolume_id.pc
%changelog
* Thu Oct 18 2007 Harald Hoyer <harald@redhat.com> 116-3
- fixed preun chkconfig
- added /sbin path to chkconfig in post section
- patch: do not generate net rules for type > 256
- fixes glitches appearing in bz#323991
* Tue Oct 16 2007 Dennis Gilmore <dennis@ausil.us> 116-2
- sparc64 requires -fPIE not -fpie
* Mon Oct 15 2007 Harald Hoyer <harald@redhat.com> 116-1
- version 116
* Fri Oct 12 2007 Harald Hoyer <harald@redhat.com> 115-5.20071012git
- added upstream patch for rhbz#328691
- moved floppy module loading to pnp-alias in /etc/modprobe.d/floppy-pnp
* Wed Oct 10 2007 Harald Hoyer <harald@redhat.com> 115-5.20070921git
- better modprobe options for the kernel command line 'modprobedebug' option
* Fri Sep 21 2007 Harald Hoyer <harald@redhat.com> - 115-4
- more upstream fixes from git
* Thu Sep 20 2007 Harald Hoyer <harald@redhat.com> - 115-3
- some upstream fixes from git
- removed last_rule for loop rules
- added "udevinfo udevtrace" kernel command line options for better debugging
* Fri Sep 07 2007 Harald Hoyer <harald@redhat.com> - 115-2
- some upstream fixes from git
- last_rule for loop rules (speedup for live-cds/qemu with 128 loop devices)
* Thu Aug 24 2007 Harald Hoyer <harald@redhat.com> - 115-1
- version 115
* Fri Aug 24 2007 Harald Hoyer <harald@redhat.com> - 113-12
- removed /dev/tape symlink, because it's now a directory
(bug #251755)
* Thu Aug 23 2007 Harald Hoyer <harald@redhat.com> - 114-4
- added patch to prevent persistent net rules for virtual network interfaces,
like vmware and vlans
* Thu Aug 23 2007 Harald Hoyer <harald@redhat.com> - 114-3
- changed license tag
- changed to latest upstream rule ordering
* Thu Aug 16 2007 Harald Hoyer <harald@redhat.com> - 113-11
- readded firmware rule (#252983)
* Wed Aug 15 2007 Harald Hoyer <harald@redhat.com> - 113-10
- do not run vol_id on non-partition block devices (bug #251401)
- read all multiline pnp modaliases again
* Mon Aug 13 2007 Harald Hoyer <harald@redhat.com> - 114-2
- fixed isapnp rule (bug #251815)
- fix for nikon cameras (bug #251401)
* Fri Aug 10 2007 Harald Hoyer <harald@redhat.com> - 114-1
- version 114
- big rule unification and cleanup
- added persistent names for network and cdrom devices over reboot
* Wed Aug 08 2007 Harald Hoyer <harald@redhat.com> - 113-9
- added lp* to 50-udev.nodes (#251272)
* Mon Jul 30 2007 Harald Hoyer <harald@redhat.com> - 113-8
- removed "noreplace" config tag from rules (#250043)
* Fri Jul 27 2007 Harald Hoyer <harald@redhat.com> - 113-7
- major rule cleanup
- removed persistent rules from 50 and included upstream rules
- removed skip_wait from modprobe
* Fri Jul 20 2007 Harald Hoyer <harald@redhat.com> - 113-6
- kernel does not provide usb_device anymore,
corrected the rules (#248916)
* Thu Jul 19 2007 Harald Hoyer <harald@redhat.com> - 113-5
- corrected the rule for usb devices (#248916)
* Sat Jul 14 2007 Harald Hoyer <harald@redhat.com> - 113-4
- do not collect modprobes (bug #222542), because firmware
loading seems to depend on it.
* Mon Jul 9 2007 Harald Hoyer <harald@redhat.com> - 113-3
- speedup things a little bit
* Wed Jun 27 2007 Harald Hoyer <harald@redhat.com> - 113-2
- added more firewire symlinks (#240770)
- minor rule patches
* Tue Jun 26 2007 Harald Hoyer <harald@redhat.com> - 113-1
- version 113
- added rule for SD cards in a TI FlashMedia slot (#217070)
* Tue Jun 26 2007 Harald Hoyer <harald@redhat.com> - 106-4.1
- fixed modprobedebug option
- removed snd-powermac from the default modules (#200585)
* Wed May 02 2007 Harald Hoyer <harald@redhat.com> - 106-4
- do not skip all events on modprobe (#238385)
- Resolves: rhbz#238385

View file

@ -1,251 +0,0 @@
--- udev-084/udevstart.c.udevstart2 2006-01-30 08:51:38.000000000 +0100
+++ udev-084/udevstart.c 2006-02-07 10:11:31.000000000 +0100
@@ -37,13 +37,13 @@
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <fcntl.h>
+#include <fnmatch.h>
#include "udev.h"
#include "udev_rules.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, ...)
@@ -101,76 +101,60 @@
static char *first_list[] = {
"/class/mem",
"/class/tty",
+ "/bus",
+ NULL,
+};
+
+/* list of devices whose modaliases we should run last */
+static char *last_modalias_list[] = {
+ "pci:v*d*sv*sd*bc0Csc03i*", /* USB controller */
+ "pci:v*d*sv*sd*bc0Csc00i10*", /* Firewire controller */
NULL,
};
static int add_device(const char *devpath)
{
- struct sysfs_device *dev;
- struct udevice *udev;
- int retval = 0;
-
- /* clear and set environment for next event */
- clearenv();
- setenv("ACTION", "add", 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);
-
- dev = sysfs_device_get(devpath);
- if (dev == NULL)
- return -1;
-
- udev = udev_device_init();
- if (udev == NULL)
- return -1;
-
- /* override built-in sysfs device */
- udev->dev = dev;
- strcpy(udev->action, "add");
- udev->devt = udev_device_get_devt(udev);
-
- if (strcmp(udev->dev->subsystem, "net") != 0) {
- udev->devt = udev_device_get_devt(udev);
- if (major(udev->devt) == 0)
- return -1;
- }
+ char filename[PATH_SIZE];
+ int fd;
+
+ snprintf(filename, sizeof(filename), "%s/%s/uevent", sysfs_path, devpath);
+ filename[sizeof(filename)-1] = '\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;
+}
- dbg("add '%s'", udev->dev->devpath);
- setenv("DEVPATH", udev->dev->devpath, 1);
- setenv("SUBSYSTEM", udev->dev->subsystem, 1);
-
- udev_rules_get_name(&rules, udev);
- if (udev->ignore_device) {
- dbg("device event will be ignored");
- goto exit;
- }
- if (udev->name[0] != '\0')
- retval = udev_add_device(udev);
- else
- info("device node creation supressed");
-
- if (retval == 0 && udev_run) {
- 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:")], udev->dev->devpath, "add");
- else {
- char program[PATH_SIZE];
-
- strlcpy(program, name_loop->name, sizeof(program));
- udev_rules_apply_format(udev, program, sizeof(program));
- run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
- }
+static int modalias_is_greylisted(struct device *dev)
+{
+
+ char filename[PATH_SIZE];
+ char alias[PATH_SIZE];
+ int fd, i;
+
+ snprintf(filename,sizeof(filename),"%s/%s/modalias", sysfs_path, dev->path);
+ filename[sizeof(filename)-1] = '\0';
+
+ fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ return 0;
+ read(fd,alias,PATH_SIZE);
+ alias[sizeof(alias)-1] = '\0';
+ alias[strlen(alias)-1] = '\0';
+
+ for (i = 0; last_modalias_list[i] != NULL; i++)
+ if (!fnmatch(last_modalias_list[i], alias, 0)) {
+ close(fd);
+ return 1;
}
- }
-exit:
- udev_device_cleanup(udev);
+ close(fd);
return 0;
}
@@ -184,6 +168,8 @@
list_for_each_entry_safe(loop_device, tmp_device, device_list, node) {
for (i = 0; first_list[i] != NULL; i++) {
if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) {
+ if (modalias_is_greylisted(loop_device))
+ continue;
add_device(loop_device->path);
list_del(&loop_device->node);
free(loop_device);
@@ -203,6 +189,8 @@
}
if (found)
continue;
+ if (modalias_is_greylisted(loop_device))
+ continue;
add_device(loop_device->path);
list_del(&loop_device->node);
@@ -222,7 +210,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)
@@ -279,6 +267,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, device_list);
+ }
+ closedir(dir2);
+ }
+ }
+ closedir(dir);
+ }
+}
+
+
static void udev_scan_class(struct list_head *device_list)
{
char base[PATH_SIZE];
@@ -312,7 +344,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, device_list);
}
closedir(dir2);
@@ -342,7 +374,6 @@
udev_config_init();
dbg("version %s", UDEV_VERSION);
- udev_run_str = getenv("UDEV_RUN");
udev_log_str = getenv("UDEV_LOG");
/* disable all logging if not explicitely requested */
@@ -362,13 +393,12 @@
alarm(UDEV_ALARM_TIMEOUT);
sysfs_init();
- 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_cleanup(&rules);
sysfs_cleanup();
logging_close();
return 0;