aboutsummaryrefslogtreecommitdiffstats
path: root/main/busybox/0002-swaponoff-add-uuid-label-support.patch
blob: 0abdab8ed6bd36ddf6f98b78e979cf71e87ab555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 3e3d6337d442225cc951a2084191dc61afb34661 Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 17 Sep 2009 11:19:20 +0000
Subject: [PATCH 2/2] swaponoff: add uuid/label support

This allows swapon -a enable swap when the swap partition is specified by
either UUID=... or LABEL=... in /etc/fstab

We could have made a separate config option for this but it makes sense
to have it with MOUNT_LABEL as you will need that to parse the rest of
fstab anyway.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
 util-linux/Config.in   |    1 +
 util-linux/swaponoff.c |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/util-linux/Config.in b/util-linux/Config.in
index 5f5adc0..49c57e1 100644
--- a/util-linux/Config.in
+++ b/util-linux/Config.in
@@ -689,6 +689,7 @@ config FEATURE_MOUNT_LABEL
 	help
 	  This allows for specifying a device by label or uuid, rather than by
 	  name. This feature utilizes the same functionality as blkid/findfs.
+	  This also enables label or uuid support for swapon. 
 
 config FEATURE_MOUNT_NFS
 	bool "Support mounting NFS file systems"
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 863f773..d69301f 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -11,6 +11,10 @@
 #include <mntent.h>
 #include <sys/swap.h>
 
+#if ENABLE_FEATURE_MOUNT_LABEL
+#include "volume_id.h"
+#endif
+
 #if ENABLE_FEATURE_SWAPON_PRI
 struct globals {
 	int flags;
@@ -26,6 +30,9 @@ static int swap_enable_disable(char *device)
 	int status;
 	struct stat st;
 
+#if ENABLE_FEATURE_MOUNT_LABEL
+	resolve_mount_spec(&device);
+#endif
 	xstat(device, &st);
 
 #if ENABLE_DESKTOP
-- 
1.6.4.2