chiark / gitweb /
finally remove the directory event-multiplexer crap
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 28 Mar 2007 18:35:05 +0000 (20:35 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 28 Mar 2007 18:35:05 +0000 (20:35 +0200)
12 files changed:
TODO
extras/run_directory/Makefile [deleted file]
extras/run_directory/README [deleted file]
extras/run_directory/RFC-dev.d [deleted file]
extras/run_directory/dev.d/default/pam_console.dev [deleted file]
extras/run_directory/dev.d/net/hotplug.dev [deleted file]
extras/run_directory/dev.d/snd/controlC0/alsa.dev [deleted file]
extras/run_directory/run_directory.c [deleted file]
extras/run_directory/run_directory.h [deleted file]
extras/run_directory/udev_run_devd.c [deleted file]
extras/run_directory/udev_run_hotplugd.c [deleted file]
test/simple-build-check.sh

diff --git a/TODO b/TODO
index 129ae9df1027b5eef00dd448b0b8ce20cd751cc1..380de4896c5805c89d5881ee64f3bb8eb3b52a57 100644 (file)
--- a/TODO
+++ b/TODO
@@ -11,6 +11,3 @@ udev version:
   o remove udevstart
     (we rely on the kernel "uevent"-triggers of kernel 2.6.15 and no longer
      want to guess event-properties from sysfs like udevstart is doing it)
-
-  o remove extra for /etc/dev.d/ /etc/hotplug.d/
-    (that inefficient stuff should finally go away)
diff --git a/extras/run_directory/Makefile b/extras/run_directory/Makefile
deleted file mode 100644 (file)
index 3d16744..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-# Makefile for udev extra invoked from the udev main Makefile
-#
-# Copyright (C) 2004-2005 Kay Sievers <kay.sievers@vrfy.org>
-#
-# Released under the GNU General Public License, version 2.
-#
-PROG = udev_run_devd udev_run_hotplugd
-OBJS = run_directory.o
-HEADERS =
-GEN_HEADERS =
-MAN_PAGES =
-
-prefix =
-etcdir =       ${prefix}/etc
-sbindir =      ${prefix}/sbin
-usrbindir =    ${prefix}/usr/bin
-usrsbindir =   ${prefix}/usr/sbin
-libudevdir =   ${prefix}/lib/udev
-mandir =       ${prefix}/usr/share/man
-configdir =    ${etcdir}/udev/
-
-INSTALL = install -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA  = ${INSTALL} -m 644
-INSTALL_SCRIPT = ${INSTALL}
-
-all: $(PROG) $(MAN_PAGES)
-.PHONY: all
-.DEFAULT: all
-
-%.o: %.c $(GEN_HEADERS)
-       $(E) "  CC      " $@
-       $(Q) $(CC) -c $(CFLAGS) $< -o $@
-
-$(PROG): %: $(HEADERS) %.o $(OBJS)
-       @echo $@ "is DEPRECATED and will be removed, don't use it"
-       $(E) "  LD      " $@
-       $(Q) $(LD) $(LDFLAGS) $@.o $(OBJS) -o $@ $(LIBUDEV) $(LIB_OBJS)
-
-# man pages
-%.8: %.xml
-       $(E) "  XMLTO   " $@
-       $(Q) xmlto man $?
-.PRECIOUS: %.8
-
-clean:
-       $(E) "  CLEAN   "
-       $(Q) rm -f $(PROG) $(OBJS) $(GEN_HEADERS)
-.PHONY: clean
-
-install-bin: all
-       @echo $@ "is DEPRECATED and will be removed, don't use it"
-       $(INSTALL_PROGRAM) -D udev_run_devd $(DESTDIR)$(libudevdir)/udev_run_devd
-       $(INSTALL_PROGRAM) -D udev_run_hotplugd $(DESTDIR)$(libudevdir)/udev_run_hotplugd
-.PHONY: install-bin
-
-uninstall-bin:
-       - rm $(DESTDIR)$(libudevdir)/udev_run_devd
-       - rm $(DESTDIR)$(libudevdir)/udev_run_hotplugd
-.PHONY: uninstall-bin
-
-install-man:
-       @echo "Please create a man page for this tool."
-.PHONY: install-man
-
-uninstall-man:
-       @echo "Please create a man page for this tool."
-.PHONY: uninstall-man
-
-install-config:
-       @echo "no config file to install"
-.PHONY: install-config
diff --git a/extras/run_directory/README b/extras/run_directory/README
deleted file mode 100644 (file)
index feae2f8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-Use these binaries only if you need backward compatibility with
-older udev versions. The use of /etc/dev.d/ is no longer recommended.
-Use explicit udev rules with RUN keys to hook into the processing.
-
-  /etc/dev.d/ + /etc/hotplug.d/ directory multiplexing is completely
-  removed from udev itself and must be emulated by calling small
-  helper binaries provided by these helpers:
-      make EXTRAS=extras/run_directory/
-    will build udev_run_devd and udev_run_hotplugd, which can be called
-    from a rule if needed:
-      RUN+="/sbin/udev_run_hotplugd"
-    The recommended way to handle this is to convert all the calls from
-    the directories to explicit udev rules and get completely rid of the
-    multiplexing. (To catch a ttyUSB event, you now no longer need to
-    fork and exit 300 tty script instances on bootup you are not interested
-    in, it is just one rule that matches exactly that single device.)
-
diff --git a/extras/run_directory/RFC-dev.d b/extras/run_directory/RFC-dev.d
deleted file mode 100644 (file)
index 1aca1aa..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
- /etc/dev.d/  How it works, and what it is for
- by Greg Kroah-Hartman <greg@kroah.com> March 2004
-
-The /etc/dev.d directory works much like the /etc/hotplug.d/ directory
-in that it is a place to put symlinks or programs that get called when
-an event happens in the system.  Programs will get called whenever the
-device naming program in the system has either named a new device and
-created a /dev node for it, or when a /dev node has been removed from
-the system due to a device being removed.
-
-The directory tree under /etc/dev.d/ dictate which program is run first,
-and when some programs will be run or not.  The device naming program
-calls the programs in the following order:
-       /etc/dev.d/DEVNAME/*.dev
-       /etc/dev.d/SUBSYSTEM/*.dev
-       /etc/dev.d/default/*.dev
-
-The .dev extension is needed to allow automatic package managers to
-deposit backup files in these directories safely.
-
-The DEVNAME name is the name of the /dev file that has been created, or
-for network devices, the name of the newly named network device.  This
-value, including the /dev path, will also be exported to userspace in
-the DEVNAME environment variable.
-
-The SUBSYSTEM name is the name of the sysfs subsystem that originally
-generated the hotplug event that caused the device naming program to
-create or remove the /dev node originally.  This value is passed to
-userspace as the first argument to the program.
-
-The default directory will always be run, to enable programs to catch
-every device add and remove in a single place.
-
-All environment variables that were originally passed by the hotplug
-call that caused this device action will also be passed to the program
-called in the /etc/dev.d/ directories.  Examples of these variables are
-ACTION, DEVPATH, and others.  See the hotplug documentation for full
-description of this
-
-An equivalent shell script that would do this same kind of action would
-be:
-       DIR="/etc/dev.d"
-       export DEVNAME="whatever_dev_name_udev_just_gave"
-       for I in "${DIR}/$DEVNAME/"*.dev "${DIR}/$1/"*.dev "${DIR}/default/"*.dev ; do
-               if [ -f $I ]; then $I $1 ; fi
-       done
-       exit 1;
-
-
diff --git a/extras/run_directory/dev.d/default/pam_console.dev b/extras/run_directory/dev.d/default/pam_console.dev
deleted file mode 100644 (file)
index 4c69ea3..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-# Fedora solution to set the ownership/permissions of s device to the local
-# logged in user. Uses the program pam_console_setowner to match the names of
-# the device node and the symlinks against a device list and applies the
-# configured ownership and permission to the node.
-
-[ "$ACTION" != "add" ] && exit 0
-
-# we do not have console users in rc.sysinit
-[ -n "$IN_INITLOG" ] && exit 0
-
-if [ -x /sbin/pam_console_setowner -a -f /var/run/console/console.lock \
-       -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 [ -t 1 -o -z "$LOGGER" ]; then
-           mesg () {
-               echo "$@"
-           }
-       else
-           mesg () {
-               $LOGGER -t $(basename $0)"[$$]" "$@"
-           }
-       fi
-
-       debug_mesg () {
-           test "$udev_log" = "" -o "$udev_log" = "no" && return
-           mesg "$@"
-       }
-
-       if [ -f /etc/udev/udev.conf ]; then
-               . /etc/udev/udev.conf
-       fi
-
-       SYMLINKS=""
-       for i in $(/usr/bin/udevinfo -q symlink -p "$DEVPATH"); do
-               [ $? -gt 0 ] && break
-               SYMLINKS="$SYMLINKS ${udev_root%%/}/$i"
-       done
-       debug_mesg "Restoring console permissions for $DEVNAME $SYMLINKS"
-       /sbin/pam_console_setowner "$DEVNAME" $SYMLINKS
-fi
diff --git a/extras/run_directory/dev.d/net/hotplug.dev b/extras/run_directory/dev.d/net/hotplug.dev
deleted file mode 100644 (file)
index e195b0f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-#
-# Script to ensure that any network device that udev renames
-# still gets the hotplug script run with the proper name.
-#
-# Released under the GPL v2
-#
-# Copyright (C) 2004 Greg Kroah-Hartman <greg@kroah.com>
-#
-
-# Do nothing if udev handles hotplug.d.
-if [ "$MANAGED_EVENT" == "1" ]; then
-       exit 0
-fi
-
-# ok, we have renamed this device, so let the network hotplug script
-# know about it to setup the device properly...
-if [ -f /etc/hotplug.d/default/default.hotplug ]; then
-       exec /etc/hotplug.d/default/default.hotplug net
-fi
-
diff --git a/extras/run_directory/dev.d/snd/controlC0/alsa.dev b/extras/run_directory/dev.d/snd/controlC0/alsa.dev
deleted file mode 100644 (file)
index 642dde4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh -e
-exec /usr/sbin/alsactl restore 0
diff --git a/extras/run_directory/run_directory.c b/extras/run_directory/run_directory.c
deleted file mode 100644 (file)
index c715ca6..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * udev_run_directory.c - directory multiplexer
- *
- * Copyright (C) 2005 Kay Sievers <kay@vrfy.org>
- *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <dirent.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#include "../../udev.h"
-#include "run_directory.h"
-
-static int exec_program(const char *filename, const char *subsystem)
-{
-       pid_t pid;
-
-       dbg("running %s", filename);
-       pid = fork();
-       switch (pid) {
-       case 0:
-               /* child */
-               execl(filename, filename, subsystem, NULL);
-               dbg("exec of child failed");
-               _exit(1);
-       case -1:
-               dbg("fork of child failed");
-               break;
-               return -1;
-       default:
-               waitpid(pid, NULL, 0);
-       }
-
-       return 0;
-}
-
-int run_directory(const char *dir, const char *suffix, const char *subsystem)
-{
-       struct name_entry *name_loop, *name_tmp;
-       struct stat buf;
-       LIST_HEAD(name_list);
-
-       dbg("looking at '%s'", dir);
-
-       if (stat(dir, &buf) != 0) {
-               dbg("directory '%s' not found", dir);
-               return 0;
-       }
-
-       add_matching_files(&name_list, dir, suffix);
-
-       list_for_each_entry_safe(name_loop, name_tmp, &name_list, node) {
-               exec_program(name_loop->name, subsystem);
-               list_del(&name_loop->node);
-       }
-
-       logging_close();
-       return 0;
-}
diff --git a/extras/run_directory/run_directory.h b/extras/run_directory/run_directory.h
deleted file mode 100644 (file)
index edb46dd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-
-extern int run_directory(const char *dir, const char *suffix, const char *subsystem);
-
diff --git a/extras/run_directory/udev_run_devd.c b/extras/run_directory/udev_run_devd.c
deleted file mode 100644 (file)
index 59ea766..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * udev_run_devd.c - directory multiplexer
- *
- * Copyright (C) 2005 Kay Sievers <kay@vrfy.org>
- *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <dirent.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#include "../../udev.h"
-#include "run_directory.h"
-
-
-#ifdef USE_LOG
-void log_message (int priority, const char *format, ...)
-{
-       va_list args;
-       static int udev_log = -1;
-
-       if (udev_log == -1) {
-               const char *value;
-
-               value = getenv("UDEV_LOG");
-               if (value)
-                       udev_log = log_priority(value);
-               else
-                       udev_log = LOG_ERR;
-       }
-
-       if (priority > udev_log)
-               return;
-
-       va_start(args, format);
-       vsyslog(priority, format, args);
-       va_end(args);
-}
-#endif
-
-int main(int argc, char *argv[], char *envp[])
-{
-       char dirname[NAME_SIZE];
-       const char *devname;
-       const char *my_devname;
-       const char *subsystem;
-       int fd;
-
-       devname = getenv("DEVNAME");
-       if (devname == NULL)
-               exit(0);
-       /*
-        * Hack, we are assuming that the device nodes are in /dev,
-        * if not, this will not work, but you should be using the
-        * RUN= rule anyway...
-        */
-       my_devname = strstr(devname, "/dev/");
-       if (my_devname != NULL)
-               my_devname = &my_devname[5];
-       else
-               my_devname = devname;
-
-       subsystem = argv[1];
-       logging_init("udev_run_devd");
-
-       fd = open("/dev/null", O_RDWR);
-       if (fd >= 0) {
-               dup2(fd, STDOUT_FILENO);
-               dup2(fd, STDIN_FILENO);
-               dup2(fd, STDERR_FILENO);
-               close(fd);
-       }
-       dbg("running dev.d directory");
-
-       sprintf(dirname, "/etc/dev.d/%s", my_devname);
-       run_directory(dirname, ".dev", subsystem);
-       sprintf(dirname, "/etc/dev.d/%s", subsystem);
-       run_directory(dirname, ".dev", subsystem);
-       run_directory("/etc/dev.d/default", ".dev", subsystem);
-
-       exit(0);
-}
diff --git a/extras/run_directory/udev_run_hotplugd.c b/extras/run_directory/udev_run_hotplugd.c
deleted file mode 100644 (file)
index f94c237..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * udev_run_hotplugd.c - directory multiplexer
- *
- * Copyright (C) 2005 Kay Sievers <kay@vrfy.org>
- *
- *     This program is free software; you can redistribute it and/or modify it
- *     under the terms of the GNU General Public License as published by the
- *     Free Software Foundation version 2 of the License.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <dirent.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/stat.h>
-
-#include "../../udev.h"
-#include "run_directory.h"
-
-
-#ifdef USE_LOG
-void log_message (int priority, const char *format, ...)
-{
-       va_list args;
-       static int udev_log = -1;
-
-       if (udev_log == -1) {
-               const char *value;
-
-               value = getenv("UDEV_LOG");
-               if (value)
-                       udev_log = log_priority(value);
-               else
-                       udev_log = LOG_ERR;
-       }
-
-       if (priority > udev_log)
-               return;
-
-       va_start(args, format);
-       vsyslog(priority, format, args);
-       va_end(args);
-}
-#endif
-
-int main(int argc, char *argv[], char *envp[])
-{
-       char dirname[NAME_SIZE];
-       const char *subsystem;
-       int fd;
-
-       subsystem = argv[1];
-       logging_init("udev_run_hotplugd");
-
-       fd = open("/dev/null", O_RDWR);
-       if (fd >= 0) {
-               dup2(fd, STDOUT_FILENO);
-               dup2(fd, STDIN_FILENO);
-               dup2(fd, STDERR_FILENO);
-               close(fd);
-       }
-
-       dbg("running hotplug.d directory");
-
-       sprintf(dirname, "/etc/hotplug.d/%s", subsystem);
-       run_directory(dirname, ".hotplug", subsystem);
-       run_directory("/etc/hotplug.d/default", ".hotplug", subsystem);
-       exit(0);
-}
index 7a8252111103eef1262c612fb030f8e4cbcaed79..a2cbbfd63190e80894af747bf9173acc04907c23 100755 (executable)
@@ -9,7 +9,6 @@ EXTRAS="\
        extras/cdrom_id \
        extras/edd_id \
        extras/floppy \
-       extras/run_directory \
        extras/firmware \
        extras/path_id \
        extras/rule_generator"