[kernel] r15349 - dists/trunk/linux-2.6/debian
Ben Hutchings
benh at alioth.debian.org
Thu Mar 11 00:54:48 UTC 2010
Author: benh
Date: Thu Mar 11 00:54:45 2010
New Revision: 15349
Log:
Replace CD/DVD/BD device names with udev-provided persistent aliases
Modified:
dists/trunk/linux-2.6/debian/changelog
dists/trunk/linux-2.6/debian/linux-base.postinst
Modified: dists/trunk/linux-2.6/debian/changelog
==============================================================================
--- dists/trunk/linux-2.6/debian/changelog Wed Mar 10 04:01:41 2010 (r15348)
+++ dists/trunk/linux-2.6/debian/changelog Thu Mar 11 00:54:45 2010 (r15349)
@@ -12,6 +12,7 @@
- Don't accept empty filesystem labels as identifiers (Closes: #572438)
- For consistency with fresh installations, use or assign UUIDs rather
than labels where both are available (Closes: #572376)
+ - Replace CD/DVD/BD device names with udev-provided persistent aliases
-- Ben Hutchings <ben at decadent.org.uk> Sun, 28 Feb 2010 17:01:33 +0000
Modified: dists/trunk/linux-2.6/debian/linux-base.postinst
==============================================================================
--- dists/trunk/linux-2.6/debian/linux-base.postinst Wed Mar 10 04:01:41 2010 (r15348)
+++ dists/trunk/linux-2.6/debian/linux-base.postinst Thu Mar 11 00:54:45 2010 (r15349)
@@ -877,6 +877,20 @@
return @results;
}
+sub udev_parse_symlink_rule {
+ my ($path, $symlink);
+ for (@_) {
+ my ($text, $key, $op, $value) = @$_;
+ next if !defined($key);
+ if ($key eq 'ENV{ID_PATH}' && $op eq '==') {
+ $path = $value;
+ } elsif ($key eq 'SYMLINK' && $op eq '+=') {
+ $symlink = $value;
+ }
+ }
+ return ($path, $symlink);
+}
+
# Find symlink rules using IDE device paths that aren't matched by rules
# using the corresponding SCSI device path. Return an array containing
# the corresponding path for each rule where this is the case and undef
@@ -891,17 +905,7 @@
my @keys = udev_next($file);
last if $#keys < 0;
- my ($path, $symlink);
- for (@keys) {
- my ($text, $key, $op, $value) = @$_;
- next if !defined($key);
- if ($key eq 'ENV{ID_PATH}' && $op eq '==') {
- $path = $value;
- } elsif ($key eq 'SYMLINK' && $op eq '+=') {
- $symlink = $value;
- }
- }
-
+ my ($path, $symlink) = udev_parse_symlink_rule(@keys);
if (defined($path) && defined($symlink)) {
if ($path =~ /-ide-\d+:\d+$/) {
# libata uses the PATA controller and device numbers
@@ -1315,11 +1319,29 @@
}
}
- # Discard all device ids that are ambiguous.
+ # Discard all labels and UUIDs(!) that are ambiguous.
for my $bdev (keys(%bdev_map)) {
@{$bdev_map{$bdev}->{ids}} = grep({ $#{$id_map{$_}} == 0 }
@{$bdev_map{$bdev}->{ids}});
}
+
+ # Add persistent aliases for CD/DVD/BD drives
+ my $cd_rules =
+ new FileHandle('/etc/udev/rules.d/70-persistent-cd.rules', 'r');
+ while (defined($cd_rules)) {
+ my @keys = udev_next($cd_rules);
+ last if $#keys < 0;
+
+ my ($path, $symlink) = udev_parse_symlink_rule(@keys);
+ if (defined($path) && defined($symlink)) {
+ $symlink =~ s{^(?!/)}{/dev/};
+ my $bdev = readlink($symlink) or next;
+ $bdev =~ s{^(?!/)}{/dev/};
+ if (exists($bdev_map{$bdev})) {
+ push @{$bdev_map{$bdev}->{ids}}, $symlink;
+ }
+ }
+ }
}
sub assign_new_ids {
More information about the Kernel-svn-changes
mailing list