substitute swapon patch with the upstream merged one
authorDennis Groenen <tj.groenen@gmail.com>
Sun, 18 Aug 2013 09:26:33 +0000 (11:26 +0200)
committerDennis Groenen <tj.groenen@gmail.com>
Sun, 18 Aug 2013 09:26:33 +0000 (11:26 +0200)
debian/patches/0001-swapon-adhere-swap-priority-in-fstab.patch [deleted file]
debian/patches/0001-swapon-support-pri-NNN-in-fstab.patch [new file with mode: 0644]
debian/patches/series

diff --git a/debian/patches/0001-swapon-adhere-swap-priority-in-fstab.patch b/debian/patches/0001-swapon-adhere-swap-priority-in-fstab.patch
deleted file mode 100644 (file)
index 74d874f..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-From 568f3f41b734f410dcd1913e25b57dde17959233 Mon Sep 17 00:00:00 2001
-From: Dennis Groenen <tj.groenen@gmail.com>
-Date: Sun, 4 Aug 2013 14:00:59 +0200
-Subject: [PATCH] swapon: adhere swap priority in fstab
-
-We already had the mount opts from fstab, but didn't do anything with them.
-
-Check mnt_opts and set g_flags accordingly prior to enabling the swapspace when
-we do_em_all().
-
-Signed-off-by: Dennis Groenen <tj.groenen at gmail.com>
----
- util-linux/Config.src  |    5 +++--
- util-linux/swaponoff.c |   13 +++++++++++++
- 2 files changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/util-linux/Config.src b/util-linux/Config.src
-index 5a8b006..b90873d 100644
---- a/util-linux/Config.src
-+++ b/util-linux/Config.src
-@@ -600,11 +600,12 @@ config SWAPONOFF
-         option disabled.
- config FEATURE_SWAPON_PRI
--      bool "Support priority option -p"
-+      bool "Support priority options"
-       default y
-       depends on SWAPONOFF
-       help
--        Enable support for setting swap device priority in swapon.
-+        Enable support for setting swap device priority in swapon. Also makes
-+        swapon respect 'pri=n' when enabling all swaps from /etc/fstab.
- config SWITCH_ROOT
-       bool "switch_root"
-diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
-index 54867ec..97f668e 100644
---- a/util-linux/swaponoff.c
-+++ b/util-linux/swaponoff.c
-@@ -95,6 +95,19 @@ static int do_em_all(void)
-                       if (applet_name[5] != 'n'
-                        || hasmntopt(m, MNTOPT_NOAUTO) == NULL
-                       ) {
-+#if ENABLE_FEATURE_SWAPON_PRI /* from util-linux-ng 2.17.2 */
-+                              char *opt, *opts;
-+
-+                              g_flags = 0; /* each swap space might have different flags */
-+                              opts = strdup(m->mnt_opts);
-+                              for (opt = strtok(opts, ","); opt != NULL;
-+                                       opt = strtok(NULL, ",")) {
-+                                      if (strncmp(opt, "pri=", 4) == 0)
-+                                              g_flags = SWAP_FLAG_PREFER |
-+                                                      ((atoi(opt+4) & SWAP_FLAG_PRIO_MASK) << SWAP_FLAG_PRIO_SHIFT);
-+                              }
-+                              if (ENABLE_FEATURE_CLEAN_UP) free(opts);
-+#endif
-                               err += swap_enable_disable(m->mnt_fsname);
-                       }
-               }
--- 
-1.7.9.5
-
diff --git a/debian/patches/0001-swapon-support-pri-NNN-in-fstab.patch b/debian/patches/0001-swapon-support-pri-NNN-in-fstab.patch
new file mode 100644 (file)
index 0000000..d5b8d02
--- /dev/null
@@ -0,0 +1,42 @@
+From 8c7fcbd7521c1bafcf6e792af8b140c256e2cbfd Mon Sep 17 00:00:00 2001
+From: Tito Ragusa <farmatito@tiscali.it>
+Date: Thu, 8 Aug 2013 10:21:27 +0200
+Subject: [PATCH] swapon: support "pri=NNN" in fstab
+
+function                                             old     new   delta
+swap_on_off_main                                     244     365    +121
+
+Signed-off-by: Tito Ragusa <farmatito@tiscali.it>
+Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
+---
+ util-linux/swaponoff.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
+index 54867ec..afad4ab 100644
+--- a/util-linux/swaponoff.c
++++ b/util-linux/swaponoff.c
+@@ -95,6 +95,20 @@ static int do_em_all(void)
+                       if (applet_name[5] != 'n'
+                        || hasmntopt(m, MNTOPT_NOAUTO) == NULL
+                       ) {
++#if ENABLE_FEATURE_SWAPON_PRI
++                              char *p;
++                              g_flags = 0; /* each swap space might have different flags */
++                              p = strstr(m->mnt_opts, "pri=");
++                              if (p) {
++                                      /* Max allowed 32767 (==SWAP_FLAG_PRIO_MASK) */
++                                      int swap_prio = MIN(bb_strtoull(p + 4 , NULL, 10), SWAP_FLAG_PRIO_MASK);
++                                      /* We want to allow "NNNN,foo", thus errno == EINVAL is allowed too */
++                                      if (errno != ERANGE) {
++                                              g_flags = SWAP_FLAG_PREFER |
++                                                      (swap_prio << SWAP_FLAG_PRIO_SHIFT);
++                                      }
++                              }
++#endif
+                               err += swap_enable_disable(m->mnt_fsname);
+                       }
+               }
+-- 
+1.7.9.5
+
index d8fe04d..fc943e5 100644 (file)
@@ -22,7 +22,6 @@ ps-accept-and-ignore-missing-options.patch
 showkey-default-option.patch
 0001-pgrep-check-whether-we-re-pkill-at-runtime.patch
 0002-ash-install-SIGHUP-signal-handler-when-interactive.patch
-0001-swapon-adhere-swap-priority-in-fstab.patch
 
 # Hotfixes
 
@@ -32,5 +31,6 @@ showkey-default-option.patch
 #ls_color_red.patch
 
 # Patched pulled from busybox git
+0001-swapon-support-pri-NNN-in-fstab.patch
 
 # Miscellaneous