diff options
author | Philip Prindeville | 2017-09-05 11:19:26 +0200 |
---|---|---|
committer | Karel Zak | 2017-09-05 11:26:39 +0200 |
commit | 00476268870b01938800af9a5ca776695df13f5d (patch) | |
tree | b9fabc95e52e620c5ff2ac0892947c785e8ad4d8 /tests/helpers/test_uuid_namespace.c | |
parent | tests: update sfdisk wipe test (diff) | |
download | kernel-qcow2-util-linux-00476268870b01938800af9a5ca776695df13f5d.tar.gz kernel-qcow2-util-linux-00476268870b01938800af9a5ca776695df13f5d.tar.xz kernel-qcow2-util-linux-00476268870b01938800af9a5ca776695df13f5d.zip |
libuuid: add support for hash-based UUIDs
Adding V3 and V5 UUIDs per RFC-4122.
[kzak@redhat.com: - fix symbols file]
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/helpers/test_uuid_namespace.c')
-rw-r--r-- | tests/helpers/test_uuid_namespace.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/helpers/test_uuid_namespace.c b/tests/helpers/test_uuid_namespace.c new file mode 100644 index 000000000..1bbf8754d --- /dev/null +++ b/tests/helpers/test_uuid_namespace.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#include "../libuuid/src/uuid.h" + +static void get_template(const char *ns) +{ + const uuid_t *uuidptr; + char buf[37]; + + uuidptr = uuid_get_template(ns); + if (uuidptr == NULL) + strcpy(buf, "NULL"); + else + uuid_unparse_lower(*uuidptr, buf); + + printf("uuid_get_template %s returns %s\n", (ns ? ns : "NULL"), buf); +} + +int main(void) +{ + get_template("dns"); + + get_template("url"); + + get_template("oid"); + + get_template("x500"); + + get_template(NULL); + get_template(""); + get_template("unknown"); + + exit(0); +} + |