chiark / gitweb /
use autotools
authorKay Sievers <kay.sievers@vrfy.org>
Tue, 29 Jul 2008 23:45:23 +0000 (01:45 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Tue, 29 Jul 2008 23:45:23 +0000 (01:45 +0200)
62 files changed:
.gitignore
INSTALL [new file with mode: 0644]
Makefile.am [new file with mode: 0644]
NEWS
README
autogen.sh [new file with mode: 0755]
configure.ac [new file with mode: 0644]
extras/Makefile.am [new file with mode: 0644]
extras/ata_id/Makefile.am [new file with mode: 0644]
extras/ata_id/ata_id.c
extras/cdrom_id/Makefile.am [new file with mode: 0644]
extras/cdrom_id/cdrom_id.c
extras/collect/Makefile.am [new file with mode: 0644]
extras/collect/collect.c
extras/edd_id/Makefile.am [new file with mode: 0644]
extras/edd_id/edd_id.c
extras/firmware/Makefile.am [new file with mode: 0644]
extras/floppy/Makefile.am [new file with mode: 0644]
extras/floppy/create_floppy_devices.c
extras/fstab_import/Makefile.am [new file with mode: 0644]
extras/fstab_import/fstab_import.c
extras/path_id/Makefile.am [new file with mode: 0644]
extras/rule_generator/Makefile.am [new file with mode: 0644]
extras/scsi_id/Makefile.am [new file with mode: 0644]
extras/scsi_id/scsi_id.c
extras/scsi_id/scsi_serial.c
extras/usb_id/Makefile.am [new file with mode: 0644]
extras/usb_id/usb_id.c
extras/volume_id/Makefile.am [new file with mode: 0644]
extras/volume_id/lib/Makefile.am [new file with mode: 0644]
extras/volume_id/lib/exported_symbols
extras/volume_id/lib/libvolume_id.pc.in [new file with mode: 0644]
extras/volume_id/vol_id.c
rules/Makefile.am [new file with mode: 0644]
test/udev-test.pl
udev/.gitignore [new file with mode: 0644]
udev/Makefile.am [new file with mode: 0644]
udev/logging.h
udev/test-udev.c
udev/udev.h
udev/udev_config.c
udev/udev_db.c
udev/udev_device.c
udev/udev_rules.c
udev/udev_rules.h
udev/udev_rules_parse.c
udev/udev_selinux.c
udev/udev_selinux.h
udev/udev_sysdeps.c
udev/udev_sysdeps.h
udev/udev_sysfs.c
udev/udev_utils.c
udev/udev_utils_file.c
udev/udev_utils_string.c
udev/udevadm.c
udev/udevcontrol.c
udev/udevd.c
udev/udevd.h
udev/udevinfo.c
udev/udevsettle.c
udev/udevtest.c
udev/udevtrigger.c

index ae9c0fe..e96d00e 100644 (file)
@@ -1,7 +1,23 @@
 *.o
-*.a
-udevd
-udevadm
-udev_version.h
-test-udev
-
+*.lo
+*.la
+.libs/
+.deps/
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache/
+config.h
+config.h.in
+config.log
+config.status
+config.guess
+config.sub
+libtool
+ltmain.sh
+install-sh
+missing
+configure
+stamp-h1
+depcomp
+udev-test-install/
diff --git a/INSTALL b/INSTALL
new file mode 100644 (file)
index 0000000..8552599
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,44 @@
+  ./configure
+    --prefix=
+        "/usr" - prefix for man pages, include files
+    --exec-prefix=
+        "" - the root filesystem, prefix for libs and binaries
+    --sysconfdir=
+        "/etc"
+    --with-libdir-name=
+        "lib" - directory name for libraries, not a path name
+        multilib 64bit systems may use "lib64" instead of "lib"
+    --enable-debug
+        compile-in verbose debug messages
+    --disable-logging
+        disable all logging and compile-out all log strings
+    --enable-selinux
+        link against SELInux libraries to set the expected context
+        for created files
+
+The installation directories are controlled by $prefix, $exec_prefix
+$sysconfdir and $libdir-name. Documentation, development files are
+installed below $prefix, binaries are installed below $exec_prefix,
+libraries below $exec_prefix/$libdir-name.
+
+The default configuration for a RPM spec file may look like:
+  --prefix=%{_prefix}
+  --exec-prefix=""
+  --sysconfdir=%{_sysconfdir}
+  --with-libdir-name=%{_lib}
+
+The well defined location for scripts and binaries which are called
+from rules is /lib/udev/ on all systems and architectures, anything
+else is broken. Other packages who use udev, may use the /lib/udev/
+directory to install their rule helper and udev rule files.
+
+It is recommended to use the /lib/udev/devices/ directory to place
+device nodes, directories and symlinks, which are copied to /dev/
+at every bootup. That way, nodes for devices which can not be
+detected automatically, or are activated on-demand by opening the
+pre-existing device node, will be available.
+
+Default udev rules and persistent device naming rules are required
+by other software that depends on the data udev collects from the
+devices, and should therefore be installed by default with every udev
+installation.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..8152af0
--- /dev/null
@@ -0,0 +1,41 @@
+SUBDIRS = \
+       udev \
+       rules \
+       extras
+
+udevconfdir = $(sysconfdir)/udev
+udevconf_DATA = \
+       udev.conf
+
+EXTRA_DIST = \
+       udev.conf \
+       docs \
+       autogen.sh
+
+distclean-local:
+       rm -f *~
+       rm -rf autom4te.cache
+       rm -f depcomp aclocal.m4 config.h.in configure install-sh
+       rm -f Makefile.in missing config.guess config.sub ltmain.sh
+       rm -rf udev-test-install
+       rm -f udev-$(VERSION).tar.gz udev-$(VERSION).tar.bz2
+
+ChangeLog:
+       @ mv $@ $@.tmp
+       @ echo "Summary of changes from v$(shell echo $$(($(VERSION) - 1))) to v$(VERSION)" >> $@
+       @ echo "============================================" >> $@
+       @ echo >> $@
+       @ git log --pretty=short $(shell echo $$(($(VERSION) - 1)))..HEAD | git shortlog  >> $@
+       @ echo >> $@
+       @ cat $@
+       @ cat $@.tmp >> $@
+       @ rm $@.tmp
+
+test-run:
+       cd test && ./udev-test.pl
+
+test-install:
+       rm -rf $(PWD)/udev-test-install/
+       make DESTDIR=$(PWD)/udev-test-install install
+       tree $(PWD)/udev-test-install/
+
diff --git a/NEWS b/NEWS
index fea7db0..767a9b7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,27 @@
+udev 126
+========
+We use ./configure now. See INSTALL for details. Current
+options are:
+    --prefix=
+        "/usr" - prefix for man pages, include files
+    --exec-prefix=
+        "" - the root filesystem, prefix for libs and binaries
+    --sysconfdir=
+        "/etc"
+    --with-libdir-name=
+        "lib" - directory name for libraries, not a path name
+        multilib 64bit systems may use "lib64" instead of "lib"
+    --enable-debug
+        compile-in verbose debug messages
+    --disable-logging
+        disable all logging and compile-out all log strings
+    --enable-selinux
+        link against SELInux libraries to set the expected context
+        for created files
+
+No symlinks to udevadm are installed anymore, if still neded, the
+package should create them.
+
 udev 125
 ========
 Bugfixes.
diff --git a/README b/README
index 0af212d..2cde586 100644 (file)
--- a/README
+++ b/README
@@ -17,19 +17,19 @@ Requirements:
     (unix domain sockets (CONFIG_UNIX) as a loadable kernel module may work,
     but it does not make any sense - don't complain if anything goes wrong.)
 
-  - The proc filesystem must be mounted on /proc, the sysfs filesystem must
-    be mounted at /sys. No other locations are supported by udev.
+  - The proc filesystem must be mounted on /proc/, the sysfs filesystem must
+    be mounted at /sys/. No other locations are supported by udev.
 
 
 Operation:
-  Udev creates and removes device nodes in /dev, based on events the kernel
+  Udev creates and removes device nodes in /dev/, based on events the kernel
   sends out on device discovery or removal.
 
-  - Very early in the boot process, the /dev directory should get a 'tmpfs'
+  - Very early in the boot process, the /dev/ directory should get a 'tmpfs'
     filesystem mounted, which is populated from scratch by udev. Created nodes
     or changed permissions will not survive a reboot, which is intentional.
 
-  - The content of /lib/udev/devices directory which contains the nodes,
+  - The content of /lib/udev/devices/ directory which contains the nodes,
     symlinks and directories, which are always expected to be in /dev, should
     be copied over to the tmpfs mounted /dev, to provide the required nodes
     to initialize udev and continue booting.
@@ -48,44 +48,6 @@ Operation:
     device node with the default kernel name, or the one specified by a
     matching udev rule.
 
-
-Compile Options:
-  DESTDIR
-       Prefix of install target, used for package building.
-  USE_LOG
-       If set to 'true', udev is able to pass errors or debug information
-       to syslog. This is very useful to see what udev is doing or not doing.
-       It is enabled by default, don't expect any useful answer, if you
-       need to hunt a bug, but you can't enable syslog.
-  DEBUG
-       If set to 'true', very verbose debugging messages will be compiled
-       into the udev binaries. The actual level of debugging is specified
-       in the udev config file.
-  USE_SELINUX
-       If set to 'true', udev will be built with SELinux support
-       enabled.  This is disabled by default.
-  EXTRAS
-       list of helper programs in extras/ to build.
-        make EXTRAS="extras/cdrom_id extras/scsi_id extras/volume_id"
-
-
-Installation:
-  - The install target intalls the udev binaries in the default locations,
-    All binaries will be installed in /lib/udev or /sbin.
-
-  - The default location for scripts and binaries that are called from
-    rules is /lib/udev. Other packages who install udev rules, may use
-    that directory too.
-
-  - It is recommended to use the /lib/udev/devices/ directory to place
-    device nodes and symlinks in, which are copied to /dev at every boot.
-    That way, nodes for broken subsystems or devices which can't be
-    detected automatically by the kernel, will always be available.
-
-  - Default udev rules and persistent device naming rules are required by other
-    software that depends on the data udev collects from the devices,
-    and should be installed by default with every udev installation.
-
-Please direct any comment/question/concern to the linux-hotplug-devel mailing list at:
+Please direct any comment/question/concern to the linux-hotplug mailing list at:
   linux-hotplug@vger.kernel.org
 
diff --git a/autogen.sh b/autogen.sh
new file mode 100755 (executable)
index 0000000..b01012e
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh -e
+
+(autopoint --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have autopoint installed to generate the build system.."
+       echo
+       exit 1
+}
+(autoconf --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have autoconf installed to generate the build system."
+       echo
+       exit 1
+}
+(libtoolize --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have libtool installed to generate the build system."
+       echo
+       exit 1
+}
+(autoheader --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have autoheader installed to generate the build system."
+       echo
+       exit 1
+}
+(automake --version) < /dev/null > /dev/null 2>&1 || {
+       echo
+       echo "You must have automake installed to generate the build system."
+       echo
+       exit 1
+}
+
+test -f udev/udevd.c || {
+       echo "You must run this script in the top-level source directory"
+       exit 1
+}
+
+echo "   aclocal:    $(aclocal --version | head -1)"
+aclocal
+echo "   autoconf:   $(autoconf --version | head -1)"
+autoconf
+echo "   libtool:   $(automake --version | head -1)"
+libtoolize --force
+echo "   autoheader: $(autoheader --version | head -1)"
+autoheader
+echo "   automake:   $(automake --version | head -1)"
+automake --add-missing
+
+if test -z "$@"; then
+       args="--prefix=/usr --exec-prefix= --sysconfdir=/etc"
+else
+       args=$@
+fi
+echo "   configure:  $args"
+echo
+./configure $args
diff --git a/configure.ac b/configure.ac
new file mode 100644 (file)
index 0000000..0ec8e20
--- /dev/null
@@ -0,0 +1,118 @@
+AC_INIT(udev,
+       126,
+       kay.sievers@vrfy.org)
+
+AC_PREREQ(2.60)
+AC_CONFIG_SRCDIR(udev/udevd.c)
+AM_INIT_AUTOMAKE([check-news foreign -Wall 1.9 dist-bzip2])
+AC_GNU_SOURCE
+AC_DISABLE_STATIC
+AC_SYS_LARGEFILE
+AC_PROG_LIBTOOL
+
+dnl /* libvolume_id version */
+VOLID_LT_CURRENT=0
+VOLID_LT_REVISION=86
+VOLID_LT_AGE=0
+AC_SUBST(VOLID_LT_CURRENT)
+AC_SUBST(VOLID_LT_REVISION)
+AC_SUBST(VOLID_LT_AGE)
+
+AC_PATH_PROG([XSLTPROC], [xsltproc])
+
+AC_CHECK_LIB(c, inotify_init,
+       [AC_DEFINE([HAVE_INOTIFY], 1, [inotify available])],
+       [AC_MSG_WARN([inotify support disabled])])
+
+AC_CHECK_LIB(c, strlcpy,
+       [AC_DEFINE([HAVE_STRLCPY], 1, [strlcpy available])],
+       [])
+
+AC_ARG_WITH(udev-prefix,
+       AS_HELP_STRING([--with-udev-prefix=DIR], [add prefix to internal udev path names]),
+       [], [with_udev_prefix='${exec_prefix}'])
+udev_prefix=$with_udev_prefix
+AC_SUBST(udev_prefix)
+
+AC_ARG_WITH(libdir-name,
+       AS_HELP_STRING([--with-libdir-name=DIR], [name of the arch lib directory]),
+       [], [with_libdir_name=lib])
+libdir_name=$with_libdir_name
+AC_SUBST(libdir_name)
+
+AC_ARG_WITH(selinux,
+       AS_HELP_STRING([--with-selinux], [compile with SELinux support]),
+       [], with_selinux=no)
+if test "x$with_selinux" = xyes; then
+       LIBS_save=$LIBS
+       AC_CHECK_LIB(selinux, getprevcon,
+               [],
+               AC_MSG_ERROR([SELinux selected but libselinux not found]))
+       LIBS=$LIBS_save
+       AC_DEFINE(USE_SELINUX, [1] ,[compile with SELinux support])
+       SELINUX_LIBS="-lselinux"
+fi
+AC_SUBST([SELINUX_LIBS])
+AM_CONDITIONAL(USE_SELINUX, [test "x$with_selinux" = xyes], [compile with SELinux support])
+
+AC_ARG_ENABLE(debug,
+       AS_HELP_STRING([--enable-debug], [turn on debugging]),
+       [], enable_debug=no)
+if test "x$enable_debug" = "xyes"; then
+       AC_DEFINE(DEBUG, [1] ,[Compile in debug messages])
+       DEBUG_CFLAGS="-DDEBUG"
+fi
+AC_SUBST(DEBUG_CFLAGS)
+
+AC_ARG_ENABLE(logging,
+       AS_HELP_STRING([--disable-logging], [turn off logging/syslog]),
+       [], enable_logging=yes)
+if test "x$enable_logging" != "xno"; then
+       AC_DEFINE(USE_LOG, [1] ,[Use logging/syslog])
+fi
+
+AC_CONFIG_HEADERS(config.h)
+AC_CONFIG_FILES([
+       Makefile
+       udev/Makefile
+       rules/Makefile
+       extras/Makefile
+       extras/ata_id/Makefile
+       extras/cdrom_id/Makefile
+       extras/edd_id/Makefile
+       extras/path_id/Makefile
+       extras/firmware/Makefile
+       extras/collect/Makefile
+       extras/floppy/Makefile
+       extras/fstab_import/Makefile
+       extras/rule_generator/Makefile
+       extras/scsi_id/Makefile
+       extras/usb_id/Makefile
+       extras/volume_id/Makefile
+       extras/volume_id/lib/Makefile
+       extras/volume_id/lib/libvolume_id.pc
+])
+AC_OUTPUT
+
+echo "
+       udev $VERSION
+       ========
+
+       prefix:                 ${prefix}
+       exec_prefix:            ${exec_prefix}
+       udev_prefix:            ${udev_prefix}
+       libdir_name:            ${libdir_name}
+       datarootdir:            ${datarootdir}
+       mandir:                 ${mandir}
+       includedir:             ${includedir}
+
+       logging:                ${enable_logging}
+       debug:                  ${enable_debug}
+       selinux:                ${with_selinux}
+
+       compiler:               ${CC}
+       cflags:                 ${CFLAGS}
+       ldflags:                ${LDFLAGS}
+
+       xsltproc:               ${XSLTPROC}
+"
diff --git a/extras/Makefile.am b/extras/Makefile.am
new file mode 100644 (file)
index 0000000..f72e0b1
--- /dev/null
@@ -0,0 +1,16 @@
+SUBDIRS = \
+       ata_id \
+       cdrom_id \
+       edd_id \
+       path_id \
+       firmware \
+       collect \
+       floppy \
+       fstab_import \
+       rule_generator \
+       scsi_id \
+       usb_id \
+       volume_id
+
+distclean-local:
+       rm -f Makefile.in
diff --git a/extras/ata_id/Makefile.am b/extras/ata_id/Makefile.am
new file mode 100644 (file)
index 0000000..81332dd
--- /dev/null
@@ -0,0 +1,20 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       ata_id
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+ata_id_SOURCES = \
+       ata_id.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+dist_man_MANS = \
+       ata_id.8
+
+distclean-local:
+       rm -f Makefile.in
+
index 6d3c233..125c3f3 100644 (file)
@@ -26,7 +26,7 @@
 #include <linux/types.h>
 #include <linux/hdreg.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 
 #ifdef USE_LOG
 void log_message(int priority, const char *format, ...)
diff --git a/extras/cdrom_id/Makefile.am b/extras/cdrom_id/Makefile.am
new file mode 100644 (file)
index 0000000..88de137
--- /dev/null
@@ -0,0 +1,24 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       cdrom_id
+
+udevrulesdir = $(udev_prefix)/lib/udev/rules.d
+dist_udevrules_DATA = \
+       60-cdrom_id.rules
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+cdrom_id_SOURCES = \
+       cdrom_id.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+dist_man_MANS = \
+       cdrom_id.8
+
+distclean-local:
+       rm -f Makefile.in
+
index a113566..acf7a97 100644 (file)
@@ -37,7 +37,8 @@
 #include <sys/time.h>
 #include <sys/ioctl.h>
 #include <linux/cdrom.h>
-#include "../../udev.h"
+
+#include "../../udev/udev.h"
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
diff --git a/extras/collect/Makefile.am b/extras/collect/Makefile.am
new file mode 100644 (file)
index 0000000..a92f4aa
--- /dev/null
@@ -0,0 +1,11 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       collect
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+distclean-local:
+       rm -f Makefile.in
+
index ce49b9f..14184a5 100644 (file)
@@ -31,9 +31,9 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#include "../../list.h"
+#include "../../udev/list.h"
 
-#define TMPFILE                        "/dev/.udev/collect"
+#define TMPFILE                        UDEV_PREFIX "/dev/.udev/collect"
 #define BUFSIZE                        16
 #define UDEV_ALARM_TIMEOUT     180
 
diff --git a/extras/edd_id/Makefile.am b/extras/edd_id/Makefile.am
new file mode 100644 (file)
index 0000000..fa4f18c
--- /dev/null
@@ -0,0 +1,24 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       edd_id
+
+udevrulesdir = $(udev_prefix)/lib/udev/rules.d
+dist_udevrules_DATA = \
+       61-persistent-storage-edd.rules
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+edd_id_SOURCES = \
+       edd_id.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+dist_man_MANS = \
+       edd_id.8
+
+distclean-local:
+       rm -f Makefile.in
+
index 4a17770..9d745c5 100644 (file)
@@ -23,7 +23,7 @@
 #include <dirent.h>
 #include <stdint.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 
 #ifdef USE_LOG
 void log_message(int priority, const char *format, ...)
diff --git a/extras/firmware/Makefile.am b/extras/firmware/Makefile.am
new file mode 100644 (file)
index 0000000..0c69de9
--- /dev/null
@@ -0,0 +1,7 @@
+udevhomedir = $(udev_prefix)/lib/udev
+dist_udevhome_SCRIPTS = \
+       firmware.sh
+
+distclean-local:
+       rm -f Makefile.in
+
diff --git a/extras/floppy/Makefile.am b/extras/floppy/Makefile.am
new file mode 100644 (file)
index 0000000..4854d52
--- /dev/null
@@ -0,0 +1,29 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       create_floppy_devices
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+create_floppy_devices_SOURCES = \
+       create_floppy_devices.c \
+       ../../udev/udev_config.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c \
+       ../../udev/udev_utils_file.c
+if USE_SELINUX
+create_floppy_devices_SOURCES += \
+       ../../udev/udev_selinux.c
+
+create_floppy_devices_LDADD = \
+       $(SELINUX_LIBS)
+endif
+
+dist_man_MANS = \
+       create_floppy_devices.8
+
+distclean-local:
+       rm -f Makefile.in
+
index d79a782..3e73aa8 100644 (file)
@@ -24,8 +24,8 @@
 #include <pwd.h>
 #include <grp.h>
 
-#include "../../udev.h"
-#include "../../udev_selinux.h"
+#include "../../udev/udev.h"
+#include "../../udev/udev_selinux.h"
 
 static char *table[] = {
        "", "d360", "h1200", "u360", "u720", "h360", "h720",
diff --git a/extras/fstab_import/Makefile.am b/extras/fstab_import/Makefile.am
new file mode 100644 (file)
index 0000000..0ee7efb
--- /dev/null
@@ -0,0 +1,21 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       fstab_import
+
+udevrulesdir = $(udev_prefix)/lib/udev/rules.d
+dist_udevrules_DATA = \
+       79-fstab_import.rules
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+fstab_import_SOURCES = \
+       fstab_import.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+distclean-local:
+       rm -f Makefile.in
+
index a8de067..2d24cfb 100644 (file)
@@ -24,7 +24,7 @@
 #include <mntent.h>
 #include <sys/stat.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 
 static int debug;
 static char root[PATH_SIZE] = "/dev";
diff --git a/extras/path_id/Makefile.am b/extras/path_id/Makefile.am
new file mode 100644 (file)
index 0000000..966a03d
--- /dev/null
@@ -0,0 +1,10 @@
+udevhomedir = $(udev_prefix)/lib/udev
+dist_udevhome_SCRIPTS = \
+       path_id
+
+dist_man_MANS = \
+       path_id.8
+
+distclean-local:
+       rm -f Makefile.in
+
diff --git a/extras/rule_generator/Makefile.am b/extras/rule_generator/Makefile.am
new file mode 100644 (file)
index 0000000..1f0248b
--- /dev/null
@@ -0,0 +1,16 @@
+udevhomedir = $(udev_prefix)/lib/udev
+dist_udevhome_SCRIPTS = \
+       write_cd_rules \
+       write_net_rules
+
+dist_udevhome_DATA = \
+       rule_generator.functions
+
+udevrulesdir = $(udev_prefix)/lib/udev/rules.d
+dist_udevrules_DATA = \
+       75-cd-aliases-generator.rules \
+       75-persistent-net-generator.rules
+
+distclean-local:
+       rm -f Makefile.in
+
diff --git a/extras/scsi_id/Makefile.am b/extras/scsi_id/Makefile.am
new file mode 100644 (file)
index 0000000..7f890b0
--- /dev/null
@@ -0,0 +1,27 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       scsi_id
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+scsi_id_SOURCES = \
+       scsi_id.c \
+       scsi_serial.c \
+       scsi.h \
+       scsi_id.h \
+       bsg.h \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+dist_sysconf_DATA = \
+       scsi_id.config
+
+dist_man_MANS = \
+       scsi_id.8
+
+distclean-local:
+       rm -f Makefile.in
+
index bc942fa..23bcb94 100644 (file)
@@ -14,6 +14,8 @@
  *     Free Software Foundation version 2 of the License.
  */
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -27,9 +29,8 @@
 #include <getopt.h>
 #include <sys/stat.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 #include "scsi_id.h"
-#include "scsi_id_version.h"
 
 static const struct option options[] = {
        { "device", 1, NULL, 'd' },
@@ -51,7 +52,7 @@ static const char dev_short_options[] = "bgp:";
 
 static int all_good;
 static int dev_specified;
-static char config_file[MAX_PATH_LEN] = SCSI_ID_CONFIG_FILE;
+static char config_file[MAX_PATH_LEN] = SYSCONFDIR "/scsi_id.config";
 static enum page_code default_page_code;
 static int sg_version = 4;
 static int use_stderr;
@@ -468,7 +469,7 @@ static int set_options(int argc, char **argv, const char *short_opts,
                        break;
 
                case 'V':
-                       printf("%s\n", SCSI_ID_VERSION);
+                       printf("%s\n", VERSION);
                        exit(0);
                        break;
 
index 016075c..104db3d 100644 (file)
 /* #include <linux/bsg.h> */
 #include "bsg.h"
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 #include "scsi.h"
 #include "scsi_id.h"
-#include "scsi_id_version.h"
 
 /*
  * A priority based list of id, naa, and binary/ascii for the identifier
diff --git a/extras/usb_id/Makefile.am b/extras/usb_id/Makefile.am
new file mode 100644 (file)
index 0000000..0de004a
--- /dev/null
@@ -0,0 +1,18 @@
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       usb_id
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+usb_id_SOURCES = \
+       usb_id.c \
+       ../../udev/udev_sysfs.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+distclean-local:
+       rm -f Makefile.in
+
index fed6631..5b78b97 100644 (file)
@@ -20,7 +20,7 @@
 #include <errno.h>
 #include <getopt.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 
 #define MAX_PATH_LEN                   512
 #define MAX_SERIAL_LEN                 256
diff --git a/extras/volume_id/Makefile.am b/extras/volume_id/Makefile.am
new file mode 100644 (file)
index 0000000..bc1b262
--- /dev/null
@@ -0,0 +1,33 @@
+SUBDIRS = \
+       lib
+
+udevhomedir = $(udev_prefix)/lib/udev
+udevhome_PROGRAMS = \
+       vol_id
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+vol_id_SOURCES = \
+       vol_id.c \
+       ../../udev/udev_sysdeps.c \
+       ../../udev/udev_utils.c \
+       ../../udev/udev_utils_string.c
+
+vol_id_LDADD = \
+       lib/libvolume_id.la
+
+dist_man_MANS = \
+       vol_id.8
+
+EXTRA_DIST = \
+       vol_id.xml
+
+%.7 %.8 : %.xml
+       $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+distclean-local:
+       rm -f Makefile.in
+       rm -f $(dist_man_MANS)
+
diff --git a/extras/volume_id/lib/Makefile.am b/extras/volume_id/lib/Makefile.am
new file mode 100644 (file)
index 0000000..de37f9e
--- /dev/null
@@ -0,0 +1,69 @@
+rootlibdir = $(exec_prefix)/$(libdir_name)
+rootlib_LTLIBRARIES = \
+       libvolume_id.la
+
+include_HEADERS =\
+       libvolume_id.h
+
+libvolume_id_la_SOURCES =\
+       ext.c \
+       fat.c \
+       hfs.c \
+       highpoint.c \
+       isw_raid.c \
+       lsi_raid.c \
+       via_raid.c \
+       silicon_raid.c \
+       nvidia_raid.c \
+       promise_raid.c \
+       adaptec_raid.c \
+       jmicron_raid.c \
+       ddf_raid.c \
+       iso9660.c \
+       jfs.c \
+       linux_raid.c \
+       linux_swap.c \
+       lvm.c \
+       ntfs.c \
+       reiserfs.c \
+       udf.c \
+       ufs.c \
+       xfs.c \
+       cramfs.c \
+       hpfs.c \
+       romfs.c \
+       sysv.c \
+       minix.c \
+       gfs.c \
+       luks.c \
+       ocfs.c \
+       vxfs.c \
+       squashfs.c \
+       netware.c \
+       oracleasm.c \
+       volume_id.c \
+       util.h \
+       util.c
+
+libvolume_id_la_LDFLAGS = \
+       -version-info $(VOLID_LT_CURRENT):$(VOLID_LT_REVISION):$(VOLID_LT_AGE) \
+       -export-symbols $(top_srcdir)/extras/volume_id/lib/exported_symbols
+
+# move devel files to $(prefix)$(libdir_name) if needed
+install-data-hook:
+       rm  $(DESTDIR)$(rootlibdir)/libvolume_id.la
+       if test "$(prefix)" != "$(exec_prefix)"; then \
+               rm $(DESTDIR)$(rootlibdir)/libvolume_id.so; \
+               mkdir -p $(DESTDIR)$(prefix)/$(libdir_name); \
+               ln -sf $(rootlibdir)/libvolume_id.so.$(VOLID_LT_CURRENT).$(VOLID_LT_AGE).$(VOLID_LT_REVISION) \
+                       $(DESTDIR)$(prefix)/$(libdir_name)/libvolume_id.so; \
+       fi
+
+EXTRA_DIST = \
+       exported_symbols
+
+pkgconfigdir = $(prefix)/$(libdir_name)/pkgconfig
+pkgconfig_DATA = libvolume_id.pc
+
+distclean-local:
+       rm -f Makefile.in
index 05b6e52..55b0265 100644 (file)
@@ -1,64 +1,55 @@
-{ global:
-       volume_id_log_fn;
-
-       volume_id_get_label;
-       volume_id_get_label_raw;
-       volume_id_get_uuid;
-       volume_id_get_uuid_raw;
-       volume_id_get_usage;
-       volume_id_get_type;
-       volume_id_get_type_version;
-
-       volume_id_open_fd;
-       volume_id_close;
-       volume_id_probe_all;
-       volume_id_probe_filesystem;
-       volume_id_probe_raid;
-       volume_id_all_probers;
-       volume_id_get_prober_by_type;
-       volume_id_encode_string;
-
-       volume_id_open_node;
-
-       volume_id_probe_linux_swap;
-       volume_id_probe_luks;
-       volume_id_probe_cramfs;
-       volume_id_probe_ext;
-       volume_id_probe_vfat;
-       volume_id_probe_hfs_hfsplus;
-       volume_id_probe_hpfs;
-       volume_id_probe_iso9660;
-       volume_id_probe_jfs;
-       volume_id_probe_minix;
-       volume_id_probe_ntfs;
-       volume_id_probe_ocfs1;
-       volume_id_probe_ocfs2;
-       volume_id_probe_reiserfs;
-       volume_id_probe_romfs;
-       volume_id_probe_sysv;
-       volume_id_probe_udf;
-       volume_id_probe_ufs;
-       volume_id_probe_vxfs;
-       volume_id_probe_xfs;
-       volume_id_probe_squashfs;
-       volume_id_probe_netware;
-       volume_id_probe_gfs;
-       volume_id_probe_gfs2;
-
-       volume_id_probe_linux_raid;
-       volume_id_probe_lvm1;
-       volume_id_probe_lvm2;
-       volume_id_probe_ddf_raid;
-       volume_id_probe_intel_software_raid;
-       volume_id_probe_highpoint_37x_raid;
-       volume_id_probe_highpoint_45x_raid;
-       volume_id_probe_lsi_mega_raid;
-       volume_id_probe_nvidia_raid;
-       volume_id_probe_promise_fasttrack_raid;
-       volume_id_probe_silicon_medley_raid;
-       volume_id_probe_via_raid;
-       volume_id_probe_adaptec_raid;
-       volume_id_probe_jmicron_raid;
-local:
-       *;
-};
+volume_id_log_fn
+volume_id_get_label
+volume_id_get_label_raw
+volume_id_get_uuid
+volume_id_get_uuid_raw
+volume_id_get_usage
+volume_id_get_type
+volume_id_get_type_version
+volume_id_open_fd
+volume_id_close
+volume_id_probe_all
+volume_id_probe_filesystem
+volume_id_probe_raid
+volume_id_all_probers
+volume_id_get_prober_by_type
+volume_id_encode_string
+volume_id_open_node
+volume_id_probe_linux_swap
+volume_id_probe_luks
+volume_id_probe_cramfs
+volume_id_probe_ext
+volume_id_probe_vfat
+volume_id_probe_hfs_hfsplus
+volume_id_probe_hpfs
+volume_id_probe_iso9660
+volume_id_probe_jfs
+volume_id_probe_minix
+volume_id_probe_ntfs
+volume_id_probe_ocfs1
+volume_id_probe_ocfs2
+volume_id_probe_reiserfs
+volume_id_probe_romfs
+volume_id_probe_sysv
+volume_id_probe_udf
+volume_id_probe_ufs
+volume_id_probe_vxfs
+volume_id_probe_xfs
+volume_id_probe_squashfs
+volume_id_probe_netware
+volume_id_probe_gfs
+volume_id_probe_gfs2
+volume_id_probe_linux_raid
+volume_id_probe_lvm1
+volume_id_probe_lvm2
+volume_id_probe_ddf_raid
+volume_id_probe_intel_software_raid
+volume_id_probe_highpoint_37x_raid
+volume_id_probe_highpoint_45x_raid
+volume_id_probe_lsi_mega_raid
+volume_id_probe_nvidia_raid
+volume_id_probe_promise_fasttrack_raid
+volume_id_probe_silicon_medley_raid
+volume_id_probe_via_raid
+volume_id_probe_adaptec_raid
+volume_id_probe_jmicron_raid
diff --git a/extras/volume_id/lib/libvolume_id.pc.in b/extras/volume_id/lib/libvolume_id.pc.in
new file mode 100644 (file)
index 0000000..5a1e1b7
--- /dev/null
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@prefix@
+libdir=@prefix@/@libdir_name@
+includedir=@prefix@/include
+
+Name: libvolume_id
+Description: Library for reading metadata, label, uuid from various filesystems
+Version: @VERSION@
+Libs: -L${libdir} -lvolume_id
+Cflags: -I${includedir}
index 5c4e05d..60428ab 100644 (file)
@@ -34,7 +34,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 
-#include "../../udev.h"
+#include "../../udev/udev.h"
 #include "lib/libvolume_id.h"
 
 #define BLKGETSIZE64 _IOR(0x12,114,size_t)
diff --git a/rules/Makefile.am b/rules/Makefile.am
new file mode 100644 (file)
index 0000000..45a64b7
--- /dev/null
@@ -0,0 +1,25 @@
+udevrulesdir = $(udev_prefix)/lib/udev/rules.d
+dist_udevrules_DATA = \
+       rules.d/50-udev-default.rules \
+       rules.d/60-persistent-storage.rules \
+       rules.d/60-persistent-storage-tape.rules \
+       rules.d/60-persistent-input.rules \
+       rules.d/60-persistent-v4l.rules \
+       rules.d/80-drivers.rules \
+       rules.d/95-udev-late.rules
+
+install-data-local:
+       -mkdir -p $(DESTDIR)$(sysconfdir)/udev/rules.d
+
+EXTRA_DIST = \
+       packages \
+       debian \
+       redhat \
+       suse \
+       gentoo \
+       slackware \
+       frugalware
+
+
+distclean-local:
+       rm -f Makefile.in
index f7f68a1..ad551dd 100755 (executable)
@@ -22,7 +22,7 @@ use strict;
 
 my $PWD                = $ENV{PWD};
 my $sysfs      = "sys/";
-my $udev_bin   = "../test-udev";
+my $udev_bin   = "../udev/test-udev";
 my $udev_root  = "udev-root/";
 my $udev_conf  = "udev-test.conf";
 my $udev_rules = "udev-test.rules";
diff --git a/udev/.gitignore b/udev/.gitignore
new file mode 100644 (file)
index 0000000..5ce11ac
--- /dev/null
@@ -0,0 +1,6 @@
+*.o
+*.a
+udevd
+udevadm
+test-udev
+.deps/
diff --git a/udev/Makefile.am b/udev/Makefile.am
new file mode 100644 (file)
index 0000000..6402f23
--- /dev/null
@@ -0,0 +1,115 @@
+sbin_PROGRAMS = \
+       udevd \
+       udevadm
+
+noinst_PROGRAMS = \
+       test-udev
+
+AM_CPPFLAGS = \
+       -DSYSCONFDIR=\""$(sysconfdir)"\" \
+       -DUDEV_PREFIX=\""$(udev_prefix)"\"
+
+udevd_SOURCES = \
+       list.h \
+       logging.h \
+       udev.h \
+       udev_rules.h \
+       udev_selinux.h \
+       udev_sysdeps.h \
+       udevd.h \
+       udevd.c \
+       udev_config.c \
+       udev_db.c \
+       udev_device.c \
+       udev_node.c \
+       udev_rules.c \
+       udev_rules_parse.c \
+       udev_sysdeps.c \
+       udev_sysfs.c \
+       udev_utils.c \
+       udev_utils_file.c \
+       udev_utils_string.c
+if USE_SELINUX
+udevd_SOURCES += \
+       udev_selinux.c
+
+udevd_LDADD = \
+       $(SELINUX_LIBS)
+endif
+
+udevadm_SOURCES = \
+       list.h \
+       logging.h \
+       udev.h \
+       udev_rules.h \
+       udev_selinux.h \
+       udev_sysdeps.h \
+       udevadm.c \
+       udevinfo.c \
+       udevcontrol.c \
+       udevtest.c \
+       udevmonitor.c \
+       udevsettle.c \
+       udevtrigger.c \
+       udev_config.c \
+       udev_db.c \
+       udev_device.c \
+       udev_node.c \
+       udev_rules.c \
+       udev_rules_parse.c \
+       udev_sysdeps.c \
+       udev_sysfs.c \
+       udev_utils.c \
+       udev_utils_file.c \
+       udev_utils_string.c
+if USE_SELINUX
+udevadm_SOURCES += \
+       udev_selinux.c
+
+udevadm_LDADD = \
+       $(SELINUX_LIBS)
+endif
+
+test_udev_SOURCES = \
+       list.h \
+       logging.h \
+       udev.h \
+       udev_rules.h \
+       udev_selinux.h \
+       udev_sysdeps.h \
+       test-udev.c \
+       udev_config.c \
+       udev_db.c \
+       udev_device.c \
+       udev_node.c \
+       udev_rules.c \
+       udev_rules_parse.c \
+       udev_sysdeps.c \
+       udev_sysfs.c \
+       udev_utils.c \
+       udev_utils_file.c \
+       udev_utils_string.c
+if USE_SELINUX
+test_udev_SOURCES += \
+       udev_selinux.c
+
+test_udev_LDADD = \
+       $(SELINUX_LIBS)
+endif
+
+dist_man_MANS = \
+       udev.7 \
+       udevadm.8 \
+       udevd.8
+
+EXTRA_DIST = \
+       udev.xml \
+       udevadm.xml \
+       udevd.xml
+
+%.7 %.8 : %.xml
+       $(XSLTPROC) -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
+
+distclean-local:
+       rm -f Makefile.in
+       rm -f $(dist_man_MANS)
index 6e1d5a2..6766ac3 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef LOGGING_H
 #define LOGGING_H
 
+#include "config.h"
+
 #define err(format, arg...)            do { } while (0)
 #define info(format, arg...)           do { } while (0)
 #define dbg(format, arg...)            do { } while (0)
index 4ac2d5a..591e930 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include "config.h"
+
 #include <stdio.h>
 #include <stddef.h>
 #include <stdlib.h>
@@ -71,7 +73,7 @@ int main(int argc, char *argv[], char *envp[])
        int retval = -EINVAL;
 
        if (argc == 2 && strcmp(argv[1], "-V") == 0) {
-               printf("%s\n", UDEV_VERSION);
+               printf("%s\n", VERSION);
                exit(0);
        }
 
@@ -93,7 +95,7 @@ int main(int argc, char *argv[], char *envp[])
                err("open /dev/null failed: %s\n", strerror(errno));
        udev_config_init();
        selinux_init();
-       dbg("version %s\n", UDEV_VERSION);
+       dbg("version %s\n", VERSION);
 
        /* set signal handlers */
        memset(&act, 0x00, sizeof(act));
index 5ecef4a..2648e2a 100644 (file)
@@ -26,7 +26,6 @@
 #include "list.h"
 #include "logging.h"
 #include "udev_sysdeps.h"
-#include "udev_version.h"
 
 #define COMMENT_CHARACTER                      '#'
 #define LINE_SIZE                              512
 #define READ_END                               0
 #define WRITE_END                              1
 
-#define UDEV_ROOT                              "/dev"
-#define DB_DIR                                 ".udev/db"
-#define DB_NAME_INDEX_DIR                      ".udev/names"
-#define RULES_LIB_DIR                          "/lib/udev/rules.d"
-#define RULES_DYN_DIR                          ".udev/rules.d"
-#define RULES_ETC_DIR                          "/etc/udev/rules.d"
-
 struct udev_rules;
 
 struct sysfs_device {
index 55f0361..8a1dac5 100644 (file)
@@ -164,8 +164,8 @@ void udev_config_init(void)
 {
        const char *env;
 
-       strcpy(udev_config_filename, UDEV_CONFIG_FILE);
-       strcpy(udev_root, UDEV_ROOT);
+       strcpy(udev_config_filename, SYSCONFDIR "/udev/udev.conf");
+       strcpy(udev_root, UDEV_PREFIX "/dev");
        udev_rules_dir[0] = '\0';
        udev_log_priority = LOG_ERR;
        udev_run = 1;
index 3348c9a..e3f0f7f 100644 (file)
@@ -40,7 +40,7 @@ static size_t devpath_to_db_path(const char *devpath, char *filename, size_t len
 
        /* translate to location of db file */
        strlcpy(filename, udev_root, len);
-       start = strlcat(filename, "/"DB_DIR"/", len);
+       start = strlcat(filename, "/.udev/db/", len);
        strlcat(filename, devpath, len);
        return path_encode(&filename[start], len - start);
 }
@@ -55,7 +55,7 @@ static int name_index(const char *devpath, const char *name, int add)
 
        /* directory with device name */
        strlcpy(filename, udev_root, sizeof(filename));
-       start = strlcat(filename, "/"DB_NAME_INDEX_DIR"/", sizeof(filename));
+       start = strlcat(filename, "/.udev/names/", sizeof(filename));
        strlcat(filename, name, sizeof(filename));
        path_encode(&filename[start], sizeof(filename) - start);
        /* entry with the devpath */
@@ -86,7 +86,7 @@ int udev_db_get_devices_by_name(const char *name, struct list_head *name_list)
        int rc = 0;
 
        strlcpy(dirname, udev_root, sizeof(dirname));
-       start = strlcat(dirname, "/"DB_NAME_INDEX_DIR"/", sizeof(dirname));
+       start = strlcat(dirname, "/.udev/names/", sizeof(dirname));
        strlcat(dirname, name, sizeof(dirname));
        path_encode(&dirname[start], sizeof(dirname) - start);
 
@@ -303,7 +303,7 @@ int udev_db_get_all_entries(struct list_head *name_list)
        DIR *dir;
 
        strlcpy(dbpath, udev_root, sizeof(dbpath));
-       strlcat(dbpath, "/"DB_DIR, sizeof(dbpath));
+       strlcat(dbpath, "/.udev/db", sizeof(dbpath));
        dir = opendir(dbpath);
        if (dir == NULL) {
                info("no udev_db available '%s': %s\n", dbpath, strerror(errno));
index cf21191..bce5b29 100644 (file)
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
+#include <string.h>
 #include <sys/ioctl.h>
 #include <sys/socket.h>
 #include <net/if.h>
index ea850a8..693bce2 100644 (file)
@@ -174,7 +174,7 @@ static int run_program(const char *command, const char *subsystem,
 
        /* allow programs in /lib/udev called without the path */
        if (strchr(argv[0], '/') == NULL) {
-               strlcpy(program, "/lib/udev/", sizeof(program));
+               strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program));
                strlcat(program, argv[0], sizeof(program));
                argv[0] = program;
        }
index fe0f9df..9a41ccb 100644 (file)
@@ -24,7 +24,6 @@
 #include "list.h"
 
 #define PAIRS_MAX              5
-#define RULESFILE_SUFFIX       ".rules"
 
 enum key_operation {
        KEY_OP_UNSET,
index 3ada8b1..273f92f 100644 (file)
@@ -451,7 +451,7 @@ static int add_to_rules(struct udev_rules *rules, char *line, const char *filena
 
                                /* allow programs in /lib/udev called without the path */
                                if (strchr(file, '/') == NULL) {
-                                       strlcpy(file, "/lib/udev/", sizeof(file));
+                                       strlcpy(file, UDEV_PREFIX "/lib/udev/", sizeof(file));
                                        strlcat(file, value, sizeof(file));
                                        pos = strchr(file, ' ');
                                        if (pos)
@@ -739,24 +739,24 @@ int udev_rules_init(struct udev_rules *rules, int resolve_names)
 
        if (udev_rules_dir[0] != '\0') {
                /* custom rules location for testing */
-               add_matching_files(&name_list, udev_rules_dir, RULESFILE_SUFFIX);
+               add_matching_files(&name_list, udev_rules_dir, ".rules");
        } else {
                /* read default rules */
-               add_matching_files(&name_list, RULES_LIB_DIR, RULESFILE_SUFFIX);
+               add_matching_files(&name_list, UDEV_PREFIX "/lib/udev/rules.d", ".rules");
 
                /* read user/custom rules */
-               add_matching_files(&sort_list, RULES_ETC_DIR, RULESFILE_SUFFIX);
+               add_matching_files(&sort_list, SYSCONFDIR "/udev/rules.d", ".rules");
 
                /* read dynamic/temporary rules */
                strlcpy(filename, udev_root, sizeof(filename));
-               strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename));
+               strlcat(filename, "/.udev/rules.d", sizeof(filename));
                if (stat(filename, &statbuf) != 0) {
                        create_path(filename);
                        selinux_setfscreatecon(filename, NULL, S_IFDIR|0755);
                        mkdir(filename, 0755);
                        selinux_resetfscreatecon();
                }
-               add_matching_files(&sort_list, filename, RULESFILE_SUFFIX);
+               add_matching_files(&sort_list, filename, ".rules");
 
                /* sort all rules files by basename into list of files */
                list_for_each_entry_safe(sort_loop, sort_tmp, &sort_list, node) {
index eec9501..66742e1 100644 (file)
@@ -16,6 +16,8 @@
  *
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <stddef.h>
index 73567d6..fcdd9db 100644 (file)
 #define _UDEV_SELINUX_H
 
 #ifdef USE_SELINUX
-
 extern void selinux_setfilecon(const char *file, const char *devname, unsigned int mode);
 extern void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode);
 extern void selinux_resetfscreatecon(void);
 extern void selinux_init(void);
 extern void selinux_exit(void);
-
 #else
-
 static inline void selinux_setfilecon(const char *file, const char *devname, unsigned int mode) {}
 static inline void selinux_setfscreatecon(const char *file, const char *devname, unsigned int mode) {}
 static inline void selinux_resetfscreatecon(void) {}
 static inline void selinux_init(void) {}
 static inline void selinux_exit(void) {}
+#endif
 
-#endif /* USE_SELINUX */
-#endif /* _UDEV_USE_SELINUX */
+#endif
index 9447cca..ef5b09e 100644 (file)
@@ -1,6 +1,5 @@
 /*
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005-2008 Kay Sievers <kay.sievers@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
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <errno.h>
 #include <sys/types.h>
 
-#include "udev.h"
-
-#ifdef __GLIBC__
+#ifndef HAVE_STRLCPY
 size_t strlcpy(char *dst, const char *src, size_t size)
 {
        size_t bytes = 0;
@@ -70,4 +64,4 @@ size_t strlcat(char *dst, const char *src, size_t size)
        *q = '\0';
        return bytes;
 }
-#endif /* __GLIBC__ */
+#endif /* HAVE_STRLCPY */
index d4f0368..f08053e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * wrapping of libc features and kernel interfaces
  *
- * Copyright (C) 2005-2006 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2005-2008 Kay Sievers <kay.sievers@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
 #ifndef _UDEV_SYSDEPS_H_
 #define _UDEV_SYSDEPS_H_
 
-#include <string.h>
-#include <unistd.h>
 #include <stdint.h>
 
-/* needed until Inotify! syscalls reach glibc */
-#include <sys/syscall.h>
-#ifndef __NR_inotify_init
-#if defined(__i386__)
-# define __NR_inotify_init     291
-# define __NR_inotify_add_watch        292
-# define __NR_inotify_rm_watch 293
-#elif defined(__x86_64__)
-# define __NR_inotify_init     253
-# define __NR_inotify_add_watch        254
-# define __NR_inotify_rm_watch 255
-#elif defined(__powerpc__) || defined(__powerpc64__)
-# define __NR_inotify_init     275
-# define __NR_inotify_add_watch        276
-# define __NR_inotify_rm_watch 277
-#elif defined (__ia64__)
-# define __NR_inotify_init     1277
-# define __NR_inotify_add_watch        1278
-# define __NR_inotify_rm_watch 1279
-#elif defined (__s390__)
-# define __NR_inotify_init     284
-# define __NR_inotify_add_watch        285
-# define __NR_inotify_rm_watch 286
-#elif defined (__alpha__)
-# define __NR_inotify_init     444
-# define __NR_inotify_add_watch        445
-# define __NR_inotify_rm_watch 446
-#elif defined (__sparc__) || defined (__sparc64__)
-# define __NR_inotify_init     151
-# define __NR_inotify_add_watch        152
-# define __NR_inotify_rm_watch 156
-#elif defined (__arm__)
-# define __NR_inotify_init     __NR_SYSCALL_BASE+316
-# define __NR_inotify_add_watch        __NR_SYSCALL_BASE+317
-# define __NR_inotify_rm_watch __NR_SYSCALL_BASE+318
-#elif defined (__sh__)
-# define __NR_inotify_init     290
-# define __NR_inotify_add_watch        291
-# define __NR_inotify_rm_watch 292
-#elif defined (__m32r__)
-# define __NR_inotify_init     290
-# define __NR_inotify_add_watch        291
-# define __NR_inotify_rm_watch 292
-#elif defined (__hppa__)
-# define __NR_inotify_init      269
-# define __NR_inotify_add_watch 270
-# define __NR_inotify_rm_watch  271
-#elif defined (__mips__)
-# include <sgidefs.h>
-# if _MIPS_SIM == _MIPS_SIM_ABI32
-#  define __NR_Linux             4000
-#  define __NR_inotify_init      (__NR_Linux + 284)
-#  define __NR_inotify_add_watch (__NR_Linux + 285)
-#  define __NR_inotify_rm_watch  (__NR_Linux + 286)
-# elif _MIPS_SIM == _MIPS_SIM_ABI64
-#  define __NR_Linux             5000
-#  define __NR_inotify_init      (__NR_Linux + 243)
-#  define __NR_inotify_add_watch (__NR_Linux + 244)
-#  define __NR_inotify_rm_watch  (__NR_Linux + 245)
-# elif _MIPS_SIM == _MIPS_SIM_NABI32
-#  define __NR_Linux             6000
-#  define __NR_inotify_init      (__NR_Linux + 247)
-#  define __NR_inotify_add_watch (__NR_Linux + 248)
-#  define __NR_inotify_rm_watch  (__NR_Linux + 249)
-# endif
+/* needed for our signal handlers to work */
+#undef asmlinkage
+#ifdef __i386__
+#define asmlinkage     __attribute__((regparm(0)))
 #else
-#warning "inotify unsupported on this architecture!"
-#endif
-#endif /* __NR_inotify_init */
+#define asmlinkage
+#endif /* __i386__ */
 
-/* dummy if we don't have the syscalls defined */
-#ifndef __NR_inotify_init
+#ifndef HAVE_INOTIFY
 static inline int inotify_init(void)
 {
        return -1;
@@ -106,67 +41,11 @@ static inline int inotify_add_watch(int fd, const char *name, uint32_t mask)
 {
        return -1;
 }
-#else
-/* needed until /usr/include/sys/inotify.h is working */
-#ifndef __GLIBC__
-#include <sys/inotify.h>
-#else
-static inline int inotify_init(void)
-{
-       return syscall(__NR_inotify_init);
-}
-
-static inline int inotify_add_watch(int fd, const char *name, uint32_t mask)
-{
-       return syscall(__NR_inotify_add_watch, fd, name, mask);
-}
-#endif /* __GLIBC__ */
-#endif /* __NR_inotify_init */
-
-#ifndef IN_CREATE
-#define IN_CREATE              0x00000100      /* Subfile was created */
-#define IN_MOVED_FROM          0x00000040      /* File was moved from X */
-#define IN_MOVED_TO            0x00000080      /* File was moved to Y */
-#define IN_DELETE              0x00000200      /* Subfile was deleted */
-#define IN_CLOSE_WRITE         0x00000008      /* Writtable file was closed */
-#define IN_MOVE                        (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
-#endif /* IN_CREATE */
-
-/* needed for our signal handlers to work */
-#undef asmlinkage
-#ifdef __i386__
-#define asmlinkage     __attribute__((regparm(0)))
-#else
-#define asmlinkage
-#endif /* __i386__ */
-
-/* headers are broken on some architectures */
-#ifndef __FD_SET
-#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
-#endif
-#ifndef __FD_CLR
-#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
-#endif
-#ifndef __FD_ISSET
-#define __FD_ISSET(d, set) (((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) != 0)
-#endif
-#ifndef __FD_ZERO
-#define __FD_ZERO(set) ((void) memset ((void*) (set), 0, sizeof (fd_set)))
-#endif
-
-#ifndef NETLINK_KOBJECT_UEVENT
-#define NETLINK_KOBJECT_UEVENT 15
-#endif
-
-#ifndef SO_RCVBUFFORCE
-#if defined(__alpha__) || defined(__hppa__) || defined(__sparc__) || defined(__sparc_v9__)
-#define SO_RCVBUFFORCE 0x100b
-#else
-#define SO_RCVBUFFORCE 33
-#endif
 #endif
 
+#ifndef HAVE_STRLCPY
 extern size_t strlcpy(char *dst, const char *src, size_t size);
 extern size_t strlcat(char *dst, const char *src, size_t size);
+#endif
 
 #endif
index c4cd4ab..91f5997 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 #include <ctype.h>
 #include <errno.h>
index 00b67da..9b22de7 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
index a492785..3e73c87 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
index e3dc137..78bfca8 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <unistd.h>
+#include <string.h>
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
index 6e7d773..7adb7c5 100644 (file)
@@ -16,6 +16,8 @@
  *
  */
 
+#include "config.h"
+
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -37,9 +39,9 @@ void log_message(int priority, const char *format, ...)
                return;
 
        va_start(args, format);
-       if (debug) {
+       if (debug)
                vprintf(format, args);
-       else
+       else
                vsyslog(priority, format, args);
        va_end(args);
 }
@@ -56,7 +58,7 @@ static const struct command cmds[];
 
 static int version(int argc, char *argv[], char *envp[])
 {
-       printf("%s\n", UDEV_VERSION);
+       printf("%s\n", VERSION);
        return 0;
 }
 
index 4c93b8f..a02bfc4 100644 (file)
@@ -16,6 +16,8 @@
  *
  */
 
+#include "config.h"
+
 #include <time.h>
 #include <errno.h>
 #include <stdio.h>
@@ -50,7 +52,7 @@ int udevcontrol(int argc, char *argv[], char *envp[])
                udev_log = log_priority(env);
 
        logging_init("udevcontrol");
-       dbg("version %s\n", UDEV_VERSION);
+       dbg("version %s\n", VERSION);
 
        if (argc < 2) {
                fprintf(stderr, "missing command\n\n");
index 0827a5c..22d261f 100644 (file)
@@ -17,6 +17,8 @@
  *
  */
 
+#include "config.h"
+
 #include <stddef.h>
 #include <signal.h>
 #include <unistd.h>
@@ -39,6 +41,9 @@
 #include <sys/ioctl.h>
 #include <linux/types.h>
 #include <linux/netlink.h>
+#ifdef HAVE_INOTIFY
+#include <sys/inotify.h>
+#endif
 
 #include "udev.h"
 #include "udev_rules.h"
@@ -156,12 +161,12 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
        size_t start;
 
        /* location of queue file */
-       snprintf(filename, sizeof(filename), "%s/"EVENT_QUEUE_DIR"/%llu", udev_root, msg->seqnum);
+       snprintf(filename, sizeof(filename), "%s/.udev/queue/%llu", udev_root, msg->seqnum);
 
        /* location of failed file */
        strlcpy(filename_failed, udev_root, sizeof(filename_failed));
        strlcat(filename_failed, "/", sizeof(filename_failed));
-       start = strlcat(filename_failed, EVENT_FAILED_DIR"/", sizeof(filename_failed));
+       start = strlcat(filename_failed, ".udev/failed/", sizeof(filename_failed));
        strlcat(filename_failed, msg->devpath, sizeof(filename_failed));
        path_encode(&filename_failed[start], sizeof(filename_failed) - start);
 
@@ -182,7 +187,7 @@ static void export_event_state(struct udevd_uevent_msg *msg, enum event_state st
 
                        strlcpy(filename_failed_old, udev_root, sizeof(filename_failed_old));
                        strlcat(filename_failed_old, "/", sizeof(filename_failed_old));
-                       start = strlcat(filename_failed_old, EVENT_FAILED_DIR"/", sizeof(filename_failed_old));
+                       start = strlcat(filename_failed_old, ".udev/failed/", sizeof(filename_failed_old));
                        strlcat(filename_failed_old, msg->devpath_old, sizeof(filename_failed_old));
                        path_encode(&filename_failed_old[start], sizeof(filename) - start);
 
@@ -273,7 +278,7 @@ static void msg_queue_insert(struct udevd_uevent_msg *msg)
        info("seq %llu queued, '%s' '%s'\n", msg->seqnum, msg->action, msg->subsystem);
 
        strlcpy(filename, udev_root, sizeof(filename));
-       strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
+       strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename));
        fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);
        if (fd >= 0) {
                char str[32];
@@ -939,7 +944,7 @@ static void export_initial_seqnum(void)
                len = 3;
        }
        strlcpy(filename, udev_root, sizeof(filename));
-       strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
+       strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename));
        create_path(filename);
        fd = open(filename, O_WRONLY|O_TRUNC|O_CREAT, 0644);
        if (fd >= 0) {
@@ -971,7 +976,7 @@ int main(int argc, char *argv[], char *envp[])
        logging_init("udevd");
        udev_config_init();
        selinux_init();
-       dbg("version %s\n", UDEV_VERSION);
+       dbg("version %s\n", VERSION);
 
        while (1) {
                option = getopt_long(argc, argv, "dDthV", options, NULL);
@@ -994,7 +999,7 @@ int main(int argc, char *argv[], char *envp[])
                        printf("Usage: udevd [--help] [--daemon] [--debug-trace] [--debug] [--version]\n");
                        goto exit;
                case 'V':
-                       printf("%s\n", UDEV_VERSION);
+                       printf("%s\n", VERSION);
                        goto exit;
                default:
                        goto exit;
@@ -1123,7 +1128,7 @@ int main(int argc, char *argv[], char *envp[])
 
        fd = open("/dev/kmsg", O_WRONLY);
        if (fd > 0) {
-               const char *str = "<6>udevd version " UDEV_VERSION " started\n";
+               const char *str = "<6>udevd version " VERSION " started\n";
 
                write(fd, str, strlen(str));
                close(fd);
@@ -1148,14 +1153,14 @@ int main(int argc, char *argv[], char *envp[])
                } else {
                        char filename[PATH_MAX];
 
-                       inotify_add_watch(inotify_fd, RULES_LIB_DIR,
+                       inotify_add_watch(inotify_fd, UDEV_PREFIX "/lib/udev/rules.d",
                                          IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
-                       inotify_add_watch(inotify_fd, RULES_ETC_DIR,
+                       inotify_add_watch(inotify_fd, SYSCONFDIR "/udev/rules.d",
                                          IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
 
                        /* watch dynamic rules directory */
                        strlcpy(filename, udev_root, sizeof(filename));
-                       strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename));
+                       strlcat(filename, "/.udev/rules.d", sizeof(filename));
                        inotify_add_watch(inotify_fd, filename,
                                          IN_CREATE | IN_DELETE | IN_MOVE | IN_CLOSE_WRITE);
                }
index 9be34cb..1f4d6e4 100644 (file)
 #define UDEVD_PRIORITY                 -4
 #define UDEV_PRIORITY                  -2
 
-#define EVENT_QUEUE_DIR                        ".udev/queue"
-#define EVENT_FAILED_DIR               ".udev/failed"
-#define EVENT_SEQNUM                   ".udev/uevent_seqnum"
-
 /* maximum limit of forked childs */
 #define UDEVD_MAX_CHILDS               256
 /* start to throttle forking if maximum number of running childs in our session is reached */
@@ -35,8 +31,8 @@
 #define UEVENT_BUFFER_SIZE             2048
 #define UEVENT_NUM_ENVP                        32
 
-#define UDEVD_CTRL_SOCK_PATH           "/org/kernel/udev/udevd"
-#define UDEVD_CTRL_MAGIC               "udevd_" UDEV_VERSION
+#define UDEVD_CTRL_SOCK_PATH           UDEV_PREFIX "/org/kernel/udev/udevd"
+#define UDEVD_CTRL_MAGIC               "udevd_" VERSION
 
 enum udevd_ctrl_msg_type {
        UDEVD_CTRL_UNKNOWN,
index b9ee17c..a97f09c 100644 (file)
@@ -16,6 +16,8 @@
  *
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -373,10 +375,10 @@ int udevinfo(int argc, char *argv[], char *envp[])
                        export_prefix = optarg;
                        break;
                case 1:
-                       printf("%s\n", UDEV_VERSION);
+                       printf("%s\n", VERSION);
                        goto exit;
                case 'V':
-                       printf("udevinfo, version %s\n", UDEV_VERSION);
+                       printf("udevinfo, version %s\n", VERSION);
                        goto exit;
                case 'h':
                        printf("Usage: udevadm info OPTIONS\n"
index cb63a66..f00a38b 100644 (file)
@@ -89,7 +89,7 @@ int udevsettle(int argc, char *argv[], char *envp[])
 
        logging_init("udevsettle");
        udev_config_init();
-       dbg("version %s\n", UDEV_VERSION);
+       dbg("version %s\n", VERSION);
        sysfs_init();
 
        while (1) {
@@ -113,7 +113,7 @@ int udevsettle(int argc, char *argv[], char *envp[])
        }
 
        strlcpy(queuename, udev_root, sizeof(queuename));
-       strlcat(queuename, "/" EVENT_QUEUE_DIR, sizeof(queuename));
+       strlcat(queuename, "/.udev/queue", sizeof(queuename));
 
        loop = timeout * LOOP_PER_SECOND;
        while (loop--) {
@@ -135,7 +135,7 @@ int udevsettle(int argc, char *argv[], char *envp[])
 
                /* read current udev seqnum */
                strlcpy(filename, udev_root, sizeof(filename));
-               strlcat(filename, "/" EVENT_SEQNUM, sizeof(filename));
+               strlcat(filename, "/.udev/uevent_seqnum", sizeof(filename));
                fd = open(filename, O_RDONLY);
                if (fd < 0)
                        goto exit;
index d5e90b0..2b43691 100644 (file)
@@ -91,7 +91,7 @@ int udevtest(int argc, char *argv[], char *envp[])
                {}
        };
 
-       info("version %s\n", UDEV_VERSION);
+       info("version %s\n", VERSION);
        udev_config_init();
        if (udev_log_priority < LOG_INFO) {
                char priority[32];
index d4b10d0..d338f82 100644 (file)
@@ -536,7 +536,7 @@ static void scan_failed(void)
        struct dirent *dent;
 
        strlcpy(base, udev_root, sizeof(base));
-       strlcat(base, "/" EVENT_FAILED_DIR, sizeof(base));
+       strlcat(base, "/.udev/failed", sizeof(base));
 
        dir = opendir(base);
        if (dir != NULL) {
@@ -582,7 +582,7 @@ int udevtrigger(int argc, char *argv[], char *envp[])
 
        logging_init("udevtrigger");
        udev_config_init();
-       dbg("version %s\n", UDEV_VERSION);
+       dbg("version %s\n", VERSION);
        sysfs_init();
 
        while (1) {