Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Internal routine for unpacking UUID |
Theodore Ts'o | 19c78dc | 1997-04-29 16:17:09 +0000 | [diff] [blame^] | 3 | * |
| 4 | * Copyright (C) 1996, 1997 Theodore Ts'o. |
| 5 | * |
| 6 | * %Begin-Header% |
| 7 | * This file may be redistributed under the terms of the GNU Public |
| 8 | * License. |
| 9 | * %End-Header% |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 10 | */ |
| 11 | |
Theodore Ts'o | 19c78dc | 1997-04-29 16:17:09 +0000 | [diff] [blame^] | 12 | #include <string.h> |
Theodore Ts'o | 1e3472c | 1997-04-29 14:53:37 +0000 | [diff] [blame] | 13 | #include "uuidP.h" |
| 14 | |
| 15 | void uuid_unpack(uuid_t in, struct uuid *uu) |
| 16 | { |
| 17 | __u8 *ptr = in; |
| 18 | __u32 tmp; |
| 19 | |
| 20 | tmp = *ptr++; |
| 21 | tmp = (tmp << 8) | *ptr++; |
| 22 | tmp = (tmp << 8) | *ptr++; |
| 23 | tmp = (tmp << 8) | *ptr++; |
| 24 | uu->time_low = tmp; |
| 25 | |
| 26 | tmp = *ptr++; |
| 27 | tmp = (tmp << 8) | *ptr++; |
| 28 | uu->time_mid = tmp; |
| 29 | |
| 30 | tmp = *ptr++; |
| 31 | tmp = (tmp << 8) | *ptr++; |
| 32 | uu->time_hi_and_version = tmp; |
| 33 | |
| 34 | tmp = *ptr++; |
| 35 | tmp = (tmp << 8) | *ptr++; |
| 36 | uu->clock_seq = tmp; |
| 37 | |
| 38 | memcpy(uu->node, ptr, 6); |
| 39 | } |
| 40 | |