[kernel] r15353 - dists/trunk/linux-2.6/debian

Ben Hutchings benh at alioth.debian.org
Thu Mar 11 03:13:05 UTC 2010


Author: benh
Date: Thu Mar 11 03:13:03 2010
New Revision: 15353

Log:
Update uswsusp resume device name

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	Thu Mar 11 03:10:21 2010	(r15352)
+++ dists/trunk/linux-2.6/debian/changelog	Thu Mar 11 03:13:03 2010	(r15353)
@@ -14,6 +14,7 @@
       than labels where both are available (Closes: #572376)
     - Replace CD/DVD/BD device names with udev-provided persistent aliases
     - Fix update of boot device name for LILO and related loaders
+    - Update uswsusp resume device name
 
  -- 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	Thu Mar 11 03:10:21 2010	(r15352)
+++ dists/trunk/linux-2.6/debian/linux-base.postinst	Thu Mar 11 03:13:03 2010	(r15353)
@@ -1013,6 +1013,59 @@
     }
 }
 
+# uswsusp resume
+
+sub uswsusp_next {
+    # Based on parse_line() in config_parser.c
+
+    my ($file) = @_;
+    my $text = <$file>;
+
+    if (!defined($text) || $text eq '') {
+	return ();
+    }
+
+    local $_ = $text;
+    s/^\s*(?:#.*)?//;
+    s/\s*$//;
+
+    if ($text =~ /^([\w ]*\w)[ \t]*[:=][ \t]*(.+)$/) {
+	return ($text, $1, $2);
+    } else {
+	return ($text);
+    }
+}
+
+sub uswsusp_resume_list {
+    my ($file) = @_;
+    my @results = ();
+
+    while (1) {
+	my ($text, $name, $value) = uswsusp_next($file);
+	last unless defined($text);
+	if (defined($name) && $name eq 'resume device') {
+	    $results[0] = $value;
+	}
+    }
+
+    return @results;
+}
+
+sub uswsusp_resume_update {
+    my ($old, $new, $map) = @_;
+
+    while (1) {
+	my ($text, $name, $value) = uswsusp_next($old);
+	last unless defined($text);
+	if (defined($name) && $name eq 'resume device' &&
+	    defined(my $new_value = $map->{$value})) {
+	    $text =~ s/^/# /gm;
+	    $text .= sprintf("%s = %s\n", $name, id_to_path($new_value));
+	}
+	$new->print($text);
+    }
+}
+
 ### list of all configuration files and functions
 
 my @config_files = ({packages => 'mount',
@@ -1089,7 +1142,11 @@
 		     update => \&initramfs_resume_update,
 		     # udev will source all files in this directory,
 		     # with few exceptions.  Such as including a '^'.
-		     suffix => '^old'});
+		     suffix => '^old'},
+		    {packages => 'uswsusp',
+		     path => '/etc/uswsusp.conf',
+		     list => \&uswsusp_resume_list,
+		     update => \&uswsusp_resume_update});
 
 ### Filesystem labels and UUIDs
 



More information about the Kernel-svn-changes mailing list