e2fsprogs/lib/uuid/unpack.c

41 lines
687 B
C
Raw Normal View History

1997-04-29 18:53:37 +04:00
/*
* Internal routine for unpacking UUID
1997-04-29 20:17:09 +04:00
*
* Copyright (C) 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
1997-04-29 18:53:37 +04:00
*/
1997-04-29 20:17:09 +04:00
#include <string.h>
1997-04-29 18:53:37 +04:00
#include "uuidP.h"
void uuid_unpack(uuid_t in, struct uuid *uu)
{
__u8 *ptr = in;
__u32 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);
}