chiark / gitweb /
udev: remove support for /lib/udev/devices/; tmpfiles should be used
authorKay Sievers <kay@vrfy.org>
Sun, 8 Apr 2012 14:50:16 +0000 (16:50 +0200)
committerKay Sievers <kay@vrfy.org>
Sun, 8 Apr 2012 14:50:16 +0000 (16:50 +0200)
NEWS
TODO
man/udev.xml
man/udevd.xml
src/udev/udevd.c

diff --git a/NEWS b/NEWS
index 288dcae56aa6d08ecdd6e5518c2b5b359cfba4d8..90445dfbe8ed9f05dd2cf0a4e17c210e4796e158 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,7 +1,10 @@
 systemd System and Service Manager
 
 CHANGES WITH 182:
 systemd System and Service Manager
 
 CHANGES WITH 182:
-        * udev sources merged
+        * udev: sources merged into the systemd sources
+
+        * udev: /lib/udev/devices/ are not read anymore; tmpfiles should
+          be used to create workarounds for broken subsystems.
 
         * systemd-logingctl and systemd-journalctl have been renamed
           to logingctl and journalctl to match systemctl.
 
         * systemd-logingctl and systemd-journalctl have been renamed
           to logingctl and journalctl to match systemctl.
diff --git a/TODO b/TODO
index 4c1de283a2c9a5fa6e7132dd11dd4248ee881b16..0b80d65c5b0b1f021407bf57f9442abfd5c86d11 100644 (file)
--- a/TODO
+++ b/TODO
@@ -35,8 +35,6 @@ Features:
   - kill: udev_monitor_from_socket()
   - kill: udev_queue_get_failed_list_entry()
 
   - kill: udev_monitor_from_socket()
   - kill: udev_queue_get_failed_list_entry()
 
-* udev: use systemd log.h
-
 * allow configuration of console width/height in vconsole.conf
 
 * PrivateTmp should apply to both /tmp and /var/tmp
 * allow configuration of console width/height in vconsole.conf
 
 * PrivateTmp should apply to both /tmp and /var/tmp
index 168b1dc1501e84c708041c394bc20eee81ceeb5c..101286699f17bff3bd2f599c43534df5df74f8c7 100644 (file)
                 <term><option>static_node=</option></term>
                 <listitem>
                   <para>Apply the permissions specified in this rule to the static device node with
                 <term><option>static_node=</option></term>
                 <listitem>
                   <para>Apply the permissions specified in this rule to the static device node with
-                  the specified name. Static device nodes might be provided by kernel modules
-                  or copied from <filename>/usr/lib/udev/devices</filename>. These nodes might not have
-                  a corresponding kernel device at the time udevd is started; they can trigger
-                  automatic kernel module loading.</para>
+                  the specified name. Static device node creation can be requested by kernel modules.
+                  These nodes might not have a corresponding kernel device at the time udevd is
+                  started; they can trigger automatic kernel module loading.</para>
                 </listitem>
               </varlistentry>
               <varlistentry>
                 </listitem>
               </varlistentry>
               <varlistentry>
index d6e401a0b223291460e5c06a6e402b4ba8b227c7..7c4e174cbe6814155d386eea2c031f94971e2b7b 100644 (file)
     instructions specified in udev rules. See <citerefentry>
         <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
       </citerefentry>.</para>
     instructions specified in udev rules. See <citerefentry>
         <refentrytitle>udev</refentrytitle><manvolnum>7</manvolnum>
       </citerefentry>.</para>
-    <para>On startup the content of the directory <filename>/usr/lib/udev/devices</filename>
-    is copied to <filename>/dev</filename>. If kernel modules specify static device
-    nodes, these nodes are created even without a corresponding kernel device, to
-    allow on-demand loading of kernel modules. Matching permissions specified in udev
-    rules are applied to these static device nodes.</para>
     <para>The behavior of the running daemon can be changed with
     <command>udevadm control</command>.</para>
   </refsect1>
     <para>The behavior of the running daemon can be changed with
     <command>udevadm control</command>.</para>
   </refsect1>
index 589a8fe75333509cab9e7dd277e501f6f7b2d634..35478c19caa51b2324032e03e025fbf53fd621c1 100644 (file)
@@ -876,71 +876,15 @@ static void static_dev_create_from_modules(struct udev *udev)
         fclose(f);
 }
 
         fclose(f);
 }
 
-static int copy_dev_dir(struct udev *udev, DIR *dir_from, DIR *dir_to, int maxdepth)
+/* needed for standalone udev operations */
+static void static_dev_create_links(struct udev *udev)
 {
 {
-        struct dirent *dent;
-
-        for (dent = readdir(dir_from); dent != NULL; dent = readdir(dir_from)) {
-                struct stat stats;
-
-                if (dent->d_name[0] == '.')
-                        continue;
-                if (fstatat(dirfd(dir_from), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0)
-                        continue;
-
-                if (S_ISBLK(stats.st_mode) || S_ISCHR(stats.st_mode)) {
-                        udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, stats.st_mode & 0777);
-                        if (mknodat(dirfd(dir_to), dent->d_name, stats.st_mode, stats.st_rdev) == 0) {
-                                fchmodat(dirfd(dir_to), dent->d_name, stats.st_mode & 0777, 0);
-                                fchownat(dirfd(dir_to), dent->d_name, stats.st_uid, stats.st_gid, 0);
-                        } else {
-                                utimensat(dirfd(dir_to), dent->d_name, NULL, 0);
-                        }
-                        udev_selinux_resetfscreatecon(udev);
-                } else if (S_ISLNK(stats.st_mode)) {
-                        char target[UTIL_PATH_SIZE];
-                        ssize_t len;
-
-                        len = readlinkat(dirfd(dir_from), dent->d_name, target, sizeof(target));
-                        if (len <= 0 || len == (ssize_t)sizeof(target))
-                                continue;
-                        target[len] = '\0';
-                        udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFLNK);
-                        if (symlinkat(target, dirfd(dir_to), dent->d_name) < 0 && errno == EEXIST)
-                                utimensat(dirfd(dir_to), dent->d_name, NULL, AT_SYMLINK_NOFOLLOW);
-                        udev_selinux_resetfscreatecon(udev);
-                } else if (S_ISDIR(stats.st_mode)) {
-                        DIR *dir2_from, *dir2_to;
-
-                        if (maxdepth == 0)
-                                continue;
-
-                        udev_selinux_setfscreateconat(udev, dirfd(dir_to), dent->d_name, S_IFDIR|0755);
-                        mkdirat(dirfd(dir_to), dent->d_name, 0755);
-                        udev_selinux_resetfscreatecon(udev);
-
-                        dir2_to = fdopendir(openat(dirfd(dir_to), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
-                        if (dir2_to == NULL)
-                                continue;
-
-                        dir2_from = fdopendir(openat(dirfd(dir_from), dent->d_name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC));
-                        if (dir2_from == NULL) {
-                                closedir(dir2_to);
-                                continue;
-                        }
-
-                        copy_dev_dir(udev, dir2_from, dir2_to, maxdepth-1);
-
-                        closedir(dir2_to);
-                        closedir(dir2_from);
-                }
-        }
+        DIR *dir;
 
 
-        return 0;
-}
+        dir = opendir(udev_get_dev_path(udev));
+        if (dir == NULL)
+                return;
 
 
-static void static_dev_create_links(struct udev *udev, DIR *dir)
-{
         struct stdlinks {
                 const char *link;
                 const char *target;
         struct stdlinks {
                 const char *link;
                 const char *target;
@@ -964,29 +908,6 @@ static void static_dev_create_links(struct udev *udev, DIR *dir)
                         udev_selinux_resetfscreatecon(udev);
                 }
         }
                         udev_selinux_resetfscreatecon(udev);
                 }
         }
-}
-
-static void static_dev_create_from_devices(struct udev *udev, DIR *dir)
-{
-        DIR *dir_from;
-
-        dir_from = opendir(UDEVLIBEXECDIR "/devices");
-        if (dir_from == NULL)
-                return;
-        copy_dev_dir(udev, dir_from, dir, 8);
-        closedir(dir_from);
-}
-
-static void static_dev_create(struct udev *udev)
-{
-        DIR *dir;
-
-        dir = opendir(udev_get_dev_path(udev));
-        if (dir == NULL)
-                return;
-
-        static_dev_create_links(udev, dir);
-        static_dev_create_from_devices(udev, dir);
 
         closedir(dir);
 }
 
         closedir(dir);
 }
@@ -1309,7 +1230,7 @@ int main(int argc, char *argv[])
         mkdir(udev_get_run_path(udev), 0755);
 
         /* create standard links, copy static nodes, create nodes from modules */
         mkdir(udev_get_run_path(udev), 0755);
 
         /* create standard links, copy static nodes, create nodes from modules */
-        static_dev_create(udev);
+        static_dev_create_links(udev);
         static_dev_create_from_modules(udev);
 
         /* before opening new files, make sure std{in,out,err} fds are in a sane state */
         static_dev_create_from_modules(udev);
 
         /* before opening new files, make sure std{in,out,err} fds are in a sane state */