summaryrefslogtreecommitdiffstats
path: root/lib/uuid/uuid.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2004-01-09 19:18:20 +0000
committerAlasdair Kergon <agk@redhat.com>2004-01-09 19:18:20 +0000
commitcc8f6e3dbc86dd0e5a532669092941e84c31b841 (patch)
tree199dbc2d316b4df0e0623c8ca3de8ee959f71826 /lib/uuid/uuid.c
parent397b239bdf677a40815dc1b352606335f22b1161 (diff)
downloadlvm2-cc8f6e3dbc86dd0e5a532669092941e84c31b841.tar.gz
lvm2-cc8f6e3dbc86dd0e5a532669092941e84c31b841.tar.xz
lvm2-cc8f6e3dbc86dd0e5a532669092941e84c31b841.zip
If PV/VG uuids are missing, generate them from the pv/vg numbers.
[This situation could occur if the uuids were oritinally created by LVM1 on a system without /dev/urandom.]
Diffstat (limited to 'lib/uuid/uuid.c')
-rw-r--r--lib/uuid/uuid.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c
index 8083b7ab..8e4a1533 100644
--- a/lib/uuid/uuid.c
+++ b/lib/uuid/uuid.c
@@ -25,6 +25,18 @@ int lvid_create(union lvid *lvid, struct id *vgid)
return 1;
}
+void uuid_from_num(char *uuid, uint32_t num)
+{
+ unsigned i;
+
+ for (i = ID_LEN; i; i--) {
+ uuid[i - 1] = _c[num % (sizeof(_c) - 1)];
+ num /= sizeof(_c) - 1;
+ }
+
+ uuid[ID_LEN] = '\0';
+}
+
int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num)
{
int i;