summaryrefslogtreecommitdiffstats
path: root/main/busybox/0001-mount-move-resolve_mount_spec-to-volume_id.patch
blob: 375da36bec63c9bf8cf2191d438ab77c52de0e97 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
From 455b23172de8f1fe8378c7c9470bf7041c242305 Mon Sep 17 00:00:00 2001
From: Natanael Copa <natanael.copa@gmail.com>
Date: Thu, 17 Sep 2009 09:33:59 +0000
Subject: [PATCH 1/2] mount: move resolve_mount_spec() to volume_id/

This is so it can be reused by other applets like swaponoff.

Signed-off-by: Natanael Copa <natanael.copa@gmail.com>
---
 include/volume_id.h                |    6 ++++++
 util-linux/mount.c                 |   17 -----------------
 util-linux/volume_id/get_devname.c |   16 ++++++++++++++++
 3 files changed, 22 insertions(+), 17 deletions(-)

diff --git a/include/volume_id.h b/include/volume_id.h
index bba32c0..cef5e9a 100644
--- a/include/volume_id.h
+++ b/include/volume_id.h
@@ -21,3 +21,9 @@
 char *get_devname_from_label(const char *spec);
 char *get_devname_from_uuid(const char *spec);
 void display_uuid_cache(void);
+
+#if ENABLE_FEATURE_MOUNT_LABEL
+void resolve_mount_spec(char **fsname);
+#else
+#define resolve_mount_spec(fsname) ((void)0)
+#endif
diff --git a/util-linux/mount.c b/util-linux/mount.c
index 478dc24..0d12506 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -290,23 +290,6 @@ static int verbose_mount(const char *source, const char *target,
 #define verbose_mount(...) mount(__VA_ARGS__)
 #endif
 
-#if ENABLE_FEATURE_MOUNT_LABEL
-static void resolve_mount_spec(char **fsname)
-{
-	char *tmp = NULL;
-
-	if (!strncmp(*fsname, "UUID=", 5))
-		tmp = get_devname_from_uuid(*fsname + 5);
-	else if (!strncmp(*fsname, "LABEL=", 6))
-		tmp = get_devname_from_label(*fsname + 6);
-
-	if (tmp)
-		*fsname = tmp;
-}
-#else
-#define resolve_mount_spec(fsname) ((void)0)
-#endif
-
 // Append mount options to string
 static void append_mount_options(char **oldopts, const char *newopts)
 {
diff --git a/util-linux/volume_id/get_devname.c b/util-linux/volume_id/get_devname.c
index 0686a07..a613b85 100644
--- a/util-linux/volume_id/get_devname.c
+++ b/util-linux/volume_id/get_devname.c
@@ -260,3 +260,19 @@ char *get_devname_from_uuid(const char *spec)
 	}
 	return NULL;
 }
+
+#if ENABLE_FEATURE_MOUNT_LABEL
+void resolve_mount_spec(char **fsname)
+{
+	char *tmp = NULL;
+
+	if (!strncmp(*fsname, "UUID=", 5))
+		tmp = get_devname_from_uuid(*fsname + 5);
+	else if (!strncmp(*fsname, "LABEL=", 6))
+		tmp = get_devname_from_label(*fsname + 6);
+
+	if (tmp)
+		*fsname = tmp;
+}
+#endif
+
-- 
1.6.4.2