summaryrefslogtreecommitdiffstats
path: root/lib/uuid/uuid.c
diff options
context:
space:
mode:
authorDave Wysochanski <dwysocha@redhat.com>2010-09-30 14:07:33 +0000
committerDave Wysochanski <dwysocha@redhat.com>2010-09-30 14:07:33 +0000
commitf4fd41552d79eb7a681c687b1d00872300c5c29e (patch)
treeec135890dcdf998b005104fd4274eba42c0774fe /lib/uuid/uuid.c
parent4bbadbe1cfbb6855f31a99432661c39c74d4288e (diff)
downloadlvm2-f4fd41552d79eb7a681c687b1d00872300c5c29e.tar.gz
lvm2-f4fd41552d79eb7a681c687b1d00872300c5c29e.tar.xz
lvm2-f4fd41552d79eb7a681c687b1d00872300c5c29e.zip
Add id_format_and_copy() common function and call from _uuid_disp.
Add supporting uuid function to allocate memory and call id_write_format. Call id_format_and_copy from _uuid_disp.
Diffstat (limited to 'lib/uuid/uuid.c')
-rw-r--r--lib/uuid/uuid.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/uuid/uuid.c b/lib/uuid/uuid.c
index de3f0cd0..e85e852c 100644
--- a/lib/uuid/uuid.c
+++ b/lib/uuid/uuid.c
@@ -206,3 +206,18 @@ int id_read_format(struct id *id, const char *buffer)
return id_valid(id);
}
+
+char *id_format_and_copy(struct dm_pool *mem, const struct id *id)
+{
+ char *repstr = NULL;
+
+ if (!(repstr = dm_pool_alloc(mem, 40))) {
+ log_error("dm_pool_alloc failed");
+ return NULL;
+ }
+
+ if (!id_write_format(id, repstr, 40))
+ return_NULL;
+
+ return repstr;
+}