chiark / gitweb /
add $name substitution
authorKay Sievers <kay.sievers@vrfy.org>
Wed, 29 Aug 2007 12:04:55 +0000 (14:04 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Wed, 29 Aug 2007 12:04:55 +0000 (14:04 +0200)
udev.7
udev.xml
udev_rules.c
udevd.c

diff --git a/udev.7 b/udev.7
index 5f0ebb997428eed4d1ce06879f60cd4e198a0cc5..0ea554923d55581afb3101076f1172de7af032e8 100644 (file)
--- a/udev.7
+++ b/udev.7
@@ -331,7 +331,7 @@ and
 \fBATTRS\fR\.
 .RE
 .PP
-\fB$driver\fR, \fB%d\fR
+\fB$driver\fR
 .RS 4
 The driver name of the device matched while searching the devpath upwards for
 \fBSUBSYSTEMS\fR,
@@ -373,6 +373,11 @@ The string returned by the external program requested with PROGRAM\. A single pa
 The node name of the parent device\.
 .RE
 .PP
+\fB$name\fR
+.RS 4
+The name of the device node\. The value is only set if an earlier rule assigned a value, or during a remove events\.
+.RE
+.PP
 \fB$root\fR, \fB%r\fR
 .RS 4
 The udev_root value\.
index b43abb779bd47e55a07863e9206c74516e1587e4..9fb615294159cafdef5a4d13823f4abbef8a54ca 100644 (file)
--- a/udev.xml
+++ b/udev.xml
             </varlistentry>
 
             <varlistentry>
-              <term><option>$driver</option>, <option>%d</option></term>
+              <term><option>$driver</option></term>
               <listitem>
                 <para>The driver name of the device matched while searching the devpath upwards for
                   <option>SUBSYSTEMS</option>, <option>KERNELS</option>, <option>DRIVERS</option> and <option>ATTRS</option>.
               </listitem>
             </varlistentry>
 
+            <varlistentry>
+              <term><option>$name</option></term>
+              <listitem>
+                <para>The name of the device node. The value is only set if an earlier
+                rule assigned a value, or during a remove events.</para>
+              </listitem>
+            </varlistentry>
+
             <varlistentry>
               <term><option>$root</option>, <option>%r</option></term>
               <listitem>
index 35db958c8df4959fbb68664b1aed7afb0124a3aa..01fb2117b25d2499fa3dcabffdc398a2a8bb2906 100644 (file)
@@ -606,6 +606,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
                SUBST_ATTR,
                SUBST_PARENT,
                SUBST_TEMP_NODE,
+               SUBST_NAME,
                SUBST_ROOT,
                SUBST_SYS,
                SUBST_ENV,
@@ -627,6 +628,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
                { .name = "sysfs",      .fmt = 's',     .type = SUBST_ATTR },
                { .name = "parent",     .fmt = 'P',     .type = SUBST_PARENT },
                { .name = "tempnode",   .fmt = 'N',     .type = SUBST_TEMP_NODE },
+               { .name = "name",       .fmt = 'D',     .type = SUBST_NAME },
                { .name = "root",       .fmt = 'r',     .type = SUBST_ROOT },
                { .name = "sys",        .fmt = 'S',     .type = SUBST_SYS },
                { .name = "env",        .fmt = 'E',     .type = SUBST_ENV },
@@ -845,6 +847,10 @@ found:
                        strlcat(string, udev->tmp_node, maxsize);
                        dbg("substitute temporary device node name '%s'", udev->tmp_node);
                        break;
+               case SUBST_NAME:
+                       strlcat(string, udev->name, maxsize);
+                       dbg("substitute udev->name '%s'", udev->name);
+                       break;
                case SUBST_ROOT:
                        strlcat(string, udev_root, maxsize);
                        dbg("substitute udev_root '%s'", udev_root);
diff --git a/udevd.c b/udevd.c
index 3c46617e4701a952a73ca53e6e881b4b6a6d3960..5ff5d3f66faab2f5876946c99c00b2f6131e5b35 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -508,7 +508,7 @@ static int devpath_busy(struct udevd_uevent_msg *msg, int limit)
                        }
        }
 
-       /* check runing-queue for still running events */
+       /* check run queue for still running events */
        list_for_each_entry(loop_msg, &running_list, node) {
                if (limit && childs_count++ > limit) {
                        dbg("%llu, maximum number (%i) of childs reached", msg->seqnum, childs_count);