[prev in list] [next in list] [prev in thread] [next in thread]
List: libguestfs
Subject: [Libguestfs] [PATCH libldm 08/12] Don't use hard-coded path to a device mapper directory.
From: Mykola Ivanets <stenavin () gmail ! com>
Date: 2018-05-15 20:38:15
Message-ID: 20180515203819.20975-9-stenavin () gmail ! com
[Download RAW message or body]
Get path to a device mapper directory calling "dm_dir" function from
devmapper library instead of using hard-coded value "/dev/mapper".
---
src/ldm.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/ldm.c b/src/ldm.c
index ac6bae8..f31a0aa 100644
--- a/src/ldm.c
+++ b/src/ldm.c
@@ -2840,6 +2840,8 @@ _dm_create_mirrored(const LDMVolumePrivate * const vol, GError ** const err)
goto out;
}
+ const char *dir = dm_dir();
+
int found = 0;
for (guint i = 0; i < vol->parts->len; i++) {
const LDMPartition * const part_o =
@@ -2860,7 +2862,7 @@ _dm_create_mirrored(const LDMVolumePrivate * const vol, GError ** const err)
found++;
g_array_append_val(devices, chunk);
- g_string_append_printf(target.params, " - /dev/mapper/%s", chunk->str);
+ g_string_append_printf(target.params, " - %s/%s", dir, chunk->str);
}
if (found == 0) {
@@ -2932,6 +2934,8 @@ _dm_create_raid5(const LDMVolumePrivate * const vol, GError ** const err)
goto out;
}
+ const char *dir = dm_dir();
+
guint n_found = 0;
for (guint i = 0; i < vol->parts->len; i++) {
const LDMPartition * const part_o =
@@ -2952,7 +2956,7 @@ _dm_create_raid5(const LDMVolumePrivate * const vol, GError ** const err)
n_found++;
g_array_append_val(devices, chunk);
- g_string_append_printf(target.params, " - /dev/mapper/%s", chunk->str);
+ g_string_append_printf(target.params, " - %s/%s", dir, chunk->str);
}
if (n_found < vol->parts->len - 1) {
--
2.17.0
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic