chiark / gitweb /
add $sys substitution
authorKay Sievers <kay.sievers@vrfy.org>
Sat, 2 Jun 2007 20:06:01 +0000 (22:06 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Sat, 2 Jun 2007 20:06:01 +0000 (22:06 +0200)
udev.7
udev.xml
udev_rules.c

diff --git a/udev.7 b/udev.7
index a4b15886c7ed3e312f88974f61a84471c9bacfcf..4fbaf924320b64f874bf975cdc9f618409c3c48b 100644 (file)
--- a/udev.7
+++ b/udev.7
@@ -362,6 +362,11 @@ The node name of the parent device.
 The udev_root value.
 .RE
 .PP
+\fB$sys\fR, \fB%S\fR
+.RS 4
+The sysfs mount point.
+.RE
+.PP
 \fB$tempnode\fR, \fB%N\fR
 .RS 4
 The name of a created temporary device node to provide access to the device from a external program before the real node is created.
index 5ba3d3636cacdd20ab544b56375528fec36f10f7..1f9e6d91972a71775ef0f6aaaf33343d939aaecd 100644 (file)
--- a/udev.xml
+++ b/udev.xml
               </listitem>
             </varlistentry>
 
+            <varlistentry>
+              <term><option>$sys</option>, <option>%S</option></term>
+              <listitem>
+                <para>The sysfs mount point.</para>
+              </listitem>
+            </varlistentry>
+
             <varlistentry>
               <term><option>$tempnode</option>, <option>%N</option></term>
               <listitem>
index 1139c99a7d0e84ff3b8e289a3c6af251d5aabf76..e61c9a69b062c02fa2fe083911cc964ba8789d3e 100644 (file)
@@ -292,6 +292,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
                SUBST_PARENT,
                SUBST_TEMP_NODE,
                SUBST_ROOT,
+               SUBST_SYS,
                SUBST_ENV,
        };
        static const struct subst_map {
@@ -311,6 +312,7 @@ void udev_rules_apply_format(struct udevice *udev, char *string, size_t maxsize)
                { .name = "parent",     .fmt = 'P',     .type = SUBST_PARENT },
                { .name = "tempnode",   .fmt = 'N',     .type = SUBST_TEMP_NODE },
                { .name = "root",       .fmt = 'r',     .type = SUBST_ROOT },
+               { .name = "sys",        .fmt = 'S',     .type = SUBST_SYS },
                { .name = "env",        .fmt = 'E',     .type = SUBST_ENV },
                { NULL, '\0', 0 }
        };
@@ -516,6 +518,10 @@ found:
                        strlcat(string, udev_root, maxsize);
                        dbg("substitute udev_root '%s'", udev_root);
                        break;
+               case SUBST_SYS:
+                       strlcat(string, sysfs_path, maxsize);
+                       dbg("substitute sysfs_path '%s'", sysfs_path);
+                       break;
                case SUBST_ENV:
                        if (attr == NULL) {
                                dbg("missing attribute");