summaryrefslogtreecommitdiff
path: root/shlibs/uuid/src/unpack.c
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2009-07-21 15:45:04 -0600
committerLaMont Jones <lamont@debian.org>2009-07-21 15:45:04 -0600
commit7a22bb9abcb56d1010cefd204709e3888f95f735 (patch)
tree5c38b4485f79ee8f6a9d5f9537e973f1f663f027 /shlibs/uuid/src/unpack.c
parent4e13a18f57a5b427c559f3b466b9655db14d28f8 (diff)
parent741064af10ec81635d708e9fb8373f96341246eb (diff)
downloadutil-linux-old-7a22bb9abcb56d1010cefd204709e3888f95f735.tar.gz
Merge commit 'origin/master'
Conflicts: AUTHORS NEWS config/include-Makefile.am configure.ac mount/lomount.c po/POTFILES.in po/ca.po po/cs.po po/da.po po/de.po po/es.po po/et.po po/eu.po po/fi.po po/fr.po po/hu.po po/id.po po/it.po po/ja.po po/nl.po po/pl.po po/pt_BR.po po/ru.po po/sl.po po/sv.po po/tr.po po/uk.po po/util-linux-ng.pot po/vi.po po/zh_CN.po
Diffstat (limited to 'shlibs/uuid/src/unpack.c')
-rw-r--r--shlibs/uuid/src/unpack.c63
1 files changed, 63 insertions, 0 deletions
diff --git a/shlibs/uuid/src/unpack.c b/shlibs/uuid/src/unpack.c
new file mode 100644
index 00000000..beaaff3c
--- /dev/null
+++ b/shlibs/uuid/src/unpack.c
@@ -0,0 +1,63 @@
+/*
+ * Internal routine for unpacking UUID
+ *
+ * Copyright (C) 1996, 1997 Theodore Ts'o.
+ *
+ * %Begin-Header%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, and the entire permission notice in its entirety,
+ * including the disclaimer of warranties.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote
+ * products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ALL OF
+ * WHICH ARE HEREBY DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
+ * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF NOT ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ * %End-Header%
+ */
+
+#include <string.h>
+#include "uuidP.h"
+
+void uuid_unpack(const uuid_t in, struct uuid *uu)
+{
+ const uint8_t *ptr = in;
+ uint32_t tmp;
+
+ tmp = *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ uu->time_low = tmp;
+
+ tmp = *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ uu->time_mid = tmp;
+
+ tmp = *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ uu->time_hi_and_version = tmp;
+
+ tmp = *ptr++;
+ tmp = (tmp << 8) | *ptr++;
+ uu->clock_seq = tmp;
+
+ memcpy(uu->node, ptr, 6);
+}
+