From: "Kevin P. Fleming" <kpfleming@backtobasicsmgmt.com>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] allow udev to process all symlink rules for a device
Date: Sat, 08 May 2004 13:38:41 +0000 [thread overview]
Message-ID: <409CE2E1.5000801@backtobasicsmgmt.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 344 bytes --]
This patch changes udev's behavior to scan all rules for every device.
Only the first NAME rule is accepted, but all SYMLINK rules are
accepted. This means that SYMLINK rules can be added in any position to
a udev.rules file (or in the rules.d directory) without concern for
where they are in relation to the NAME rule for the same device.
[-- Attachment #2: udev-025-symlinks.patch --]
[-- Type: text/plain, Size: 1725 bytes --]
--- udev-orig/namedev.c Wed Apr 21 14:39:10 2004
+++ udev-025/namedev.c Sat May 8 06:33:04 2004
@@ -780,6 +780,7 @@
struct perm_device *perm;
struct sysinfo info;
char *pos;
+ int name_rule_found = 0;
udev->mode = 0;
@@ -805,7 +806,9 @@
strfieldcpy(udev->kernel_number, pos);
dbg("kernel_number='%s'", udev->kernel_number);
- /* look for a matching rule to apply */
+ /* look for matching rules to apply */
+ /* only the first matching NAME rule will be used */
+ /* all matching SYMLINK rules will be used */
list_for_each_entry(dev, &config_device_list, node) {
dbg("process rule");
if (match_rule(dev, class_dev, udev, sysfs_device) == 0) {
@@ -827,6 +830,9 @@
strfieldcat(udev->symlink, temp);
}
+ if (name_rule_found)
+ continue;
+
if (dev->name[0] != '\0') {
/* apply all_partitions flag only at a main block device */
if (dev->partitions > 0 &&
@@ -836,18 +842,20 @@
info("configured rule in '%s' at line %i applied, '%s' becomes '%s'",
dev->config_file, dev->config_line, udev->kernel_name, dev->name);
strfieldcpy(udev->name, dev->name);
- goto found;
+ name_rule_found = 1;
}
}
}
- /* no rule was found so we use the kernel name */
- strfieldcpy(udev->name, udev->kernel_name);
- if (udev->type == 'n')
- goto done;
- else
- goto perms;
-found:
+ if (!name_rule_found) {
+ /* no NAME rule was found so we use the kernel name */
+ strfieldcpy(udev->name, udev->kernel_name);
+ if (udev->type == 'n')
+ goto done;
+ else
+ goto perms;
+ }
+
apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
strfieldcpy(udev->config_file, dev->config_file);
udev->config_line = dev->config_line;
next reply other threads:[~2004-05-08 13:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-08 13:38 Kevin P. Fleming [this message]
2004-05-20 18:18 ` [PATCH] allow udev to process all symlink rules for a device Greg KH
2004-05-20 18:44 ` Kevin P. Fleming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=409CE2E1.5000801@backtobasicsmgmt.com \
--to=kpfleming@backtobasicsmgmt.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).